Tuesday, July 23, 2019

Building a GWT project in Eclipse 2019-03+ with Java 11.

As of Eclipse 2019-03, Eclipse started to strictly enforce JLS §7.4.3 (7.4.3. Package Observability and Visibility), as discussed here:

https://stackoverflow.com/questions/51094274/eclipse-cant-find-xml-related-classes-after-switching-build-path-to-jdk-10

https://bugs.eclipse.org/bugs/show_bug.cgi?id=544758

This means that when building with Java 11, any Eclipse package with a classpath that contains any classes that are also defined in the JDK will now report a flood of build errors in the format:

"The package org.w3c.dom is accessible from more than one module: <unnamed>, jdk.xml.dom" 

My GWT project uses classes that are defined in these Java 11 modules:



It turns out that gwt-dev.jar contains several hundred classes that conflict with Java 11 internal modules. In an attempt to hack around this, I made a copy of the gwt-2.8.2 folder and stripped out the offending classes:

scrappy:gwt-2.8.2-mod jimdouglas$ zip -d gwt-dev.jar "org/w3c/*" "org/xml/*" "javax/xml/*" "netscape/javascript/*"


When I configure Eclipse 2019-06 to use this modified GWT 2.8.2 SDK, i am able to more or less get it to build, eventually, but with a flood of obscure "Validating GWT Components" errors that have to be tediously clicked through:

An internal error occurred during: "Validating GWT components".

class org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding cannot be cast to class org.eclipse.jdt.internal.compiler.lookup.PackageBinding (org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding and org.eclipse.jdt.internal.compiler.lookup.PackageBinding are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @57cd77e1)


So...first question: Did I miss an important step when I stripped those classes out of gwt-dev.jar? Or is there a way to make "Validating GWT components" stop complaining?

And moving forward, are there plans for a GWT 2.9.0, and would it be possible for it to incorporate some version of this hack, or whatever other changes are necessary to enable GWT development in Eclipse with Java 11? (N.B. I don't particularly care about Java 11 syntax support, just minimal build ability.)

ValidatingGWTComponents.png


--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/9482a0db-8156-417c-bfef-1a40f3b17f33%40googlegroups.com.

No comments:

Post a Comment