diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2021-03-21 05:24:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-21 05:24:46 +0100 |
commit | 8e23c10a999e08c37b83cdd51dac5f224a1394cd (patch) | |
tree | 7e900ab2aca0705017ab0f35b32cdba742979caa | |
parent | fb455f4634a673d1c28a82caed18c4a171466335 (diff) | |
parent | 70951d4dd7eb82500bb8de98749ae136d9a38d78 (diff) | |
download | lombok-8e23c10a999e08c37b83cdd51dac5f224a1394cd.tar.gz lombok-8e23c10a999e08c37b83cdd51dac5f224a1394cd.tar.bz2 lombok-8e23c10a999e08c37b83cdd51dac5f224a1394cd.zip |
Merge pull request #2725 from md-5/master
[fixes #2724] Increase priority of Builder annotation removal
11 files changed, 99 insertions, 10 deletions
@@ -25,6 +25,7 @@ Maarten Mulders <mthmulders@users.noreply.github.com> Mark Haynes <markhaynes.work@gmail.com> Mart Hagenaars <marthagenaars@gmail.com> Mateusz Matela <mateusz.matela@gmail.com> +Michael Dardis <git@md-5.net> Michael Ernst <mernst@alum.mit.edu> Michiel Verheul <cheelio@gmail.com> Pascal Bihler <pascal@qfs.de> @@ -49,4 +50,4 @@ Till Brychcy <till.brychcy@mercateo.com> Victor Williams Stafusa da Silva <victorwssilva@gmail.com> Yun Zhi Lin <yun@yunspace.com> -By adding your name to this list, you grant full and irrevocable copyright and patent indemnity to Project Lombok and all use of Project Lombok, and you certify that you have the right to do so for all commits you add to Project Lombok. +By adding your name to this list, you grant full and irrevocable copyright and patent indemnity to Project Lombok and all use of Project Lombok in relation to all commits you add to Project Lombok, and you certify that you have the right to do so. diff --git a/src/core/lombok/javac/handlers/HandleBuilderDefaultRemove.java b/src/core/lombok/javac/handlers/HandleBuilderDefaultRemove.java index 510784d6..d7bc28cb 100644 --- a/src/core/lombok/javac/handlers/HandleBuilderDefaultRemove.java +++ b/src/core/lombok/javac/handlers/HandleBuilderDefaultRemove.java @@ -35,7 +35,7 @@ import lombok.javac.JavacNode; import lombok.spi.Provides; @Provides -@HandlerPriority(65536) +@HandlerPriority(32768) @AlreadyHandledAnnotations public class HandleBuilderDefaultRemove extends JavacAnnotationHandler<Builder.Default> { @Override public void handle(AnnotationValues<Default> annotation, JCAnnotation ast, JavacNode annotationNode) { diff --git a/src/core/lombok/javac/handlers/HandleBuilderRemove.java b/src/core/lombok/javac/handlers/HandleBuilderRemove.java index 7cfcf273..a47ed6b0 100644 --- a/src/core/lombok/javac/handlers/HandleBuilderRemove.java +++ b/src/core/lombok/javac/handlers/HandleBuilderRemove.java @@ -34,7 +34,7 @@ import lombok.javac.JavacNode; import lombok.spi.Provides; @Provides -@HandlerPriority(65536) +@HandlerPriority(32768) @AlreadyHandledAnnotations public class HandleBuilderRemove extends JavacAnnotationHandler<Builder> { @Override public void handle(AnnotationValues<Builder> annotation, JCAnnotation ast, JavacNode annotationNode) { diff --git a/src/core/lombok/javac/handlers/HandleSuperBuilderRemove.java b/src/core/lombok/javac/handlers/HandleSuperBuilderRemove.java index fed75876..d3db5ef4 100644 --- a/src/core/lombok/javac/handlers/HandleSuperBuilderRemove.java +++ b/src/core/lombok/javac/handlers/HandleSuperBuilderRemove.java @@ -34,7 +34,7 @@ import lombok.javac.JavacNode; import lombok.spi.Provides; @Provides -@HandlerPriority(65536) +@HandlerPriority(32768) @AlreadyHandledAnnotations public class HandleSuperBuilderRemove extends JavacAnnotationHandler<SuperBuilder> { @Override public void handle(AnnotationValues<SuperBuilder> annotation, JCAnnotation ast, JavacNode annotationNode) { 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; +} |