Skip to content
This repository has been archived by the owner on Sep 13, 2018. It is now read-only.

JDK9 support #27

Closed
ben-manes opened this issue Aug 18, 2016 · 11 comments
Closed

JDK9 support #27

ben-manes opened this issue Aug 18, 2016 · 11 comments
Milestone

Comments

@ben-manes
Copy link

Using 9ea and Gradle 3.0, the plugin has to be disabled due to the error

Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.ltgt.gradle.errorprone.ErrorProneCompiler$SelfFirstClassLoader
        at net.ltgt.gradle.errorprone.ErrorProneCompiler.execute(ErrorProneCompiler.java:51)
        at net.ltgt.gradle.errorprone.ErrorProneCompiler.execute(ErrorProneCompiler.java:25)
@tbroyer
Copy link
Owner

tbroyer commented Aug 23, 2016

Reproduced.

Looks like the Jvm.current().getToolsJar().… throws an NPE (expected, as there's no tools.jar in JDK 9 any longer), but removing it (using a URLClassLoader with no entries) then fails with an NPE during the compilation, because that System.getProperty("sun.boot.class.path") returns null (see http://openjdk.java.net/jeps/261).

I think Error Prone simply is not compatible with JDK 9 yet.

@tbroyer
Copy link
Owner

tbroyer commented Aug 23, 2016

See google/error-prone#448 (comment)

We're not yet supporting running on JDK 9.

So, I'll change the plugin to support JDK 9 (i.e. no longer fail when there's no tools.jar), but you'll have to wait for Error Prone to support JDK 9 to be able to actually use it.

@tbroyer
Copy link
Owner

tbroyer commented Aug 23, 2016

In retrospect, not really knowing how Error Prone will tackle the problem, it's probably safer to wait for them to support JDK 9 and only then update the plugin accordingly. WDYT?

@ben-manes
Copy link
Author

I'm fine disabling in my build. I think being explicit is reasonable.

@tbroyer tbroyer mentioned this issue Apr 12, 2017
Closed
@tbroyer
Copy link
Owner

tbroyer commented May 3, 2017

FWIW, 8aa08a8 (shipped in 0.0.9) now handles the case where Jvm.current().getToolsJar() returns null; so with JDK 9 the build should now fail with an explicit error message hinting that the JDK might not be compatible (I can't even make Gradle start with Java 9 though…).

(leaving this issue open as this will need to change anyway once Error Prone supports JDK 9)

@tbroyer
Copy link
Owner

tbroyer commented Jul 16, 2017

It looks like JDK 9 support is becoming official through the use of the -Xplugin flag: google/error-prone#681

I'd rather wait for the final JDK 9 release before making any change though (if any, having to use the -processorpath could easily conflict with other plugins or JavaCompile tasks' configuration, so maybe this plugin will actually never support JDK 9, by design).

@ben-manes
Copy link
Author

Finally released so a bunch of tooling is officially busted. ;)

@sormuras
Copy link

A PR hits the "no tools.jar" wall junit-team/junit5#961 -- any news on supporting JDK 9?

@tbroyer
Copy link
Owner

tbroyer commented Oct 13, 2017

Let me have a look at it. It looks like tools.jar is actually not (no longer?) needed with Java 8 (actually, that was probably a requirement of ErrorProne 1.x, remove from 2.x when it started using its own javac; and I recently removed support for Java 7 and ErrorProne 1.x), and ErrorProne would then work in a JDK 9 environment.
Needs more testing…

@tbroyer
Copy link
Owner

tbroyer commented Oct 13, 2017

I just release v0.0.13 which works with Java 9; but please note that Error Prone does not support JPMS or the --release flag (to guarantee backwards-compatibility with JDK 7 or JDK 8, without the need to use those JDKs when compiling), among other things.

Closing this issue, as things are now on Error Prone's side.

@sormuras
Copy link

I just release v0.0.13 which works with Java 9

Thanks Thomas!

please note that Error Prone does not support JPMS or the --release flag (to guarantee backwards-compatibility with JDK 7 or JDK 8, without the need to use those JDKs when compiling), among other things.

Okay for me. :)

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

No branches or pull requests

3 participants