google / j2cl

Java to Closure JavaScript transpiler
Apache License 2.0
1.23k stars 144 forks source link

Closure-Compiler error in javaemul/internal/StringHashCache.java #115

Closed kschrage closed 3 years ago

kschrage commented 3 years ago

After migrating my project from GWT to J2CL (just some java business logic) I get the following error during my build.

bazel-out/darwin-fastbuild/bin/external/com_google_j2cl/jre/java/jre.js.zip!/javaemul/internal/StringHashCache.java:57: ERROR - Property m_setProperty__java_lang_Object__java_lang_String__java_lang_Object never defined on module$exports$javaemul$internal$JsUtils$impl ProTip: "JSC_INEXISTENT_PROPERTY" or "checkTypes" or "missingProperties" or "missingSourcesWarnings" can be added to thesuppressattribute of: @com_google_j2cl//jre/java:jre Alternatively /** @suppress {missingProperties} */ can be added to the source file.

Please see my attached WORKSPACE file (modified from the hellworld-sample). WORKSPACE.txt

Could my maven_install additions be responsible for this?

kschrage commented 3 years ago

Since I obviously didn't need the maven-stuff I deleted it from my WORKSPACE-file. After cleaning with expunge the build still fails with the same error.

niloc132 commented 3 years ago

JsUtils.setProperty was just deleted in GWT (see https://github.com/gwtproject/gwt/commit/0a56fb5c795a2cc580e3e6ff13b6523a3ae6a446#diff-31f364ff63da8032bd9cdf6af5a66c9b142f86d0d03d3096b2e41deec013ee4cL59). A matching change was made in j2cl (https://github.com/google/j2cl/commit/7033abb59574f6c4483bbe23f59c8537e7b1f054#diff-08b2e068eec299169b75b881d3de91a58b3cd52825b9f24e50ebd3ac642bb3fbL57), perhaps you are using an older commit than that?

Try a bazel sync to make sure that it has the latest of any of the dependencies - as of recent versions that seems to do the job better than the old bazel clean --expunge.

gkdn commented 3 years ago

We have pinned down the GWT JRE dep in J2CL for reproducible builds. I will update the GWT version which should fix the problem.

niloc132 commented 3 years ago

Oh I missed that fact, thank you for the correction.

kschrage commented 3 years ago

Thanks for your replies. I tried to change the mentioned GWT JRE dep myself but gut strange consequential failures regarding the gwt-user dependency. Looking forward for your change @gkdn to see what the correct solution looks like.

gkdn commented 3 years ago

https://github.com/google/j2cl/commit/bce3e2f27823d3a576777ff3c96721a5bca40d23 should be fixing this.

kschrage commented 3 years ago

Thank, works now. I had the same fix. Unfortunately my local j2cl-checkout was a sibling of my WORKSPACE-containing project and not the parent (as used in the WORKSPACE-local template). That seems to have introduced the mentioned dependency problems (for anyone who is also seeing as similar error in the future)