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

Add support for Java 19 #3264

Closed
SimSonic opened this issue Sep 22, 2022 · 47 comments
Closed

Add support for Java 19 #3264

SimSonic opened this issue Sep 22, 2022 · 47 comments

Comments

@SimSonic
Copy link

1.18.24:

[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ soap-clients ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 345 source files to /builds/someproject/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] error: Error during the transformation of 'somepackage.SomeClass'; post-compiler 'lombok.bytecode.SneakyThrowsRemover' caused an exception: java.lang.IllegalArgumentException: Unsupported class file major version 63
[INFO] 1 error

I believe there should be just little changes to support new class file version 63.

Thanks.

@YassinHajaj
Copy link
Contributor

Hello,
Hope you're doing fine.
Is there any idea when this will be solved ?
Is there a workaround ?
Or can I do something to help solve it quicker ?

@jkickic
Copy link

jkickic commented Oct 5, 2022

There's a draft PR for this
#3251

@SimSonic
Copy link
Author

SimSonic commented Oct 5, 2022

There's a draft PR for this #3251

It's undone and frozen.

@laxika
Copy link

laxika commented Oct 10, 2022

Is the project dead? Or I should send some support money to get this fixed or something? I want to use JDK 19 to be able to use virtual threads, but this unfortunately blocks me entirely. (I use SneakyThrows at 100+ places lol.)

@alexanderankin
Copy link

I am also here because SneakyThrows does not compile on java 19... I think it is worth at least pulling down the branches with the pr's (projectlombok/lombok.patcher#11 and #3251), pushing to maven local and seeing if that works.

i think #3251 is actually doing too much, there should just be a simple pr that bumps the patcher version after pr11 gets merged (if that accomplishes what i think it might, and restore all the base functionality like sneakythrows in java 19)

@SimSonic
Copy link
Author

@rzwitserloot, ping?

@alexanderankin
Copy link

alexanderankin commented Oct 10, 2022

lombok.extern.slf4j.Slf4j still works on java 19 as is btw. Another one that is everywhere.

the lombok.patcher pr.11 built and compiled, but it looks like it is an odd version, so that requires making it even for a release (iirc how lombok versioning works, but the version referenced in lombok proper is 44, so I changed lombok.patcher.Version.VERSION to "46"). Running ./propagateDistToLombok script with ./propagateDistToLombok 0.46, and recompiling lombok -- does not seem to change the version of the patcher which is used in the lombok build.

but after renaming the files manually, and manually creating a pom file, it works! and switching back to the published version (.24), it gives

this error
error: Error during the transformation of 'org.example.Main'; post-compiler 'lombok.bytecode.SneakyThrowsRemover' caused an exception: java.lang.IllegalArgumentException: Unsupported class file major version 63

Here is a repo where you can try the same (after publishing to maven local) - https://github.com/alexanderankin/lombok-maven-local-reproducer

seems like it is just a matter of running the release.


edit: so to summarize, all that is needed to restore basic functionality is to upgrade the asm dep version, which can be accomplished in the lombok.patcher.

@Rawi01
Copy link
Collaborator

Rawi01 commented Oct 10, 2022

I uploaded a pre-built version of the linked PR: lombok-jdk19-20221010.zip

It would be really helpful if you can test it with JDK19 and especially some of the new language features. I have no time to do all that myself at the moment.

I know that it is annoying that there is no new release but everyone who works on the project does it in his spare time.

@alexanderankin
Copy link

I've updated my repo to install this new version from @Rawi01 into the maven local repository in alexanderankin/lombok-maven-local-reproducer#1

@laxika
Copy link

laxika commented Oct 10, 2022

I know that it is annoying that there is no new release but everyone who works on the project does it in his spare time.

That's fine and absolutely understandable. I just wanted to know what's up because I saw next to zero responses on the issues in the past couple of weeks.

I have a pretty big project. Will try compiling it with the provided JAR.

