question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lombok + Eclipse compiler problem

See original GitHub issue

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 https://github.com/mplushnikov/lombok-intellij-plugin/issues/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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
rzwitserlootcommented, Dec 4, 2020

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.

1reaction
Rawi01commented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lombok problems with Eclipse Oxygen - Stack Overflow
1. It may be an issue with the annotation processor. Check if it is turned on. · Wouldn't that mean that the @Override...
Read more >
Setting up Lombok with Eclipse and Intellij - Baeldung
In this tutorial, we'll talk about configuring Lombok in two of the most popular Java IDEs — IntelliJ IDEA and Eclipse.
Read more >
eclipse compiler and lombok not working
I am getting compilation errors when trying to use the new eclipse compiler and the lombok library that does compile time code generation....
Read more >
570753 – Eclipse 2020-12 does not support Lombok. - Bugs
Eclipse 2020-12 (Eclipse 2020-12 Java) does not support Lombok. It runs fine, but the IDE shows errors for all Lombok generates getters/setters. The...
Read more >
Lombok Changelog
BUGFIX: Eclipse projects using the jasperreports-plugin will now compile. ... BUGFIX: @SuperBuilder with an existing constructor caused issues in eclipse.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found