getting symbol not found for lombok annotation after upgrading java version from 8 to 17

1.1k Views Asked by At

I've been trying to upgrade the java version[from 8 -> 17] of a spring boot 2.6.4 project. After setting the java.version property to 17 in pom.xml , I started getting the following issue.

[ERROR] Constructing Javadoc information...
[ERROR] @RequiredArgsConstructor(onConstructor = @__(@Autowired))
[ERROR]                                           ^
[ERROR]   symbol: class __
[ERROR] 2 errors
[ERROR] 
[ERROR] Command line was: /Users/utkarsh.s/Library/Java/JavaVirtualMachines/corretto-17.0.5/Contents/Home/bin/javadoc @options @packages
[ERROR] 
[ERROR] Refer to the generated Javadoc files in '/Users/utkarsh.s/Development/apps/sample_project/target/apidocs' dir.
[ERROR] 

Please Note :

  • I'm using IntelliJ 2022.2.3
  • My lombok version is : 1.18.22 and it is working properly with java8.
  • In order to upgrade the java version for my project , i have done the following : -
    • Installed jdk17 Amazon Correto 17.0.5. [I installed it with intelliJ]
    • updated maven setting to use JDK for importer as 17.
    • set the project SDK as 17.

Attaching few snippets of the pom file .

    <properties>
         <lombok.version>1.18.22</lombok.version>
         <java.version>17<java.version>
    <properties>
    .
    .
    .
    <dependencies>
    .
    .
    .
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>
    .
    .
    .
    </dependencies>

1

There are 1 best solutions below

1
On

As per lombok doc https://www.javadoc.io/doc/org.projectlombok/lombok/1.16.18/lombok/RequiredArgsConstructor.html, the syntax has been updated to

@RequiredArgsConstructor(onConstructor_={@AnnotationsGohere})