diff --git a/guava-tests/test/com/google/common/collect/TableCollectorsTest.java b/guava-tests/test/com/google/common/collect/TableCollectorsTest.java index ced6751a3b9a..8ecfcde69cb1 100644 --- a/guava-tests/test/com/google/common/collect/TableCollectorsTest.java +++ b/guava-tests/test/com/google/common/collect/TableCollectorsTest.java @@ -25,9 +25,11 @@ import com.google.common.collect.Table.Cell; import com.google.common.testing.CollectorTester; import java.util.function.BiPredicate; +import java.util.function.BinaryOperator; import java.util.stream.Collector; import java.util.stream.Stream; import junit.framework.TestCase; +import org.checkerframework.checker.nullness.qual.Nullable; /** Unit tests for {@link TableCollectors}. */ @GwtCompatible(emulated = true) @@ -191,12 +193,15 @@ public void testToTable() { } public void testToTableNullMerge() { + // TODO github.com/google/guava/issues/6824 - the null merge feature is not compatible with the + // current nullness annotation of the mergeFunction parameter. Work around with casts. + BinaryOperator<@Nullable Integer> mergeFunction = (v1, v2) -> null; Collector, ?, Table> collector = TableCollectors.toTable( Cell::getRowKey, Cell::getColumnKey, Cell::getValue, - (Integer v1, Integer v2) -> null, + (BinaryOperator) mergeFunction, HashBasedTable::create); BiPredicate, Table> equivalence = pairwiseOnResultOf(Table::cellSet);