diff options
author | md_5 <git@md-5.net> | 2021-03-20 13:17:15 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2021-03-20 13:18:50 +1100 |
commit | 70951d4dd7eb82500bb8de98749ae136d9a38d78 (patch) | |
tree | 4f7cbdc1a688628b60eee67e3274915571fdf157 /test/transform/resource | |
parent | c6076730de3b7b587ca0e1d6e31f5e7bd6ab6761 (diff) | |
download | lombok-70951d4dd7eb82500bb8de98749ae136d9a38d78.tar.gz lombok-70951d4dd7eb82500bb8de98749ae136d9a38d78.tar.bz2 lombok-70951d4dd7eb82500bb8de98749ae136d9a38d78.zip |
[fixes #2724] Increase priority of Builder annotation removal
Otherwise they may run after `HandleDelegate`. This is problematic as
`HandleDelegate` parses the compulation unit and `@Builder` may contain imports
(eg `AccessLevel`) that were already removed by other processors, eg `@Getter`.
Diffstat (limited to 'test/transform/resource')
7 files changed, 94 insertions, 6 deletions
diff --git a/test/transform/resource/after-delombok/BuilderAccessWithGetter.java b/test/transform/resource/after-delombok/BuilderAccessWithGetter.java new file mode 100644 index 00000000..f36403bf --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderAccessWithGetter.java @@ -0,0 +1,49 @@ +public final class BuilderAccessWithGetter { + private final String string; + + @java.lang.SuppressWarnings("all") + BuilderAccessWithGetter(final String string) { + this.string = string; + } + + + @java.lang.SuppressWarnings("all") + private static class BuilderAccessWithGetterBuilder { + @java.lang.SuppressWarnings("all") + private String string; + + @java.lang.SuppressWarnings("all") + BuilderAccessWithGetterBuilder() { + } + + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + private BuilderAccessWithGetter.BuilderAccessWithGetterBuilder string(final String string) { + this.string = string; + return this; + } + + @java.lang.SuppressWarnings("all") + private BuilderAccessWithGetter build() { + return new BuilderAccessWithGetter(this.string); + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderAccessWithGetter.BuilderAccessWithGetterBuilder(string=" + this.string + ")"; + } + } + + @java.lang.SuppressWarnings("all") + private static BuilderAccessWithGetter.BuilderAccessWithGetterBuilder builder() { + return new BuilderAccessWithGetter.BuilderAccessWithGetterBuilder(); + } + + @java.lang.SuppressWarnings("all") + public String getString() { + return this.string; + } +} diff --git a/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java b/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java index 2b0a6d3b..c7e37abe 100644 --- a/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java +++ b/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java @@ -1,6 +1,4 @@ //skip-idempotent -import lombok.Builder; -@Builder public class BuilderDefaultsWarnings { long x = System.currentTimeMillis(); final int y = 5; @@ -87,7 +85,6 @@ public class BuilderDefaultsWarnings { } class NoBuilderButHasDefaults { private final long z = 5; - @Builder public NoBuilderButHasDefaults() { } @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/BuilderSingularNoAuto.java b/test/transform/resource/after-delombok/BuilderSingularNoAuto.java index 8c30f926..de86383f 100644 --- a/test/transform/resource/after-delombok/BuilderSingularNoAuto.java +++ b/test/transform/resource/after-delombok/BuilderSingularNoAuto.java @@ -1,6 +1,5 @@ //skip-idempotent import java.util.List; -@lombok.Builder class BuilderSingularNoAuto { private List<String> things; private List<String> widgets; diff --git a/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java index 4207cf74..8858f145 100644 --- a/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java @@ -1,6 +1,5 @@ //skip-idempotent import java.util.List; -@lombok.Builder(setterPrefix = "with") class BuilderSingularNoAutoWithSetterPrefix { private List<String> things; private List<String> widgets; diff --git a/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java b/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java index d26b4ee4..1ed38f05 100644 --- a/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java +++ b/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java @@ -1,5 +1,4 @@ //skip-idempotent -@lombok.experimental.SuperBuilder @com.fasterxml.jackson.databind.annotation.JsonDeserialize public class JacksonizedSuperBuilderWithJsonDeserialize { int field1; diff --git a/test/transform/resource/after-ecj/BuilderAccessWithGetter.java b/test/transform/resource/after-ecj/BuilderAccessWithGetter.java new file mode 100644 index 00000000..7ad5fa6a --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderAccessWithGetter.java @@ -0,0 +1,35 @@ +import lombok.AccessLevel; +import lombok.Builder; +import lombok.Getter; +public final @Builder(access = AccessLevel.PRIVATE) class BuilderAccessWithGetter { + private static @java.lang.SuppressWarnings("all") class BuilderAccessWithGetterBuilder { + private @java.lang.SuppressWarnings("all") String string; + @java.lang.SuppressWarnings("all") BuilderAccessWithGetterBuilder() { + super(); + } + /** + * @return {@code this}. + */ + private @java.lang.SuppressWarnings("all") BuilderAccessWithGetter.BuilderAccessWithGetterBuilder string(final String string) { + this.string = string; + return this; + } + private @java.lang.SuppressWarnings("all") BuilderAccessWithGetter build() { + return new BuilderAccessWithGetter(this.string); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderAccessWithGetter.BuilderAccessWithGetterBuilder(string=" + this.string) + ")"); + } + } + private final @Getter String string; + @java.lang.SuppressWarnings("all") BuilderAccessWithGetter(final String string) { + super(); + this.string = string; + } + private static @java.lang.SuppressWarnings("all") BuilderAccessWithGetter.BuilderAccessWithGetterBuilder builder() { + return new BuilderAccessWithGetter.BuilderAccessWithGetterBuilder(); + } + public @java.lang.SuppressWarnings("all") String getString() { + return this.string; + } +} diff --git a/test/transform/resource/before/BuilderAccessWithGetter.java b/test/transform/resource/before/BuilderAccessWithGetter.java new file mode 100644 index 00000000..38212ecf --- /dev/null +++ b/test/transform/resource/before/BuilderAccessWithGetter.java @@ -0,0 +1,10 @@ +import lombok.AccessLevel; +import lombok.Builder; +import lombok.Getter; + +@Builder(access = AccessLevel.PRIVATE) +public final class BuilderAccessWithGetter { + + @Getter + private final String string; +} |