Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot resolve method 'onMethod_' in IDE #1354

Closed
oleksandrzaiats opened this issue Apr 5, 2017 · 10 comments
Closed

Cannot resolve method 'onMethod_' in IDE #1354

oleksandrzaiats opened this issue Apr 5, 2017 · 10 comments

Comments

@oleksandrzaiats
Copy link

After fix for #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?

@ikstewa
Copy link

ikstewa commented May 4, 2017

I believe this is an issue with lombok-intellij-plugin mplushnikov/lombok-intellij-plugin#382

@Maaartinus
Copy link
Contributor

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.

@denbypda
Copy link

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

@vguna
Copy link

vguna commented May 30, 2017

Same here, exact same version.

@evgenyh
Copy link

evgenyh commented Dec 6, 2017

facing the same
any solution for this ?

@roglar
Copy link

roglar commented Mar 22, 2018

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...

@LilithXing
Copy link

Same here

JDK:9.0.4
idea: 2018.1
lombok:1.16.20

can some one help?

@ronnyfm
Copy link

ronnyfm commented Oct 2, 2018

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.

@ronnyfm
Copy link

ronnyfm commented Oct 2, 2018

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.

@oleksandrzaiats
Copy link
Author

This issue is closed since original cause mplushnikov/lombok-intellij-plugin#382 was fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants