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

[FEATURE] JDK 23 compatibility #3722

Closed
mmoayyed opened this issue Aug 13, 2024 · 37 comments
Closed

[FEATURE] JDK 23 compatibility #3722

mmoayyed opened this issue Aug 13, 2024 · 37 comments
Assignees
Milestone

Comments

@mmoayyed
Copy link
Contributor

mmoayyed commented Aug 13, 2024

Describe the feature

Allow lombok to support building against JDK 23.

Describe the target audience

While JDK 23 is still in RC mode as of this writing, there are RC builds available nonetheless that one can use for experimentation and preparation against the next JDK release.

Additional context

Lombok today, 1.8.34, seems unable to build against JDK 23. To start with, there is the following error:

error: An unhandled exception was thrown by the Error Prone static analysis plugin.
     Please report this at https://github.com/google/error-prone/issues/new and include the following:

     error-prone version: 2.30.0
     BugPattern: (see stack trace)
     Stack Trace:
     java.lang.NoSuchFieldError: Class com.sun.tools.javac.parser.Tokens$Comment$CommentStyle does not have member field 'com.sun.tools.javac.parser.Tokens$Comment$CommentStyle JAVADOC'
        at lombok.javac.Javac$JavadocOps_8$1.getStyle(Javac.java:364)
        at jdk.compiler/com.sun.tools.javac.parser.DocCommentParser.getTextKind(DocCommentParser.java:171)
        at jdk.compiler/com.sun.tools.javac.parser.DocCommentParser.<init>(DocCommentParser.java:164)
        at jdk.compiler/com.sun.tools.javac.parser.DocCommentParser.<init>(DocCommentParser.java:139)
        at jdk.compiler/com.sun.tools.javac.api.JavacTrees.getDocCommentTree(JavacTrees.java:1129)
        at jdk.compiler/com.sun.tools.javac.parser.LazyDocCommentTable.getCommentTree(LazyDocCommentTable.java:101)
        at jdk.compiler/com.sun.tools.javac.api.JavacTrees.getDocCommentTree(JavacTrees.java:759)
        at com.google.errorprone.bugpatterns.javadoc.Utils.getDocCommentTree(Utils.java:132)
        at com.google.errorprone.bugpatterns.javadoc.Utils.getDocTreePath(Utils.java:124)
        at com.google.errorprone.bugpatterns.javadoc.EmptyBlockTag.checkForEmptyBlockTags(EmptyBlockTag.java:81)
        at com.google.errorprone.bugpatterns.javadoc.EmptyBlockTag.matchVariable(EmptyBlockTag.java:76)
        at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:449)
        at com.google.errorprone.scanner.ErrorProneScanner.visitVariable(ErrorProneScanner.java:884)
        at com.google.errorprone.scanner.ErrorProneScanner.visitVariable(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:1081)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:95)
        at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:110)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:118)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:202)
        at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:548)
        at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:896)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:110)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:118)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:151)
        at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:560)
        at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:625)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:66)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:58)
        at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43)
        at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:227)
        at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:133)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1432)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1379)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:964)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
        at org.gradle.internal.compiler.java.IncrementalCompileTask.call(IncrementalCompileTask.java:92)
        at org.gradle.api.internal.tasks.compile.AnnotationProcessingCompileTask.call(AnnotationProcessingCompileTask.java:94)
        at org.gradle.api.internal.tasks.compile.ResourceCleaningCompilationTask.call(ResourceCleaningCompilationTask.java:57)
        at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:76)
        at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:46)
        at org.gradle.api.internal.tasks.compile.daemon.AbstractIsolatedCompilerWorkerExecutor$CompilerWorkAction.execute(AbstractIsolatedCompilerWorkerExecutor.java:78)
        at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
        at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:54)
        at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:48)
        at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
        at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:48)
        at org.gradle.workers.internal.FlatClassLoaderWorker.run(FlatClassLoaderWorker.java:32)
        at org.gradle.workers.internal.FlatClassLoaderWorker.run(FlatClassLoaderWorker.java:22)
        at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:103)
        at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:72)
        at org.gradle.process.internal.worker.request.WorkerAction$1.call(WorkerAction.java:152)
        at org.gradle.process.internal.worker.child.WorkerLogEventListener.withWorkerLoggingProtocol(WorkerLogEventListener.java:41)
        at org.gradle.process.internal.worker.request.WorkerAction.lambda$run$1(WorkerAction.java:149)
        at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:85)
        at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:141)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
        at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1575)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error

