Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
12.2
-
None
-
None
Description
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.