I have a feeling this is a bug / spec ambiguity that hasn't been addressed. If you search the bug database there are plenty of these, such as: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7117383
How to suppress deprecation warning on annotation argument
-
13-06-2023 - |
Frage
I compile javac 1.7.0_45 using the -Xlint
option, the following code causes a deprecation warning.
@Deprecated
public class Bar {}
@SuppressWarnings("deprecation")
public class Foo {
@XmlElement(type = Bar.class)
Object something;
}
>> Warning: Bar in mavenproject1 has been deprecated
I would have expected the @SuppressWarnings
to prevent the warning message to be raised.
How to avoid this warning ?
Lösung
Andere Tipps
A program element annotated @Deprecated is one that programmers are discouraged from using, typically because it is dangerous, or because a better alternative exists. Compilers warn when a deprecated program element is used or overridden in non-deprecated code.
http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Deprecated.html
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow