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

JDK 9 support #448

Closed
dudaerich opened this issue Aug 17, 2016 · 12 comments
Closed

JDK 9 support #448

dudaerich opened this issue Aug 17, 2016 · 12 comments

Comments

@dudaerich
Copy link

When I try to compile my project using JDK 9 (https://jdk9.java.net/download/), I get following error.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project artemis-commons: Fatal error compiling: CompilerException: InvocationTargetException: java.nio.file.NotDirectoryException: /opt/jdk1.9.ea/lib/modules -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project artemis-commons: Fatal error compiling
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-ea/Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@9-ea/NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-ea/DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(java.base@9-ea/Method.java:535)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:796)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more
Caused by: org.codehaus.plexus.compiler.CompilerException
    at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne.performCompile(JavacCompilerWithErrorProne.java:95)
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:785)
    ... 23 more
Caused by: java.lang.reflect.InvocationTargetException
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-ea/Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@9-ea/NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-ea/DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(java.base@9-ea/Method.java:535)
    at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne.performCompile(JavacCompilerWithErrorProne.java:91)
    ... 24 more
Caused by: java.io.UncheckedIOException: java.nio.file.NotDirectoryException: /opt/jdk1.9.ea/lib/modules
    at com.sun.tools.javac.file.Locations$BootClassPathLocationHandler.lazy(Locations.java:725)
    at com.sun.tools.javac.file.Locations$BootClassPathLocationHandler.isDefault(Locations.java:559)
    at com.sun.tools.javac.file.Locations.isDefaultBootClassPath(Locations.java:129)
    at com.sun.tools.javac.file.BaseFileManager.isDefaultBootClassPath(BaseFileManager.java:149)
    at com.sun.tools.javac.main.Arguments.validate(Arguments.java:411)
    at com.sun.tools.javac.main.Main.compile(Main.java:218)
    at com.google.errorprone.BaseErrorProneCompiler.run(BaseErrorProneCompiler.java:190)
    at com.google.errorprone.BaseErrorProneCompiler.run(BaseErrorProneCompiler.java:101)
    at com.google.errorprone.ErrorProneCompiler.run(ErrorProneCompiler.java:131)
    at com.google.errorprone.ErrorProneCompiler.compile(ErrorProneCompiler.java:73)
    at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne$CompilerInvoker.compile(JavacCompilerWithErrorProne.java:219)
    ... 29 more
Caused by: java.nio.file.NotDirectoryException: /opt/jdk1.9.ea/lib/modules
    at sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(java.base@9-ea/UnixFileSystemProvider.java:427)
    at java.nio.file.Files.newDirectoryStream(java.base@9-ea/Files.java:460)
    at java.nio.file.Files.list(java.base@9-ea/Files.java:3506)
    at com.sun.tools.javac.file.Locations$BootClassPathLocationHandler.systemClasses(Locations.java:678)
    at com.sun.tools.javac.file.Locations$BootClassPathLocationHandler.computePath(Locations.java:634)
    at com.sun.tools.javac.file.Locations$BootClassPathLocationHandler.lazy(Locations.java:722)
    ... 39 more

The error-prone-javac assumes that $JAVA_HOME/lib/modules is a directory but in my case it is regular file. I use 1.9.0-dev-r2973-2 version of error-prone-javac.

@eaftan
Copy link
Contributor

eaftan commented Aug 17, 2016

We're not yet supporting running on JDK 9.

The current version of error-prone-javac was cut before Project Jigsaw (i.e. the module system) landed. It will require significant work for us to run on a modularized JDK. We are working on this internally, but it's low priority as the JDK 9 release date is more than 6 months away.

@eaftan eaftan closed this as completed Aug 17, 2016
@dudaerich
Copy link
Author

I see. Thank you for your response.

@talios
Copy link

talios commented Feb 16, 2017

WIth Java 9 coming later this year, I thought it'd be good to start occasionally tracking it with our builds, but hit this problem - any word on when some support might be available in error_prone?

@eaftan
Copy link
Contributor

eaftan commented Feb 21, 2017

We still don't have a firm timeline for this. @cushon might have thoughts.

@clebertsuconic
Copy link

clebertsuconic commented May 9, 2017

It's a bit weird to me you guys closing this issue without being fixed.. no plans to fix it?

