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 202453 - Java code completion does not offer to complete with static methods when invoked on an instance variable.
Summary: Java code completion does not offer to complete with static methods when invo...
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-21 19:47 UTC by swpalmer
Modified: 2011-09-22 07:31 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description swpalmer 2011-09-21 19:47:08 UTC
Product Version = NetBeans IDE Dev (Build 201109202329)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.7.0
Runtime = Java HotSpot(TM) Client VM 21.0-b17

Using the JavaFX example case that I ran into:

AnchorPane ap = new AnchorPane();
ap.getChildren().add(node);
ap.setL   <-- ctrl-space to invoke code completion

the options shown are:
setLayoutX(double)
setLayoutY(double)

but I wanted AnchorPane.setLeftAnchor(Node, Double)

Curiously, if while offered the setLayout choices I type an 'e' it suddenly completes with ap.setLeftAnchor(Node,Double) so obviously it is aware of the choice but it wasn't shown.
Comment 1 swpalmer 2011-09-22 03:22:45 UTC
I notice now that a second ctrl-space will show the static methods.  I don't remember if it was always that way, and I do remember certain things being done to speed the showing of the popup..
I just didn't expect that with such specific context the list would still be so limited.

I will change this to a feature request instead...

The code completion should offer the static methods AND it should change the preceding code to the class name, just as the hint that appears after doing the code completion will suggest.  It makes no sense for code completion to put in code that then immediately has a "quick fix" tagged on it.. just do the "fix"
Comment 2 Dusan Balek 2011-09-22 07:31:28 UTC
This is as designed behavior. See issue #186829 for more details. Changing the
preceding code to the class name could be dangerous in some cases - imagine a chain of method calls (that cloud have some side effects) to be replaced with a simple class name...