
Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
On Fri, 18 Nov 2005 09:40:51 +0000, Thomas Hawtin
<usenet@tackline.plus.com> wrote, quoted or indirectly quoted someone
who said :
>As an annotation, it cannot be applied to a package or an annotation
>type declaration.
>
>http://download.java.net/jdk6/docs/api/java/lang/SuppressWarnings.html
oops. Why did they not document the list of warnings you can suppress?
Apparently you can't just leave the list blank.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Hendrik Maryns - 18 Nov 2005 12:50 GMT
Roedy Green schreef:
> On Fri, 18 Nov 2005 09:40:51 +0000, Thomas Hawtin
> <usenet@tackline.plus.com> wrote, quoted or indirectly quoted someone
[quoted text clipped - 7 lines]
> oops. Why did they not document the list of warnings you can suppress?
> Apparently you can't just leave the list blank.
Indeed, I´ve been looking for them too. Luckily, Eclipse seems to know
all about them, that´s where Ctrl-1 comes in handy ;-)
H.

Signature
Hendrik Maryns
==================
www.lieverleven.be
http://aouw.org
Hendrik Maryns - 18 Nov 2005 13:17 GMT
Hendrik Maryns schreef:
> Roedy Green schreef:
>
[quoted text clipped - 12 lines]
> Indeed, I´ve been looking for them too. Luckily, Eclipse seems to know
> all about them, that´s where Ctrl-1 comes in handy ;-)
After much googling, I found this:
"The set of names you can use with @SuppressWarnings for javac can be
loosely inferred by going "javac -X" and looking at the spec of -Xlint.
Any -Xlint option that does not begin with "-", and excluding "all" and
"path", can be used with SuppressWarnings. E.g.
@SuppressWarnings("deprecation")
@SuppressWarnings("unchecked")
etc."
found on http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4986256
And something can be found in the SCSL source ZIP file for 1.5. it seems:
"The full list of properties can be found at:
src\j2se\src\share\classes\com\sun\tools\javac\resources\compiler.properties
It appears the keywords are the ones surrounded by brackets. Though I am
just guessing here."
Anybody know where I can get this latest file?
Cheers, H.

Signature
Hendrik Maryns
==================
www.lieverleven.be
http://aouw.org
On Fri, 18 Nov 2005 09:40:51 +0000, Thomas Hawtin
<usenet@tackline.plus.com> wrote, quoted or indirectly quoted someone
who said :
>Can it?
Oops no.
>As an annotation, it cannot be applied to a package or an annotation
>type declaration.
Here is my current understanding, quoted from
http://mindprod.com/annotations.html#SUPPRESSWARNINGS
In JDK 1.5 an annotation was introduced called SuppressWarnings.
Unfortunately, it will be ignored until JDK 1.6. You just insert the
annotation prior to a class or method telling which sort of warning
you want suppressed. e.g.
// Turn off warnings about failing to use generics for the whole class
@SuppressWarnings( "unchecked" ) public class MyClass
{
// Suppress warnings about missing serialVersionUID
@SuppressWarnings( "serial" ) public void MyMethod1()
{ /* ... */ }
// Suppress warnings about unused variables
@SuppressWarnings( "unused" ) public void MyMethod2()
{ /* ... */ }
// Suppress warnings about both missing serialVersionUID and unused
variables
@SuppressWarnings( "serial", "unused" ) public void MyMethod3()
{ /* ... */ }
}
Here are the sorts of warning you can suppress
SuppressWarnings Options
Option Notes
all All warnings
allDeprecation deprecation even inside deprecated code
allJavadoc invalid or missing javadoc
assertIdentifier occurrence of assert used as identifier
boxing autoboxing conversion
charConcat when a char array is used in a string concatenation
without being converted explicitly to a string
conditionAssign possible accidental boolean assignment
constructorName method with constructor name
dep-ann missing @Deprecated annotation
deprecation usage of deprecated type or member outside deprecated
code
emptyBlock undocumented empty block
enumSwitch incomplete enum switch
incomplete-switch incomplete enum switch
fieldHiding field hiding another variable
finalBound type parameter with final bound
finally finally block not completing normally
hiding shorthand for fieldHiding, localHiding, typeHiding and
maskedCatchBlock
indirectStatic indirect reference to static member
intfAnnotation annotation type used as super interface
intfNonInherited interface non-inherited method compatibility
javadoc invalid javadoc
localHiding local variable hiding another variable
maskedCatchBlocks hidden catch block
nls non-nls string literals
noEffectAssign for assignment with no effect
null missing or redundant null check
over-ann missing @Override annotation
pkgDefaultMethod attempt to override package-default method
serial missing serialVersionUID
semicolon unnecessary semicolon or empty statement
specialParamHiding constructor or setter parameter hiding another
field
static-access shorthand for indirectStatic and staticReceiver
staticReceiver if a non static receiver is used to get a static field
or call a static method
suppress enable @SuppressWarnings
syntheticAccess when performing synthetic access for innerclass
synthetic-access when performing synthetic access for
innerclass
tasks enable support for tasks tags in source code
typeHiding type parameter hiding another type
unchecked unchecked type operation
unnecessaryElse unnecessary else clause
unqualified-field-access unqualified reference to field
unqualifiedField unqualified reference to field
unused shorthand for unusedArgument, unusedImport, unusedLocal,
unusedPrivate and unusedThrown
unusedArgument unused method argument
unusedImport unused import reference
unusedLocal unused local variable
unusedPrivate unused private member declaration
unusedThrown unused declared thrown exception
uselessTypeCheck unnecessary cast/instanceof operation
varargsCast varargs argument need explicit cast
warningToken unhandled warning token in @SuppressWarningsb
Some of the options above are for Eclipse only, however Javac will
quietly ignore them.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Thomas Hawtin - 18 Nov 2005 16:20 GMT
> Here is my current understanding, quoted from
> http://mindprod.com/annotations.html#SUPPRESSWARNINGS
http://mindprod.com/jgloss/annotations.html#SUPPRESSWARNINGS
> In JDK 1.5 an annotation was introduced called SuppressWarnings.
> Unfortunately, it will be ignored until JDK 1.6. You just insert the
> annotation prior to a class or method telling which sort of warning
> you want suppressed. e.g.
It will be in 1.5.0_06, which should be with us soon.
As well as classes and methods, it is also applicable to enum,
interface, constructor, field, parameter and local variable declarations.
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
Roedy Green - 19 Nov 2005 13:09 GMT
On Fri, 18 Nov 2005 16:21:34 +0000, Thomas Hawtin
<usenet@tackline.plus.com> wrote, quoted or indirectly quoted someone
who said :
>It will be in 1.5.0_06, which should be with us soon.
>
>As well as classes and methods, it is also applicable to enum,
>interface, constructor, field, parameter and local variable declarations.
thanks. The entry at
http://mindprod.com/jgloss/annotations.html#SUPPRESSWARNINGS is now
corrected.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.