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

Update gwt build to run under Java 11 #9683

Closed
4 tasks done
niloc132 opened this issue Apr 24, 2020 · 18 comments · Fixed by #9780
Closed
4 tasks done

Update gwt build to run under Java 11 #9683

niloc132 opened this issue Apr 24, 2020 · 18 comments · Fixed by #9780
Assignees
Milestone

Comments

@niloc132
Copy link
Contributor

niloc132 commented Apr 24, 2020

As of 2.8.2, GWT supports being run under Java7+, but the build itself only works cleanly in Java 7. As of GWT 2.9, this changed to support Java8+ (via https://gwt-review.googlesource.com/c/gwt/+/22320), but Java 9+ still do not work to actually produce the GWT distribution. This issue is a placeholder to track the problems faced.

  • Internal build for Java 7 vs "modern" can be removed
  • SwingLoggerPanel.java uses improper generics for Java 9+. Previously, the postorderEnumeration() returned a raw Enumeration, but that changed in Java 9 https://docs.oracle.com/javase/9/docs/api/javax/swing/tree/DefaultMutableTreeNode.html#postorderEnumeration--
  • CloseableJarHandler.java uses classes in the java.base module that are not exported. An extra compiler arg can either make that accessible, or it is possible that this class is dead and can be removed
  • The GWT doctool project uses com.sun.javadoc packages com.sun.tools.doclets package, deprecated in java9, gone in 11. Finding a cross-version way to support this could be difficult (having not tried at all yet), it may be easier to find a different way to support the custom documentation present in GWT.
@niloc132 niloc132 added this to the 2.9 milestone Apr 24, 2020
@niloc132 niloc132 self-assigned this Apr 24, 2020
@niloc132
Copy link
Contributor Author

niloc132@java9+ is a quick and dirty patch that at least makes it possible to build GWT under java9, 11 (have not yet tested 14). Some aspects can be cherry-picked to address the issues discussed above, but some will need more work.

@MCMicS
Copy link
Contributor

MCMicS commented Apr 24, 2020

under Windows (version 1.10.7, JDK 11.0.7, 14.0.1 Windows) I got following error if gwt.javac macro is executed:

[gwt.javac] Caused by: java.nio.file.NotDirectoryException: P:\Java\jdk-11.0.7\lib\modules
[gwt.javac]     at java.base/sun.nio.fs.WindowsDirectoryStream.<init>(WindowsDirectoryStream.java:84)
[gwt.javac]     at java.base/sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:523)
[gwt.javac]     at java.base/java.nio.file.Files.newDirectoryStream(Files.java:471)
[gwt.javac]     at java.base/java.nio.file.Files.list(Files.java:3696)
[gwt.javac]     at com.sun.tools.javac.file.Locations$BootClassPathLocationHandler.systemClasses(Locations.java:665)
[gwt.javac]     at com.sun.tools.javac.file.Locations$BootClassPathLocationHandler.computePath(Locations.java:621)
[gwt.javac]     at com.sun.tools.javac.file.Locations$BootClassPathLocationHandler.lazy(Locations.java:709)
[gwt.javac]     ... 133 more

Tested with ant buildonly and ant -f samples\build.xml hello

@niloc132
Copy link
Contributor Author

Can you share the full log, and confirm that you have my commit running? Looks like I might have missed some java.tools.path somewhere, but as far as I can tell, in that commit they are all commented out.

@MCMicS
Copy link
Contributor

MCMicS commented Apr 24, 2020

Sure. Have prepared it and then forget to upload 🤦

9683_Win10_jdk11.txt

@niloc132
Copy link
Contributor Author

Can you do it again from clean, and confirm that the whole thing is there? I was expecting to see something like this at the end, note the lines after BUILD FAILED:

[gwt.javac] Caused by: java.nio.file.NotDirectoryException: /usr/lib/jvm/java-11-openjdk/lib/modules
[gwt.javac] 	at java.base/sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:431)
[gwt.javac] 	at java.base/java.nio.file.Files.newDirectoryStream(Files.java:471)
[gwt.javac] 	at java.base/java.nio.file.Files.list(Files.java:3696)
[gwt.javac] 	at com.sun.tools.javac.file.Locations$BootClassPathLocationHandler.systemClasses(Locations.java:665)
[gwt.javac] 	at com.sun.tools.javac.file.Locations$BootClassPathLocationHandler.computePath(Locations.java:621)
[gwt.javac] 	at com.sun.tools.javac.file.Locations$BootClassPathLocationHandler.lazy(Locations.java:709)
[gwt.javac] 	... 80 more