@laxika
Copy link

laxika commented Oct 15, 2022

@Rawi01 Thanks for the JAR, it works well. I was able to compile the project with it, tests ran just fine and the apps start as expected. I'll do more testing soon but as for now, it looks good!

@bademux
Copy link

bademux commented Oct 30, 2022

@alexanderankin temporary solution

task downloadLombok() {
	inputs.property('lombokSrc', 'https://github.com/projectlombok/lombok/files/9745621/lombok-jdk19-20221010.zip')
	outputs.files file("$buildDir/lombok.zip")
	doLast {
		ant.get(src: inputs.properties.lombokSrc, dest: tasks.downloadLombok.outputs.files.singleFile)
	}
}

task installLombok(type: Sync, dependsOn: tasks.downloadLombok) { task ->
	def extractDir = file("${buildDir}/ext-libs")
	outputs.files fileTree(extractDir) {
		include "**/*.jar"
		builtBy task
	}
	from zipTree(tasks.downloadLombok.outputs.files.singleFile)
	into extractDir
}

dependencies {

	compileOnly files({ tasks.installLombok.outputs.files })
	annotationProcessor files({ tasks.installLombok.outputs.files })
}

@Rawi01
Copy link
Collaborator

Rawi01 commented Oct 30, 2022

Thanks for testing, I marked my PR as ready

@stephane-dereppe
Copy link

Thanks for the job!

The build of the PR is failing. I guess that's why it is not merged yet.

@marinus-suniram
Copy link

any ETA on this?

@Harmelodic
Copy link

Harmelodic commented Nov 15, 2022

So... we're waiting on this:

which is dependent on the lombok patcher being updated, by this:

which... doesn't seem to have any blockers, other than someone with write access to be merge it and kick off things, I guess.

@Harmelodic
Copy link

Update:

To get Java 19 support, this needs to be merged:

Which is blocked by the lombok.patcher from supporting Java 19/20:

Which is blocked/not-wanting-to-merge-yet, because the lombok.patcher seems to be in a... weird/broken state, where tags are missing and (maybe) even code is missing:

@laxika
Copy link

laxika commented Dec 5, 2022

Any ETA? This one is open for almost 2.5 months. The java release cycle is 6 months so at this pace by the time it will be fixed, JDK 20 will be out already.

I'm using Rawi's jar from a local repo of my project. It works but is still super sketchy, to be honest. :/

@alexanderankin
Copy link

I think its just two maintainers on this project, so i would expect it to be handled at the next lts release, thats about 1.5 years apart.

@laxika
Copy link

laxika commented Dec 5, 2022

I think its just two maintainers on this project, so i would expect it to be handled at the next lts release, thats about 1.5 years apart.

So I'll need to provide my own patch to jump to JDK 20 in the future? Ouch.

@MCakrt
Copy link

MCakrt commented Dec 12, 2022

@Rawi01 thanks!

@MCakrt
Copy link

MCakrt commented Dec 12, 2022

@bademux
Thank you. I had to tweak it a little bit to make it work in my project:

tasks.register('downloadLombok') {
    inputs.property('lombokSrc', 'https://github.com/projectlombok/lombok/files/9745621/lombok-jdk19-20221010.zip')
    outputs.files file("$buildDir/lombok.zip")
    doLast {
        ant.get(src: inputs.properties.lombokSrc, dest: tasks.downloadLombok.outputs.files.singleFile)
    }
}

tasks.register('installLombok', Copy) { task ->
    def extractDir = file("${buildDir}/ext-libs")
    outputs.files fileTree(extractDir) {
        include "**/*.jar"
        builtBy task
    }
    from(zipTree(tasks.downloadLombok.outputs.files.singleFile))
    into extractDir
}

dependencies {

    compileOnly files({ tasks.installLombok.outputs.files })
    annotationProcessor files({ tasks.installLombok.outputs.files })
    testCompileOnly files({ tasks.installLombok.outputs.files })
    testAnnotationProcessor files({ tasks.installLombok.outputs.files })
    
    ...
}

