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

Add jdk9 compiler support #985

Closed
rspilker opened this issue Dec 6, 2015 · 98 comments
Closed

Add jdk9 compiler support #985

rspilker opened this issue Dec 6, 2015 · 98 comments

Comments

@rspilker
Copy link
Collaborator

@rspilker rspilker commented Dec 6, 2015

Status (Updated 2018-01-09)

  • Given the right amount of --add-opens parameters, we can compile code that contains lombok annotations on build 9.0.1+11
  • 1.16.20 supports jdk9, gradle 4.2.1, maven 3.5.0 (example pom)
  • module-info.java is not present for lombok, so far lombok can only be used on the classpath, It's uncertain if you can compile modules.
  • @javax.annotation.Generated will no longer be generated by default, see below
  • We didn't even look at ecj/Eclipse support. It might just work, it might not
  • We will probably run into problems with classes compiled with jdk9 that have new contant pool entries. We will need to fix ClassFileMetaData

Most recent information (Based on build 9.0.1+11)

module jdk.compiler does not "opens com.sun.tools.javac.processing" to unnamed module @6b927fb

Lombok uses non-exposed APIs. We need to instruct the jvm that that's okay.

javac \
-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
-cp lombok.jar \
Test.java

According to this mail by Mark Reinhold we can replace all the --add-opens clauses by --permit-illegal-access in a future version of jdk9. However, that will generate warnings on the stderr. Using --add-opens does not.

package javax.annotation is not visible

Since 1.16.20, this message will only occur if your explicitly turned it on in lombok.config using lombok.addJavaxGeneratedAnnotation = true.

If specified, lombok adds @javax.annotation.Generated("lombok") to all generated methods.

Since the new module system, this annotation is no longer standard available.

There are two ways to fix this:

  1. Remove the following line from your project lombok.config file:

     lombok.addJavaxGeneratedAnnotation = true
    
  2. Add --add-modules=java.xml.ws.annotation to your javac command line parameters.

This description will be updated if more information is available.

@rspilker
Copy link
Collaborator Author

@rspilker rspilker commented Dec 6, 2015

I've just created an edge release. This takes care of the pid problem.

I only tested @Data, and expect that features that depend on resolution, like val, @Delegate and @ExtensionMethod will result in some more problems.

@Jose123456
Copy link

@Jose123456 Jose123456 commented Feb 14, 2016

Building with Bazel works now. Thanks!

@thefallentree
Copy link

@thefallentree thefallentree commented Feb 18, 2016

can we get this released ?

Cheers

@JLLeitschuh
Copy link

@JLLeitschuh JLLeitschuh commented May 11, 2016

Any chance that this will be released to maven soon?
I'm having the error prone issue.

@rspilker
Copy link
Collaborator Author

@rspilker rspilker commented May 11, 2016

The fixes are part of version 1.16.8, that has been released 2016-03-07. Are you already using that version?

@JLLeitschuh
Copy link

@JLLeitschuh JLLeitschuh commented May 12, 2016

Let me give it a shot again.

@JLLeitschuh
Copy link

@JLLeitschuh JLLeitschuh commented May 12, 2016

It seems like it works!
Thanks!

@dreis2211
Copy link

@dreis2211 dreis2211 commented Jan 5, 2017

Hey,

since JDK 9 is coming closer - are there any updates regarding this issue?

Cheers,
Christoph

@rspilker
Copy link
Collaborator Author

@rspilker rspilker commented Jan 5, 2017

There's still too much motion on the module specification to have any meaningful estimation.

I'm convinced it will work in the end. I do fear that there need to be compiler flags to open up to lombok. How bad it will be, we don't know yet.

@javadev
Copy link

@javadev javadev commented Jan 9, 2017

I tried to switch my project to jdk9 in heroku and got the same error.

@md-5
Copy link

@md-5 md-5 commented Jan 30, 2017

JDK 9 rampdown has begun, so I think it's safe to start working on this.
http://openjdk.java.net/projects/jdk9/

@rspilker
Copy link
Collaborator Author

@rspilker rspilker commented Feb 13, 2017

@javadev What do you mean by "the same error"?

@schauder
Copy link

@schauder schauder commented Apr 27, 2017

It's a little hard to tell what is already fixed, and what isn't.

I'm specifically concerned about module jdk.compiler does not "opens com.sun.tools.javac.processing" to unnamed module @6b927fb. I'm seeing this in a build using 1.16.16. So I assume it isn't fixed yet? Is there a snapshot I can use for now?

@schauder
Copy link

@schauder schauder commented Apr 27, 2017

Sorry, misunderstood ... those --add-opens are needed for the javac invocation for compiling code that uses lombok.

@rschmitt
Copy link

@rschmitt rschmitt commented Apr 27, 2017