BUILD FAILED
/home/colin/workspace/gwt/build.xml:40: The following error occurred while executing this line:
/home/colin/workspace/gwt/build.xml:27: The following error occurred while executing this line:
/home/colin/workspace/gwt/build.xml:58: The following error occurred while executing this line:
/home/colin/workspace/gwt/dev/build.xml:200: Compile failed; see the compiler error output for details.

Total time: 0 seconds

@MCMicS
Copy link
Contributor

MCMicS commented Apr 24, 2020

your "hack and slash commit" produce following:

gwt-master_niloc>set JAVA_HOME=P:\Java\jdk-11.0.7

gwt-master_niloc>ant buildonly
Buildfile: gwt-master_niloc\build.xml

buildonly:

dev:

buildtools:

build:

doctool:

-do:

compiler.standalone:
[gwt.javac] Compiling 7 source files to gwt-master_niloc\build\out\dev\bin
[gwt.javac] error: option --add-exports not allowed with target 1.8

BUILD FAILED
gwt-master_niloc\build.xml:40: The following error occurred while executing this line:
gwt-master_niloc\build.xml:27: The following error occurred while executing this line:
gwt-master_niloc\build.xml:58: The following error occurred while executing this line:
gwt-master_niloc\dev\build.xml:200: Compile failed; see the compiler error output for details.

Total time: 2 seconds

for sample without your hack commit and use the one from gerrit (+ + gwt master):
9683_Win10_jdk11_sample_hello.txt

I try a full rebuild now (first create gwt-user with java8).

@niloc132
Copy link
Contributor Author

Looks like I might have changed/reverted something else in an attempt to "clean" it up for commit and broken it? Will get back to you.

@niloc132
Copy link
Contributor Author

Okay, I force pushed a commit to that branch to replace it - this is better in a few ways than what I had intended to push last time:

  • compiling on java9+ is still runnable on java8
  • no need for extra conditional wiring on the gwt.javac task

Sorry about that, let me know if this new commit works any better for you. Be sure to do a clean between builds, I've seen odd issues in the past even when you don't change JDK. Tested the build on both java8 and java11, have not tried running both on java8 projects, only checked the magic number in bytecode in a few files.

@MCMicS
Copy link
Contributor

MCMicS commented Apr 24, 2020

getting same error

compiler.standalone:
    [mkdir] Created dir: gwt\build\out\dev\bin
[gwt.javac] Compiling 7 source files to build\out\dev\bin
[gwt.javac] javac: invalid flag: --add-exports
[gwt.javac] Usage: javac <options> <source files>
[gwt.javac] use -help for a list of possible options

BUILD FAILED
gwt\build.xml:40: The following error occurred while executing this line:
gwt\build.xml:27: The following error occurred while executing this line:
gwt\build.xml:58: The following error occurred while executing this line:
dev\build.xml:200: Compile failed; see the compiler error output for details.

used this: https://github.com/niloc132/gwt/tree/java9+
Am I on the wrong branch or where you have pushed ;)

@niloc132
Copy link
Contributor Author

niloc132 commented Apr 24, 2020

Sorry, I pushed the branch to the wrong place - I re-pushed, here's the commit to be sure, with no more --add-exports.
niloc132@d51a0e8

@MCMicS
Copy link
Contributor

MCMicS commented Apr 24, 2020

Now it seems to work
tested with jdk11,jdk14 and jdk15

thanks for that

@niloc132
Copy link
Contributor Author

@niloc132
Copy link
Contributor Author

jofrantoba pushed a commit to jofrantoba/gwt that referenced this issue Jul 13, 2020
Prior to Java 9, the postOrderEnumeration method returned a raw
Enumeration, but to correctly compile in newer JDKs we must return
the correctly parameterized type.

Bug: gwtproject#9683
Change-Id: I9a21df1bc6473a7e569e0e4d3aa65ba45215167f
Bug-Link: gwtproject#9683
@jncanches
Copy link

Tested with OpenJDK 17 and it worked.
Thanks!

@niloc132
Copy link
Contributor Author

Javadocs will still not work, and some tests won't either, but at least producing a build (and running it) should all function at this point. Javadoc is still not going to work until we make the decision to drop java 8/9/10 support for producing javadoc, so we'll continue producing official builds using java8 or so for the time being, until someone adopts that migration work.

niloc132 added a commit to niloc132/gwt-playground that referenced this issue Oct 14, 2021
This patch does some initial work of adding support for building GWT
on Java >8, but until the javadoc wiring is rebuilt (or conditionally
disabled) a normal build won't be possible.

After Javadoc has been updated or guarded behind a flag, isJava8 can be
false when Java >8 JDK is used to build, and tests for those can be
guarded as makes sense.

