Details
-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
None
-
6
-
x86
-
linux
Description
FULL PRODUCT VERSION :
JDK6
ADDITIONAL OS VERSION INFORMATION :
All platforms
EXTRA RELEVANT SYSTEM CONFIGURATION :
All configurations
A DESCRIPTION OF THE PROBLEM :
javac 1.6 give no unchecked warning on this:
interface I1<T> {}
final class GC33<T> implements I1<Short> {}
class Z<T, U extends T, V extends Number> {
GC33<Short> x = null;
I1<V> y = (I1<V>)x;
}
We can tell that a GC33<Short> can be cast safely to an I1<Short>, but if V is something other than Short the cast to I1<V> is not valid.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the program and observe the absence of the required warning.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
An unchecked warning is required by the JLS.
ACTUAL -
No warning is produced.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
The required warning message is not produced by the compiler.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
interface I1<T> {}
final class GC33<T> implements I1<Short> {}
class Z<T, U extends T, V extends Number> {
GC33<Short> x = null;
I1<V> y = (I1<V>)x;
}
---------- END SOURCE ----------
JDK6
ADDITIONAL OS VERSION INFORMATION :
All platforms
EXTRA RELEVANT SYSTEM CONFIGURATION :
All configurations
A DESCRIPTION OF THE PROBLEM :
javac 1.6 give no unchecked warning on this:
interface I1<T> {}
final class GC33<T> implements I1<Short> {}
class Z<T, U extends T, V extends Number> {
GC33<Short> x = null;
I1<V> y = (I1<V>)x;
}
We can tell that a GC33<Short> can be cast safely to an I1<Short>, but if V is something other than Short the cast to I1<V> is not valid.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the program and observe the absence of the required warning.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
An unchecked warning is required by the JLS.
ACTUAL -
No warning is produced.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
The required warning message is not produced by the compiler.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
interface I1<T> {}
final class GC33<T> implements I1<Short> {}
class Z<T, U extends T, V extends Number> {
GC33<Short> x = null;
I1<V> y = (I1<V>)x;
}
---------- END SOURCE ----------
Attachments
Issue Links
- relates to
-
JDK-6557182 Unchecked warning *and* inconvertible types
-
- Closed
-
-
JDK-6790039 overhaul cast-conversion (umbrella)
-
- Closed
-