The new JDK9 flag --permit-illegal-access, introduced just a few weeks ago, is a lot easier to use than the litany of --add-opens flags you need otherwise. It's mentioned in the issue update.

@josephlbarnett
Copy link

@josephlbarnett josephlbarnett commented May 5, 2017

with lombok 1.16.16 and errorprone 2.0.19 (plexus-compiler-javac-errorprone 2.8.1), everything appears to work but outputs this troubling looking stack trace during compilation:

java.lang.NullPointerException
	at lombok.javac.apt.LombokFileObjects.createEmpty(LombokFileObjects.java:123)
	at lombok.javac.apt.InterceptingJavaFileManager.getJavaFileForOutput(InterceptingJavaFileManager.java:47)
	at com.sun.tools.javac.processing.JavacFiler.createSourceOrClassFile(JavacFiler.java:414)
	at com.sun.tools.javac.processing.JavacFiler.createSourceFile(JavacFiler.java:388)
	at lombok.javac.apt.LombokProcessor.forceNewRound(LombokProcessor.java:333)
	at lombok.javac.apt.LombokProcessor.process(LombokProcessor.java:322)
	at lombok.core.AnnotationProcessor$JavacDescriptor.process(AnnotationProcessor.java:114)
	at lombok.core.AnnotationProcessor.process(AnnotationProcessor.java:164)
	at lombok.launch.AnnotationProcessorHider$AnnotationProcessor.process(AnnotationProcessor.java:74)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:826)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:742)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$2000(JavacProcessingEnvironment.java:100)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1046)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1153)
	at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1120)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:814)
	at com.sun.tools.javac.api.JavacTaskImpl$1.call(JavacTaskImpl.java:97)
	at com.sun.tools.javac.api.JavacTaskImpl$1.call(JavacTaskImpl.java:93)
	at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:128)
	at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:93)
	at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:87)
	at com.google.errorprone.BaseErrorProneJavaCompiler$1.call(BaseErrorProneJavaCompiler.java:99)
	at com.google.errorprone.BaseErrorProneCompiler.run(BaseErrorProneCompiler.java:137)
	at com.google.errorprone.BaseErrorProneCompiler.run(BaseErrorProneCompiler.java:108)
	at com.google.errorprone.ErrorProneCompiler.run(ErrorProneCompiler.java:119)
	at com.google.errorprone.ErrorProneCompiler.compile(ErrorProneCompiler.java:66)
	at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne$CompilerInvoker.compile(JavacCompilerWithErrorProne.java:219)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne.performCompile(JavacCompilerWithErrorProne.java:91)
	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:886)
	at org.apache.maven.plugin.compiler.TestCompilerMojo.execute(TestCompilerMojo.java:153)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	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)
warning: Can't force a new processing round. Lombok won't work.

Is that a known/expected/safe error?

@rspilker
Copy link
Collaborator Author

@rspilker rspilker commented May 8, 2017

No. I've just pushed 539b2a7 to add some additional debug information. Can you please download the edge release and compile with that? You will probably need to do some maven magic to use this jar, like put it in your cache under the wrong name.

It will not fix your problem, but will help us fix it, so please tell us if you now get an IllegalArgumentException, and what the message is,

@josephlbarnett
Copy link

@josephlbarnett josephlbarnett commented May 8, 2017

 warning: lombok.javac.apt.LombokProcessor could not be initialized. Lombok will not run during this compilation: java.lang.IllegalArgumentException: com.google.errorprone.MaskedClassLoader$MaskedFileManager extends com.sun.tools.javac.file.JavacFileManager
  	at lombok.javac.apt.LombokFileObjects.getCompiler(LombokFileObjects.java:127)
  	at lombok.javac.apt.InterceptingJavaFileManager.<init>(InterceptingJavaFileManager.java:40)
  	at lombok.javac.apt.LombokProcessor.placePostCompileAndDontMakeForceRoundDummiesHook(LombokProcessor.java:164)
  	at lombok.javac.apt.LombokProcessor.init(LombokProcessor.java:85)
  	at lombok.core.AnnotationProcessor$JavacDescriptor.want(AnnotationProcessor.java:87)
  	at lombok.core.AnnotationProcessor.init(AnnotationProcessor.java:140)
  	at lombok.launch.AnnotationProcessorHider$AnnotationProcessor.init(AnnotationProcessor.java:69)
  	at com.sun.tools.javac.processing.JavacProcessingEnvironment$ProcessorState.<init>(JavacProcessingEnvironment.java:539)
  	at com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors$ProcessorStateIterator.next(JavacProcessingEnvironment.java:636)
  	at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:727)
  	at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$2000(JavacProcessingEnvironment.java:100)
  	at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1046)
  	at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1153)
  	at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1120)
  	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:814)
  	at com.sun.tools.javac.api.JavacTaskImpl$1.call(JavacTaskImpl.java:97)
  	at com.sun.tools.javac.api.JavacTaskImpl$1.call(JavacTaskImpl.java:93)
  	at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:128)
  	at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:93)
  	at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:87)
  	at com.google.errorprone.BaseErrorProneJavaCompiler$1.call(BaseErrorProneJavaCompiler.java:99)
  	at com.google.errorprone.BaseErrorProneCompiler.run(BaseErrorProneCompiler.java:137)
  	at com.google.errorprone.BaseErrorProneCompiler.run(BaseErrorProneCompiler.java:108)
  	at com.google.errorprone.ErrorProneCompiler.run(ErrorProneCompiler.java:119)
  	at com.google.errorprone.ErrorProneCompiler.compile(ErrorProneCompiler.java:66)
  	at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne$CompilerInvoker.compile(JavacCompilerWithErrorProne.java:219)
  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  	at java.lang.reflect.Method.invoke(Method.java:498)
  	at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne.performCompile(JavacCompilerWithErrorProne.java:91)
  	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:886)
  	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)
  	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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  	at java.lang.reflect.Method.invoke(Method.java:498)
  	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)
