Does lombok works with Java 12?
Asked Answered
I

1

9

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
Inharmonic answered 26/4, 2019 at 16:55 Comment(1)
I believe it works fine with Java-12 but not with the Lombok plugin for IntelliJ if that's where might be stuck as well. Could you confirm if you're compiling your code with javac directly, or using maven or gradle or any other tool? Possibly, a follow-up question to #53867429Spillage
U
12

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
Ureide answered 26/4, 2019 at 19:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.