Lombok: Cannot resolve method 'onMethod_' in IDE

Created on 5 Apr 2017  路  10Comments  路  Source: projectlombok/lombok

After fix for https://github.com/rzwitserloot/lombok/issues/778 issue I have got an error in IDE.
I am using new version of lombok with the fix (1.16.16) and Java 8.
It turns whole my project to red with hint that IDE Cannot resolve method 'onMethod_' (I am using Intellij).
But compilation is successful and generated code is working as expected.

public class DTO {
    @Getter(onMethod_= @TestAnnotation(testParam = "testParam"))
    @Setter
    String data;
}

Actually there is not such method in sources https://github.com/rzwitserloot/lombok/blob/master/src/core/lombok/Getter.java, only AnyAnnotation[] onMethod() default {};
I don't want to disable Cannot resolve method Intellij inspection, is there any way to fix it?

Most helpful comment

I run into this when upgrading to java8 but not another person in my team!
After comparison we found out that compiler arg caused this (in maven)

javac -processor org.checkerframework.checker.nullness.NullnessChecker ...

Without this even the java7 method compiles, will delombok getters and setters that needed this...

All 10 comments

I believe this is an issue with lombok-intellij-plugin https://github.com/mplushnikov/lombok-intellij-plugin/issues/382

Actually there is not such method in sources

AFAIK, it mustn't exist.

https://projectlombok.org/features/experimental/onX.html

The syntax is a little strange and depends on the javac you are using.
On javac7, to use any of the 3 onX features, you must wrap the annotations to be applied to the constructor / method / parameter in @__(@AnnotationGoesHere)....
On javac8 and up, you add an underscore after onMethod, onParam, or onConstructor.

Getting the same issue when using new Java8 onMethod syntax with Windows jdk1.8.0_121 and lombok 1.16.16.

Using the new JDK 8 syntax

@Getter(onMethod_ = { @JsonProperty(value = ID) })

No IDE, just javac

error: cannot find symbol
@Getter(onMethod_ = { @JsonProperty(value = ID) })
^
symbol: method onMethod_()
location: @interface Getter

Same here, exact same version.

facing the same
any solution for this ?

I run into this when upgrading to java8 but not another person in my team!
After comparison we found out that compiler arg caused this (in maven)

javac -processor org.checkerframework.checker.nullness.NullnessChecker ...

Without this even the java7 method compiles, will delombok getters and setters that needed this...

Same here

JDK:9.0.4
idea: 2018.1
lombok:1.16.20

can some one help?

Facing a similar issue when I run Enunciate plugin. Eclipse works after I run the Lombok JAR, and the Maven project compiles without errors, but other IDEs (like Visual Studio Code) and moreover, the Enunciate plugin is unable to finish.

I run into this when upgrading to java8 but not another person in my team!
After comparison we found out that compiler arg caused this (in maven)

javac -processor org.checkerframework.checker.nullness.NullnessChecker ...

Without this even the java7 method compiles, will delombok getters and setters that needed this...

Do you mean to add that parameter or to remove it in order to compile? I was trying to add the parameter in the Maven configuration but it is not working.

This issue is closed since original cause https://github.com/mplushnikov/lombok-intellij-plugin/issues/382 was fixed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

michaelkuechler picture michaelkuechler  路  3Comments

lombokissues picture lombokissues  路  3Comments

merric picture merric  路  4Comments

rspilker picture rspilker  路  3Comments

gardenias picture gardenias  路  3Comments