-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2770 from janrieke/superBuilderNPEinConstructorEx…
…ists [fixes #2704] SuperBuilder: avoid NPE on existing constructors
- Loading branch information
Showing
4 changed files
with
77 additions
and
1 deletion.
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
39 changes: 39 additions & 0 deletions
39
test/transform/resource/after-delombok/SuperBuilderWithExistingConstuctor.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,39 @@ | ||
public class SuperBuilderWithExistingConstuctor { | ||
public SuperBuilderWithExistingConstuctor() { | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
public static abstract class SuperBuilderWithExistingConstuctorBuilder<C extends SuperBuilderWithExistingConstuctor, B extends SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilder<C, B>> { | ||
@java.lang.SuppressWarnings("all") | ||
protected abstract B self(); | ||
@java.lang.SuppressWarnings("all") | ||
public abstract C build(); | ||
@java.lang.Override | ||
@java.lang.SuppressWarnings("all") | ||
public java.lang.String toString() { | ||
return "SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilder()"; | ||
} | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
private static final class SuperBuilderWithExistingConstuctorBuilderImpl extends SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilder<SuperBuilderWithExistingConstuctor, SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilderImpl> { | ||
@java.lang.SuppressWarnings("all") | ||
private SuperBuilderWithExistingConstuctorBuilderImpl() { | ||
} | ||
@java.lang.Override | ||
@java.lang.SuppressWarnings("all") | ||
protected SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilderImpl self() { | ||
return this; | ||
} | ||
@java.lang.Override | ||
@java.lang.SuppressWarnings("all") | ||
public SuperBuilderWithExistingConstuctor build() { | ||
return new SuperBuilderWithExistingConstuctor(this); | ||
} | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
protected SuperBuilderWithExistingConstuctor(final SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilder<?, ?> b) { | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
public static SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilder<?, ?> builder() { | ||
return new SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilderImpl(); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
test/transform/resource/after-ecj/SuperBuilderWithExistingConstuctor.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,32 @@ | ||
public @lombok.experimental.SuperBuilder class SuperBuilderWithExistingConstuctor { | ||
public static abstract @java.lang.SuppressWarnings("all") class SuperBuilderWithExistingConstuctorBuilder<C extends SuperBuilderWithExistingConstuctor, B extends SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilder<C, B>> { | ||
public SuperBuilderWithExistingConstuctorBuilder() { | ||
super(); | ||
} | ||
protected abstract @java.lang.SuppressWarnings("all") B self(); | ||
public abstract @java.lang.SuppressWarnings("all") C build(); | ||
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { | ||
return "SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilder()"; | ||
} | ||
} | ||
private static final @java.lang.SuppressWarnings("all") class SuperBuilderWithExistingConstuctorBuilderImpl extends SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilder<SuperBuilderWithExistingConstuctor, SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilderImpl> { | ||
private SuperBuilderWithExistingConstuctorBuilderImpl() { | ||
super(); | ||
} | ||
protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilderImpl self() { | ||
return this; | ||
} | ||
public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithExistingConstuctor build() { | ||
return new SuperBuilderWithExistingConstuctor(this); | ||
} | ||
} | ||
public SuperBuilderWithExistingConstuctor() { | ||
super(); | ||
} | ||
protected @java.lang.SuppressWarnings("all") SuperBuilderWithExistingConstuctor(final SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilder<?, ?> b) { | ||
super(); | ||
} | ||
public static @java.lang.SuppressWarnings("all") SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilder<?, ?> builder() { | ||
return new SuperBuilderWithExistingConstuctor.SuperBuilderWithExistingConstuctorBuilderImpl(); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
test/transform/resource/before/SuperBuilderWithExistingConstuctor.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 @@ | ||
@lombok.experimental.SuperBuilder | ||
public class SuperBuilderWithExistingConstuctor { | ||
public SuperBuilderWithExistingConstuctor() { | ||
} | ||
} |