Bug: 9683
Bug-Link: gwtproject/gwt#9683
Change-Id: I5ec65e330409802368b2a60148d7ef1ee97c03d1
niloc132 added a commit to niloc132/gwt-playground that referenced this issue Oct 17, 2021
This patch does some initial work of adding support for building GWT
on Java >8, but until the javadoc wiring is rebuilt (or conditionally
disabled) a normal build won't be possible.

After Javadoc has been updated or guarded behind a flag, isJava8 can be
false when Java >8 JDK is used to build, and tests for those can be
guarded as makes sense.

Bug: 9683
Bug-Link: gwtproject/gwt#9683
Change-Id: I5ec65e330409802368b2a60148d7ef1ee97c03d1
niloc132 added a commit to niloc132/gwt-playground that referenced this issue Oct 21, 2021
This patch does some initial work of adding support for building GWT
on Java >8, but until the javadoc wiring is rebuilt (or conditionally
disabled) a normal build won't be possible.

After Javadoc has been updated or guarded behind a flag, isJava8 can be
false when Java >8 JDK is used to build, and tests for those can be
guarded as makes sense.

Bug: 9683
Bug-Link: gwtproject/gwt#9683
Change-Id: I5ec65e330409802368b2a60148d7ef1ee97c03d1
niloc132 added a commit to niloc132/gwt-playground that referenced this issue Nov 10, 2021
This patch does some initial work of adding support for building GWT
on Java >8, but until the javadoc wiring is rebuilt (or conditionally
disabled) a normal build won't be possible.

After Javadoc has been updated or guarded behind a flag, isJava8 can be
false when Java >8 JDK is used to build, and tests for those can be
guarded as makes sense.

The error-prone Java compiler is also temporarily disabled in this
commit, and will be restored and updated to latest in a follow-up patch.

Bug: 9683
Bug-Link: gwtproject/gwt#9683
Change-Id: I5ec65e330409802368b2a60148d7ef1ee97c03d1
@niloc132
Copy link
Contributor Author

With https://gwt-review.googlesource.com/c/gwt/+/23700 / b6cc5cf merged and https://gwt-review.googlesource.com/c/gwt/+/23740 ready to go (will probably merge later today, just doing a bit more testing first after rebasing), most of the build (and some tests) can work on java8, java11, and java17, as long as the docs part of the build is disabled.

If we want to keep Java 8 support for a while longer, we need to decide if docs should continue to be built in Java 8 or assume something newer. Either approach requires that the other build cannot produce javadocs, so any "builds with docs" produced needs to be tested with other Java versions.

The time will come when GWT will be held back by supporting the Java 8 runtime at all - Jetty has announced that Jetty 9.4.x will EOL in April 2022 (and 10, 11 require Java 11+), and recent Eclipse JDT versions (which support Java 17 syntax) require a minimum of Java 11 as well.

@tbroyer
Copy link
Member

tbroyer commented Nov 11, 2021

AFAICT, there are two tools that are problematic because they're using the old doclet API: the javadoc generation itself, and the JRE emulation reference ("ezt" in the codebase).
If I'm not mistaken, javadoc is only about the @example, @gwt.include, and @tip tags. Those could be inlined the classes' javadoc, instead of trying to make the taglets work with the new API (@tip would likely be easy to keep, maybe even just as -tag tip:a:"Tip:").
EztDoclet looks much easier to port to the new API (and might not even need to be ported in the near future as the com.sun.javadoc package is still available in JDK 11).

@niloc132
Copy link
Contributor Author

Inlining example is only really problematic because the examples are actual Java classes, getting formatting and linking right (and keeping them up to date when minor changes have to be made) could be irritating, but not hard by any means.

My understanding of Ezt is very limited, thanks for the details there. Naively, it seems like it might be straightforward to just find a more compatible way to walk the available super source and generate links. Especially since it seems that this tool keys off of a properties file, which in turn is just printed out disk from the FindPackages main?

As you say, Ezt at least can safely wait until after we've dealt with the end of Java 8.

@niloc132 niloc132 modified the milestones: 2.9, 2.11 Jun 9, 2022
@niloc132 niloc132 changed the title Update gwt build to work under all supported java versions Update gwt build to build under Java 11 Apr 8, 2023
@niloc132 niloc132 changed the title Update gwt build to build under Java 11 Update gwt build to run under Java 11 Apr 8, 2023
niloc132 added a commit that referenced this issue Apr 11, 2023
Update doctool to run on Java 11, thus allowing either Java 8 or 11 to
build GWT itself. Because the new javadoc types are not available in
Java 8, the ant wiring has been configured to just skip docs when
building with Java 8. CI is updated to build with both 8 and 11, but
since Java 8 cannot produce documentation, only the Java 11 build is
published.

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

Successfully merging a pull request may close this issue.

4 participants