-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Under J2CL+GWT, remove
keyType()
and valueType()
from the `Enum*B…
…iMap` classes. Previously, the methods were present but sometimes returned `null` Under J2CL. And soon, J2CL may drop support for the reflective enum-related APIs that they depend on. `guava-gwt` is used by both GWT and J2CL users, so we have to keep our code buildable against both. RELNOTES=`collect`: Removed the `Enum*BiMap` classes's `keyType()` and `valueType()` methods from `guava-gwt` to prepare for the removal of reflective enum-related APIs from J2CL. If this causes you problems as a GWT user, let us know. PiperOrigin-RevId: 535711221
- Loading branch information
Showing
12 changed files
with
144 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,15 +21,15 @@ | |
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
import jsinterop.annotations.JsMethod; | ||
import jsinterop.annotations.JsPackage; | ||
import jsinterop.annotations.JsProperty; | ||
import jsinterop.annotations.JsType; | ||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
||
/** | ||
* Minimal GWT emulation of {@code com.google.common.collect.Platform}. | ||
* | ||
* <p><strong>This .java file should never be consumed by javac.</strong> | ||
* | ||
* @author Hayward Chan | ||
*/ | ||
final class Platform { | ||
|
@@ -96,6 +96,19 @@ static MapMaker tryWeakKeys(MapMaker mapMaker) { | |
return mapMaker; | ||
} | ||
|
||
static <E extends Enum<E>> Class<E> getDeclaringClassOrObjectForJ2cl(E e) { | ||
Class<E> classOrNull = getDeclaringClassOrNullForJ2cl(e); | ||
@SuppressWarnings("unchecked") | ||
Class<E> result = classOrNull == null ? (Class<E>) (Class<?>) Object.class : classOrNull; | ||
return result; | ||
} | ||
|
||
@JsMethod | ||
private static native <E extends Enum<E>> @Nullable Class<E> getDeclaringClassOrNullForJ2cl( | ||
E e) /*-{ | ||
return [email protected]::getDeclaringClass()(); | ||
}-*/; | ||
|
||
static int reduceIterationsIfGwt(int iterations) { | ||
return iterations / 10; | ||
} | ||
|
3 changes: 3 additions & 0 deletions
3
...wt/src-super/com/google/common/collect/super/com/google/common/collect/Platform.native.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Platform.getDeclaringClassOrNullForJ2cl = function(e) { | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.