-
Bug
-
Resolution: Unresolved
-
P4
-
8
-
x86
-
os_x
FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
Compiling the provided java snippet should yield a unchecked cast warning
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile code code using javac
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
unchecked cast warning
ACTUAL -
no warning
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package a;
public class CastTest {
public interface BaseInterface<T> {
}
public interface SubInterfaceA<T> extends BaseInterface<T> {
}
public interface SubInterfaceB<T> extends BaseInterface<T> {
}
public static void main(String[] args) {
SubInterfaceA<String> a = null;
SubInterfaceB<String> b = (SubInterfaceB<String>) a; // javac does not warn
b = (SubInterfaceB<String>)(BaseInterface<String>)a;
}
}
---------- END SOURCE ----------
also discussed in compiler-dev: http://mail.openjdk.java.net/pipermail/compiler-dev/2014-May/008747.html
A DESCRIPTION OF THE PROBLEM :
Compiling the provided java snippet should yield a unchecked cast warning
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile code code using javac
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
unchecked cast warning
ACTUAL -
no warning
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package a;
public class CastTest {
public interface BaseInterface<T> {
}
public interface SubInterfaceA<T> extends BaseInterface<T> {
}
public interface SubInterfaceB<T> extends BaseInterface<T> {
}
public static void main(String[] args) {
SubInterfaceA<String> a = null;
SubInterfaceB<String> b = (SubInterfaceB<String>) a; // javac does not warn
b = (SubInterfaceB<String>)(BaseInterface<String>)a;
}
}
---------- END SOURCE ----------
also discussed in compiler-dev: http://mail.openjdk.java.net/pipermail/compiler-dev/2014-May/008747.html