-
Bug
-
Resolution: Unresolved
-
P4
-
6u37, 7u45, 8
-
Fix Understood
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01, mixed mode)
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b109)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b51, mixed mode)
A DESCRIPTION OF THE PROBLEM :
This code used to compile in JDK 1.6.0_37, but does not compiles in JDK 1.7.0_45 nor in JDK 1.8.0-ea-b109:
interface A {}
abstract class B<X> {
abstract X m();
}
abstract class C<Y> extends B<Y> {
@Override
abstract Y m();
}
class MyBug<Z extends C<?> & A> {}
REGRESSION. Last worked in version 6u43
ADDITIONAL REGRESSION INFORMATION:
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01, mixed mode)
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b109)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b51, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the program using JDK 1.7.0 or JDK 8 EA b109.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The code should compile in JDK 7 and JDK 8, as it used to compile in JDK 6.
ACTUAL -
error: m() in C cannot override m() in B
class MyBug<Z extends C<?> & A> {}
return type CAP#1 is not compatible with CAP#2
where Y,X are type-variables:
Y extends Object declared in class C
X extends Object declared in class B
where CAP#1,CAP#2 are fresh type-variables:
CAP#1 extends Object from capture of ?
CAP#2 extends Object from capture of ?
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
interface A {}
abstract class B<X> {
abstract X m();
}
abstract class C<Y> extends B<Y> {
@Override
abstract Y m();
}
class MyBug<Z extends C<?> & A> {}
---------- END SOURCE ----------
- duplicates
-
JDK-8066379 javac 1.7/1.8 rejects to compile code though javac 1.6 accepts the code
- Closed
- is blocked by
-
JDK-7034922 4.9: Clarify membership of intersection types for wildcard parameterizations
- Open
-
JDK-8027253 javac illegally accepts array as bound
- Closed
-
JDK-8030660 Compile-time error in the case of ((Integer[] & Serializable)new Integer[1]).getClass()
- Closed
- relates to
-
JDK-7040590 Intersection types: membership of intersection types in unspecified in some cases
- Open
-
JDK-7120669 4.9: Clarify well-formedness for intersection types & bounded type variables
- Open