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 - Warning hint when referencing static methods using class reference
Summary: Warning hint when referencing static methods using class reference
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.0
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-16 10:35 UTC by larand54
Modified: 2011-03-28 08:46 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 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.