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 203476

Summary: Java "Create Method" fix is not offered when call site is argument to another method
Product: java Reporter: dbell
Component: HintsAssignee: Jan Lahoda <jlahoda>
Status: RESOLVED WONTFIX    
Severity: normal CC: Mahene
Priority: P3    
Version: 7.1   
Hardware: Macintosh   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:

Description dbell 2011-10-11 01:37:25 UTC
[ BUILD # : 201110070600 ]
[ JDK VERSION : 1.6.26 ]

Usually, when I reference a nonexistent Java method in the editor, a hint
appears with a "Create Method" fix.

e.g.
Person person = ...
String name = getName(person);

If the method getName() with param "person" does not exist, a "Create method
"getName(com.example.Person)" in ..." hint is given.

However, consider this example:
String name = getName(getPerson());

If getName() exists, but getPerson() does not exist, no hint is given to create
getPerson().
Comment 1 dbell 2011-10-30 14:19:37 UTC
This seems to only happen if the call site is an argument to an external static method.
Comment 2 Jan Lahoda 2013-07-18 19:57:43 UTC
Fixed in jet-main:
http://hg.netbeans.org/jet-main/rev/1955590d6248
Comment 3 Quality Engineering 2013-07-20 02:13:46 UTC
Integrated into 'main-silver', will be available in build *201307192300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/1955590d6248
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #203476: fuzzy resolving methods should take enclosing elements and static imported elements into account.
Comment 4 Mahene 2014-05-13 20:56:05 UTC
In Ubuntu 14.04 with Netbeans 8 and JDK 8 this type of code completion doesn't work, e.g.
assertThat(g.width(), is(3));
from a hamcrest test method where width() doesn't exist yet, Netbeans doesn't offer any hint.
Comment 5 Martin Balin 2016-07-07 07:16:39 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss