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 196763

Summary: Warning hint when referencing static methods using class reference
Product: java Reporter: larand54
Component: HintsAssignee: Jan Lahoda <jlahoda>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 7.0   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:

Description larand54 2011-03-16 10:35:23 UTC
When I addresses a static method using the class name referencing it I get an irritating warning on that line.

e.g.
Thread.currentThread().sleep(1000);

This is in my opinion nothing to warn about but it would be ok on the following:

Thread th = new Thread();
th.currentThread().sleep(1000);

This is the NetBeans status:

Product Version: NetBeans IDE 7.0 Beta 2 (Build 201102140001)
Java: 1.6.0_23; Java HotSpot(TM) Client VM 19.0-b09
System: Windows XP version 5.1 running on x86; Cp1252; sv_SE (nb)
Userdir: C:\Documents and Settings\swelga\.netbeans\7.0beta2

/LG
Comment 1 Jan Lahoda 2011-03-24 14:57:50 UTC
The Thread.sleep method is static, and so:
Thread.currentThread().sleep(1000);
can be changed to
Thread.sleep(1000);
which is simpler and less confusing. This is what the hint warns about. I have changed the underline so that the method name is underlined instead of the site:
http://hg.netbeans.org/jet-main/rev/393507a13d35
Comment 2 Quality Engineering 2011-03-28 08:46:08 UTC
Integrated into 'main-golden', will be available in build *201103280400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/393507a13d35
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #196763: let static access warning underline the method/field name, not the site.