IntelliJ 14 + Lombok plugin + @Builder = error
i have problem with my IntelliJ 14 and Lombok annotation "@Builder".
I've got some class :
@Getter
@Builder
public class TransactionFilter {
private String name;
private ProductType product;
...
public static TransactionFilterBuilder defaultBuilder() {
TransactionFilterBuilder builder = builder();
builder.product(ProductType.DEFAULT);
return builder;
}
}
And i'm trying to use its's generated builder in another class :
import org.---.TransactionFilter.TransactionFilterBuilder;
public class Foo {
public void boo() {
TransactionFilterBuilder filterBuilder;
...
}
}
In both classes i've got some errors
While compiling with Java 1.6 i've got error :
TransactionFilter java:26: cannot find symbol symbol : class TransactionFilterBuilder location: class org.---.TransactionFilterBuilder
Also my tooltip says that in line 26 i've got incompatible types :
Required : org.---.TransactionFilter.TransactionFilterBuilder
Found : org.---.TransactionFilter.TransactionFilterBuilder
This second error is plugin defect i guess and is not important.
Environment :
In other cases my lombok plugin works fine. Also under Eclipse this example compiles as well. But when i'm using IDEA "@Builder" fails.
I'm the only one who uses IntelliJ in my team and I don't want to go back to Eclipse :(.
Anyone had this problem ?
Can someone help me ?
I've tried to reproduce with a bit different setup:
My code is working fine. Only issue I encountered was following IntelliJ error:
I suppose it may be some plugin issue, because compilation goes without any problem. It may be helpful, I used gradle build task for compilation.
@Getter
@Builder
public class Foo {
private String foo;
public static FooBuilder fooBuilder(String foo) {
FooBuilder builder = builder();
builder.foo(foo);
return builder;
}
}
public class Bar {
public static void main(String[] args) {
Foo foo = Foo.fooBuilder("foo").build();
System.out.println(foo.getFoo());
}
}
apply plugin: 'java'
sourceCompatibility = 1.8
version = '1.0'
repositories {
mavenCentral()
}
configurations {
provided
compile.extendsFrom provided
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
provided 'org.projectlombok:lombok:1.16.2'
}
quick update to that issue, some time ago i've repoerted issue to plugin's official GitHub.
https://github.com/mplushnikov/lombok-intellij-plugin/issues/91
Issue with @Builder for Jdk 1.6 is known and won't be fixed.