assylias
assylias

Reputation: 328598

Fluent getters generate errors

I have a project with the following lombok.config file:

lombok.accessors.chain = true
lombok.accessors.fluent = true

So the following class should compile fine:

@Data class A {
  private int i;
  public static void main(String[] args) {
    new A().i();
  }
}

and it does when compiling with javac. But Intellij (with or without the lombok plugin) shows a compilation error and the auto completion suggests using getI() which does not exist.

How can I fix this?

Upvotes: 2

Views: 967

Answers (1)

user180100
user180100

Reputation:

I think you're facing issue 53.

As a workaround, you could use @Accessors:

@Accessors(fluent = true) // order matters
@Data
class A {
    private int i;
    public static void main(String[] args) {
        new A().i();
    }
}

compile fine here (IntelliJ 14.0.3, lombok-plugin 0.8.9)

Upvotes: 4

Related Questions