7

I have the following code:

import lombok.Builder;
import lombok.Getter;

@Getter
@Builder
public class NameParserResponse {
    private boolean match;
}


public class Main {

    public static void main(String[] args) {
        NameParserResponse nameParserResponse = NameParserResponse.builder().build();
        nameParserResponse.isMatch();
    }
}

When trying to reference isMatch(), I get:

Ambiguous method call. Both

isMatch () in Response and
isMatch () in Response match

enter image description here

I have also tried removing the @Builder annotation, but this doesn't help.

Adrian Elder
  • 1,993
  • 3
  • 19
  • 38
  • Show more code please. – NiVeR May 03 '18 at 19:27
  • Have you tried rebuilding project and/or invalidate Intellij caches? Also you're wokring with intellij alone or in pair with some building tool like maven or gradle? – krzychek May 03 '18 at 19:38
  • I am using Maven with Intellij, and I have tried running the cleanup command, and have did the invalidate caches / restart option. I actually just created a brand new project with the code above, and still the same issue. – Adrian Elder May 03 '18 at 19:42
  • Have you tried removing `@Getter` and making a getter yourself called `isMatch()`? Does the problem persist? – filpa May 03 '18 at 19:45
  • After removing the `@Getter`, there is no error. Also, I am using Lombok `1.16.20` and the latest version of Intellij/Lombok plugins. – Adrian Elder May 03 '18 at 19:47
  • try Kotlin if you feel like needing Lombok for Java – jediz May 03 '18 at 20:18

2 Answers2

4

It looks like I had the Hrisey Intellij plugin installed in addition to the Project Lombok plugin. I must have accidentally installed this when I was looking for the Project Lombok plugin.

After disabling this plugin, the issue was no longer present.

Adrian Elder
  • 1,993
  • 3
  • 19
  • 38
0

IntelliJ has a refactoring to "de-Lombok" the code, which will expand the Lombok magic out into the more lengthy code it auto-generates behind the scenes. When I've encountered oddities like this before, looking at the actual produced code, instead of just guessing about it, has helped make the problem clearer. YMMV.

Good luck.

Jamie Bisotti
  • 2,605
  • 19
  • 23
  • Thanks - I have checked the source code. There are no ambiguous "isMatch" methods, not even two methods named this. The weird thing is it is just on my work computer, at home this issue does not occur. I am trying to check the differences between the two environments. I am up to date on Intellij/Lombok. – Adrian Elder May 14 '18 at 14:03
  • One difference that I just thought about would be that I am using the Ultimate edition of Intellij at home, but the Community Edition at work. Hmm... – Adrian Elder May 14 '18 at 14:05