@SimSonic
Copy link
Author

SimSonic commented Dec 12, 2022

@rspilker, hi, could you maybe promote this issue somehow?

@laxika
Copy link

laxika commented Dec 12, 2022

@MCakrt

I did something similar, but I committed the JAR into my repo:

repositories {
    mavenCentral()
    flatDir {
        dirs "$rootProject.projectDir/libs"
    }
}

dependencies {
    // A forked version of Lombok because the official one doesn't support Java 19 yet
    compileOnly name: 'lombok-jdk19-20221010'
    annotationProcessor name: 'lombok-jdk19-20221010'
    testCompileOnly name: 'lombok-jdk19-20221010'
    testAnnotationProcessor name: 'lombok-jdk19-20221010'
}

I don't want to let my build process depend on GitHub. But that's just me and my boring enterprisy thinking.

@bademux
Copy link

bademux commented Dec 13, 2022

@laxika
"enterprisy thinking" would be to not use java19 and unofficial lombok in the first place :)

@laxika
Copy link

laxika commented Dec 14, 2022

@bademux Damn, you got me!

@MCakrt
Copy link

MCakrt commented Dec 15, 2022

@laxika That's a good point. I will update my project like this.

@MCakrt
Copy link

MCakrt commented Dec 20, 2022

@laxika I did it as you suggested. This is much better than pulling stuff from GitHub. Thank you, I am not that familiar with Gradle.

It works well but there's a problem with my IDE (IntelliJ Idea). It doesn't recognize Lombok and highlights all Lombok annotations etc. as errors, even though the code compiles and runs without any problems.

I polished the dependencies further, so now it's

    // A forked version of Lombok because the official one doesn't support Java 19 yet
    compileOnly group: 'org.projectlombok', name: 'lombok', version: 'jdk19-20221010'
    annotationProcessor group: 'org.projectlombok', name: 'lombok', version: 'jdk19-20221010'
    testCompileOnly group: 'org.projectlombok', name: 'lombok', version: 'jdk19-20221010'
    testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: 'jdk19-20221010'

Everything works well now. The code compiles and runs and Idea is happy.

@laxika
Copy link

laxika commented Dec 21, 2022

@MCakrt Do you use the latest IntelliJ Idea? It works for me with the latest one. :/ Nice that you found a fix though!

@MCakrt
Copy link

MCakrt commented Dec 22, 2022

@laxika I was using the previous version when I wrote the comment. I have upgraded Idea after that.

@sven-v-t-veer
Copy link

I wouldn't commit a jar to my git repository. That's not reallt "enterprise thinking.

Enterprise thinking would be to clone the repo to your enterprise and use git submodules to use lombok in you project.

@sven-v-t-veer
Copy link

@laxika "enterprisy thinking" would be to not use java19 and unofficial lombok in the first place :)

And why woud that be?

There is a reason why Java updates every 6 months, and there is a reason why every enterprise should too.

@sven-v-t-veer
Copy link

Is there any chance that this support will be added any time soon? I'm considerin de-lomboking my projects over this. Java 19 has been out for months now nd Java 20 will be released within 3 months.

@laxika
Copy link

laxika commented Jan 6, 2023

Enterprise thinking would be to clone the repo to your enterprise and use git submodules to use lombok in you project.

Actually in an enterprise environment companies use their own maven repository (Artifactory for example). You would fork the lombok repo and deploy your own code into your own repo.

To be honest, I just ment that line as a joke. It was a crappy one, I see. :)

@SimSonic
Copy link
Author

SimSonic commented Jan 7, 2023

I think it is not a world-scale problem for us if lombok doesn't update with non lts versions. Actually using non lts is offen considered as risky for enterprise.

But for me it is very dangerous signal that maintainers are silent for months. If the silence will continue after release of java 20, I think somebody should fork repo.

