-
Bug
-
Resolution: Duplicate
-
P3
-
9
-
x86_64
-
generic
FULL PRODUCT VERSION :
java full version "9-ea+114"
ADDITIONAL OS VERSION INFORMATION :
x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The attach program is accepted by the JDK 8 javac, but rejected by the JDK 9 javac.
REGRESSION. Last worked in version 8u92
ADDITIONAL REGRESSION INFORMATION:
java full version "1.8.0_92-b14"
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
$ javac Test.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expected the compilation to succeed.
ACTUAL -
The compilation failed.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Test.java:7: error: method m in class Test cannot be applied to given types;
m(Arrays.asList(cs));
^
required: Iterable<? extends Test.C<? super T#1>>
found: List<Test.C<? super T#2>>
reason: inference variable T#3 has incompatible bounds
upper bounds: Test.C<? super CAP#1>,Object
lower bounds: Test.C<? super T#2>
where T#1,T#2,T#3 are type-variables:
T#1 extends Object declared in method <T#1>m(Iterable<? extends Test.C<? super T#1>>)
T#2 extends Object declared in method <T#2>t(Test.C<? super T#2>...)
T#3 extends Object declared in method <T#3>asList(T#3...)
where CAP#1 is a fresh type-variable:
CAP#1 extends Object super: T#2 from capture of ? super T#2
Note: Test.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.Arrays;
class Test {
public class C<T> {}
public static <T> void m(Iterable<? extends C<? super T>> cs) {}
public static <T> void t(C<? super T>... cs) {
m(Arrays.<C<? super T>>asList(cs));
m(Arrays.asList(cs));
}
}
---------- END SOURCE ----------
java full version "9-ea+114"
ADDITIONAL OS VERSION INFORMATION :
x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The attach program is accepted by the JDK 8 javac, but rejected by the JDK 9 javac.
REGRESSION. Last worked in version 8u92
ADDITIONAL REGRESSION INFORMATION:
java full version "1.8.0_92-b14"
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
$ javac Test.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expected the compilation to succeed.
ACTUAL -
The compilation failed.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Test.java:7: error: method m in class Test cannot be applied to given types;
m(Arrays.asList(cs));
^
required: Iterable<? extends Test.C<? super T#1>>
found: List<Test.C<? super T#2>>
reason: inference variable T#3 has incompatible bounds
upper bounds: Test.C<? super CAP#1>,Object
lower bounds: Test.C<? super T#2>
where T#1,T#2,T#3 are type-variables:
T#1 extends Object declared in method <T#1>m(Iterable<? extends Test.C<? super T#1>>)
T#2 extends Object declared in method <T#2>t(Test.C<? super T#2>...)
T#3 extends Object declared in method <T#3>asList(T#3...)
where CAP#1 is a fresh type-variable:
CAP#1 extends Object super: T#2 from capture of ? super T#2
Note: Test.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.Arrays;
class Test {
public class C<T> {}
public static <T> void m(Iterable<? extends C<? super T>> cs) {}
public static <T> void t(C<? super T>... cs) {
m(Arrays.<C<? super T>>asList(cs));
m(Arrays.asList(cs));
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-8160244 skip capture conversion before subtyping if types are parameterizations of the same class or interface
- Open
- relates to
-
JDK-8016196 Inference: define supertype parameterization for wildcard-parameterized types
- Open
-
JDK-8033718 Inference ignores capture variable as upper bound
- Closed
-
JDK-8160114 Unexpected inferred type from wildcard subtyping constraint
- Closed