@rspilker
Copy link
Collaborator Author

@rspilker rspilker commented May 15, 2017

Thanks. We've just created a new edge release, that just might fix your problem. Can you please try it again?

@josephlbarnett
Copy link

@josephlbarnett josephlbarnett commented May 18, 2017

Getting a different exception with the latest edge release:

java.lang.IllegalArgumentException: URI has an authority component
	at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:53)
	at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
	at java.nio.file.Paths.get(Paths.java:138)
	at lombok.javac.apt.LombokFileObjects$Java9Compiler.wrap(LombokFileObjects.java:151)
	at lombok.javac.apt.LombokFileObjects.createEmpty(LombokFileObjects.java:132)
	at lombok.javac.apt.InterceptingJavaFileManager.getJavaFileForOutput(InterceptingJavaFileManager.java:47)
	at com.sun.tools.javac.processing.JavacFiler.createSourceOrClassFile(JavacFiler.java:414)
	at com.sun.tools.javac.processing.JavacFiler.createSourceFile(JavacFiler.java:388)
	at lombok.javac.apt.LombokProcessor.forceNewRound(LombokProcessor.java:333)
	at lombok.javac.apt.LombokProcessor.process(LombokProcessor.java:322)
	at lombok.core.AnnotationProcessor$JavacDescriptor.process(AnnotationProcessor.java:114)
	at lombok.core.AnnotationProcessor.process(AnnotationProcessor.java:164)
	at lombok.launch.AnnotationProcessorHider$AnnotationProcessor.process(AnnotationProcessor.java:74)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:826)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:742)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$2000(JavacProcessingEnvironment.java:100)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1046)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1153)
	at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1120)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:814)
	at com.sun.tools.javac.api.JavacTaskImpl$1.call(JavacTaskImpl.java:97)
	at com.sun.tools.javac.api.JavacTaskImpl$1.call(JavacTaskImpl.java:93)
	at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:128)
	at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:93)
	at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:87)
	at com.google.errorprone.BaseErrorProneJavaCompiler$1.call(BaseErrorProneJavaCompiler.java:99)
	at com.google.errorprone.BaseErrorProneCompiler.run(BaseErrorProneCompiler.java:137)
	at com.google.errorprone.BaseErrorProneCompiler.run(BaseErrorProneCompiler.java:108)
	at com.google.errorprone.ErrorProneCompiler.run(ErrorProneCompiler.java:119)
	at com.google.errorprone.ErrorProneCompiler.compile(ErrorProneCompiler.java:66)
	at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne$CompilerInvoker.compile(JavacCompilerWithErrorProne.java:219)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne.performCompile(JavacCompilerWithErrorProne.java:91)
	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:886)
	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)
	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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	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)
warning: Can't force a new processing round. Lombok won't work.
@CiaoWood
Copy link

@CiaoWood CiaoWood commented May 22, 2017

I encountered the same issue with @jbarnettwomply. Looking forward for your solution, thx! :)

@zhexuany
Copy link

@zhexuany zhexuany commented Jun 8, 2017

@rspilker Bazel test is failing although Baazel build is perfect working.

@godpit
Copy link

@godpit godpit commented Mar 3, 2018

@slf4j doesn't work in java 9 , and module-info.java add 'require static lomlok',cannot found symbol: variable log while compiling in intellij 2018 EAP idea, and install lombok plugin,use lomlok.jar with latest version(1.16.20).

@krzyk
Copy link
Contributor

@krzyk krzyk commented Mar 3, 2018

@godpit do you have an example project (basically a Minimal, Complete, and Verifiable example)?
Does it work in IDEA 2017?

