[lombok] IDEA-345991 Fix Error Highlighting: Lombok Builder.Default on Final Fields

GitOrigin-RevId: 839bffdf12b4c5046ed8ec0732bfce9f09801516
This commit is contained in:
Michail Plushnikov
2024-09-10 21:21:37 +02:00
committed by intellij-monorepo-bot
parent ddadd53ad0
commit 6ebc72d816
3 changed files with 42 additions and 1 deletions

View File

@@ -48,6 +48,10 @@ public class LombokHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testBuilderWithDefaultReinitializeInConstructor() {
doTest();
}
public void testValueSealedInterface() {
doTest();
}

View File

@@ -0,0 +1,35 @@
import lombok.Builder;
import lombok.experimental.SuperBuilder;
@Builder
class Bar {
@Builder.Default
private final String bar = "FooBar";
private final String foo = "Foo";
public Bar(String bar, String foo) {
this.bar = bar;
<error descr="Cannot assign a value to final variable 'foo'">this.foo</error> = foo;
}
}
@SuperBuilder
class Foo {
@Builder.Default
private final String bar = "FooBar";
private final String foo = "Foo";
public Foo(String bar, String foo) {
this.bar = bar;
<error descr="Cannot assign a value to final variable 'foo'">this.foo</error> = foo;
}
}
public class BuilderWithDefaultReinitializeInConstructor {
public static void main(String[] args) {
new Bar("FooBar", "Foo");
new Foo("FooBar", "Foo");
}
}