-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fixes #2046] you can now suppress the builder() method, useful if yo…
…u only want toBuilder(). Also suppresses the warnings about any missing Builder.Default annotations.
- Loading branch information
1 parent
535e209
commit 228e99f
Showing
8 changed files
with
118 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
test/transform/resource/after-delombok/BuilderWithNoBuilderMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class BuilderWithNoBuilderMethod { | ||
private String a = ""; | ||
@java.lang.SuppressWarnings("all") | ||
BuilderWithNoBuilderMethod(final String a) { | ||
this.a = a; | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
public static class BuilderWithNoBuilderMethodBuilder { | ||
@java.lang.SuppressWarnings("all") | ||
private String a; | ||
@java.lang.SuppressWarnings("all") | ||
BuilderWithNoBuilderMethodBuilder() { | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
public BuilderWithNoBuilderMethodBuilder a(final String a) { | ||
this.a = a; | ||
return this; | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
public BuilderWithNoBuilderMethod build() { | ||
return new BuilderWithNoBuilderMethod(a); | ||
} | ||
@java.lang.Override | ||
@java.lang.SuppressWarnings("all") | ||
public java.lang.String toString() { | ||
return "BuilderWithNoBuilderMethod.BuilderWithNoBuilderMethodBuilder(a=" + this.a + ")"; | ||
} | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
public BuilderWithNoBuilderMethodBuilder toBuilder() { | ||
return new BuilderWithNoBuilderMethodBuilder().a(this.a); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
test/transform/resource/after-ecj/BuilderWithNoBuilderMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import lombok.Builder; | ||
@Builder(toBuilder = true,builderMethodName = "") class BuilderWithNoBuilderMethod { | ||
public static @java.lang.SuppressWarnings("all") class BuilderWithNoBuilderMethodBuilder { | ||
private @java.lang.SuppressWarnings("all") String a; | ||
@java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder() { | ||
super(); | ||
} | ||
public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder a(final String a) { | ||
this.a = a; | ||
return this; | ||
} | ||
public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethod build() { | ||
return new BuilderWithNoBuilderMethod(a); | ||
} | ||
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { | ||
return (("BuilderWithNoBuilderMethod.BuilderWithNoBuilderMethodBuilder(a=" + this.a) + ")"); | ||
} | ||
} | ||
private String a = ""; | ||
@java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethod(final String a) { | ||
super(); | ||
this.a = a; | ||
} | ||
public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder toBuilder() { | ||
return new BuilderWithNoBuilderMethodBuilder().a(this.a); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
test/transform/resource/before/BuilderWithNoBuilderMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import lombok.Builder; | ||
@Builder(toBuilder = true, builderMethodName = "") | ||
class BuilderWithNoBuilderMethod { | ||
private String a = ""; | ||
} |
2 changes: 1 addition & 1 deletion
2
test/transform/resource/messages-delombok/BuilderDefaultsWarnings.java.messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
13 @Builder.Default requires @Builder on the class for it to mean anything. | ||
6 @Builder will ignore the initializing expression entirely. If you want the initializing expression to serve as default, add @Builder.Default. If it is not supposed to be settable during building, make the field final. | ||
8 @Builder.Default requires an initializing expression (' = something;'). | ||
9 @Builder.Default and @Singular cannot be mixed. | ||
6 @Builder will ignore the initializing expression entirely. If you want the initializing expression to serve as default, add @Builder.Default. If it is not supposed to be settable during building, make the field final. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters