Lombok + Eclipse compiler problem
See original GitHub issueShort description
The combination of Lombok and the Eclipse compiler produces illegal class files (contains the “normal” byte code twice).
Also see my issue in the IntelliJ IDEA forum: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360009866900-Lombok-Eclipse-compiler-problem-java-lang-ClassFormatError-Extra-bytes-at-the-end-of-class-file-
Expected behavior
Usage of lombok and Eclipse compiler produces executable byte code
Version information
-
IDEA Version: IntelliJ IDEA 2020.2.3 (Ultimate Edition) Build #IU-202.7660.26, built on October 6, 2020 Runtime version: 11.0.8+10-b944.34 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 10 10.0 GC: ParNew, ConcurrentMarkSweep Memory: 4029M Cores: 8 Registry: debugger.watches.in.variables=false Non-Bundled Plugins: com.alayouni.ansiHighlight, EclipseCodeFormatter, Lombook Plugin, PIT mutation testing Idea plugin, com.dubreuia, com.oliverlockwood.plugins.jenkinsfile, com.intellij.plugins.watcher, com.renemaas.intellij.zipper, mobi.hsz.idea.nodesecurity, net.seesharpsoft.intellij.plugins.csv, org.exbin.deltahex.intellij, org.sonarlint.idea, intellij.prettierJS, Karma, org.jetbrains.plugins.vue, org.jetbrains.kotlin, org.mapstruct.intellij, org.intellij.scala, training, org.asciidoctor.intellij.asciidoc
-
JDK Version: jdk1.8.0_202-x86
-
OS Type & Version: Windows 10
-
Lombok Plugin Version: 0.32-2020.2
-
Lombok Dependency Version: lombok-1.18.16.jar
Steps to reproduce
What steps do we need to take to reproduce this issue?
See the sample project included…
- Create a project with a lombok annotated class and an application/test using the class
- Set Eclipse compiler in the settings dialog and add the lombok jar as VM option with javaagent (also see https://github.com/mplushnikov/lombok-intellij-plugin/issues/89)
- Compile the code
- Start the application/test
Sample project
Please provide a sample project that exhibits the problem.
You should also include .idea
folder so we can inspect the settings.
- Sample project provided
- I am able to reproduce this error on the sample project by following the steps described above
Additional information
Stacktrace
java.lang.ClassFormatError: Extra bytes at the end of class file de/lomboktest/Application
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main"
Process finished with exit code 1
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Fixed in lombok (slightly different take on the fix, but the hard work was figuring out what was wrong – all credit goes to @Rawi01), will be in next release.
Hi, I finally managed to debug it and developed a small fix that solves the problem. This probem is unrelated to the InteliJ annotation processing change as lombok uses a javagent for eclipse/ecj.