Skip to content

Workaround https://github.com/google/guava/issues/6824 for J2KT test #7049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
1 commit merged into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
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