Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GWT compiler shows warning for class Platform.getDeclaringClassOrNullForJ2cl(Enum) #6602

Closed
lgemeinhardt opened this issue Jun 28, 2023 · 2 comments
Assignees
Labels

Comments

@lgemeinhardt
Copy link

The GWT compiler (latest version - 2.10.0) shows this warnings (using the latest version of guava)

Warnings in com/google/common/collect/super/com/google/common/collect/Platform.java
   [WARN] Line 107: [unusable-by-js] Return type of 'Class Platform.getDeclaringClassOrNullForJ2cl(Enum)' is not usable by but exposed to JavaScript.
[WARN] Suppress "[unusable-by-js]" warnings by adding a `@SuppressWarnings("unusable-by-js")` annotation to the corresponding member.

Is it possible to add the suggested @SuppressWarnings("unusable-by-js") to suppress it and avoid such warnings?

@cpovirk cpovirk self-assigned this Jun 28, 2023
@cpovirk
Copy link
Member

cpovirk commented Jun 28, 2023

Thanks. I've found that I can reproduce this by adding <generateJsInteropExports>true</generateJsInteropExports> to our configuration.

I'm not absolutely 100% clear on what the warning is telling us, but I think I get the sense of it: It may be saying that we shouldn't expect for getDeclaringClassOrNullForJ2cl to be useful to call from JavaScript (as @JsMethod might suggest we intend to do), since Class doesn't map to a JavaScript type, but that's fine because we need only to implement it in JavaScript. (And that's all a result of how we set things up to work with both GWT and J2CL.)

@SuppressWarnings("unusable-by-js") does solve it. I'll get that committed.

copybara-service bot pushed a commit that referenced this issue Jun 29, 2023
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: 544042558
@cpovirk
Copy link
Member

cpovirk commented Jun 30, 2023

The suppression landed in 32.1.0, but because we got the Gradle metadata wrong in that release, I suggest going straight to 32.1.1, which also contains the fix for that problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants