@Slf4j
class Foo {
private Org org;
}
This produces a compiler error "non-static variable org cannot be referenced from a static context". It makes sense; the = org.slf4j.LoggerFactory.getLogger(... is ambiguous. Is there any way to make @Slf4j work?
BTW, you are likely to run into this same problem if you import both org.example.foo.Bar and com.example.moo.Bar and needs to reference somewhere in your code the org.example.foo.Bar class - You'd have no way to do that! This is a handicap in the java language that uses the same notation for two completely different concepts. Don't know what could be done in lombok to solve this issue without creating some other issue somewhere else.
I didn't find any.
so, had to replace @Slf4j with direct private static final Logger log: stackoverflow
Actually you might maybe get away with just adding the missing import to make this compile.
There is a problem in the java language where using fully qualified names and the presence of a field with a name that is the same as the first part of the fully qualified names gives a compiler error.
Also, in our generated we use fully qualified names for several important reasons:
Most helpful comment
BTW, you are likely to run into this same problem if you import both
org.example.foo.Barandcom.example.moo.Barand needs to reference somewhere in your code theorg.example.foo.Barclass - You'd have no way to do that! This is a handicap in the java language that uses the same notation for two completely different concepts. Don't know what could be done in lombok to solve this issue without creating some other issue somewhere else.