Community
Participate
Working Groups
I20090224-0800 see bug 265999 With the latest I-Build JDT fixed a few bugs dealing with catching dead code. This has surfaced a few errors in Equinox. In most cases the errors are probably valid, but there are rare cases where the the "dead code" is intentional. In the osgi case we have an inner private class with a public constructor(String). This inner class is used with the OSGi Filter specification which uses reflection to find a constructor which takes a String object. It then uses this to construct values to match against a string value from a filter. It would be nice if there was a way to suppress the warning for a particular method/field etc. Currently we have to change the error to a warning for the complete project to avoid getting compile errors in the workspace.
(In reply to comment #0) > I20090224-0800 > see bug 265999 > With the latest I-Build JDT fixed a few bugs dealing with catching dead code. > This has surfaced a few errors in Equinox. In most cases the errors are > probably valid, but there are rare cases where the the "dead code" is > intentional. In the osgi case we have an inner private class with a public > constructor(String). This inner class is used with the OSGi Filter > specification which uses reflection to find a constructor which takes a String > object. It then uses this to construct values to match against a string value > from a filter. > It would be nice if there was a way to suppress the warning for a particular > method/field etc. Currently we have to change the error to a warning for the > complete project to avoid getting compile errors in the workspace. If you are using 1.5 or later you can use @SuppressWarning annotation to suppress warnings on an individual definition basis: For example, in the code below: public class Boo { @SuppressWarnings("unused") private void goo() {} private void zoo(int a) {} } the compiler will warn about zoo() being unused and will NOT complain about goo() being unused. See bug# 83739, bug# 71968. Does this solution address your needs ?
This was suggested in bug 265999 comment 1. But BJ was just kidding because he knows the core framework cannot move up to Java 5 at this time ;-) A solution for this case would have to work with J2SE 1.4.
(In reply to comment #2) > This was suggested in bug 265999 comment 1. But BJ was just kidding because he > knows the core framework cannot move up to Java 5 at this time ;-) A solution > for this case would have to work with J2SE 1.4. Ah, I see, OK. I doubt if we have a javadoc equivalent to suppress warnings, will check anyways. [Nice name, BTW]
Feel free to close this as wont fix. I don't really need this anymore and Java 1.4 is pretty much dead. The annotation @SuppressWarnings should be used in Java 5.
Closing as WONTFIX.
Verified for 3.7M4
.