Skip to content

Commit 8e6a96f

Browse files
martinkretzschmarGoogle Java Core Libraries
authored and
Google Java Core Libraries
committed
Workaround #6824 for J2KT test
RELNOTES=n/a PiperOrigin-RevId: 610746438
1 parent 0ea03da commit 8e6a96f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

guava-tests/test/com/google/common/collect/TableCollectorsTest.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525
import com.google.common.collect.Table.Cell;
2626
import com.google.common.testing.CollectorTester;
2727
import java.util.function.BiPredicate;
28+
import java.util.function.BinaryOperator;
2829
import java.util.stream.Collector;
2930
import java.util.stream.Stream;
3031
import junit.framework.TestCase;
32+
import org.checkerframework.checker.nullness.qual.Nullable;
3133

3234
/** Unit tests for {@link TableCollectors}. */
3335
@GwtCompatible(emulated = true)
@@ -191,12 +193,15 @@ public void testToTable() {
191193
}
192194

193195
public void testToTableNullMerge() {
196+
// TODO github.com/google/guava/issues/6824 - the null merge feature is not compatible with the
197+
// current nullness annotation of the mergeFunction parameter. Work around with casts.
198+
BinaryOperator<@Nullable Integer> mergeFunction = (v1, v2) -> null;
194199
Collector<Cell<String, String, Integer>, ?, Table<String, String, Integer>> collector =
195200
TableCollectors.toTable(
196201
Cell::getRowKey,
197202
Cell::getColumnKey,
198203
Cell::getValue,
199-
(Integer v1, Integer v2) -> null,
204+
(BinaryOperator<Integer>) mergeFunction,
200205
HashBasedTable::create);
201206
BiPredicate<Table<String, String, Integer>, Table<String, String, Integer>> equivalence =
202207
pairwiseOnResultOf(Table::cellSet);

0 commit comments

Comments
 (0)