Niklas Matthies created NETBEANS-5379:
-----------------------------------------

             Summary: Warning hint "Unused Element" can't be suppressed
                 Key: NETBEANS-5379
                 URL: https://issues.apache.org/jira/browse/NETBEANS-5379
             Project: NetBeans
          Issue Type: Bug
          Components: java - Hints
    Affects Versions: 12.2
            Reporter: Niklas Matthies


The hint "Unused Element" (category "Probably Bugs") can't be suppressed, it 
seems. In particular, @SuppressWarnings("unused") doesn't suppress it.

One concrete use case I have is a try-with-resources where the resource 
variable is not used in the try block. (Of course, it is implicitly used for 
close()-ing the resource.) NetBeans generates a warning (which is fine, the 
code could indeed be wrong) which however can't be suppressed. Previously (last 
tested in 12.0), @SuppressWarnings("try") would do the trick.

This isn't the first time a warning hint was introduced without a way to 
suppress it. I'd like to suggest to always, as a rule, without exception, add a 
suppression constant, because there are invariably cases where a warning is a 
false positive.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to