In my project @SLF4j works in IntlelliJ 2017.5 using java 9 compiler. I think lombok plugin is not compatible with latest 2018 EAP.

@jonathanlermitage
Copy link

@jonathanlermitage jonathanlermitage commented Mar 3, 2018

+1, Lombok plugin is not compatible with IntelliJ 2018 EAP yet.
Try to compile your project with command line. If it fails too, don't use module-info at all.

@godpit
Copy link

@godpit godpit commented Mar 5, 2018

@krzyk I try to use intellij 2017.3.4,but it also doesn't work, however i try to use java 8, it work well.

@polle
Copy link

@polle polle commented Mar 13, 2018

Lombok in Eclipse fails the build with the following error when adding a module-info.java to the project:

Errors occurred during the build.
Errors running builder 'Java Builder' on project 'entities'.
Unknown constant pool type 19

@LukaszTheProgrammer
Copy link

@LukaszTheProgrammer LukaszTheProgrammer commented Apr 23, 2018

I tested a minimal project setup with edge release. As soon as I add module-info.java with single line requires static lombok code generation stops working: no getters are generated.
If I remove module-info it works again. I used this project as a baseline for my experiment:
https://github.com/krzyk/lombok-jdk10-example

@m31collision
Copy link

@m31collision m31collision commented Jun 6, 2018

1.18.0 is still not working with module-info.java (IntelliJ IDEA 2018.1.3), although release 1.16.22 has this note:

PLATFORM: Fix for using lombok together with JDK9+'s new module-info.java feature. Issue #985

@m31collision
Copy link

@m31collision m31collision commented Jun 8, 2018

After moving lombok to class path, compilation succeeded, but when I run application I get this error:

Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Module lombok does not read a module that exports org.mapstruct.ap.spi
@arrowman53
Copy link

@arrowman53 arrowman53 commented Aug 7, 2018

I get the same error.
In my Java 11 Module project I have added the Maven dependency:

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.18.2</version>
    <scope>provided</scope>
</dependency>

In my module-info I added

requires static lombok

but when I run my application in Eclipse Photon I get the error:

Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Module lombok does not read a module that exports org.mapstruct.ap.spi
@tzieleniewski
Copy link

@tzieleniewski tzieleniewski commented Aug 22, 2018

Error: java.lang.module.ResolutionException: Module lombok does not read a module that exports org.mapstruct.ap.spi

Issue #1806 - the above problem has been rosolved in the edge version.

@hughjdavey
Copy link

@hughjdavey hughjdavey commented Aug 22, 2018

What edge version? I am using the latest one (119-769185e1 - from here) and it is still present.

To clarify I mean the mapstruct error is still present - the names containing a dot issue has indeed been resolved :)

@tzieleniewski
Copy link

@tzieleniewski tzieleniewski commented Aug 22, 2018

@hughjdavey the 'edge' version can be downloaded from here https://projectlombok.org/download-edge

@MCMicS
Copy link

@MCMicS MCMicS commented Aug 22, 2018

@hughjdavey yes the mapstruct error still exists,

@arrowman53
Copy link

@arrowman53 arrowman53 commented Aug 23, 2018

@hughjdavey Did you also add the mapstruct-processor-1.3.0.Beta1.jar to your module path? When I did that the error disappeared.

@tzieleniewski
Copy link

@tzieleniewski tzieleniewski commented Aug 23, 2018

Sorry I could have mentioned about the mapstruct-processor.
For me it works as well with current final version 1.2.0.Final pom.xml.

@hughjdavey
Copy link

@hughjdavey hughjdavey commented Aug 23, 2018

@tzieleniewski so no need to do --add-modules I can just add it as a dependency in build.gradle (as you have done in your maven file)?

@hughjdavey
Copy link

@hughjdavey hughjdavey commented Aug 23, 2018

@arrowman53 how do I do that? Is it one of those --add-modules or --add-reads flags?

@arrowman53
Copy link

@arrowman53 arrowman53 commented Aug 23, 2018

@hughjdavey Yes, its the --add-modules you need to add it to.

@tzieleniewski
Copy link

@tzieleniewski tzieleniewski commented Aug 24, 2018

@hughjdavey I am not familiar with Gradle but my investigation with Maven showed that Maven during compilation adds to the module path those dependencies which are modular JARs, other dependencies are added to classpath (unnamed module).

So in my case it was not the --add-modules missing. I needed to extend the list of observable modules. For that purpose I used the --upgrade-module-path parameter. Otherwise org.mapstruct.ap.spi, as a not modular JAR, would not be resolable.

@rzwitserloot
Copy link
Owner

@rzwitserloot rzwitserloot commented Oct 15, 2018

At this point, lombok works fine in jdk9. I see lots of comments, many referencing gradle and such. That's a different issue (and various gradle issues have already been filed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet