forked from projectlombok/lombok
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fixes projectlombok#3053] Delay default annotation removal
- Loading branch information
Showing
6 changed files
with
180 additions
and
2 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
94 changes: 94 additions & 0 deletions
94
test/transform/resource/after-delombok/ConstructorsWithSuperBuilderDefaults.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,94 @@ | ||
class ConstructorsWithSuperBuilderDefaults { | ||
int x; | ||
int y; | ||
|
||
@java.lang.SuppressWarnings("all") | ||
private static int $default$x() { | ||
return 5; | ||
} | ||
|
||
|
||
@java.lang.SuppressWarnings("all") | ||
public static abstract class ConstructorsWithSuperBuilderDefaultsBuilder<C extends ConstructorsWithSuperBuilderDefaults, B extends ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilder<C, B>> { | ||
@java.lang.SuppressWarnings("all") | ||
private boolean x$set; | ||
@java.lang.SuppressWarnings("all") | ||
private int x$value; | ||
@java.lang.SuppressWarnings("all") | ||
private int y; | ||
|
||
@java.lang.SuppressWarnings("all") | ||
protected abstract B self(); | ||
|
||
@java.lang.SuppressWarnings("all") | ||
public abstract C build(); | ||
|
||
/** | ||
* @return {@code this}. | ||
*/ | ||
@java.lang.SuppressWarnings("all") | ||
public B x(final int x) { | ||
this.x$value = x; | ||
x$set = true; | ||
return self(); | ||
} | ||
|
||
/** | ||
* @return {@code this}. | ||
*/ | ||
@java.lang.SuppressWarnings("all") | ||
public B y(final int y) { | ||
this.y = y; | ||
return self(); | ||
} | ||
|
||
@java.lang.Override | ||
@java.lang.SuppressWarnings("all") | ||
public java.lang.String toString() { | ||
return "ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilder(x$value=" + this.x$value + ", y=" + this.y + ")"; | ||
} | ||
} | ||
|
||
|
||
@java.lang.SuppressWarnings("all") | ||
private static final class ConstructorsWithSuperBuilderDefaultsBuilderImpl extends ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilder<ConstructorsWithSuperBuilderDefaults, ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilderImpl> { | ||
@java.lang.SuppressWarnings("all") | ||
private ConstructorsWithSuperBuilderDefaultsBuilderImpl() { | ||
} | ||
|
||
@java.lang.Override | ||
@java.lang.SuppressWarnings("all") | ||
protected ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilderImpl self() { | ||
return this; | ||
} | ||
|
||
@java.lang.Override | ||
@java.lang.SuppressWarnings("all") | ||
public ConstructorsWithSuperBuilderDefaults build() { | ||
return new ConstructorsWithSuperBuilderDefaults(this); | ||
} | ||
} | ||
|
||
@java.lang.SuppressWarnings("all") | ||
protected ConstructorsWithSuperBuilderDefaults(final ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilder<?, ?> b) { | ||
if (b.x$set) this.x = b.x$value; | ||
else this.x = ConstructorsWithSuperBuilderDefaults.$default$x(); | ||
this.y = b.y; | ||
} | ||
|
||
@java.lang.SuppressWarnings("all") | ||
public static ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilder<?, ?> builder() { | ||
return new ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilderImpl(); | ||
} | ||
|
||
@java.lang.SuppressWarnings("all") | ||
public ConstructorsWithSuperBuilderDefaults() { | ||
this.x = ConstructorsWithSuperBuilderDefaults.$default$x(); | ||
} | ||
|
||
@java.lang.SuppressWarnings("all") | ||
public ConstructorsWithSuperBuilderDefaults(final int x, final int y) { | ||
this.x = x; | ||
this.y = y; | ||
} | ||
} |
1 change: 0 additions & 1 deletion
1
test/transform/resource/after-delombok/SuperBuilderWithDefaultsAndTargetTyping.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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import java.util.Arrays; | ||
import lombok.Builder; | ||
|
||
public class SuperBuilderWithDefaultsAndTargetTyping { | ||
|
||
|
70 changes: 70 additions & 0 deletions
70
test/transform/resource/after-ecj/ConstructorsWithSuperBuilderDefaults.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,70 @@ | ||
import lombok.AllArgsConstructor; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
import lombok.Builder; | ||
@NoArgsConstructor @AllArgsConstructor @SuperBuilder class ConstructorsWithSuperBuilderDefaults { | ||
public static abstract @java.lang.SuppressWarnings("all") class ConstructorsWithSuperBuilderDefaultsBuilder<C extends ConstructorsWithSuperBuilderDefaults, B extends ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilder<C, B>> { | ||
private @java.lang.SuppressWarnings("all") int x$value; | ||
private @java.lang.SuppressWarnings("all") boolean x$set; | ||
private @java.lang.SuppressWarnings("all") int y; | ||
public ConstructorsWithSuperBuilderDefaultsBuilder() { | ||
super(); | ||
} | ||
protected abstract @java.lang.SuppressWarnings("all") B self(); | ||
public abstract @java.lang.SuppressWarnings("all") C build(); | ||
/** | ||
* @return {@code this}. | ||
*/ | ||
public @java.lang.SuppressWarnings("all") B x(final int x) { | ||
this.x$value = x; | ||
x$set = true; | ||
return self(); | ||
} | ||
/** | ||
* @return {@code this}. | ||
*/ | ||
public @java.lang.SuppressWarnings("all") B y(final int y) { | ||
this.y = y; | ||
return self(); | ||
} | ||
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { | ||
return (((("ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilder(x$value=" + this.x$value) + ", y=") + this.y) + ")"); | ||
} | ||
} | ||
private static final @java.lang.SuppressWarnings("all") class ConstructorsWithSuperBuilderDefaultsBuilderImpl extends ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilder<ConstructorsWithSuperBuilderDefaults, ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilderImpl> { | ||
private ConstructorsWithSuperBuilderDefaultsBuilderImpl() { | ||
super(); | ||
} | ||
protected @java.lang.Override @java.lang.SuppressWarnings("all") ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilderImpl self() { | ||
return this; | ||
} | ||
public @java.lang.Override @java.lang.SuppressWarnings("all") ConstructorsWithSuperBuilderDefaults build() { | ||
return new ConstructorsWithSuperBuilderDefaults(this); | ||
} | ||
} | ||
@Builder.Default int x; | ||
int y; | ||
private static @java.lang.SuppressWarnings("all") int $default$x() { | ||
return 5; | ||
} | ||
protected @java.lang.SuppressWarnings("all") ConstructorsWithSuperBuilderDefaults(final ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilder<?, ?> b) { | ||
super(); | ||
if (b.x$set) | ||
this.x = b.x$value; | ||
else | ||
this.x = ConstructorsWithSuperBuilderDefaults.$default$x(); | ||
this.y = b.y; | ||
} | ||
public static @java.lang.SuppressWarnings("all") ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilder<?, ?> builder() { | ||
return new ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilderImpl(); | ||
} | ||
public @java.lang.SuppressWarnings("all") ConstructorsWithSuperBuilderDefaults() { | ||
super(); | ||
this.x = ConstructorsWithSuperBuilderDefaults.$default$x(); | ||
} | ||
public @java.lang.SuppressWarnings("all") ConstructorsWithSuperBuilderDefaults(final int x, final int y) { | ||
super(); | ||
this.x = x; | ||
this.y = y; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
test/transform/resource/before/ConstructorsWithSuperBuilderDefaults.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,12 @@ | ||
import lombok.AllArgsConstructor; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
import lombok.Builder; | ||
|
||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@SuperBuilder | ||
class ConstructorsWithSuperBuilderDefaults { | ||
@Builder.Default int x = 5; | ||
int y; | ||
} |