-
Type:
Bug
-
Status: New
-
Priority:
P4
-
Resolution: Unresolved
-
Affects Version/s: 11.0.4
-
Fix Version/s: None
-
Component/s: tools
-
Labels:
-
Subcomponent:
-
CPU:x86_64
-
OS:os_x
A DESCRIPTION OF THE PROBLEM :
In Java 11 when i try to compile code sometimes it compiles, sometimes it fails.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile couple times
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Success compilation
ACTUAL -
Error:(10, 58) java: incompatible types: inferred type does not conform to equality constraint(s)
inferred: java.util.List<Main.A<?,?>>
equality constraints(s): java.util.List<capture#1 of ? extends Main.A<?,?>>
---------- BEGIN SOURCE ----------
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class Main {
public static void main(String[] args) {
List<? extends A<?, ?>> a = new LinkedList<>();
Map<String, List<A<?, ?>>> b = a.stream().collect(
Collectors.groupingBy(A::getval, Collectors.toList())
);
System.out.println("Hello World!");
}
class A<K, V> {
String getval() {
return "sss";
}
}
}
---------- END SOURCE ----------
FREQUENCY : often
In Java 11 when i try to compile code sometimes it compiles, sometimes it fails.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile couple times
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Success compilation
ACTUAL -
Error:(10, 58) java: incompatible types: inferred type does not conform to equality constraint(s)
inferred: java.util.List<Main.A<?,?>>
equality constraints(s): java.util.List<capture#1 of ? extends Main.A<?,?>>
---------- BEGIN SOURCE ----------
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class Main {
public static void main(String[] args) {
List<? extends A<?, ?>> a = new LinkedList<>();
Map<String, List<A<?, ?>>> b = a.stream().collect(
Collectors.groupingBy(A::getval, Collectors.toList())
);
System.out.println("Hello World!");
}
class A<K, V> {
String getval() {
return "sss";
}
}
}
---------- END SOURCE ----------
FREQUENCY : often