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 121267 - "accessing static" hint should be improved
Summary: "accessing static" hint should be improved
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-06 10:21 UTC by olegsukhodolsky
Modified: 2008-01-20 14:08 UTC (History)
1 user (show)

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 olegsukhodolsky 2007-11-06 10:21:45 UTC
I have a code:

DataTransferer.getInstance().keysToLongArray(formatMap);

and NB (beta2) highlights DataTransferer.getInstance() and shows warning "Accessing static field", but it looks like it
complains about accessing keysToLongArray() which is static METHOD.  So I think it would be better to change warning
for such cases to "Accessing static method".  Or, even better, pointed name of static member the code accesses to the
waning (e.g. "Accessing static member keysToLongArray")
Comment 1 _ wadechandler 2008-01-07 14:00:23 UTC
Thread.currentThread().yield();

Causes this as well. The feature is turned on by default, and without turning it off altogether then the gutters get
cluttered and it makes the rest of editor harder to use in classes where such access is heavily needed. For this reason
per the priority page which states "Part of a product feature is affected, a viable workaround exists" and "Highly
visible usability problem" I am setting this to a P3. If this warning is more needed than I think then it really should
be a P2 because then no viable workaround exists which P2 states if the workaround, turning off static checks
altogether, is impractical it is a P2.
Comment 2 Jan Lahoda 2008-01-20 14:08:26 UTC
I have changed the message to say the type of the element (field/method) and its simple name. I am afraid that I do not
understand the last comment - as I understand the original report, this is about incorrect message of the hint, not
about incorrect warning ("yield" method on Thread is a static method, so there is no reason to access it through an
instance reference, so the warning is correct in this case). So the warning will show on the same places as they did
until now, only the message is improved. If you have a particular case where the warning is incorrect, please file a
bug. Thanks.

Checking in src/org/netbeans/modules/java/hints/Bundle.properties;
/cvs/java/hints/src/org/netbeans/modules/java/hints/Bundle.properties,v  <--  Bundle.properties
new revision: 1.36; previous revision: 1.35
done
Checking in src/org/netbeans/modules/java/hints/StaticAccess.java;
/cvs/java/hints/src/org/netbeans/modules/java/hints/StaticAccess.java,v  <--  StaticAccess.java
new revision: 1.15; previous revision: 1.14
done
Checking in test/unit/src/org/netbeans/modules/java/hints/StaticAccessTest.java;
/cvs/java/hints/test/unit/src/org/netbeans/modules/java/hints/StaticAccessTest.java,v  <--  StaticAccessTest.java
new revision: 1.10; previous revision: 1.9
done
RCS file: /cvs/java/hints/test/unit/src/org/netbeans/modules/java/hints/Bundle_test.properties,v
done
Checking in test/unit/src/org/netbeans/modules/java/hints/Bundle_test.properties;
/cvs/java/hints/test/unit/src/org/netbeans/modules/java/hints/Bundle_test.properties,v  <--  Bundle_test.properties
initial revision: 1.1
done