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 191979 - Create ?? hint is not working for field, parameter, or local variable
Summary: Create ?? hint is not working for field, parameter, or local variable
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Hints & Annotations (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-15 19:49 UTC by swpalmer
Modified: 2012-06-07 17:13 UTC (History)
0 users

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 swpalmer 2010-11-15 19:49:33 UTC
Product Version = NetBeans IDE Dev (Build 201011150001)
Operating System = Windows XP version 5.1 running on x86
Java; VM; Vendor = 1.6.0_22
Runtime = Java HotSpot(TM) Client VM 17.1-b03

I wrote a small bit of code and purposely left-out the declaration of a variable so I could use the hint to fill in the type of the variable for me.
The code is of the form

  xx = someFunction();

where xx is not a declared variable.

The following hints are offered:
Create field xx in aa.bb.cc
Create parameter xx
Create local variable xx

When I select any of these options nothing happens.

messages.log shows:

INFO [org.netbeans.api.java.source.ElementHandle]: Cannot resolve: ElementHandle[kind=CLASS; sigs=the.correct.fully.qualified.classname.Here ]
INFO [org.netbeans.modules.java.hints]: Cannot resolve proposed type.


Where "the.correct.fully.qualified.classname.Here" is the name of the correct class to use, that is it is the return type of "someFunction()" from my example above.

It turns out that the library containing that class was not listed in the libraries for this project.  So I added it by selecting "Add Project..." from the context menu of the project Libraries and everything worked.. but there should have been better feedback in the UI.  E.g. an error message stating that the class in question was not on the class path for this project.
Comment 1 Jan Lahoda 2012-06-07 17:13:50 UTC
IIRC there were fixes recently since this report to make handles for unresolvable type work. I tried to reproduce in a recent daily build, and it creates the variable (a simple name of the unresolvable type is used as the type of the variable).