-
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.
And enable a setting that at least _shows_ us that warning (though it doesn't fail the build). Fixes #6602 RELNOTES=Suppressed [an `unusable-by-js` warning](#6602) seen by users of `guava-gwt`. PiperOrigin-RevId: 544409394
- Loading branch information
Showing
2 changed files
with
15 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,21 @@ static <E extends Enum<E>> Class<E> getDeclaringClassOrObjectForJ2cl(E e) { | |
return result; | ||
} | ||
|
||
/* | ||
* If I understand correctly: | ||
* | ||
* This needs to be a @JsMethod so that J2CL knows to look for a JavaScript implemention of | ||
* it in Platform.native.js. (The JavaScript implementation inline below is visible to *GWT*, but | ||
* *J2CL* doesn't look at it.) | ||
* | ||
* However, once it's a @JsMethod, GWT produces a warning. That's because (a) the *other* purpose | ||
* of @JsMethod is to make a method *callable* from JavaScript and (b) this method would not be | ||
* useful to call from vanilla JavaScript because it returns an instance of Class, which can't be | ||
* converted to a standard JavaScript type. (Contrast to something like String or boolean.) Since | ||
* we're not calling it from JavaScript, we suppress the warning. | ||
*/ | ||
@JsMethod | ||
@SuppressWarnings("unusable-by-js") | ||
private static native <E extends Enum<E>> @Nullable Class<E> getDeclaringClassOrNullForJ2cl( | ||
E e) /*-{ | ||
return [email protected]::getDeclaringClass()(); | ||
|