we are using it on activemq artemis.. we may have to remove error prone otherwise we won't be able to move to jdk1.9.

@cushon
Copy link
Collaborator

cushon commented May 9, 2017

Is this still happening with recent JDK 9 EA builds and Error Prone 2.0.20-SNAPSHOT?

@clebertsuconic
Copy link

clebertsuconic commented May 9, 2017

I didn't try with a snapshot of Error Prone.. I can try it later today:

We were having a discussion here:

http://activemq.2283324.n4.nabble.com/DISCUSS-Artemis-JDK9-support-tp4725823.html;cid=1494353758727-471

if you want to be part of the discussion, you can subscribe to the dev list:

http://activemq.apache.org/mailing-lists.html

if you want to build it and try yourself:

https://github.com/apache/activemq-artemis/

a simple git clone and mvn install would do!

@cushon cushon changed the title NotDirectoryException when jdk-9-ea+131 is used JDK 9 support May 10, 2017
@cushon
Copy link
Collaborator

cushon commented May 10, 2017

Let's leave this bug open to track JDK 9 support. I'm not sure we can commit to supporting JDK 9 before it's released, but it's definitely something we plan to do eventually.

@clebertsuconic I can build activemq-artemis with JDK 9-ea+168 and Error Prone 2.0.20-SNAPSHOT. I started with the fixes in ARTEMIS-683 and then re-enabled Error Prone.

  • -Xep:StaticAccessedFromInstance:ERROR needs to be updated to -Xep:StaticQualifiedUsingExpression:ERROR
  • I made a small change to Error Prone to work around JDK-8152842 that I'll submit soon
  • Error Prone reported a handful of new errors in the code that will need to be fixed or suppressed

@cushon cushon reopened this May 10, 2017
ronshapiro pushed a commit that referenced this issue May 10, 2017
java.annotations.common isn't provided by default in JDK 9, see
https://bugs.openjdk.java.net/browse/JDK-8152842

This helps with #448

RELNOTES: N/A

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155635468
ronshapiro pushed a commit that referenced this issue May 23, 2017
java.annotations.common isn't provided by default in JDK 9, see
https://bugs.openjdk.java.net/browse/JDK-8152842

This helps with #448

RELNOTES: N/A

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155635468
ronshapiro pushed a commit that referenced this issue May 24, 2017
java.annotations.common isn't provided by default in JDK 9, see
https://bugs.openjdk.java.net/browse/JDK-8152842

This helps with #448

RELNOTES: N/A

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155635468
floscher pushed a commit to floscher/josm that referenced this issue May 24, 2017
floscher added a commit to JOSM/Mapillary that referenced this issue Sep 16, 2017
ErrorProne is not compatible with JDK9, so the default compiler is used when compiling with JDK9.
See google/error-prone#448.
floscher added a commit to JOSM/Mapillary that referenced this issue Sep 16, 2017
ErrorProne is not compatible with JDK9, so the default compiler is used when compiling with JDK9.
See google/error-prone#448.
@cushon
Copy link
Collaborator

cushon commented Oct 13, 2017

Error Prone should run on JDK 9 now (see the "Java 9" section http://errorprone.info/docs/installation for instructions). If anyone encounters issues using it from the command line that way, please let us know.

We haven't done as much testing of the build system integrations: Bazel will work soon, there's an issue open for gradle (tbroyer/gradle-errorprone-plugin/issues/27), and I'm not sure about maven yet.

Support for using the Java 9 language level (not just running the tool on JDK 9) is work in progress.

@mkarg
Copy link

mkarg commented Dec 10, 2017

@cushon Can you please post the issue ID for the Java 9 language features? So one could track progress of that. :-)

@novalis
Copy link
Contributor

novalis commented May 16, 2018

The ant integration is broken for JDK 9 because (at least) of this line:
https://github.com/google/error-prone/blob/master/ant/src/main/java/com/google/errorprone/ErrorProneExternalCompilerAdapter.java#L93

-XbootClasspath/p isn't supported in Java 9, and the error-prone installation instructions recommend a different integration method for Java 9.

@cushon
Copy link
Collaborator

cushon commented Aug 10, 2018

We need up update the rest of the build system installation docs to mention the -Xplugin integration, but Java 9, 10, and 11 are supported now: #860

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

No branches or pull requests

7 participants