diff --git a/android/guava-tests/test/com/google/common/collect/SetsTest.java b/android/guava-tests/test/com/google/common/collect/SetsTest.java index d46cbb136a40..82c40b09f828 100644 --- a/android/guava-tests/test/com/google/common/collect/SetsTest.java +++ b/android/guava-tests/test/com/google/common/collect/SetsTest.java @@ -578,48 +578,56 @@ public void testNewCOWASFromIterable() { verifySetContents(set, SOME_COLLECTION); } + @GwtIncompatible // complementOf public void testComplementOfEnumSet() { Set units = EnumSet.of(SomeEnum.B, SomeEnum.D); EnumSet otherUnits = Sets.complementOf(units); verifySetContents(otherUnits, EnumSet.of(SomeEnum.A, SomeEnum.C)); } + @GwtIncompatible // complementOf public void testComplementOfEnumSetWithType() { Set units = EnumSet.of(SomeEnum.B, SomeEnum.D); EnumSet otherUnits = Sets.complementOf(units, SomeEnum.class); verifySetContents(otherUnits, EnumSet.of(SomeEnum.A, SomeEnum.C)); } + @GwtIncompatible // complementOf public void testComplementOfRegularSet() { Set units = Sets.newHashSet(SomeEnum.B, SomeEnum.D); EnumSet otherUnits = Sets.complementOf(units); verifySetContents(otherUnits, EnumSet.of(SomeEnum.A, SomeEnum.C)); } + @GwtIncompatible // complementOf public void testComplementOfRegularSetWithType() { Set units = Sets.newHashSet(SomeEnum.B, SomeEnum.D); EnumSet otherUnits = Sets.complementOf(units, SomeEnum.class); verifySetContents(otherUnits, EnumSet.of(SomeEnum.A, SomeEnum.C)); } + @GwtIncompatible // complementOf public void testComplementOfEmptySet() { Set noUnits = Collections.emptySet(); EnumSet allUnits = Sets.complementOf(noUnits, SomeEnum.class); verifySetContents(EnumSet.allOf(SomeEnum.class), allUnits); } + @GwtIncompatible // complementOf public void testComplementOfFullSet() { Set allUnits = Sets.newHashSet(SomeEnum.values()); EnumSet noUnits = Sets.complementOf(allUnits, SomeEnum.class); verifySetContents(noUnits, EnumSet.noneOf(SomeEnum.class)); } + @GwtIncompatible // complementOf public void testComplementOfEmptyEnumSetWithoutType() { Set noUnits = EnumSet.noneOf(SomeEnum.class); EnumSet allUnits = Sets.complementOf(noUnits); verifySetContents(allUnits, EnumSet.allOf(SomeEnum.class)); } + @GwtIncompatible // complementOf public void testComplementOfEmptySetWithoutTypeDoesntWork() { Set set = Collections.emptySet(); try { diff --git a/android/guava/src/com/google/common/collect/Sets.java b/android/guava/src/com/google/common/collect/Sets.java index 514530a8bdaf..691a4bf78130 100644 --- a/android/guava/src/com/google/common/collect/Sets.java +++ b/android/guava/src/com/google/common/collect/Sets.java @@ -466,6 +466,7 @@ public static TreeSet newTreeSet(Iterable * contains no elements */ @J2ktIncompatible + @GwtIncompatible public static > EnumSet complementOf(Collection collection) { if (collection instanceof EnumSet) { return EnumSet.complementOf((EnumSet) collection); @@ -486,6 +487,7 @@ public static > EnumSet complementOf(Collection collecti * @return a new, modifiable {@code EnumSet} initially containing all the values of the enum not * present in the given collection */ + @GwtIncompatible public static > EnumSet complementOf( Collection collection, Class type) { checkNotNull(collection); @@ -494,6 +496,7 @@ public static > EnumSet complementOf( : makeComplementByHand(collection, type); } + @GwtIncompatible private static > EnumSet makeComplementByHand( Collection collection, Class type) { EnumSet result = EnumSet.allOf(type); diff --git a/guava-tests/test/com/google/common/collect/SetsTest.java b/guava-tests/test/com/google/common/collect/SetsTest.java index b0d2ab9d50cf..50fb456e5e56 100644 --- a/guava-tests/test/com/google/common/collect/SetsTest.java +++ b/guava-tests/test/com/google/common/collect/SetsTest.java @@ -609,48 +609,56 @@ public void testNewCOWASFromIterable() { verifySetContents(set, SOME_COLLECTION); } + @GwtIncompatible // complementOf public void testComplementOfEnumSet() { Set units = EnumSet.of(SomeEnum.B, SomeEnum.D); EnumSet otherUnits = Sets.complementOf(units); verifySetContents(otherUnits, EnumSet.of(SomeEnum.A, SomeEnum.C)); } + @GwtIncompatible // complementOf public void testComplementOfEnumSetWithType() { Set units = EnumSet.of(SomeEnum.B, SomeEnum.D); EnumSet otherUnits = Sets.complementOf(units, SomeEnum.class); verifySetContents(otherUnits, EnumSet.of(SomeEnum.A, SomeEnum.C)); } + @GwtIncompatible // complementOf public void testComplementOfRegularSet() { Set units = Sets.newHashSet(SomeEnum.B, SomeEnum.D); EnumSet otherUnits = Sets.complementOf(units); verifySetContents(otherUnits, EnumSet.of(SomeEnum.A, SomeEnum.C)); } + @GwtIncompatible // complementOf public void testComplementOfRegularSetWithType() { Set units = Sets.newHashSet(SomeEnum.B, SomeEnum.D); EnumSet otherUnits = Sets.complementOf(units, SomeEnum.class); verifySetContents(otherUnits, EnumSet.of(SomeEnum.A, SomeEnum.C)); } + @GwtIncompatible // complementOf public void testComplementOfEmptySet() { Set noUnits = Collections.emptySet(); EnumSet allUnits = Sets.complementOf(noUnits, SomeEnum.class); verifySetContents(EnumSet.allOf(SomeEnum.class), allUnits); } + @GwtIncompatible // complementOf public void testComplementOfFullSet() { Set allUnits = Sets.newHashSet(SomeEnum.values()); EnumSet noUnits = Sets.complementOf(allUnits, SomeEnum.class); verifySetContents(noUnits, EnumSet.noneOf(SomeEnum.class)); } + @GwtIncompatible // complementOf public void testComplementOfEmptyEnumSetWithoutType() { Set noUnits = EnumSet.noneOf(SomeEnum.class); EnumSet allUnits = Sets.complementOf(noUnits); verifySetContents(allUnits, EnumSet.allOf(SomeEnum.class)); } + @GwtIncompatible // complementOf public void testComplementOfEmptySetWithoutTypeDoesntWork() { Set set = Collections.emptySet(); try { diff --git a/guava/src/com/google/common/collect/Sets.java b/guava/src/com/google/common/collect/Sets.java index 4df1fb2f3820..c00cfae0cc6f 100644 --- a/guava/src/com/google/common/collect/Sets.java +++ b/guava/src/com/google/common/collect/Sets.java @@ -480,6 +480,7 @@ public static TreeSet newTreeSet(Iterable * contains no elements */ @J2ktIncompatible + @GwtIncompatible public static > EnumSet complementOf(Collection collection) { if (collection instanceof EnumSet) { return EnumSet.complementOf((EnumSet) collection); @@ -500,6 +501,7 @@ public static > EnumSet complementOf(Collection collecti * @return a new, modifiable {@code EnumSet} initially containing all the values of the enum not * present in the given collection */ + @GwtIncompatible public static > EnumSet complementOf( Collection collection, Class type) { checkNotNull(collection); @@ -508,6 +510,7 @@ public static > EnumSet complementOf( : makeComplementByHand(collection, type); } + @GwtIncompatible private static > EnumSet makeComplementByHand( Collection collection, Class type) { EnumSet result = EnumSet.allOf(type);