@rzwitserloot
Copy link
Collaborator

rzwitserloot commented Jan 12, 2023

@SimSonic wrote:

I think it is not a world-scale problem for us if lombok doesn't update with non lts versions.

Yup, we didn't feel all that much stress about 19 for that reason.


Various awesome PRs - thanks, @Rawi01 :) - have been merged, and JDK19 support has been added.

You can now download the edge release and give it a spin! We'll ship this as official release, assuming nobody finds major problems with it, within a week.

Feedback welcome!

@Vyacheslav-Lapin
Copy link

Great! Thanks a lot!
But seems like, now we can only download it directly (link https://projectlombok.org/lombok-edge.jar works correctly), but not by Maven or Gradle through remote repository. Got this error while building in my Maven project:

[ERROR] Failed to execute goal on project demo-project: Could not resolve dependencies for project demo-project:demo-project:jar:0.0.1-SNAPSHOT: org.projectlombok:lombok:jar:edge-SNAPSHOT was not found in https://projectlombok.org/edge-releases during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of projectlombok.org has elapsed or updates are forced -> [Help 1]

@SimSonic
Copy link
Author

+1

image

@laxika
Copy link

laxika commented Jan 12, 2023

Yaaaay! Thanks a lot for picking this issue up!

@sz-liva
Copy link

sz-liva commented Jan 12, 2023

It seems like https://projectlombok.org/edge-releases repository doesn't work. I've got this error during Maven build:

[ERROR] Failed to execute goal on project testproject: Could not resolve dependencies for project com.livalife.api:liva-api:jar:6.1.0-SNAPSHOT: org.projectlombok:lombok:jar:edge-1.18.25 was not found in https://projectlombok.org/edge-releases during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of projectlombok.org has elapsed or updates are forced -> [Help 1]

@rspilker
Copy link
Collaborator

rspilker commented Jan 13, 2023

Hmm, possibly the edge release via maven has been broken since we moved the website to a new location.

I know that in both maven and grade you can use a local jar, I think you need to mark it system for maven.

A fix for the edge release might take another week.

@rzwitserloot
Copy link
Collaborator

rzwitserloot commented Jan 20, 2023

Turns out our switch to new hosting is slightly more complex than we signed up for. We'll try to get the release out the door ASAP but would prefer not to kludge it together with a bunch of error-prone manual upload actions. Status so far:

✅ Making the JDK19- compatible artefact (lombok 1.18.26)
✅ Ability to deliver this to mavencentral and deploy it
❌ Push out website (HTML) updates automatically
❌ Ability to deliver an edge release to our own maven repo hosted on projectlombok.org
❌ Push out build artefacts to website (we also host lombok.jar and a version history, for example)
❌ Push out eclipse p2 repo updates for those using lombok as eclipse plugin

The 4 crosses aren't particularly difficult to fix; primary blocker is that we need to find a simple way to send objects into S3 buckets (well, cloudflare R2, but it's API compatible) automatically from the buildscripts. We'll try to get this all done this week.

@SimSonic
Copy link
Author

I suppose this should not be very hard with their docs for aws cli and aws cli in docker image...

@sven-v-t-veer
Copy link

I suppose this should not be very hard with their docs for aws cli and aws cli in docker image...

I'm beginning to think Java 20 might be released first.

@Harmelodic
Copy link

Status so far: ...
... We'll try to get this all done this week.

Everything ok @rzwitserloot? Any new ETA?

Obviously I hold some bias, since I really want the JDK 19 support, but it's quite frustrating to not receive a release nor an update, for quite a while 👀 😢

@vananiev
Copy link

vananiev commented Feb 5, 2023

Thanks a lot, lombok 1.18.26 form mavencentral works correctly with java 19.

@Harmelodic
Copy link

Omg, it's out!
https://mvnrepository.com/artifact/org.projectlombok/lombok/1.18.26

Thanks @rzwitserloot for publishing it!

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