Java Lombok "@Getter" not applicable to field

I'm trying to get Lombok to work in IntelliJ IDEA, but whenever I try to use any of its annotations, I get an error message that looks like this:

Error:(5, 5) java: annotation type not applicable to this kind of declaration

My code looks like this using my example on my home page.

import jdk.nashorn.internal.objects.annotations.Getter;

public class GetterSetterExample {
    @Getter
    private int age = 10;
}

I installed the lombok plugin and enabled the annotation processor in the settings. I am using IntelliJ 15 with java 1.8.0_40.

I cannot find anyone with the same problem as me, so I ask here if anyone knows what is happening.

+4
source share
1 answer

Using

import lombok.Getter;

instead of import jdk.nashorn.internal.objects.annotations.Getter:;

+9
source

Source: https://habr.com/ru/post/1628835/


All Articles