projectlombok / lombok

Very spicy additions to the Java programming language.
https://projectlombok.org/
Other
12.83k stars 2.37k forks source link

[BUG] Compile error on Java 21, Unsupported class file major version 65 #3492

Closed sblantipodi closed 1 year ago

sblantipodi commented 1 year ago

Describe the bug Using JDK21 from Adoptium along with the latest edge version of Lombok.

When I compile my source code I get this error:

Error:  COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
Error:  /home/runner/work/firefly_luciferin/firefly_luciferin/src/main/java/org/dpsoftware/network/MessageServer.java: 
Error during the transformation of 'org.dpsoftware.network.MessageServer$ClientHandler'; 
post-compiler 'lombok.bytecode.SneakyThrowsRemover' caused an 
exception: java.lang.IllegalArgumentException: 
Unsupported class file major version 65

This is my pom.xml

<project ...>
...
    <repositories>
        <repository>
            <id>projectlombok.org</id>
            <url>https://projectlombok.org/edge-releases</url>
        </repository>
    </repositories>
...
    <dependencies>
...
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>2.0.7</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>edge-SNAPSHOT</version>
        </dependency>
    </dependencies>
...
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compilerplugin.version}</version>
                <configuration>
                    <source>21</source>
                    <target>21</target>
                    <enablePreview>true</enablePreview>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>edge-SNAPSHOT</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            ...
        </plugins>
    </build>
...
</project>

As far as I know the latest edge version should support Java 21, isn't it?

Rawi01 commented 1 year ago

You are right, the edge version does not include the upadted lombok.patcher dependency and I missed to mention that in the PR. As a temporary workaround you can use the build artifact of my daily JDK21 github actions run (e.g. https://github.com/Rawi01/lombok/actions/runs/6041547819). This run also builds and includes the latest lombok.patcher.

I cannot publish a new version of the patcher, thats something only @rzwitserloot or @rspilker can do. After that they can adjust the used version in the build script and release a new edge version.

hantsy commented 1 year ago

Got the same issue when building on Java 21.

hantsy commented 1 year ago

@Rawi01 Hope there is a new version to test Java 21.

rspilker commented 1 year ago

Please try the edge release.

hantsy commented 1 year ago

@rspilker I have already used it in my sample project. I got the same exception "Unsupported class file major version 65" described in this issue last week.

It includes the fixes of this issue now?

dstango commented 1 year ago

@rspilker I have already used it in my sample project.

It includes the fixes of this issue now?

Please check the release notes of the provided link

hantsy commented 1 year ago

This issue is a block for me. All of my sample projects failed to compile.

rspilker commented 1 year ago

@hantsy last night we released a new edge version that should address all the problems

rspilker commented 1 year ago

@hantsy how do you compile? Java, mvn, Gradle?

hantsy commented 1 year ago

@hantsy how do you compile? Java, mvn, Gradle?

I was using Maven 3.9.x, will try again in the weekend.

hantsy commented 1 year ago

@rspilker There is a new SNAPSHOT version published in Sep 15. Updated and verified it is worked.

Thanks.

danishnawab commented 1 year ago

@rzwitserloot @rspilker when will the new version (1.18.29?) be released?

dstango commented 1 year ago

@danishnawab https://github.com/projectlombok/lombok/issues/3393#issuecomment-1725937341

rzwitserloot commented 1 year ago

@danishnawab 30 minutes ago :)

sblantipodi commented 1 year ago

@rzwitserloot can you tell me why in the releases here on GitHub there is no release yet please? https://github.com/projectlombok/lombok/releases last release is from 2020...

rzwitserloot commented 1 year ago

@sblantipodi We release via maven and our website, not via that. I wonder how you even got to that page!

sblantipodi commented 1 year ago

@rzwitserloot aren't your sources versioned on github that is a "Smart GUI" to GIT? don't you create a TAG when you release? if so, why don't just create a release on github like every other projects?

releases is accessible from the homepage of your's github page...

image

rspilker commented 1 year ago

It is a feature, we acknowledge its existence. It is a manual extra step in the release process. And no, not every other project uses this.

sblantipodi commented 12 months ago

It is a feature, we acknowledge its existence. It is a manual extra step in the release process. And no, not every other project uses this.

you can write a simple GitHub action to do it automatically on a new Tag or push or whatever... having an old release on github feels bad and not accurate IMHO.

rzwitserloot commented 12 months ago

The readme has been slightly updated: It spells out you're in the wrong place for releases. Also, the old releases have now been deleted. We have no intention of using the github release system.

sblantipodi commented 12 months ago

The readme has been slightly updated: It spells out you're in the wrong place for releases. Also, the old releases have now been deleted. We have no intention of using the github release system.

now it's much better, having old releases on GitHub is confusing :) if you don't want to use that release system, it's better to not have any release.

good job! 👍