Lombok-intellij-plugin: @Slf4j LOG variable is not recognised by Intellij IDEA 15

Created on 12 Nov 2015  Â·  15Comments  Â·  Source: mplushnikov/lombok-intellij-plugin

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.

invalid

Most helpful comment

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

All 15 comments

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

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 [email protected] 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
.

Double check annotation processing and lombok enabled in project settings.

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.

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.

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

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.

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.

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!

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

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.

I have fixed it installing Lombok plugin

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

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.

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

Was this page helpful?
0 / 5 - 0 ratings