This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 205951 - CC shows wrong leftShift return type in tests
Summary: CC shows wrong leftShift return type in tests
Status: RESOLVED FIXED
Alias: None
Product: groovy
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.0.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Martin Janicek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-05 15:48 UTC by Martin Janicek
Modified: 2013-03-23 01:59 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Janicek 2011-12-05 15:48:25 UTC
There is a wrong leftShift return type shown by code completion. It should be StringBuffer, but at the moment cc shows StringBuilder.

Uncomment MethodCompletionTest.testCompletionNoPrefixString1 and MethodCompletionTest.testCompletionNoPrefixString2 tests to see wrong output.
Comment 1 Martin Janicek 2011-12-12 14:31:15 UTC
Uncomment also those two tests together with fix:

OperatorsCompletionTest.testSafeNavigation4
OperatorsCompletionTest.testMethodClosure4
Comment 2 Martin Janicek 2011-12-20 12:51:45 UTC
Seems like the problem occurs only in tests where the IDE shows unexpected token error. For example test containing: "".&^ seems to be invalid for parser, but similar: "".&a^ seems to be valid.

(the parser behavior looks fine to me - dynamic method are valid if there is some method name, otherwise the file cannot be compiled)
Comment 3 Martin Janicek 2012-10-09 13:09:15 UTC

*** This bug has been marked as a duplicate of bug 206610 ***
Comment 4 Martin Janicek 2013-03-21 09:00:32 UTC
Reopening, setting TM = Dev. At the end this and the issue 206610 are probably separate problems caused by insufficient sanitization. It's still hard to say why it results in randomly shown code completion, but at least it could be possibly fixed.
Comment 5 Martin Janicek 2013-03-22 09:40:51 UTC
MetaElementHandler.getMethods() is the problem! Obviously GroovySystem.getMetaClassRegistry().getMetaClass(clz) does not guarantees the order of loaded meta methods and thus sometimes String's methods commes before CharSequence ones and sometimes not. After so MetaElementHandler.addOrReplaceItem() checks for superClass (meaning java.lang.Object) distance which is lower for String methods and as a result they are replaced by CharSequence ones (e.g. returning StringBuilder instead of StringBuffer in leftShift method)..
Altough not sure yet how to fix it correcly..
Comment 6 Martin Janicek 2013-03-22 10:26:25 UTC
Fixed in: web-main #2c06023f31ec
Comment 7 Quality Engineering 2013-03-23 01:59:22 UTC
Integrated into 'main-golden', will be available in build *201303222300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2c06023f31ec
User: Martin Janicek <mjanicek@netbeans.org>
Log: #205951 - CC shows wrong leftShift return type in tests