Vertispan / j2clmavenplugin

Maven plugin to launch new J2CL compilation
https://vertispan.github.io/j2clmavenplugin/
Apache License 2.0
53 stars 26 forks source link

Java 11 Optional.isEmpty causes compile error #209

Open jestan opened 1 year ago

jestan commented 1 year ago

I am using latest snapshot version of the plugin (0.21-SNAPSHOT) and using Optional.isEmpty method causes a compile error.

j2cl build prints an error like this

cannot find symbol
  symbol:   method isEmpty()

According to J2CL repo, this method seems to be supported https://github.com/google/j2cl/blob/master/jre/java/java/util/Optional.java#L60

I am wondering why it doesn't work as expected?

niloc132 commented 1 year ago

Thanks for the bug report, can you post a little more of your log or a simple test case project?

The only guess I have right now is that it was added in Java 11, and the plugin is presently limited to Java 8, but that should still allow the jre emulation to provide methods not otherwise present in the traditional JRE (this is how some specific Map specialization works, etc).