Lombok: 1.18.0 doesn't work anymore with Java 8?

Created on 26 Jun 2018  ·  13Comments  ·  Source: projectlombok/lombok

My project uses Java 8. I just updated to 1.18.0 and I'm getting an error saying it requires a Java 9 JVM.

Can't read [/Users/julien.cayzac/.gradle/caches/modules-2/files-2.1/org.projectlombok/lombok/1.18.0/c4647d46f0742746ac07ce4abeeee9b2fb18d147/lombok-1.18.0.jar(;;;;;;**.class)] (Can't process class [module-info.class] (Unsupported class version number [53.0] (maximum 52.0, Java 1.8)))

Android projects can't use Java 9 yet. Could we get Java 8 support back please? :'(

Most helpful comment

@TylerDuniEC

buildscript {
  …
  dependencies {
    …
    classpath 'net.sf.proguard:proguard-gradle:6.0.3'
  }
}

All 13 comments

Related to #1659

@jcayzac Lombok works with Java 8, I'm using

~/.gradle/caches/modules-2/files-2.1/org.projectlombok/lombok/1.18.0/c4647d46f0742746ac07ce4abeeee9b2fb18d147/lombok-1.18.0.jar

too and have no Java 9. Obviously, module-info.class must have a version of at least 53 (Java 9), as it didn't exist before. All other included *.class file have the version 49 as IIRC Java 5 is still supported.

No idea what's going on (you wrote nothing about your toolchain!), but the module info should simply be ignored. You may try to remove it manually (jar is just a renamed zip).

Indeed, the problem lies somewhere else (in proguard)…

Caused by: java.io.IOException: Can't process class [module-info.class] (Unsupported class version number [53.0] (maximum 52.0, Java 1.8))
        at proguard.io.ClassReader.read(ClassReader.java:112)
        at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
        at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
        at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
        at proguard.io.JarReader.read(JarReader.java:65)
        at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
        at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
        at proguard.InputReader.readInput(InputReader.java:184)

Closing the issue. Sorry for not having taken the time to confirm it was caused by Lombok before I opened it, it really sucked. And thanks for that great project that makes writing Java less boring 👍

@jcayzac Nice! I guess, a solution is to exclude the class file from proguard processing.... but actually, the whole JAR should NOT be processed by proguard as Lombok is compile-time only.

Yes, I only add it as compileOnly and annotationProcessor of course. But compileOnly just makes the dependency non-transitive.

And the good news is that, as usual, the Android plugin comes with outdated dependencies (proguard 5.3.3). Forcing in proguard 6.0.3 actually fixes everything 🎉

Thanks for reporting back in @jcayzac :) Glad to hear it worked out in the end.

For what it's worth, yes, lombok definitely is designed (when using it; if you want to compile lombok yourself, that's different) to be compatible with older versions of java, as far as back as 1.6, and definitely whatever android's on.

@jcayzac How did you force proguard to 6.0.3? I tried some suggestions from SO posts but it didn't work for me.

@TylerDuniEC

buildscript {
  …
  dependencies {
    …
    classpath 'net.sf.proguard:proguard-gradle:6.0.3'
  }
}

@jcayzac use 6.0.3 can generate signed packages,but when it no need proguard(eg: run or build a debug package,) ,it dosent work ,and the log:

error processing /Users/example/.gradle/caches/modules-2/files-2.1/org.projectlombok/lombok/1.18.0/c4647d46f0742746ac07ce4abeeee9b2fb18d147/lombok-1.18.0.jar java.lang.IllegalArgumentException at org.objectweb.asm.ClassReader.<init>(Unknown Source) at org.objectweb.asm.ClassReader.<init>(Unknown Source) at org.objectweb.asm.ClassReader.<init>(Unknown Source) at com.android.builder.desugaring.DesugaringClassAnalyzer.analyze(DesugaringClassAnalyzer.java:142) at com.android.builder.desugaring.DesugaringClassAnalyzer.analyzeJar(DesugaringClassAnalyzer.java:92) at com.android.builder.desugaring.DesugaringClassAnalyzer.analyze(DesugaringClassAnalyzer.java:63) at com.android.build.gradle.internal.transforms.DesugarIncrementalTransformHelper.lambda$getInitalGraphData$4(DesugarIncrementalTransformHelper.java:150) at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) :packages:example:transformClassesWithDesugarForDebug FAILED

Did u face the problem ?

@wxjer sorry, no. For me it just works.

@wxjer i'm not using Desugar, tho.

I got the same issue in maven build:

[WARNING] Rule 2: org.apache.maven.plugins.enforcer.EnforceBytecodeVersion failed with message:
Found Banned Dependency: org.projectlombok:lombok:jar:1.18.4
Use 'mvn dependency:tree' to locate the source of the banned dependencies.

No, that sounds like a completely different problem.

Someone - meaning, you, or someone on your team - configured maven to
exclude the version of lombok you are using by configuring this:
https://www.mojohaus.org/extra-enforcer-rules/enforceBytecodeVersion.html

That's hardly lombok's fault, just change your pom.xml to stop banning
lombok ;)

On Wed, May 13, 2020, 17:54 Nikolas Falco notifications@github.com wrote:

I got the same issue in maven build:

[WARNING] Rule 2: org.apache.maven.plugins.enforcer.EnforceBytecodeVersion
failed with message:
Found Banned Dependency: org.projectlombok:lombok:jar:1.18.4
Use 'mvn dependency:tree' to locate the source of the banned dependencies.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/rzwitserloot/lombok/issues/1743#issuecomment-628082664,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AABIERISBOXOIUEPH5CDNF3RRK7C5ANCNFSM4FG4KOLQ
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lombokissues picture lombokissues  ·  42Comments

pbi-qfs picture pbi-qfs  ·  37Comments

arana198 picture arana198  ·  53Comments

xiaolongzuo picture xiaolongzuo  ·  32Comments

ilgrosso picture ilgrosso  ·  76Comments