Bug 266132

Summary: Consider adding javadoc tag to suppress warnings
Product: [Eclipse Project] JDT Reporter: Thomas Watson <tjwatson>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: frederic_fusier, Olivier_Thomann, satyam.kandula, srikanth_sankaran
Version: 3.5   
Target Milestone: 3.7 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Thomas Watson CLA 2009-02-25 09:17:35 EST
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.
Comment 1 Srikanth Sankaran CLA 2009-02-26 00:46:20 EST
(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 ?


Comment 2 Thomas Watson CLA 2009-02-26 01:33:31 EST
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.
Comment 3 Srikanth Sankaran CLA 2009-02-26 01:50:11 EST
(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]
Comment 4 Thomas Watson CLA 2010-12-06 13:59:25 EST
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.
Comment 5 Olivier Thomann CLA 2010-12-06 14:28:29 EST
Closing as WONTFIX.
Comment 6 Satyam Kandula CLA 2010-12-07 04:10:10 EST
Verified for 3.7M4
Comment 7 Satyam Kandula CLA 2010-12-07 04:10:27 EST
.