Tried on Solaris -10
JDK :java version "1.6.0-ea" (build 1.6.0-ea-b46)
SuppressWarning(dep-ann) suppresses sum of calling class [deprecation] warnings.
See the following code
<code>
class Bar{
Foo foo = new Foo();
}
//@SuppressWarnings("dep-ann")
/** @deprecated */
@Deprecated
public class Foo{
}
</code>
Output the when compiled
<Output>
bash-3.00$ javac -Xlint Foo.java
Foo.java:2: warning: [deprecation] Foo in unnamed package has been deprecated
Foo foo = new Foo();
^
Foo.java:2: warning: [deprecation] Foo in unnamed package has been deprecated
Foo foo = new Foo();
^
2 warnings
</Output>
Output is fine but when SuppressWarning(dep-ann) is un commented then first [deprecation] warning will be suppressed.
<code>
class Bar{
Foo foo = new Foo();
}
@SuppressWarnings("dep-ann")
/** @deprecated */
@Deprecated
public class Foo{
}
</code>
Then output
<output>
bash-3.00$ javac -Xlint Foo.java
Foo.java:2: warning: [deprecation] Foo in unnamed package has been deprecated
Foo foo = new Foo();
^
1 warning
</output>
One [deprecation] warning has been suppressed.
JDK :java version "1.6.0-ea" (build 1.6.0-ea-b46)
SuppressWarning(dep-ann) suppresses sum of calling class [deprecation] warnings.
See the following code
<code>
class Bar{
Foo foo = new Foo();
}
//@SuppressWarnings("dep-ann")
/** @deprecated */
@Deprecated
public class Foo{
}
</code>
Output the when compiled
<Output>
bash-3.00$ javac -Xlint Foo.java
Foo.java:2: warning: [deprecation] Foo in unnamed package has been deprecated
Foo foo = new Foo();
^
Foo.java:2: warning: [deprecation] Foo in unnamed package has been deprecated
Foo foo = new Foo();
^
2 warnings
</Output>
Output is fine but when SuppressWarning(dep-ann) is un commented then first [deprecation] warning will be suppressed.
<code>
class Bar{
Foo foo = new Foo();
}
@SuppressWarnings("dep-ann")
/** @deprecated */
@Deprecated
public class Foo{
}
</code>
Then output
<output>
bash-3.00$ javac -Xlint Foo.java
Foo.java:2: warning: [deprecation] Foo in unnamed package has been deprecated
Foo foo = new Foo();
^
1 warning
</output>
One [deprecation] warning has been suppressed.
- duplicates
-
JDK-6308104 Order of declarations has effect on [dep-ann] warning
-
- Closed
-