diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2022-02-08 06:02:05 +0100 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2022-02-08 06:02:05 +0100 |
commit | 261758b4448b3d48ff2f48926ffcb8ea66121603 (patch) | |
tree | 1996f090ab62b3626fe875406a294e724ad94a12 /test | |
parent | 8a914b1bf0eaa13178e719431add47b78d4e7277 (diff) | |
download | lombok-261758b4448b3d48ff2f48926ffcb8ea66121603.tar.gz lombok-261758b4448b3d48ff2f48926ffcb8ea66121603.tar.bz2 lombok-261758b4448b3d48ff2f48926ffcb8ea66121603.zip |
[implements #1456] accessors can now be made final via `@Accessors`.
Diffstat (limited to 'test')
16 files changed, 203 insertions, 2 deletions
diff --git a/test/transform/resource/after-delombok/AccessorsCascade.java b/test/transform/resource/after-delombok/AccessorsCascade.java new file mode 100644 index 00000000..ba4d13d4 --- /dev/null +++ b/test/transform/resource/after-delombok/AccessorsCascade.java @@ -0,0 +1,39 @@ +//CONF: lombok.Accessors.prefix += f +class AccessorsOuter { + private String fTest; + private String zTest2; + class AccessorsInner1 { + private String zTest3; + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public AccessorsOuter.AccessorsInner1 setTest3(final String zTest3) { + this.zTest3 = zTest3; + return this; + } + } + class AccessorsInner2 { + private String fTest4; + @java.lang.SuppressWarnings("all") + public void setTest4(final String fTest4) { + this.fTest4 = fTest4; + } + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public AccessorsOuter setTest(final String fTest) { + this.fTest = fTest; + return this; + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public AccessorsOuter setTest2(final String zTest2) { + this.zTest2 = zTest2; + return this; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/AccessorsMakeFinal.java b/test/transform/resource/after-delombok/AccessorsMakeFinal.java new file mode 100644 index 00000000..d88e8616 --- /dev/null +++ b/test/transform/resource/after-delombok/AccessorsMakeFinal.java @@ -0,0 +1,11 @@ +class AccessorsMakeFinal1 { + private String test; + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public final AccessorsMakeFinal1 test(final String test) { + this.test = test; + return this; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/AccessorsMakeFinalLombokConfig.java b/test/transform/resource/after-delombok/AccessorsMakeFinalLombokConfig.java new file mode 100644 index 00000000..61deedee --- /dev/null +++ b/test/transform/resource/after-delombok/AccessorsMakeFinalLombokConfig.java @@ -0,0 +1,7 @@ +class AccessorsMakeFinalLombokConfig { + private String test; + @java.lang.SuppressWarnings("all") + public final void setTest(final String test) { + this.test = test; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/AccessorsNoParamWarning.java b/test/transform/resource/after-delombok/AccessorsNoParamWarning.java new file mode 100644 index 00000000..3e9c4c5f --- /dev/null +++ b/test/transform/resource/after-delombok/AccessorsNoParamWarning.java @@ -0,0 +1,14 @@ +class AccessorsNoParams { + private String otherFieldWithOverride = ""; + @java.lang.SuppressWarnings("all") + public String otherFieldWithOverride() { + return this.otherFieldWithOverride; + } +} +class AccessorsNoParams2 { + private boolean foo; + @java.lang.SuppressWarnings("all") + public void setFoo(final boolean foo) { + this.foo = foo; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/Accessors.java b/test/transform/resource/after-ecj/Accessors.java index cdc7b146..149d16f9 100644 --- a/test/transform/resource/after-ecj/Accessors.java +++ b/test/transform/resource/after-ecj/Accessors.java @@ -16,7 +16,7 @@ class AccessorsFluent { } @lombok.experimental.Accessors(fluent = true) @lombok.Getter class AccessorsFluentOnClass { private @lombok.Setter String fieldName = ""; - private @lombok.experimental.Accessors String otherFieldWithOverride = ""; + private @lombok.experimental.Accessors(fluent = false) String otherFieldWithOverride = ""; AccessorsFluentOnClass() { super(); } diff --git a/test/transform/resource/after-ecj/AccessorsCascade.java b/test/transform/resource/after-ecj/AccessorsCascade.java new file mode 100644 index 00000000..cacd338f --- /dev/null +++ b/test/transform/resource/after-ecj/AccessorsCascade.java @@ -0,0 +1,43 @@ +@lombok.experimental.Accessors(chain = true) class AccessorsOuter { + class AccessorsInner1 { + private @lombok.experimental.Accessors(prefix = "z") @lombok.Setter String zTest3; + AccessorsInner1() { + super(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") AccessorsOuter.AccessorsInner1 setTest3(final String zTest3) { + this.zTest3 = zTest3; + return this; + } + } + @lombok.experimental.Accessors(chain = false) class AccessorsInner2 { + private @lombok.Setter String fTest4; + AccessorsInner2() { + super(); + } + public @java.lang.SuppressWarnings("all") void setTest4(final String fTest4) { + this.fTest4 = fTest4; + } + } + private @lombok.Setter String fTest; + private @lombok.experimental.Accessors(prefix = "z") @lombok.Setter String zTest2; + AccessorsOuter() { + super(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") AccessorsOuter setTest(final String fTest) { + this.fTest = fTest; + return this; + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") AccessorsOuter setTest2(final String zTest2) { + this.zTest2 = zTest2; + return this; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/AccessorsMakeFinal.java b/test/transform/resource/after-ecj/AccessorsMakeFinal.java new file mode 100644 index 00000000..c8ac4bbd --- /dev/null +++ b/test/transform/resource/after-ecj/AccessorsMakeFinal.java @@ -0,0 +1,13 @@ +@lombok.experimental.Accessors(makeFinal = true) class AccessorsMakeFinal1 { + private @lombok.Setter @lombok.experimental.Accessors(fluent = true) String test; + AccessorsMakeFinal1() { + super(); + } + /** + * @return {@code this}. + */ + public final @java.lang.SuppressWarnings("all") AccessorsMakeFinal1 test(final String test) { + this.test = test; + return this; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/AccessorsMakeFinalLombokConfig.java b/test/transform/resource/after-ecj/AccessorsMakeFinalLombokConfig.java new file mode 100644 index 00000000..f7c411e3 --- /dev/null +++ b/test/transform/resource/after-ecj/AccessorsMakeFinalLombokConfig.java @@ -0,0 +1,9 @@ +class AccessorsMakeFinalLombokConfig { + private @lombok.Setter String test; + AccessorsMakeFinalLombokConfig() { + super(); + } + public final @java.lang.SuppressWarnings("all") void setTest(final String test) { + this.test = test; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/AccessorsNoParamWarning.java b/test/transform/resource/after-ecj/AccessorsNoParamWarning.java new file mode 100644 index 00000000..e5d2d905 --- /dev/null +++ b/test/transform/resource/after-ecj/AccessorsNoParamWarning.java @@ -0,0 +1,18 @@ +@lombok.experimental.Accessors(fluent = true) class AccessorsNoParams { + private @lombok.Getter @lombok.experimental.Accessors String otherFieldWithOverride = ""; + AccessorsNoParams() { + super(); + } + public @java.lang.SuppressWarnings("all") String otherFieldWithOverride() { + return this.otherFieldWithOverride; + } +} +@lombok.experimental.Accessors class AccessorsNoParams2 { + private @lombok.Setter boolean foo; + AccessorsNoParams2() { + super(); + } + public @java.lang.SuppressWarnings("all") void setFoo(final boolean foo) { + this.foo = foo; + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/Accessors.java b/test/transform/resource/before/Accessors.java index 3ef8a02f..54430cd6 100644 --- a/test/transform/resource/before/Accessors.java +++ b/test/transform/resource/before/Accessors.java @@ -7,7 +7,7 @@ class AccessorsFluent { @lombok.Getter class AccessorsFluentOnClass { @lombok.Setter private String fieldName = ""; - @lombok.experimental.Accessors private String otherFieldWithOverride = ""; + @lombok.experimental.Accessors(fluent=false) private String otherFieldWithOverride = ""; } class AccessorsChain { diff --git a/test/transform/resource/before/AccessorsCascade.java b/test/transform/resource/before/AccessorsCascade.java new file mode 100644 index 00000000..8ad141f8 --- /dev/null +++ b/test/transform/resource/before/AccessorsCascade.java @@ -0,0 +1,23 @@ +//CONF: lombok.Accessors.prefix += f + +@lombok.experimental.Accessors(chain=true) +class AccessorsOuter { + @lombok.Setter + private String fTest; + + @lombok.experimental.Accessors(prefix="z") + @lombok.Setter + private String zTest2; + + class AccessorsInner1 { + @lombok.experimental.Accessors(prefix="z") + @lombok.Setter + private String zTest3; + } + + @lombok.experimental.Accessors(chain=false) + class AccessorsInner2 { + @lombok.Setter + private String fTest4; + } +} diff --git a/test/transform/resource/before/AccessorsMakeFinal.java b/test/transform/resource/before/AccessorsMakeFinal.java new file mode 100644 index 00000000..5c45873a --- /dev/null +++ b/test/transform/resource/before/AccessorsMakeFinal.java @@ -0,0 +1,5 @@ +@lombok.experimental.Accessors(makeFinal = true) +class AccessorsMakeFinal1 { + @lombok.Setter @lombok.experimental.Accessors(fluent = true) + private String test; +} diff --git a/test/transform/resource/before/AccessorsMakeFinalLombokConfig.java b/test/transform/resource/before/AccessorsMakeFinalLombokConfig.java new file mode 100644 index 00000000..8e948520 --- /dev/null +++ b/test/transform/resource/before/AccessorsMakeFinalLombokConfig.java @@ -0,0 +1,6 @@ +//CONF: lombok.Accessors.makeFinal = true + +class AccessorsMakeFinalLombokConfig { + @lombok.Setter + private String test; +} diff --git a/test/transform/resource/before/AccessorsNoParamWarning.java b/test/transform/resource/before/AccessorsNoParamWarning.java new file mode 100644 index 00000000..572b2178 --- /dev/null +++ b/test/transform/resource/before/AccessorsNoParamWarning.java @@ -0,0 +1,9 @@ +@lombok.experimental.Accessors(fluent=true) +class AccessorsNoParams { + @lombok.Getter @lombok.experimental.Accessors private String otherFieldWithOverride = ""; +} + +@lombok.experimental.Accessors +class AccessorsNoParams2 { + @lombok.Setter private boolean foo; +} diff --git a/test/transform/resource/messages-delombok/AccessorsNoParamWarning.java.messages b/test/transform/resource/messages-delombok/AccessorsNoParamWarning.java.messages new file mode 100644 index 00000000..29215afe --- /dev/null +++ b/test/transform/resource/messages-delombok/AccessorsNoParamWarning.java.messages @@ -0,0 +1,2 @@ +3 Accessors on its own does nothing. Set at least one parameter +6 Accessors on its own does nothing. Set at least one parameter
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/AccessorsNoParamWarning.java.messages b/test/transform/resource/messages-ecj/AccessorsNoParamWarning.java.messages new file mode 100644 index 00000000..29215afe --- /dev/null +++ b/test/transform/resource/messages-ecj/AccessorsNoParamWarning.java.messages @@ -0,0 +1,2 @@ +3 Accessors on its own does nothing. Set at least one parameter +6 Accessors on its own does nothing. Set at least one parameter
\ No newline at end of file |