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 207606

Summary: Code Completion generates wrong Method Parameters
Product: editor Reporter: bht <bht>
Component: Completion & TemplatesAssignee: Dusan Balek <dbalek>
Status: VERIFIED FIXED    
Severity: normal    
Priority: P2    
Version: 7.1   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Attachments: testcase in zip file

Description bht 2012-01-22 02:45:23 UTC
Created attachment 115147 [details]
testcase in zip file

Please see the attached JUnit testcase.

This happens a lot and irritates especially peope who convert from Eclipse.

NetBeans is smart and matches types as much as possible, but it makes bad choices even when it actually has variables in scope that match the names of the method.

In other words, in a case where NetBeans cannot find local variables with both matching type and name, then it would be preferable to insert the name of the API not any variable in scope with a matching type.

The current implementation introduces subtle errors as can be seen in the testcase, and this is worse overall than a completely dumb implementation as in Eclipse.
Comment 1 Dusan Balek 2012-02-03 17:52:16 UTC
Particular example fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/291e9208a8b3

Please note, that you could switch the code completion parameter guessing off (Tools -> Options -> Editor -> Code Completion -> Java -> Guess Filled Method Arguments)
Comment 2 bht 2012-02-03 18:07:11 UTC
Thanks :)
Comment 3 Jiri Prox 2012-04-02 13:16:01 UTC
verified in trunk
Comment 4 Dusan Balek 2012-04-04 10:03:21 UTC
Transplanted into release71_fixes.

http://hg.netbeans.org/releases/rev/5400aa3f5096
http://hg.netbeans.org/releases/rev/2a82a445f246
Comment 5 Quality Engineering 2012-04-05 01:20:23 UTC
Integrated into 'releases', will be available in build *201204042205* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/5400aa3f5096
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #207606: Code Completion generates wrong Method Parameters - fixed.
Comment 6 Jiri Prox 2012-04-06 08:18:32 UTC
verified in patch