Originally reported here: google/error-prone#4532

Judging by the trace, this line seems to suggest that this is more of a Lombok issue, rather than Gradle or Error Prone:

java.lang.NoSuchFieldError: Class com.sun.tools.javac.parser.Tokens$Comment$CommentStyle does not have member field 'com.sun.tools.javac.parser.Tokens$Comment$CommentStyle JAVADOC'
        at lombok.javac.Javac$JavadocOps_8$1.getStyle(Javac.java:364)

JDK:

openjdk version "23" 2024-09-17
OpenJDK Runtime Environment (build 23+36-2368)
OpenJDK 64-Bit Server VM (build 23+36-2368, mixed mode, sharing)

Gradle:

------------------------------------------------------------
Gradle 8.10-rc-1
------------------------------------------------------------

Build time:    2024-08-08 06:07:55 UTC
Revision:      4f143ee84909970e5148c38b3ac7db3ff826a022

Kotlin:        1.9.24
Groovy:        3.0.22
Ant:           Apache Ant(TM) version 1.10.14 compiled on August 16 2023
Launcher JVM:  23 (Oracle Corporation 23+36-2368)
Daemon JVM:    /Library/Java/JavaVirtualMachines/jdk-23.jdk/Contents/Home (no JDK specified, using current Java home)
OS:            Mac OS X 14.5 aarch64

Related: projectlombok/lombok.patcher#15

@mickaelistria
Copy link

I can reproduce this error in some other context (also involving calling compilation task programatically): https://ci.eclipse.org/ls/job/jdt-ls-javac/lastCompletedBuild/testReport/org.eclipse.jdt.ls.core.internal.handlers/RenameHandlerTest/testLombokSingular/
I suspect the culprit line is

return CommentStyle.JAVADOC;
, which makes lombok add into the AST an incompatible node. Since Java 23, the possible values for CommentStyle are https://github.com/openjdk/jdk/blob/4b7906375b4bd11a480665110561180825c2dd9c/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/Tokens.java#L276...L281

@mingchiuli
Copy link

GraalVM compatibility:

> Task :micro-gateway:compileJava FAILED
error: Error during the transformation of 'org.chiu.micro.gateway.router.Router'; post-compiler 'lombok.bytecode.SneakyThrowsRemover' caused an exception: java.lang.IllegalArgumentException: Unsupported class file major version 67
  	at org.lombokweb.asm.ClassReader.<init>(ClassReader.java:200)
  	at org.lombokweb.asm.ClassReader.<init>(ClassReader.java:180)
  	at org.lombokweb.asm.ClassReader.<init>(ClassReader.java:166)
  	at lombok.bytecode.AsmUtil.fixJSRInlining(AsmUtil.java:37)
  	at lombok.bytecode.SneakyThrowsRemover.applyTransformations(SneakyThrowsRemover.java:46)
  	at lombok.core.PostCompiler.applyTransformations(PostCompiler.java:44)
  	at lombok.core.PostCompiler$1.close(PostCompiler.java:87)
  	at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1548)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:771)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1700)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1668)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:977)
  	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
  	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
  	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
  	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
  	at org.gradle.internal.compiler.java.IncrementalCompileTask.call(IncrementalCompileTask.java:92)
  	at org.gradle.api.internal.tasks.compile.AnnotationProcessingCompileTask.call(AnnotationProcessingCompileTask.java:94)
  	at org.gradle.api.internal.tasks.compile.ResourceCleaningCompilationTask.call(ResourceCleaningCompilationTask.java:57)
  	at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:76)
  	at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:46)
  	at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:98)
  	at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:52)
  	at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:38)
  	at org.gradle.api.internal.tasks.compile.AnnotationProcessorDiscoveringCompiler.execute(AnnotationProcessorDiscoveringCompiler.java:52)
  	at org.gradle.api.internal.tasks.compile.AnnotationProcessorDiscoveringCompiler.execute(AnnotationProcessorDiscoveringCompiler.java:38)
  	at org.gradle.api.internal.tasks.compile.ModuleApplicationNameWritingCompiler.execute(ModuleApplicationNameWritingCompiler.java:46)
  	at org.gradle.api.internal.tasks.compile.ModuleApplicationNameWritingCompiler.execute(ModuleApplicationNameWritingCompiler.java:[36](https://github.com/mingchiuli/megalith-micro/actions/runs/10904698290/job/30261760666#step:5:37))
  	at org.gradle.jvm.toolchain.internal.DefaultToolchainJavaCompiler.execute(DefaultToolchainJavaCompiler.java:57)
  	at org.gradle.api.tasks.compile.JavaCompile.lambda$createToolchainCompiler$3(JavaCompile.java:204)
  	at org.gradle.api.internal.tasks.compile.CleaningJavaCompiler.execute(CleaningJavaCompiler.java:53)
  	at org.gradle.api.internal.tasks.compile.incremental.IncrementalCompilerFactory.lambda$createRebuildAllCompiler$0(IncrementalCompilerFactory.java:52)
  	at org.gradle.api.internal.tasks.compile.incremental.SelectiveCompiler.execute(SelectiveCompiler.java:70)
  	at org.gradle.api.internal.tasks.compile.incremental.SelectiveCompiler.execute(SelectiveCompiler.java:44)
  	at org.gradle.api.internal.tasks.compile.incremental.IncrementalResultStoringCompiler.execute(IncrementalResultStoringCompiler.java:66)
  	at org.gradle.api.internal.tasks.compile.incremental.IncrementalResultStoringCompiler.execute(IncrementalResultStoringCompiler.java:52)
  	at org.gradle.api.internal.tasks.compile.CompileJavaBuildOperationReportingCompiler$1.call(CompileJavaBuildOperationReportingCompiler.java:64)
  	at org.gradle.api.internal.tasks.compile.CompileJavaBuildOperationReportingCompiler$1.call(CompileJavaBuildOperationReportingCompiler.java:[48](https://github.com/mingchiuli/megalith-micro/actions/runs/10904698290/job/30261760666#step:5:49))
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:209)

@0x3C50
Copy link

0x3C50 commented Sep 18, 2024

OpenJDK 23 also throws the above error. The ASM shadow can't handle version 23 bytecode.

@mmoayyed
Copy link
Contributor Author

Aside from the Javadoc error, lombok-patcher needs to be released first: projectlombok/lombok.patcher#15

and then lombok should be updated to use the new patcher.

@HenrikPublic
Copy link

It looks like SneakyThrowsRemover also needs some fiddling:

post-compiler 'lombok.bytecode.SneakyThrowsRemover' caused an exception: java.lang.IllegalArgumentException: Unsupported class file major version 67
        at org.lombokweb.asm.ClassReader.<init>(ClassReader.java:200)
        at org.lombokweb.asm.ClassReader.<init>(ClassReader.java:180)
        at org.lombokweb.asm.ClassReader.<init>(ClassReader.java:166)
        at lombok.bytecode.AsmUtil.fixJSRInlining(AsmUtil.java:37)
        at lombok.bytecode.SneakyThrowsRemover.applyTransformations(SneakyThrowsRemover.java:46)
        at lombok.core.PostCompiler.applyTransformations(PostCompiler.java:44)
        at lombok.core.PostCompiler$1.close(PostCompiler.java:87)

Rawi01 added a commit to Rawi01/lombok that referenced this issue Sep 20, 2024
@Rawi01
Copy link
Collaborator

Rawi01 commented Sep 21, 2024

This should be fixed by my PR, can you try the artifact build by our pipeline?

@mmoayyed
Copy link
Contributor Author

@Rawi01 works quite well, thank you.

@danishnawab
Copy link

@mmoayyed how exactly does one reproduce this?

I just migrated an existing project from Java 22 to 23 and it was built successfully.

Stack:

  • Java: openjdk 23 2024-09-17
  • Gradle: 8.10.2
  • Lombok: 1.18.34

I would like to know exactly which conditions trigger the incompatibility with lombok.

@asashour
Copy link

asashour commented Sep 30, 2024

With Liquibase 4.29.2, and with SneakyThrowsRemover, there is an exception of Unsupported class file major version 67:

/DataChangeExecListener.java: Error during the transformation of 'DataChangeExecListener'; post-compiler 'lombok.bytecode.SneakyThrowsRemover' caused an exception: java.lang.IllegalArgumentException: Unsupported class file major version 67   
[ERROR]         at org.lombokweb.asm.ClassReader.<init>(ClassReader.java:200)
[ERROR]         at org.lombokweb.asm.ClassReader.<init>(ClassReader.java:180)
[ERROR]         at org.lombokweb.asm.ClassReader.<init>(ClassReader.java:166)
[ERROR]         at lombok.bytecode.AsmUtil.fixJSRInlining(AsmUtil.java:37)
DataChangeExecListener
@RequiredArgsConstructor
@Slf4j
class DataChangeExecListener implements ChangeExecListener {
  @Override
  public void willRun(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database, ChangeSet.RunStatus runStatus) {
    test(changeSet, true);
  }

  @Override
  public void ran(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database, ChangeSet.ExecType execType) {
    test(changeSet, false);
  }

  @SneakyThrows
  private void test(ChangeSet changeSet, boolean before) {
    try (var reader = Files.newBufferedReader(Path.of(""))) {
    }
  }

  @Override
  public void willRollback(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database) {
  }

  @Override
  public void rolledBack(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database) {

  }

  @Override
  public void preconditionFailed(PreconditionFailedException error, PreconditionContainer.FailOption onFail) {
  }

  @Override
  public void preconditionErrored(PreconditionErrorException error, PreconditionContainer.ErrorOption onError) {
  }

  @Override
  public void willRun(Change change, ChangeSet changeSet, DatabaseChangeLog changeLog, Database database) {
  }

  @Override
  public void ran(Change change, ChangeSet changeSet, DatabaseChangeLog changeLog, Database database) {
  }

  @Override
  public void runFailed(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database, Exception exception) {
  }

  @Override
  public void rollbackFailed(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database, Exception exception) {
  }
}

@faris-git
Copy link

Is this @SneakyThrows issue handled in this issue. Or should I create new one for that.

@lprimak
Copy link

lprimak commented Oct 6, 2024

I've been running edge release for a while. Can we get a release going please?

@victorwss
Copy link
Contributor

@mmoayyed how exactly does one reproduce this?

I just migrated an existing project from Java 22 to 23 and it was built successfully.

Stack:

* Java: `openjdk 23 2024-09-17`

* Gradle: `8.10.2`

* Lombok: `1.18.34`

I would like to know exactly which conditions trigger the incompatibility with lombok.

It seems that the use of Lombok's @Getter and/or @Setter in a field with a Javadoc containing the -- GETTER -- and/or -- SETTER -- sections triggers this bug. I think that the @SneakyThrows issue is something different.

@asashour
Copy link

asashour commented Oct 7, 2024

I think that the @SneakyThrows issue is something different.

The title hints that all issues regarding Java 23 would be included. Please change it otherwise, thanks.

@d-eder
Copy link

d-eder commented Oct 9, 2024

is there any estimated time when lombok will support Java23?
We also have the issue with @SneakyThrows:

post-compiler 'lombok.bytecode.SneakyThrowsRemover' caused an exception: java.lang.IllegalArgumentException: Unsupported class file major version 67

@victorwss
Copy link
Contributor

I think that the @SneakyThrows issue is something different.

The title hints that all issues regarding Java 23 would be included. Please change it otherwise, thanks.

Yes, the title does, but the content of the first post doesn't, focusing on a single issue. I don't have any editing or mod priviledge here. I think that each issue should be submitted in a different bug report, this one either has a title too broad or should be written as an umbrella-issue right from the start.

Further, the title contains "[FEATURE]" when it is in fact a "[BUG]" report. This is important, since bugfixes normally have higher priority (not that it really makes a difference in this project though).

@lprimak
Copy link

lprimak commented Oct 9, 2024

I think all the bugs already have separate issues. This issue (IMHO) is mostly about the release of the artifact

@linghengqian
Copy link

  • From my point of view, the current problem seems to only require thinking about how to support markdown comments in JDK23? I tested Support compiling and using ShardingSphere under OpenJDK 23 apache/shardingsphere#33025 against org.projectlombok:lombok:1.18.34 under GraalVM CE For JDK23 and found no issues other than not supporting markdown comments.
  • Of course, maven.compiler.proc has been set to full by me to reflect the changes after JDK20.

@aholland
Copy link

aholland commented Oct 16, 2024

Rawi01 works quite well, thank you.

@mmoayyed We have been using that jar, from #3750, for some weeks now, but not in production. Any ETA on when that PR will be merged, this issue closed, and there will be another release? It's the main thing holding us back from moving to JDK23 in production. Thanks.

@danishnawab
Copy link

@rspilker @rzwitserloot lombok team: any idea when a JDK 23-compatible version of lombok will be released?

@rzwitserloot rzwitserloot added this to the next-version milestone Oct 17, 2024
@rzwitserloot
Copy link
Collaborator

There wasn't much to do to enable JDK23 compatibility; pretty sure we got there. The edge release has it: https://projectlombok.org/download-edge

Feedback welcome!

One thing that doesn't seem to work quite yet is lombok's understanding of markdown-based javadoc comments. As in, our @Getter fails to copy them (having them doesn't cause crashes, only, the javadoc isn't copied over like it should). We'll look into that.

@aholland JDK23 isn't something you should be running in production at all.

@fbacchella
Copy link

@rzwitserloot why ? Any specific problems with this release ?

@lprimak
Copy link

lprimak commented Oct 18, 2024

@rzwitserloot This is a very common misconception.
All JDK releases are production-ready.
The only time LTS comes into play if you are paying support contract to Oracle/Azul/etc

See https://inside.java/2023/07/06/java-21-is-no-lts/

@danishnawab
Copy link

JDK23 isn't something you should be running in production at all.

This suggestion makes me really nervous.

If anything, everyone should be running the latest JDK (Java 23 as of today) as that's the only one OpenJDK supports and maintains.
To use older versions one has to have commercial licenses in place with OpenJDK vendors (Oracle is one such vendor).

Please check the video shared by @lprimak as well as JEP 14: The Tip & Tail Model of Library Development.

I am hoping Lombok will align its release model in a way that is compatible with the latest JDKs.

@linghengqian
Copy link

If anything, everyone should be running the latest JDK (Java 23 as of today) as that's the only one OpenJDK supports and maintains.
To use older versions one has to have commercial licenses in place with OpenJDK vendors (Oracle is one such vendor).

I am hoping Lombok will align its release model in a way that is compatible with the latest JDKs.

  • I personally agree with this view.

@danishnawab
Copy link

JDK23 is not the only JDK version maintained by OpenJDK ... are all actively maintained.

That's not accurate. Please watch: https://youtu.be/3bfR22iv8Pc?t=168

The presence of the update repository in no way guarantees any maintenance/support from the OpenJDK project itself. Depending on these versions for bug fixes or security patches is like relying on charity i.e. some altruistic (instead of contractual) contributions from the community. That might work from time to time, but that's hardly something to base an IT strategy on top of.
Unless of course you are in a commercial contract with one of the vendors (Oracle, Azul, Amazon, etc.) that guarantees support for old and outdated versions.

Applications have reasons to use the latest jdk, but I don't believe that libraries or frameworks have reasons to bump the minimum jdk runtime to jdk23, and most libraries or frameworks have no reason to do so.

And this is why I am not asking for lombok to be upgraded to the latest JDK, but to merely be made compatible with the latest.

You may not believe it, but the master branch of Apache Hive can still only be compiled with jdk8.

I believe that because I have also worked on projects using Java 5. But that's nothing to be proud of.
It's not too late to start looking into the JEP 14: The Tip & Tail Model of Library Development which can be used as a template to serve the needs of users of ancient version (e.g. Java 8) and the modern versions.

@pron
Copy link

pron commented Oct 21, 2024

That's not accurate. Please watch: https://youtu.be/3bfR22iv8Pc?t=168

Right, and I would elaborate a bit further on what it means to be "maintained". The current JDK (23 at this time) is the only JDK version where the entire JDK is fully maintained in OpenJDK in the sense that any issue anywhere in the JDK would be looked into. When it comes to older releases, maintenance takes the form of backports, i.e. a fix is made in mainline and then potentially backported to an update release of the old version. Components that have been removed from the mainline (as, for example, SecurityManager is about to be) are not maintained in old versions in the sense that an issue against them is often likely to be ignored as there is no original work in old repo, just backports. Such original work could still happen if a paying support customer of a JDK vendor files an issue against such a component that no longer appears in mainline, and the vendor does that original work for the customer and chooses to contribute it to OpenJDK.

@lprimak
Copy link

lprimak commented Oct 21, 2024

In fact, I would suggest that Lombok is released when a new version of Java is in "rampdown phase" about 2-3 months before the actual release.

Lombok is such a great tool, my only "complaint" is the late releases vs. JDK release.
ASM does it this way, and you never get any problems.
Both Lombok and ASM are backwards-compatible, and it's OK to release "early and often"

Thanks for such a great tool guys, makes Java much more of a pleasure to use than it already is!
Go Java, go Lombok!

@lprimak
Copy link

lprimak commented Oct 21, 2024

Maybe Oracle could standardize the APIs Lombok uses so this could be easier?
@pron ? :)

@pron
Copy link

pron commented Oct 21, 2024

@lprimak

Lombok doesn't use APIs but internal classes and members. Standardising arbitrary AST transformations would be one of the most radical changes to the Java language. It would essentially mean that any library can change the meaning of Java code as it sees fit; it's more radical than adding macros. It would effectively turn Java into Racket. The "compiler plugin API" (i.e. annotation processing) has been designed so that with any "plugin" the language that's accepted still conforms to the Java language specification (Lombok code obviously doesn't).

There's no doubt some people would love to see Java work like Racket, but there's also little doubt that it would change the nature of the language.

@Saljack
Copy link

Saljack commented Oct 22, 2024

But there is JEP 484: Class-File API https://openjdk.org/jeps/484 (in Java 24)

Provide a standard API for parsing, generating, and transforming Java class files.

I am not sure if there is everything what Lombok uses or needs but it is a good starting point. This should resolve Java version incompatibility and waiting for a new release of ASM or other byte code manipulation library.

@kimec
Copy link

kimec commented Oct 22, 2024

Imagine a language where it is possible to have "a common misconception" about its releases. I bet Dennis Ritchie is having a chuckle right now:

Maybe you don't have pointer arithmetic, but you've got release arithmetic. Touché

@lprimak
Copy link

lprimak commented Oct 22, 2024

Lombok doesn't use APIs but internal classes and members.

I was afraid it was something like that.

Standardising arbitrary AST transformations would be one of the most radical changes to the Java language

Perhaps I am a bit naive, but doesn't Groovy standardize AST transformation in the language, and it's still Groovy?
I was thinking JDK can do something similar and allow Lombok be standardized.

@victorwss
Copy link
Contributor

victorwss commented Oct 24, 2024

Perhaps I am a bit naive, but doesn't Groovy standardize AST transformation in the language, and it's still Groovy? I was thinking JDK can do something similar and allow Lombok be standardized.

No, the JDK doesn't standardize any of such. Lombok works by hacking the inner guts of Javac and Eclipsec, it's very dirt and tricky internally.

@mmoayyed
Copy link
Contributor Author

@rzwitserloot When you get the chance, would you please publish the next lombok release? The current snapshot does indeed solve the original issue reported above, and that should be good enough for most cases. (I understand there may be some lingering issues with markdown support, but I suspect they can be handled and supported in a future release) Thank you!

(Somewhat related, I have also filed #3772 and done some initial work to update the patcher)

@itsAbuSalah
Copy link

itsAbuSalah commented Nov 14, 2024

Hi team, any updates here ?
i have upgraded my service to Java-23 and its not compiling anymore because of lombok compatibility :(

@rspilker
Copy link
Collaborator

We expect to be able to release within twelve hours

@rzwitserloot
Copy link
Collaborator

just released. If you're working with mavencentral, give it an hour or so to update mirrors.

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