Skip to content

Commit

Permalink
Update TableCollectorsTest for compatibility with J2KT.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 729184487
  • Loading branch information
java-team-github-bot authored and Google Java Core Libraries committed Feb 20, 2025
1 parent 60ba1ab commit ba42c96
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public void testToImmutableTableConflict() {
.collect(collector));
}

// https://youtrack.jetbrains.com/issue/KT-58242/. Crash when rowFunction result (null) is unboxed
@J2ktIncompatible
public void testToImmutableTableNullRowKey() {
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector =
toImmutableTable(t -> null, Cell::getColumnKey, Cell::getValue);
Expand All @@ -74,6 +76,9 @@ public void testToImmutableTableNullRowKey() {
() -> Stream.of(immutableCell("one", "uno", 1)).collect(collector));
}

// https://youtrack.jetbrains.com/issue/KT-58242/. Crash when columnFunction result (null) is
// unboxed
@J2ktIncompatible
public void testToImmutableTableNullColumnKey() {
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector =
toImmutableTable(Cell::getRowKey, t -> null, Cell::getValue);
Expand All @@ -82,6 +87,8 @@ public void testToImmutableTableNullColumnKey() {
() -> Stream.of(immutableCell("one", "uno", 1)).collect(collector));
}

// https://youtrack.jetbrains.com/issue/KT-58242/. Crash when getValue result (null) is unboxed
@J2ktIncompatible
public void testToImmutableTableNullValue() {
{
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>>
Expand Down Expand Up @@ -119,6 +126,8 @@ public void testToImmutableTableMerging() {
immutableCell("two", "dos", 4));
}

// https://youtrack.jetbrains.com/issue/KT-58242/. Crash when rowFunction result (null) is unboxed
@J2ktIncompatible
public void testToImmutableTableMergingNullRowKey() {
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector =
toImmutableTable(t -> null, Cell::getColumnKey, Cell::getValue, Integer::sum);
Expand All @@ -127,6 +136,9 @@ public void testToImmutableTableMergingNullRowKey() {
() -> Stream.of(immutableCell("one", "uno", 1)).collect(collector));
}

// https://youtrack.jetbrains.com/issue/KT-58242/. Crash when columnFunction result (null) is
// unboxed
@J2ktIncompatible
public void testToImmutableTableMergingNullColumnKey() {
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector =
toImmutableTable(Cell::getRowKey, t -> null, Cell::getValue, Integer::sum);
Expand All @@ -135,6 +147,9 @@ public void testToImmutableTableMergingNullColumnKey() {
() -> Stream.of(immutableCell("one", "uno", 1)).collect(collector));
}

// https://youtrack.jetbrains.com/issue/KT-58242/. Crash when valueFunction result (null) is
// unboxed
@J2ktIncompatible
public void testToImmutableTableMergingNullValue() {
{
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>>
Expand All @@ -160,6 +175,9 @@ public void testToImmutableTableMergingNullValue() {
}
}

// https://youtrack.jetbrains.com/issue/KT-58242/. Crash when mergeFunction result (null) is
// unboxed
@J2ktIncompatible
public void testToImmutableTableMergingNullMerge() {
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector =
toImmutableTable(Cell::getRowKey, Cell::getColumnKey, Cell::getValue, (v1, v2) -> null);
Expand Down Expand Up @@ -188,6 +206,9 @@ public void testToTable() {
immutableCell("three", "tres", 3));
}

// https://youtrack.jetbrains.com/issue/KT-58242/. Crash when mergeFunction result (null) is
// unboxed
@J2ktIncompatible
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.
Expand Down

0 comments on commit ba42c96

Please sign in to comment.