mplushnikov / lombok-intellij-plugin

Lombok Plugin for IntelliJ IDEA
Apache License 2.0
3.11k stars 636 forks source link

@Slf4j LOG variable is not recognised by Intellij IDEA 15 #154

Closed myndworks closed 8 years ago

myndworks commented 8 years ago

Lombok intellij plugin works pretty well, except it does not recognise the LOG variable. (It marks it in red and thinks the variable is undefined.)

But compiles and runs ok.

Not a show stopper rather annoying. A fix would be appreciated.

Thank you for your help.

tomaszganski commented 8 years ago

Hi, I am using intellij 15 with @Slf4j and for me everything works fine. In my case help me File > Invalidate Caches / Restart > Invalidate and Restart

myndworks commented 8 years ago

Hi, thanks. I did that still has no luck.

Intellij is still complaining about LOG variable. Other lombok annotations are working fine.

:-(

Kind Regards Senthil.

On Mon, Nov 23, 2015 at 7:09 PM, Tomek notifications@github.com wrote:

Hi, I am using intellij 15 with @Slf4j https://github.com/Slf4j and for me everything works fine. In my case help me File > Invalidate Caches / Restart > Invalidate and Restart

— Reply to this email directly or view it on GitHub https://github.com/mplushnikov/lombok-intellij-plugin/issues/154#issuecomment-158873739 .

Janmm14 commented 8 years ago

Double check annotation processing and lombok enabled in project settings.

alexejk commented 8 years ago

By default, Lombok generates a variable called log (lower-case). If you placed a new variable name in lombok.config, you have to make sure it's in the src/main/java. Lombok itself will search higher up in te structure, however IDEA plugin currently has a limitation where it searches only up to default package.

Could it be that you are hitting that specific issue? Reason why I'm asking is that I'm on IDEA 15 and latest plugin version and am using LOG variable, which is set in my lombok.config via lombok.log.fieldName = LOG. But I did have to move the file to the default package, until more flexible placement is supported by the plugin.

vict0r81 commented 8 years ago

After update to 0.9.7.15 with IDEA 15.0.2. I've experienced almost the same issues with with @Slf4j annotations when I do 'make project' by pressing hot key Command(Ctrl) + F9, IDEA cause error: Error:(79, 9) java: cannot find symbol symbol: variable log location: class And point on the line, where I have: log.error("Error ....");

*Update: Checked with Idea 14.1.6, 15.0.2 / 15.0.3 / 16 EAP 0.9.8.14 (0.9.8.15) The result is the same. Checked in another module within the same project and I don't have such issue. Lombok dependency is the same like in version I have an issue... Will try to reproduce that thing in another clear project soon and will try to add sources, if I'll be succeed in that.

sarah-jay-peper commented 8 years ago

After update to 0.9.8.15 (IDEA 15.0.3) I have the same problem now. previously it was working (don't know if I had 0.9.7 or 0.9.6). Now also other annotations seems to fail, but I cannot see a pattern there

alexejk commented 8 years ago

Interesting. Im using @Slfj4 and a bunch of other annotations and the latest plugin works fine. However, contrary to you, I'm on EAP 16 version.

vict0r81 commented 8 years ago

Looks like I've found solution: close IDEA project, delete .idea folder and .iml files in each module, reimport project. Now I can Make project w.o. any issue (at least not with @Slf4j annotation). Another solutions like change IDEA versions (checked on 14.1.6, 15.0.2, 15.0.3, 16 EAP), change lombok plugin version, upgrade lombok dependency itself, even upgrade JDK doesn't make any success results for me. Hope this solution could be useful.

mplushnikov commented 8 years ago

I will close this issue now, because it is not reproducible for me. I hope it is something with your local setup... Feel free to open new issue if problem still exists!

radsimu commented 6 years ago

I just experienced the same thing. Only in one file log was not recognised by intellij - build worked fine. ctrl+a, ctrl+c, delete, ctrl+v, profit

WesternGun commented 6 years ago

I just encountered the same problem in Intellij IDEA 2018.1. I just delete the log occurrence, make IDEA warns me to "add the lombok.extern.xxx.jar to classpath", and all is fine. Just get a little bit crazy about this.

lucasdaniele1 commented 4 years ago

I have fixed it installing Lombok plugin

lauriall commented 4 years ago

Just upgraded from version 1.18.8 to 1.18.12 and everything started working ...

StefanSchade commented 4 years ago

Just for the record: I just ran into the same problem with IntelliJ Ultimate 2019-3. Stragely enogh this applies only to one module in a multi-maven-project and could not be fixed adjusting the lombok plugin settings. As it is rather an invonvenience, I think, I will ignore it for the moment.

dev2013slk commented 3 years ago

Hi, I am using intellij 15 with @slf4j and for me everything works fine. In my case help me File > Invalidate Caches / Restart > Invalidate and Restart

Perfect this works for me

domainy commented 6 months ago

Facing again added details here - https://github.com/projectlombok/lombok/issues/1855#issuecomment-1925343215