Skip to content

Commit

Permalink
Workaround #6824 for J2KT test
Browse files Browse the repository at this point in the history
RELNOTES=n/a
PiperOrigin-RevId: 610746438
  • Loading branch information
martinkretzschmar authored and Google Java Core Libraries committed Feb 27, 2024
1 parent 0ea03da commit 8e6a96f
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -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)
Expand Down Expand Up @@ -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<Cell<String, String, Integer>, ?, Table<String, String, Integer>> collector =
TableCollectors.toTable(
Cell::getRowKey,
Cell::getColumnKey,
Cell::getValue,
(Integer v1, Integer v2) -> null,
(BinaryOperator<Integer>) mergeFunction,
HashBasedTable::create);
BiPredicate<Table<String, String, Integer>, Table<String, String, Integer>> equivalence =
pairwiseOnResultOf(Table::cellSet);
Expand Down

0 comments on commit 8e6a96f

Please sign in to comment.