Skip to content

Commit

Permalink
Make Primitives available to GWT/j2cl.
Browse files Browse the repository at this point in the history
I was going to use it in google/truth@3a47110, but I found that it wasn't available under those environments.

RELNOTES=n/a
PiperOrigin-RevId: 479106559
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Oct 5, 2022
1 parent e7d6821 commit 5ed6e43
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import static com.google.common.truth.Truth.assertThat;

import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.testing.NullPointerTester;
import java.util.Set;
import junit.framework.TestCase;
Expand All @@ -27,6 +29,7 @@
*
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class PrimitivesTest extends TestCase {
public void testIsWrapperType() {
assertThat(Primitives.isWrapperType(Void.class)).isTrue();
Expand Down Expand Up @@ -87,6 +90,7 @@ public void testAllWrapperTypes() {
}
}

@GwtIncompatible
public void testNullPointerExceptions() {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicStaticMethods(Primitives.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.GwtCompatible;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
Expand All @@ -29,7 +29,7 @@
* @author Kevin Bourrillion
* @since 1.0
*/
@GwtIncompatible
@GwtCompatible
@ElementTypesAreNonnullByDefault
public final class Primitives {
private Primitives() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import static com.google.common.truth.Truth.assertThat;

import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.testing.NullPointerTester;
import java.util.Set;
import junit.framework.TestCase;
Expand All @@ -27,6 +29,7 @@
*
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class PrimitivesTest extends TestCase {
public void testIsWrapperType() {
assertThat(Primitives.isWrapperType(Void.class)).isTrue();
Expand Down Expand Up @@ -87,6 +90,7 @@ public void testAllWrapperTypes() {
}
}

@GwtIncompatible
public void testNullPointerExceptions() {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicStaticMethods(Primitives.class);
Expand Down
4 changes: 2 additions & 2 deletions guava/src/com/google/common/primitives/Primitives.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.GwtCompatible;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
Expand All @@ -29,7 +29,7 @@
* @author Kevin Bourrillion
* @since 1.0
*/
@GwtIncompatible
@GwtCompatible
@ElementTypesAreNonnullByDefault
public final class Primitives {
private Primitives() {}
Expand Down

0 comments on commit 5ed6e43

Please sign in to comment.