I have a problem with the following code:
public class A {
public String someMethod() {
return "some";
}
}
public class AExtension {
public static void extensionMethod(A a, String s) {
System.out.println(a.someMethod() + s);
}
}
@ExtensionMethod({ AExtension.class })
public class ExtensionMethodExample {
public void test(List<String> someList) {
A a = new A();
someList.stream().forEach(x -> a.extensionMethod(x));
}
}
And while compiling this code using Maven I get:
[ERROR] [...]ExtensionMethodExample.java:[12,49] cannot find symbol
symbol: method extensionMethod(java.lang.String)
location: variable a of type [...].A
The error only occurs while compiling using Maven, while running in Eclipse everything seems to work properly.
Some of my config:
maven-compiler-plugin: 3.5.1
lombok: 1.16.10 (I also tried 1.16.2)
Update: Invocation without Lambda expression works, of course.