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

Lombok + Eclipse compiler problem #969

Closed
2 tasks done
eilensm opened this issue Oct 26, 2020 · 6 comments
Closed
2 tasks done

Lombok + Eclipse compiler problem #969

eilensm opened this issue Oct 26, 2020 · 6 comments

Comments

@eilensm
Copy link

eilensm commented Oct 26, 2020

Short 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...

  1. Create a project with a lombok annotated class and an application/test using the class
  2. Set Eclipse compiler in the settings dialog and add the lombok jar as VM option with javaagent (also see IntelliJ + Lombok + Eclipse Compiler? #89)
  3. Compile the code
  4. 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.

lombok-test.zip

  • Sample project provided
  • I am able to reproduce this error on the sample project by following the steps described above

Additional information

see 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-

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
@eilensm
Copy link
Author

eilensm commented Oct 28, 2020

Update:
I changed the version of lombok to lombok-1.18.12.jar and the problem went away. So maybe it's either a bug in the lombok jar or perhaps in the interaction between the plugin and lombok???

@eilensm
Copy link
Author

eilensm commented Oct 28, 2020

I added scripts to my example projects that directly compile the code via command line using eclipse compiler.
As can be seen using the scripts, the problem is not in lombok jar itself, since both variants (compiling with version 1.18.12 AND version 1.18.16) work!

Thus, I guess the problem really seems to come either from the IDEA lombok plugin or the integration of this plugin with IDEA.

lombok-test-with-scripts.zip

@mplushnikov
Copy link
Owner

Hello @eilensm,
I think this can be some issue of fixing another problem for IntelliJ in lombok 1.18.16 projectlombok/lombok#2592
Can you maybe verify it together with @Rawi01 ?

@Rawi01
Copy link

Rawi01 commented Nov 2, 2020

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.

@mplushnikov
Copy link
Owner

@Rawi01 Thank you very much!

rzwitserloot added a commit to projectlombok/lombok that referenced this issue Dec 4, 2020
…causing corrupt classfiles

Would crash with java.lang.ClassFormatError: Extra bytes at the end of class file de/lomboktest/Application
Fixes mplushnikov/lombok-intellij-plugin#969

figuring out the problem was the hard work - credits to @Rawi01 for discovering this
@rzwitserloot
Copy link

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.

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