Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does lombok works with Java 12?

I was recently working with Java 11 and Lombok on Intellij and it was all fine.
I tried Java 12 but now I'm always getting compilation errors, because lombok 's annotations seem to be ignored.

Does anyone know if lombok supports java 12 ?

- Intellij : 2019 1.1
- Lombok : 1.18.6
- Lombok plugin : v0.24
- JDK : 12.0.1
like image 636
Arnaud Claudel Avatar asked Apr 26 '19 16:04

Arnaud Claudel


1 Answers

Yes it should work. Lombok supports Java 12 since Early Access version of Java 12.

https://github.com/rzwitserloot/lombok/issues/1888

Use the latest available versions of Lombok library (1.18.6+), Lombok IDE plugin (0.24+) and IntelliJ IDEA itself (2019.1+). Don't forget to 'Enable Annotation Processing' within IntelliJ's settings.

Just tested:

build.gradle

plugins {
    id 'java-library'
}

repositories {
    mavenCentral()
}

dependencies {
    compileOnly 'org.projectlombok:lombok:1.18.6'
    annotationProcessor 'org.projectlombok:lombok:1.18.6'
}

Application.java

public class Application {

    public static void main(String[] args) {
        Dto dto = new Dto();
        dto.setParam("Hello World!");

        System.out.println(dto.getParam());
    }
}

Dto.java

import lombok.Data;

@Data
public class Dto {

    private String param;
}

Output

"C:\Program Files\Java\jdk-12\bin\java.exe" ... Application
Hello World!

Process finished with exit code 0
like image 158
Mikhail Kholodkov Avatar answered Sep 24 '22 15:09

Mikhail Kholodkov