-
Bug
-
Resolution: Fixed
-
P3
-
5.0, 7
-
b130
-
generic, x86
-
generic, linux
-
Verified
Compilation of this code:
package javaapplication1;
public class Main {
public static void main(String[] args) {
@SuppressWarnings("deprecation")
java.rmi.RMISecurityException ex;
}
}
with "-Xlint:deprecation" produces:
/tmp/JavaApplication1/src/javaapplication1/Main.java:7: warning: [deprecation] java.rmi.RMISecurityException in java.rmi has been deprecated
This does not seem right, as JLS 9.6.1.5 says that:
"a Java compiler must not report any warning identified by one of S1, ... , S k if that warning would have been generated as a result of the annotated declaration or any of its parts"
Tested this on:
[snip]/jdk17/bin$ ./java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b18)
Java HotSpot(TM) Server VM (build 1.7.0-ea-b18, mixed mode)
Another case where the @SuppressWarnings("deprecation") does not work correctly:
package javaapplication5;
@Deprecated
public class A {
}
package javaapplication5;
@SuppressWarnings("deprecation")
public class B extends A { //reports "A is deprecated" here
}
package javaapplication1;
public class Main {
public static void main(String[] args) {
@SuppressWarnings("deprecation")
java.rmi.RMISecurityException ex;
}
}
with "-Xlint:deprecation" produces:
/tmp/JavaApplication1/src/javaapplication1/Main.java:7: warning: [deprecation] java.rmi.RMISecurityException in java.rmi has been deprecated
This does not seem right, as JLS 9.6.1.5 says that:
"a Java compiler must not report any warning identified by one of S1, ... , S k if that warning would have been generated as a result of the annotated declaration or any of its parts"
Tested this on:
[snip]/jdk17/bin$ ./java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b18)
Java HotSpot(TM) Server VM (build 1.7.0-ea-b18, mixed mode)
Another case where the @SuppressWarnings("deprecation") does not work correctly:
package javaapplication5;
@Deprecated
public class A {
}
package javaapplication5;
@SuppressWarnings("deprecation")
public class B extends A { //reports "A is deprecated" here
}
- duplicates
-
JDK-6558554 undeserved deprecation warning
- Closed
-
JDK-6460147 @SuppressWarnings("deprecation") does not work on fields
- Closed
- relates to
-
JDK-7026845 Regression since JDK7b130: VariableElement.getConstantValue() leads to java.lang.AssertionError
- Closed
-
JDK-6460147 @SuppressWarnings("deprecation") does not work on fields
- Closed