From fe7f0db2fce7b4c80853b9aed100908ff1f55f40 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Wed, 10 Nov 2010 01:44:04 +0100 Subject: From now on it is possible to specify annotations to be placed on the method or the parameter of the generated getter/setter methods. --- .../resource/after-delombok/DataPlain.java | 52 ++++++++++++++++++++++ .../resource/after-delombok/GetterOnMethod.java | 39 ++++++++++++++++ .../resource/after-delombok/SetterOnMethod.java | 39 ++++++++++++++++ .../resource/after-delombok/SetterOnParam.java | 36 +++++++++++++++ .../after-delombok/SetterOnParamAndOnMethod.java | 8 ++++ test/transform/resource/after-ecj/DataPlain.java | 30 +++++++++++++ .../resource/after-ecj/GetterOnMethod.java | 40 +++++++++++++++++ .../resource/after-ecj/SetterOnMethod.java | 40 +++++++++++++++++ .../resource/after-ecj/SetterOnParam.java | 40 +++++++++++++++++ .../after-ecj/SetterOnParamAndOnMethod.java | 9 ++++ test/transform/resource/before/DataPlain.java | 6 +++ test/transform/resource/before/GetterOnMethod.java | 15 +++++++ test/transform/resource/before/SetterOnMethod.java | 15 +++++++ test/transform/resource/before/SetterOnParam.java | 15 +++++++ .../resource/before/SetterOnParamAndOnMethod.java | 3 ++ .../messages-delombok/GetterOnMethod.java.messages | 17 +++++++ .../messages-delombok/SetterOnMethod.java.messages | 17 +++++++ .../messages-delombok/SetterOnParam.java.messages | 17 +++++++ .../SetterOnParamAndOnMethod.java.messages | 6 +++ .../messages-ecj/GetterOnMethod.java.messages | 2 + .../messages-ecj/SetterOnMethod.java.messages | 2 + .../messages-ecj/SetterOnParam.java.messages | 2 + 22 files changed, 450 insertions(+) create mode 100644 test/transform/resource/after-delombok/GetterOnMethod.java create mode 100644 test/transform/resource/after-delombok/SetterOnMethod.java create mode 100644 test/transform/resource/after-delombok/SetterOnParam.java create mode 100644 test/transform/resource/after-delombok/SetterOnParamAndOnMethod.java create mode 100644 test/transform/resource/after-ecj/GetterOnMethod.java create mode 100644 test/transform/resource/after-ecj/SetterOnMethod.java create mode 100644 test/transform/resource/after-ecj/SetterOnParam.java create mode 100644 test/transform/resource/after-ecj/SetterOnParamAndOnMethod.java create mode 100644 test/transform/resource/before/GetterOnMethod.java create mode 100644 test/transform/resource/before/SetterOnMethod.java create mode 100644 test/transform/resource/before/SetterOnParam.java create mode 100644 test/transform/resource/before/SetterOnParamAndOnMethod.java create mode 100644 test/transform/resource/messages-delombok/GetterOnMethod.java.messages create mode 100644 test/transform/resource/messages-delombok/SetterOnMethod.java.messages create mode 100644 test/transform/resource/messages-delombok/SetterOnParam.java.messages create mode 100644 test/transform/resource/messages-delombok/SetterOnParamAndOnMethod.java.messages create mode 100644 test/transform/resource/messages-ecj/GetterOnMethod.java.messages create mode 100644 test/transform/resource/messages-ecj/SetterOnMethod.java.messages create mode 100644 test/transform/resource/messages-ecj/SetterOnParam.java.messages (limited to 'test/transform') diff --git a/test/transform/resource/after-delombok/DataPlain.java b/test/transform/resource/after-delombok/DataPlain.java index ef86f9d7..38e006ed 100644 --- a/test/transform/resource/after-delombok/DataPlain.java +++ b/test/transform/resource/after-delombok/DataPlain.java @@ -182,3 +182,55 @@ final class Data4 extends java.util.Timer { return result; } } +class Data5 { + @java.lang.SuppressWarnings("all") + public Data5() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof Data5)) return false; + final Data5 other = (Data5)o; + if (!other.canEqual(this)) return false; + return true; + } + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof Data5; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + int result = 1; + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "Data5()"; + } +} +final class Data6 { + @java.lang.SuppressWarnings("all") + public Data6() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof Data6)) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + int result = 1; + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "Data6()"; + } +} \ No newline at end of file diff --git a/test/transform/resource/after-delombok/GetterOnMethod.java b/test/transform/resource/after-delombok/GetterOnMethod.java new file mode 100644 index 00000000..0c18170b --- /dev/null +++ b/test/transform/resource/after-delombok/GetterOnMethod.java @@ -0,0 +1,39 @@ +class GetterOnMethod { + int i; + int j; + @Deprecated + @java.lang.SuppressWarnings("all") + public int getI() { + return this.i; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public int getJ() { + return this.j; + } +} +class GetterOnClassOnMethod { + int i; + int j; + @java.lang.SuppressWarnings("all") + public int getI() { + return this.i; + } + @java.lang.SuppressWarnings("all") + public int getJ() { + return this.j; + } +} +class GetterOnClassAndOnAField { + int i; + int j; + @java.lang.SuppressWarnings("all") + public int getI() { + return this.i; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public int getJ() { + return this.j; + } +} \ No newline at end of file diff --git a/test/transform/resource/after-delombok/SetterOnMethod.java b/test/transform/resource/after-delombok/SetterOnMethod.java new file mode 100644 index 00000000..b261ce92 --- /dev/null +++ b/test/transform/resource/after-delombok/SetterOnMethod.java @@ -0,0 +1,39 @@ +class SetterOnMethod { + int i; + int j; + @Deprecated + @java.lang.SuppressWarnings("all") + public void setI(final int i) { + this.i = i; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public void setJ(final int j) { + this.j = j; + } +} +class SetterOnClassOnMethod { + int i; + int j; + @java.lang.SuppressWarnings("all") + public void setI(final int i) { + this.i = i; + } + @java.lang.SuppressWarnings("all") + public void setJ(final int j) { + this.j = j; + } +} +class SetterOnClassAndOnAField { + int i; + int j; + @java.lang.SuppressWarnings("all") + public void setI(final int i) { + this.i = i; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public void setJ(final int j) { + this.j = j; + } +} \ No newline at end of file diff --git a/test/transform/resource/after-delombok/SetterOnParam.java b/test/transform/resource/after-delombok/SetterOnParam.java new file mode 100644 index 00000000..89a55e00 --- /dev/null +++ b/test/transform/resource/after-delombok/SetterOnParam.java @@ -0,0 +1,36 @@ +class SetterOnParam { + int i; + int j; + @java.lang.SuppressWarnings("all") + public void setI(@SuppressWarnings("all") final int i) { + this.i = i; + } + @java.lang.SuppressWarnings("all") + public void setJ(@java.lang.SuppressWarnings("all") final int j) { + this.j = j; + } +} +class SetterOnClassOnParam { + int i; + int j; + @java.lang.SuppressWarnings("all") + public void setI(final int i) { + this.i = i; + } + @java.lang.SuppressWarnings("all") + public void setJ(final int j) { + this.j = j; + } +} +class SetterOnClassAndOnAFieldParam { + int i; + int j; + @java.lang.SuppressWarnings("all") + public void setI(final int i) { + this.i = i; + } + @java.lang.SuppressWarnings("all") + public void setJ(@java.lang.SuppressWarnings("all") final int j) { + this.j = j; + } +} \ No newline at end of file diff --git a/test/transform/resource/after-delombok/SetterOnParamAndOnMethod.java b/test/transform/resource/after-delombok/SetterOnParamAndOnMethod.java new file mode 100644 index 00000000..a80c3462 --- /dev/null +++ b/test/transform/resource/after-delombok/SetterOnParamAndOnMethod.java @@ -0,0 +1,8 @@ +class SetterOnParamAndOnMethod { + int i; + @Deprecated + @java.lang.SuppressWarnings("all") + public void setI(@SuppressWarnings("all") final int i) { + this.i = i; + } +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/DataPlain.java b/test/transform/resource/after-ecj/DataPlain.java index d704a249..7cb60148 100644 --- a/test/transform/resource/after-ecj/DataPlain.java +++ b/test/transform/resource/after-ecj/DataPlain.java @@ -162,3 +162,33 @@ final @Data @lombok.EqualsAndHashCode(callSuper = true) class Data4 extends java super(); } } +@Data class Data5 { + public @java.lang.SuppressWarnings("all") Data5() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof Data5))) + return false; + final Data5 other = (Data5) o; + if ((! other.canEqual(this))) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof Data5); + } +} +final @Data class Data6 { + public @java.lang.SuppressWarnings("all") Data6() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof Data6))) + return false; + return true; + } +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/GetterOnMethod.java b/test/transform/resource/after-ecj/GetterOnMethod.java new file mode 100644 index 00000000..d7be009b --- /dev/null +++ b/test/transform/resource/after-ecj/GetterOnMethod.java @@ -0,0 +1,40 @@ +import lombok.Getter; +class GetterOnMethod { + @lombok.Getter() int i; + @lombok.Getter() int j; + public @Deprecated @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") int getJ() { + return this.j; + } + GetterOnMethod() { + super(); + } +} +@lombok.Getter() class GetterOnClassOnMethod { + int i; + int j; + public @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } + public @java.lang.SuppressWarnings("all") int getJ() { + return this.j; + } + GetterOnClassOnMethod() { + super(); + } +} +@lombok.Getter() class GetterOnClassAndOnAField { + int i; + @lombok.Getter() int j; + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") int getJ() { + return this.j; + } + public @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } + GetterOnClassAndOnAField() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/SetterOnMethod.java b/test/transform/resource/after-ecj/SetterOnMethod.java new file mode 100644 index 00000000..8cd9727b --- /dev/null +++ b/test/transform/resource/after-ecj/SetterOnMethod.java @@ -0,0 +1,40 @@ +import lombok.Setter; +class SetterOnMethod { + @lombok.Setter() int i; + @lombok.Setter() int j; + public @Deprecated @java.lang.SuppressWarnings("all") void setI(final int i) { + this.i = i; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") void setJ(final int j) { + this.j = j; + } + SetterOnMethod() { + super(); + } +} +@lombok.Setter() class SetterOnClassOnMethod { + int i; + int j; + public @java.lang.SuppressWarnings("all") void setI(final int i) { + this.i = i; + } + public @java.lang.SuppressWarnings("all") void setJ(final int j) { + this.j = j; + } + SetterOnClassOnMethod() { + super(); + } +} +@lombok.Setter() class SetterOnClassAndOnAField { + int i; + @lombok.Setter() int j; + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") void setJ(final int j) { + this.j = j; + } + public @java.lang.SuppressWarnings("all") void setI(final int i) { + this.i = i; + } + SetterOnClassAndOnAField() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/SetterOnParam.java b/test/transform/resource/after-ecj/SetterOnParam.java new file mode 100644 index 00000000..3ec7f098 --- /dev/null +++ b/test/transform/resource/after-ecj/SetterOnParam.java @@ -0,0 +1,40 @@ +import lombok.Setter; +class SetterOnParam { + @lombok.Setter() int i; + @lombok.Setter() int j; + public @java.lang.SuppressWarnings("all") void setI(final @SuppressWarnings("all") int i) { + this.i = i; + } + public @java.lang.SuppressWarnings("all") void setJ(final @java.lang.SuppressWarnings("all") int j) { + this.j = j; + } + SetterOnParam() { + super(); + } +} +@lombok.Setter() class SetterOnClassOnParam { + int i; + int j; + public @java.lang.SuppressWarnings("all") void setI(final int i) { + this.i = i; + } + public @java.lang.SuppressWarnings("all") void setJ(final int j) { + this.j = j; + } + SetterOnClassOnParam() { + super(); + } +} +@lombok.Setter() class SetterOnClassAndOnAFieldParam { + int i; + @lombok.Setter() int j; + public @java.lang.SuppressWarnings("all") void setJ(final @java.lang.SuppressWarnings("all") int j) { + this.j = j; + } + public @java.lang.SuppressWarnings("all") void setI(final int i) { + this.i = i; + } + SetterOnClassAndOnAFieldParam() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/SetterOnParamAndOnMethod.java b/test/transform/resource/after-ecj/SetterOnParamAndOnMethod.java new file mode 100644 index 00000000..8d77fc67 --- /dev/null +++ b/test/transform/resource/after-ecj/SetterOnParamAndOnMethod.java @@ -0,0 +1,9 @@ +class SetterOnParamAndOnMethod { + @lombok.Setter() int i; + public @Deprecated @java.lang.SuppressWarnings("all") void setI(final @SuppressWarnings("all") int i) { + this.i = i; + } + SetterOnParamAndOnMethod() { + super(); + } +} diff --git a/test/transform/resource/before/DataPlain.java b/test/transform/resource/before/DataPlain.java index 4151dd20..e2469d44 100644 --- a/test/transform/resource/before/DataPlain.java +++ b/test/transform/resource/before/DataPlain.java @@ -19,3 +19,9 @@ final class Data4 extends java.util.Timer { super(); } } +@Data +class Data5 { +} +@Data +final class Data6 { +} diff --git a/test/transform/resource/before/GetterOnMethod.java b/test/transform/resource/before/GetterOnMethod.java new file mode 100644 index 00000000..38b498de --- /dev/null +++ b/test/transform/resource/before/GetterOnMethod.java @@ -0,0 +1,15 @@ +import lombok.Getter; +class GetterOnMethod { + @lombok.Getter(onMethod=@Deprecated) int i; + @lombok.Getter(onMethod={@java.lang.Deprecated}) int j; +} +@lombok.Getter(onMethod=@Deprecated) +class GetterOnClassOnMethod { + int i; + int j; +} +@lombok.Getter(onMethod=@Deprecated) +class GetterOnClassAndOnAField { + int i; + @lombok.Getter(onMethod={@java.lang.Deprecated}) int j; +} diff --git a/test/transform/resource/before/SetterOnMethod.java b/test/transform/resource/before/SetterOnMethod.java new file mode 100644 index 00000000..d680b34b --- /dev/null +++ b/test/transform/resource/before/SetterOnMethod.java @@ -0,0 +1,15 @@ +import lombok.Setter; +class SetterOnMethod { + @lombok.Setter(onMethod=@Deprecated) int i; + @lombok.Setter(onMethod={@java.lang.Deprecated}) int j; +} +@lombok.Setter(onMethod=@Deprecated) +class SetterOnClassOnMethod { + int i; + int j; +} +@lombok.Setter(onMethod=@Deprecated) +class SetterOnClassAndOnAField { + int i; + @lombok.Setter(onMethod={@java.lang.Deprecated}) int j; +} diff --git a/test/transform/resource/before/SetterOnParam.java b/test/transform/resource/before/SetterOnParam.java new file mode 100644 index 00000000..12b90696 --- /dev/null +++ b/test/transform/resource/before/SetterOnParam.java @@ -0,0 +1,15 @@ +import lombok.Setter; +class SetterOnParam { + @lombok.Setter(onParam=@SuppressWarnings("all")) int i; + @lombok.Setter(onParam={@java.lang.SuppressWarnings("all")}) int j; +} +@lombok.Setter(onParam=@SuppressWarnings("all")) +class SetterOnClassOnParam { + int i; + int j; +} +@lombok.Setter(onParam=@SuppressWarnings("all")) +class SetterOnClassAndOnAFieldParam { + int i; + @lombok.Setter(onParam={@java.lang.SuppressWarnings("all")}) int j; +} diff --git a/test/transform/resource/before/SetterOnParamAndOnMethod.java b/test/transform/resource/before/SetterOnParamAndOnMethod.java new file mode 100644 index 00000000..b223fea8 --- /dev/null +++ b/test/transform/resource/before/SetterOnParamAndOnMethod.java @@ -0,0 +1,3 @@ +class SetterOnParamAndOnMethod { + @lombok.Setter(onMethod=@Deprecated,onParam=@SuppressWarnings("all")) int i; +} diff --git a/test/transform/resource/messages-delombok/GetterOnMethod.java.messages b/test/transform/resource/messages-delombok/GetterOnMethod.java.messages new file mode 100644 index 00000000..d437cb05 --- /dev/null +++ b/test/transform/resource/messages-delombok/GetterOnMethod.java.messages @@ -0,0 +1,17 @@ +3:34 ERROR incompatible types +found : java.lang.Deprecated +required: lombok.Getter.AnyAnnotation +4:44 ERROR incompatible types +found : java.lang.Deprecated +required: lombok.Getter.AnyAnnotation +6:26 ERROR incompatible types +found : java.lang.Deprecated +required: lombok.Getter.AnyAnnotation +11:26 ERROR incompatible types +found : java.lang.Deprecated +required: lombok.Getter.AnyAnnotation +14:44 ERROR incompatible types +found : java.lang.Deprecated +required: lombok.Getter.AnyAnnotation +6:1 ERROR 'onMethod' is not supported for @Getter on a type. +11:1 ERROR 'onMethod' is not supported for @Getter on a type. diff --git a/test/transform/resource/messages-delombok/SetterOnMethod.java.messages b/test/transform/resource/messages-delombok/SetterOnMethod.java.messages new file mode 100644 index 00000000..2df11f97 --- /dev/null +++ b/test/transform/resource/messages-delombok/SetterOnMethod.java.messages @@ -0,0 +1,17 @@ +3:34 ERROR incompatible types +found : java.lang.Deprecated +required: lombok.Setter.AnyAnnotation +4:44 ERROR incompatible types +found : java.lang.Deprecated +required: lombok.Setter.AnyAnnotation +6:26 ERROR incompatible types +found : java.lang.Deprecated +required: lombok.Setter.AnyAnnotation +11:26 ERROR incompatible types +found : java.lang.Deprecated +required: lombok.Setter.AnyAnnotation +14:44 ERROR incompatible types +found : java.lang.Deprecated +required: lombok.Setter.AnyAnnotation +6:1 ERROR 'onMethod' is not supported for @Setter on a type. +11:1 ERROR 'onMethod' is not supported for @Setter on a type. diff --git a/test/transform/resource/messages-delombok/SetterOnParam.java.messages b/test/transform/resource/messages-delombok/SetterOnParam.java.messages new file mode 100644 index 00000000..a18f1b83 --- /dev/null +++ b/test/transform/resource/messages-delombok/SetterOnParam.java.messages @@ -0,0 +1,17 @@ +3:33 ERROR incompatible types +found : java.lang.SuppressWarnings +required: lombok.Setter.AnyAnnotation +4:43 ERROR incompatible types +found : java.lang.SuppressWarnings +required: lombok.Setter.AnyAnnotation +6:25 ERROR incompatible types +found : java.lang.SuppressWarnings +required: lombok.Setter.AnyAnnotation +11:25 ERROR incompatible types +found : java.lang.SuppressWarnings +required: lombok.Setter.AnyAnnotation +14:43 ERROR incompatible types +found : java.lang.SuppressWarnings +required: lombok.Setter.AnyAnnotation +6:1 ERROR 'onParam' is not supported for @Setter on a type. +11:1 ERROR 'onParam' is not supported for @Setter on a type. diff --git a/test/transform/resource/messages-delombok/SetterOnParamAndOnMethod.java.messages b/test/transform/resource/messages-delombok/SetterOnParamAndOnMethod.java.messages new file mode 100644 index 00000000..b247b624 --- /dev/null +++ b/test/transform/resource/messages-delombok/SetterOnParamAndOnMethod.java.messages @@ -0,0 +1,6 @@ +2:34 ERROR incompatible types +found : java.lang.Deprecated +required: lombok.Setter.AnyAnnotation +2:54 ERROR incompatible types +found : java.lang.SuppressWarnings +required: lombok.Setter.AnyAnnotation \ No newline at end of file diff --git a/test/transform/resource/messages-ecj/GetterOnMethod.java.messages b/test/transform/resource/messages-ecj/GetterOnMethod.java.messages new file mode 100644 index 00000000..24e00370 --- /dev/null +++ b/test/transform/resource/messages-ecj/GetterOnMethod.java.messages @@ -0,0 +1,2 @@ +6 error 'onMethod' is not supported for @Getter on a type. +11 error 'onMethod' is not supported for @Getter on a type. \ No newline at end of file diff --git a/test/transform/resource/messages-ecj/SetterOnMethod.java.messages b/test/transform/resource/messages-ecj/SetterOnMethod.java.messages new file mode 100644 index 00000000..608489ce --- /dev/null +++ b/test/transform/resource/messages-ecj/SetterOnMethod.java.messages @@ -0,0 +1,2 @@ +6 error 'onMethod' is not supported for @Setter on a type. +11 error 'onMethod' is not supported for @Setter on a type. \ No newline at end of file diff --git a/test/transform/resource/messages-ecj/SetterOnParam.java.messages b/test/transform/resource/messages-ecj/SetterOnParam.java.messages new file mode 100644 index 00000000..d067b156 --- /dev/null +++ b/test/transform/resource/messages-ecj/SetterOnParam.java.messages @@ -0,0 +1,2 @@ +6 error 'onParam' is not supported for @Setter on a type. +11 error 'onParam' is not supported for @Setter on a type. \ No newline at end of file -- cgit