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

Delombok fails on Java 21 #179

Open
pacphi opened this issue Sep 20, 2023 · 7 comments · May be fixed by #180
Open

Delombok fails on Java 21 #179

pacphi opened this issue Sep 20, 2023 · 7 comments · May be fixed by #180

Comments

@pacphi
Copy link

pacphi commented Sep 20, 2023

While there's a work-around for Java 17, delombok-ing does not work for Java 21. I used sdkman to download and install Graal CE v21. Then I tried to compile a project of mine, see output.

❯ sdk install java 21-graalce

Downloading: java 21-graalce

In progress...

############################################################################################################################################################################################ 100.0%

Repackaging Java 21-graalce...

Done repackaging...

Installing: java 21-graalce
lchmod (file attributes) error: Operation not supported
lchmod (file attributes) error: Operation not supported
lchmod (file attributes) error: Operation not supported
Done installing!

Do you want java 21-graalce to be set as default? (Y/n): Y

Setting java 21-graalce as default.
❯ mvn clean package
Running `/home/cphillipson/Documents/development/pivotal/cf/cf-butler/mvnw`...
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------< io.pivotal:cf-butler >------------------------
[INFO] Building cf-butler 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- clean:3.2.0:clean (default-clean) @ cf-butler ---
[INFO] Deleting /home/cphillipson/Documents/development/pivotal/cf/cf-butler/target
[INFO] 
[INFO] --- git-commit-id:4.9.10:revision (get-the-git-infos) @ cf-butler ---
[INFO] 
[INFO] --- jacoco:0.8.10:prepare-agent (before-unit-test-execution) @ cf-butler ---
[INFO] surefire.jacoco.args set to -javaagent:/home/cphillipson/.m2/repository/org/jacoco/org.jacoco.agent/0.8.10/org.jacoco.agent-0.8.10-runtime.jar=destfile=/home/cphillipson/Documents/development/pivotal/cf/cf-butler/target/jacoco-output/jacoco-unit-tests.exec
[INFO] 
[INFO] --- lombok:1.18.20.0:delombok (delombok) @ cf-butler ---
Creating empty directory: /home/cphillipson/Documents/development/pivotal/cf/cf-butler/target/generated-sources/delombok/io/pivotal/cfapp/hints
Note: Annotation processing is enabled because one or more processors were found
  on the class path. A future release of javac may disable annotation processing
  unless at least one processor is specified by name (-processor), or a search
  path is specified (--processor-path, --processor-module-path), or annotation
  processing is enabled explicitly (-proc:only, -proc:full).
  Use -Xlint:-options to suppress this message.
  Use -proc:none to disable annotation processing.
