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
Naman
  • 27,789
  • 26
  • 218
  • 353
Arnaud Claudel
  • 3,000
  • 19
  • 25
  • 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 https://stackoverflow.com/questions/53866929/unable-to-use-lombok-with-java-11 – Naman Apr 26 '19 at 20:22

1 Answers1

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
Mikhail Kholodkov
  • 23,642
  • 17
  • 61
  • 78