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

1.18.0 doesn't work anymore with Java 8? #1743

Closed
jcayzac opened this issue Jun 26, 2018 · 13 comments
Closed

1.18.0 doesn't work anymore with Java 8? #1743

jcayzac opened this issue Jun 26, 2018 · 13 comments

Comments

@jcayzac
Copy link

jcayzac commented Jun 26, 2018

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? :'(

@jcayzac

This comment has been minimized.

@Maaartinus
Copy link
Contributor

@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).

@jcayzac
Copy link
Author

jcayzac commented Jun 26, 2018

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 jcayzac closed this as completed Jun 26, 2018
@Maaartinus
Copy link
Contributor

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

@jcayzac
Copy link
Author

jcayzac commented Jun 26, 2018

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 🎉

@rzwitserloot
Copy link
Collaborator

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.

@TylerDuniEC
Copy link

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

@jcayzac
Copy link
Author

jcayzac commented Jul 4, 2018

@TylerDuniEC

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

@wxjer
Copy link

wxjer commented Jul 18, 2018

@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 ?

@jcayzac
Copy link
Author

jcayzac commented Jul 18, 2018

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

@jcayzac
Copy link
Author

jcayzac commented Jul 18, 2018

@wxjer i'm not using Desugar, tho.

@nfalco79
Copy link

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.

@randakar
Copy link

randakar commented May 14, 2020 via email

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

No branches or pull requests

7 participants