/home/cphillipson/Documents/development/pivotal/cf/cf-butler/src/main/lombok/io/pivotal/cfapp/domain/ServiceInstanceDetail.java:53: error: cannot find symbol
    public static ServiceInstanceDetailBuilder from(ServiceInstanceDetail detail) {
                  ^
  symbol:   class ServiceInstanceDetailBuilder
  location: class io.pivotal.cfapp.domain.ServiceInstanceDetail
/home/cphillipson/Documents/development/pivotal/cf/cf-butler/src/main/lombok/io/pivotal/cfapp/domain/AppDetail.java:56: error: cannot find symbol
    public static AppDetailBuilder from(AppDetail detail) {
                  ^
  symbol:   class AppDetailBuilder
  location: class io.pivotal.cfapp.domain.AppDetail
/home/cphillipson/Documents/development/pivotal/cf/cf-butler/src/main/lombok/io/pivotal/cfapp/controller/DormantWorkloadsController.java:11: error: cannot find symbol
import io.pivotal.cfapp.domain.Workloads.WorkloadsBuilder;
                                        ^
  symbol:   class WorkloadsBuilder
  location: class io.pivotal.cfapp.domain.Workloads
/home/cphillipson/Documents/development/pivotal/cf/cf-butler/src/main/lombok/io/pivotal/cfapp/controller/LegacyWorkloadsController.java:11: error: cannot find symbol
import io.pivotal.cfapp.domain.Workloads.WorkloadsBuilder;
                                        ^
  symbol:   class WorkloadsBuilder
  location: class io.pivotal.cfapp.domain.Workloads
/home/cphillipson/Documents/development/pivotal/cf/cf-butler/src/main/lombok/io/pivotal/cfapp/service/ApplicationReporter.java:26: error: cannot find symbol
import io.pivotal.cfapp.domain.accounting.application.AppUsageMonthly.AppUsageMonthlyBuilder;
                                                                     ^
  symbol:   class AppUsageMonthlyBuilder
  location: class io.pivotal.cfapp.domain.accounting.application.AppUsageMonthly
/home/cphillipson/Documents/development/pivotal/cf/cf-butler/src/main/lombok/io/pivotal/cfapp/service/ApplicationReporter.java:28: error: cannot find symbol
import io.pivotal.cfapp.domain.accounting.application.AppUsageReport.AppUsageReportBuilder;
                                                                    ^
  symbol:   class AppUsageReportBuilder
  location: class io.pivotal.cfapp.domain.accounting.application.AppUsageReport
/home/cphillipson/Documents/development/pivotal/cf/cf-butler/src/main/lombok/io/pivotal/cfapp/service/ServiceInstanceReporter.java:27: error: cannot find symbol
import io.pivotal.cfapp.domain.accounting.service.NormalizedServicePlanMonthlyUsage.NormalizedServicePlanMonthlyUsageBuilder;
                                                                                   ^
  symbol:   class NormalizedServicePlanMonthlyUsageBuilder
  location: class io.pivotal.cfapp.domain.accounting.service.NormalizedServicePlanMonthlyUsage
/home/cphillipson/Documents/development/pivotal/cf/cf-butler/src/main/lombok/io/pivotal/cfapp/task/HygienePolicyExecutorTask.java:24: error: cannot find symbol
import io.pivotal.cfapp.domain.Workloads.WorkloadsBuilder;
                                        ^
  symbol:   class WorkloadsBuilder
  location: class io.pivotal.cfapp.domain.Workloads
/home/cphillipson/Documents/development/pivotal/cf/cf-butler/src/main/lombok/io/pivotal/cfapp/task/LegacyWorkloadReportingTask.java:24: error: cannot find symbol
import io.pivotal.cfapp.domain.Workloads.WorkloadsBuilder;
                                        ^
  symbol:   class WorkloadsBuilder
  location: class io.pivotal.cfapp.domain.Workloads
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.568 s
[INFO] Finished at: 2023-09-20T10:24:55-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.projectlombok:lombok-maven-plugin:1.18.20.0:delombok (delombok) on project cf-butler: Unable to delombok: InvocationTargetException: java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid' -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Key error seems to be

Unable to delombok: InvocationTargetException: java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid'
@pacphi
Copy link
Author

pacphi commented Sep 20, 2023

There appears to be some related info mentioned here, projectlombok/lombok#3393. Adding edge-SNAPSHOT version works!

@dstango
Copy link

dstango commented Sep 20, 2023

Did you notice the new release?
https://projectlombok.org/changelog

@basil
Copy link

basil commented Sep 22, 2023

@awhitford Please update lombok-maven-plugin to Lombok 1.18.30 and release a new version to fix this bug

@alecharp
Copy link

@awhitford I created #180 to update Lombok and Jacoco Maven plugin so this plugin can support Java 21.

@eivinhb
Copy link

eivinhb commented Nov 27, 2023

This maven plugin seems to be dead in the water.

To work around the problem, just specify the dependency yourself.

<plugin>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok-maven-plugin</artifactId>
    <version>1.18.20.0</version>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals>
                <goal>delombok</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>
    </dependencies>
</plugin>

@mttfranci
Copy link

Actually @eivinhb solution worked fine for me.

@awhitford would be great to be this project updated.

Thanks in advance.

@binkley
Copy link

binkley commented Aug 10, 2024

For me, adding the Lombok Maven plugin for delombok produced no output underneath target/.
I am using Java 21.

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

Successfully merging a pull request may close this issue.

7 participants