-
Bug
-
Resolution: Unresolved
-
P4
-
8, 11, 12, 13
-
Cause Known
-
x86_64
-
windows_10
A DESCRIPTION OF THE PROBLEM :
Attached code does not compile.
I use Guava 27.0-jre.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
paste the code into any main method and try to compile it with javac
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
program compiles
ACTUAL -
incompatible types: inferred type does not conform to upper bound(s)
inferred: com.google.common.collect.Table<java.lang.Object,java.lang.Object,java.lang.Object>
upper bound(s): com.google.common.collect.Table<java.lang.Object,java.lang.Object,java.lang.Object>,com.google.common.collect.Table<? extends java.lang.Integer,? extends java.lang.Integer,? extends java.lang.Integer>,java.lang.Object
---------- BEGIN SOURCE ----------
final Table<Integer, Integer, Integer> destination = HashBasedTable.create();
final Map<Integer, Integer> source = new HashMap<>();
// doesn't compile
destination.putAll( source.entrySet().stream().collect( Tables.toTable( e -> 0, e -> 0, e -> 0, ( e1, e2 ) -> 0, HashBasedTable::create ) ) );
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
final Table<Integer, Integer, Integer> destination = HashBasedTable.create();
final Map<Integer, Integer> source = new HashMap<>();
// compiles
final Table<Integer, Integer, Integer> broker = source.entrySet().stream().collect( Tables.toTable( e -> 0, e -> 0, e -> 0, ( e1, e2 ) -> 0, HashBasedTable::create ) );
destination.putAll( broker );
FREQUENCY : always
Attached code does not compile.
I use Guava 27.0-jre.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
paste the code into any main method and try to compile it with javac
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
program compiles
ACTUAL -
incompatible types: inferred type does not conform to upper bound(s)
inferred: com.google.common.collect.Table<java.lang.Object,java.lang.Object,java.lang.Object>
upper bound(s): com.google.common.collect.Table<java.lang.Object,java.lang.Object,java.lang.Object>,com.google.common.collect.Table<? extends java.lang.Integer,? extends java.lang.Integer,? extends java.lang.Integer>,java.lang.Object
---------- BEGIN SOURCE ----------
final Table<Integer, Integer, Integer> destination = HashBasedTable.create();
final Map<Integer, Integer> source = new HashMap<>();
// doesn't compile
destination.putAll( source.entrySet().stream().collect( Tables.toTable( e -> 0, e -> 0, e -> 0, ( e1, e2 ) -> 0, HashBasedTable::create ) ) );
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
final Table<Integer, Integer, Integer> destination = HashBasedTable.create();
final Map<Integer, Integer> source = new HashMap<>();
// compiles
final Table<Integer, Integer, Integer> broker = source.entrySet().stream().collect( Tables.toTable( e -> 0, e -> 0, e -> 0, ( e1, e2 ) -> 0, HashBasedTable::create ) );
destination.putAll( broker );
FREQUENCY : always