-
Bug
-
Resolution: Cannot Reproduce
-
P5
-
None
-
6
-
x86
-
linux
FULL PRODUCT VERSION :
java version "1.6.0-beta2"
Java(TM) SE Runtime Environment (build 1.6.0-beta2-b86)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b86, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Linux meco 2.6.10 #1 SMP Wed Aug 31 19:48:13 CEST 2005 i686 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
I have found javac to generate a compiler error for the generic type invocation in the below code even though I understand that the code is correct. The error produced claims that the wildcard type argument "? super C2" is not within the bound of the formal type parameter.
=== $ cat -n A.java
1 interface I { }
2 class C1 { }
3 class C2 extends C1 implements I { }
4
5 public class A<T extends C1 & I> {
6 A<? super C2> a;
7 }
=== $ javac A.java
A.java:6: type parameter ? super C2 is not within its bound
A<? super C2> a;
^
1 error
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Invoke the javac on the provided code file.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The code snippet should compile without errors.
ACTUAL -
A compiler error is generated for the generic type invocation.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Compiler error produced by javac:
A.java:6: type parameter ? super C2 is not within its bound
A<? super C2> a;
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
interface I { }
class C1 { }
class C2 extends C1 implements I { }
public class A<T extends C1 & I> {
A<? super C2> a;
}
---------- END SOURCE ----------
java version "1.6.0-beta2"
Java(TM) SE Runtime Environment (build 1.6.0-beta2-b86)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b86, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Linux meco 2.6.10 #1 SMP Wed Aug 31 19:48:13 CEST 2005 i686 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
I have found javac to generate a compiler error for the generic type invocation in the below code even though I understand that the code is correct. The error produced claims that the wildcard type argument "? super C2" is not within the bound of the formal type parameter.
=== $ cat -n A.java
1 interface I { }
2 class C1 { }
3 class C2 extends C1 implements I { }
4
5 public class A<T extends C1 & I> {
6 A<? super C2> a;
7 }
=== $ javac A.java
A.java:6: type parameter ? super C2 is not within its bound
A<? super C2> a;
^
1 error
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Invoke the javac on the provided code file.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The code snippet should compile without errors.
ACTUAL -
A compiler error is generated for the generic type invocation.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Compiler error produced by javac:
A.java:6: type parameter ? super C2 is not within its bound
A<? super C2> a;
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
interface I { }
class C1 { }
class C2 extends C1 implements I { }
public class A<T extends C1 & I> {
A<? super C2> a;
}
---------- END SOURCE ----------
- relates to
-
JDK-6638712 Inference with wildcard types causes selection of inapplicable method
- Closed
-
JDK-6718388 4.9: Specify subtyping of intersection types
- Open