diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-02-11 22:34:48 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-02-11 22:34:48 +0100 |
commit | aafd83079a3000d3deb6e40a182849da2509fbfb (patch) | |
tree | cf87951eee9bb098bb96ecc3c02c6f1ab34c405d /test/transform/resource | |
parent | ef8769d3180b2c6de91a64f69dfa23a2e6e449b9 (diff) | |
download | lombok-aafd83079a3000d3deb6e40a182849da2509fbfb.tar.gz lombok-aafd83079a3000d3deb6e40a182849da2509fbfb.tar.bz2 lombok-aafd83079a3000d3deb6e40a182849da2509fbfb.zip |
BIG commit:
* re-introduction of onMethod/onConstructor/onParam
* tests checking error/warnings rewritten to be more heuristic, in order to accomodate difference in messaging between java6 and java 7
* Ability to eliminate java's own output of erroneous error messages (heh); i.e. those messages that are invalidated by lombok's actions. This mechanism is used for onMethod/onConstructor/onParam
* First steps to unifying a billion setGeneratedBy calls into a single visitor traversal for eclipse' HandleGetter/Setter/Constructor/Wither
* To simplify 'zooming in' the tests on just a few files, added an 'accept' mechanism.
* Updated copyright headers of website to 2013.
Diffstat (limited to 'test/transform/resource')
26 files changed, 349 insertions, 13 deletions
diff --git a/test/transform/resource/after-delombok/Constructors.java b/test/transform/resource/after-delombok/Constructors.java index d4633dbc..12aa75ab 100644 --- a/test/transform/resource/after-delombok/Constructors.java +++ b/test/transform/resource/after-delombok/Constructors.java @@ -28,6 +28,16 @@ class RequiredArgsConstructorStaticName { return new RequiredArgsConstructorStaticName(x); } } +class RequiredArgsConstructorWithAnnotations { + final int x; + String name; + @java.beans.ConstructorProperties({"x"}) + @Deprecated + @java.lang.SuppressWarnings("all") + public RequiredArgsConstructorWithAnnotations(final int x) { + this.x = x; + } +} class AllArgsConstructor1 { final int x; String name; diff --git a/test/transform/resource/after-delombok/GetterOnMethod.java b/test/transform/resource/after-delombok/GetterOnMethod.java new file mode 100644 index 00000000..4a5b3622 --- /dev/null +++ b/test/transform/resource/after-delombok/GetterOnMethod.java @@ -0,0 +1,24 @@ +class GetterOnMethod { + int i; + int j; + int k; + public @interface Test { + } + @Deprecated + @java.lang.SuppressWarnings("all") + public int getI() { + return this.i; + } + @java.lang.Deprecated + @Test + @java.lang.SuppressWarnings("all") + public int getJ() { + return this.j; + } + @java.lang.Deprecated + @Test + @java.lang.SuppressWarnings("all") + public int getK() { + return this.k; + } +} diff --git a/test/transform/resource/after-delombok/GetterOnMethodErrors.java b/test/transform/resource/after-delombok/GetterOnMethodErrors.java new file mode 100644 index 00000000..86813bd2 --- /dev/null +++ b/test/transform/resource/after-delombok/GetterOnMethodErrors.java @@ -0,0 +1,9 @@ +class PlaceFillerToMakeSurePositionIsRelevant { +} +class GetterOnMethodErrors { + private int test; + @java.lang.SuppressWarnings("all") + public int getTest() { + return this.test; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/GetterOnMethodErrors2.java b/test/transform/resource/after-delombok/GetterOnMethodErrors2.java new file mode 100644 index 00000000..639022d0 --- /dev/null +++ b/test/transform/resource/after-delombok/GetterOnMethodErrors2.java @@ -0,0 +1,48 @@ +class GetterOnMethodErrors2 { + private int bad1; + private int bad2; + private int bad3; + private int bad4; + private int good1; + private int good2; + private int good3; + private int good4; + public @interface Test { + } + @java.lang.SuppressWarnings("all") + public int getBad1() { + return this.bad1; + } + @java.lang.SuppressWarnings("all") + public int getBad2() { + return this.bad2; + } + @Deprecated + @java.lang.SuppressWarnings("all") + public int getBad3() { + return this.bad3; + } + @java.lang.SuppressWarnings("all") + public int getBad4() { + return this.bad4; + } + @java.lang.SuppressWarnings("all") + public int getGood1() { + return this.good1; + } + @java.lang.SuppressWarnings("all") + public int getGood2() { + return this.good2; + } + @Deprecated + @java.lang.SuppressWarnings("all") + public int getGood3() { + return this.good3; + } + @Deprecated + @Test + @java.lang.SuppressWarnings("all") + public int getGood4() { + return this.good4; + } +} diff --git a/test/transform/resource/after-delombok/SetterOnMethodOnParam.java b/test/transform/resource/after-delombok/SetterOnMethodOnParam.java new file mode 100644 index 00000000..555bf698 --- /dev/null +++ b/test/transform/resource/after-delombok/SetterOnMethodOnParam.java @@ -0,0 +1,24 @@ +class SetterOnMethodOnParam { + int i; + int j; + int k; + public @interface Test { + } + @Deprecated + @java.lang.SuppressWarnings("all") + public void setI(final int i) { + this.i = i; + } + @java.lang.Deprecated + @Test + @java.lang.SuppressWarnings("all") + public void setJ(@Test final int j) { + this.j = j; + } + @java.lang.Deprecated + @Test + @java.lang.SuppressWarnings("all") + public void setK(@Test final int k) { + this.k = k; + } +} diff --git a/test/transform/resource/after-ecj/Constructors.java b/test/transform/resource/after-ecj/Constructors.java index e994702f..540c2407 100644 --- a/test/transform/resource/after-ecj/Constructors.java +++ b/test/transform/resource/after-ecj/Constructors.java @@ -25,6 +25,14 @@ return new RequiredArgsConstructorStaticName(x); } } +@lombok.RequiredArgsConstructor() class RequiredArgsConstructorWithAnnotations { + final int x; + String name; + public @Deprecated @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") RequiredArgsConstructorWithAnnotations(final int x) { + super(); + this.x = x; + } +} @lombok.AllArgsConstructor class AllArgsConstructor1 { final int x; String name; diff --git a/test/transform/resource/after-ecj/GetterOnMethod.java b/test/transform/resource/after-ecj/GetterOnMethod.java new file mode 100644 index 00000000..a21f628c --- /dev/null +++ b/test/transform/resource/after-ecj/GetterOnMethod.java @@ -0,0 +1,19 @@ +class GetterOnMethod { + public @interface Test { + } + @lombok.Getter() int i; + @lombok.Getter() int j; + @lombok.Getter() int k; + GetterOnMethod() { + super(); + } + public @Deprecated @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } + public @java.lang.Deprecated @Test @java.lang.SuppressWarnings("all") int getJ() { + return this.j; + } + public @java.lang.Deprecated @Test @java.lang.SuppressWarnings("all") int getK() { + return this.k; + } +} diff --git a/test/transform/resource/after-ecj/GetterOnMethodErrors.java b/test/transform/resource/after-ecj/GetterOnMethodErrors.java new file mode 100644 index 00000000..16c625b5 --- /dev/null +++ b/test/transform/resource/after-ecj/GetterOnMethodErrors.java @@ -0,0 +1,14 @@ +class PlaceFillerToMakeSurePositionIsRelevant { + PlaceFillerToMakeSurePositionIsRelevant() { + super(); + } +} +@lombok.Getter() class GetterOnMethodErrors { + private int test; + GetterOnMethodErrors() { + super(); + } + public @java.lang.SuppressWarnings("all") int getTest() { + return this.test; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/GetterOnMethodErrors2.java b/test/transform/resource/after-ecj/GetterOnMethodErrors2.java new file mode 100644 index 00000000..bfaa5dd4 --- /dev/null +++ b/test/transform/resource/after-ecj/GetterOnMethodErrors2.java @@ -0,0 +1,39 @@ +class GetterOnMethodErrors2 { + public @interface Test { + } + private @lombok.Getter() int bad1; + private @lombok.Getter() int bad2; + private @lombok.Getter() int bad3; + private @lombok.Getter() int bad4; + private @lombok.Getter() int good1; + private @lombok.Getter() int good2; + private @lombok.Getter() int good3; + private @lombok.Getter() int good4; + GetterOnMethodErrors2() { + super(); + } + public @java.lang.SuppressWarnings("all") int getBad1() { + return this.bad1; + } + public @java.lang.SuppressWarnings("all") int getBad2() { + return this.bad2; + } + public @java.lang.SuppressWarnings("all") int getBad3() { + return this.bad3; + } + public @java.lang.SuppressWarnings("all") int getBad4() { + return this.bad4; + } + public @java.lang.SuppressWarnings("all") int getGood1() { + return this.good1; + } + public @java.lang.SuppressWarnings("all") int getGood2() { + return this.good2; + } + public @Deprecated @java.lang.SuppressWarnings("all") int getGood3() { + return this.good3; + } + public @Deprecated @Test @java.lang.SuppressWarnings("all") int getGood4() { + return this.good4; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SetterOnMethod.java b/test/transform/resource/after-ecj/SetterOnMethod.java new file mode 100644 index 00000000..8bdff212 --- /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(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SetterOnMethodOnParam.java b/test/transform/resource/after-ecj/SetterOnMethodOnParam.java new file mode 100644 index 00000000..d4ea9f5d --- /dev/null +++ b/test/transform/resource/after-ecj/SetterOnMethodOnParam.java @@ -0,0 +1,19 @@ +class SetterOnMethodOnParam { + public @interface Test { + } + @lombok.Setter() int i; + @lombok.Setter() int j; + @lombok.Setter() int k; + SetterOnMethodOnParam() { + super(); + } + public @Deprecated @java.lang.SuppressWarnings("all") void setI(final int i) { + this.i = i; + } + public @java.lang.Deprecated @Test @java.lang.SuppressWarnings("all") void setJ(final @Test int j) { + this.j = j; + } + public @java.lang.Deprecated @Test @java.lang.SuppressWarnings("all") void setK(final @Test int k) { + this.k = k; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SetterOnParam.java b/test/transform/resource/after-ecj/SetterOnParam.java new file mode 100644 index 00000000..119c8fc3 --- /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(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SetterOnParamAndOnMethod.java b/test/transform/resource/after-ecj/SetterOnParamAndOnMethod.java new file mode 100644 index 00000000..21d22a8f --- /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(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/Constructors.java b/test/transform/resource/before/Constructors.java index d3ed3504..0ab7b7f0 100644 --- a/test/transform/resource/before/Constructors.java +++ b/test/transform/resource/before/Constructors.java @@ -10,6 +10,10 @@ final int x; String name; } +@lombok.RequiredArgsConstructor(onConstructor=@_(@Deprecated)) class RequiredArgsConstructorWithAnnotations { + final int x; + String name; +} @lombok.AllArgsConstructor class AllArgsConstructor1 { final int x; String name; diff --git a/test/transform/resource/before/GetterOnMethod.java b/test/transform/resource/before/GetterOnMethod.java new file mode 100644 index 00000000..558f3f64 --- /dev/null +++ b/test/transform/resource/before/GetterOnMethod.java @@ -0,0 +1,7 @@ +class GetterOnMethod { + @lombok.Getter(onMethod=@_(@Deprecated)) int i; + @lombok.Getter(onMethod=@_({@java.lang.Deprecated, @Test})) int j, k; + + public @interface Test { + } +} diff --git a/test/transform/resource/before/GetterOnMethodErrors.java b/test/transform/resource/before/GetterOnMethodErrors.java new file mode 100644 index 00000000..ae5d5b54 --- /dev/null +++ b/test/transform/resource/before/GetterOnMethodErrors.java @@ -0,0 +1,6 @@ +class PlaceFillerToMakeSurePositionIsRelevant { +} +@lombok.Getter(onMethod=@_(@Deprecated)) +class GetterOnMethodErrors { + private int test; +} diff --git a/test/transform/resource/before/GetterOnMethodErrors2.java b/test/transform/resource/before/GetterOnMethodErrors2.java new file mode 100644 index 00000000..423183b9 --- /dev/null +++ b/test/transform/resource/before/GetterOnMethodErrors2.java @@ -0,0 +1,12 @@ +class GetterOnMethodErrors2 { + @lombok.Getter(onMethod=@_A_(@Deprecated)) private int bad1; + @lombok.Getter(onMethod=@_(5)) private int bad2; + @lombok.Getter(onMethod=@_({@Deprecated, 5})) private int bad3; + @lombok.Getter(onMethod=@_(bar=@Deprecated)) private int bad4; + @lombok.Getter(onMethod=@_) private int good1; + @lombok.Getter(onMethod=@_()) private int good2; + @lombok.Getter(onMethod=@_(value=@Deprecated)) private int good3; + @lombok.Getter(onMethod=@_(value={@Deprecated, @Test})) private int good4; + public @interface Test { + } +} diff --git a/test/transform/resource/before/SetterOnMethodOnParam.java b/test/transform/resource/before/SetterOnMethodOnParam.java new file mode 100644 index 00000000..70f3dc8c --- /dev/null +++ b/test/transform/resource/before/SetterOnMethodOnParam.java @@ -0,0 +1,7 @@ +class SetterOnMethodOnParam { + @lombok.Setter(onMethod=@_(@Deprecated)) int i; + @lombok.Setter(onMethod=@_({@java.lang.Deprecated, @Test}), onParam=@_(@Test)) int j, k; + + public @interface Test { + } +} diff --git a/test/transform/resource/messages-delombok/GetterOnMethod.java.messages b/test/transform/resource/messages-delombok/GetterOnMethod.java.messages deleted file mode 100644 index db5ef9a6..00000000 --- a/test/transform/resource/messages-delombok/GetterOnMethod.java.messages +++ /dev/null @@ -1,7 +0,0 @@ -3:34 incompatible types -4:44 incompatible types -6:26 incompatible types -11:26 incompatible types -14:44 incompatible types -6:1 'onMethod' is not supported for @Getter on a type. -11:1 'onMethod' is not supported for @Getter on a type. diff --git a/test/transform/resource/messages-delombok/GetterOnMethodErrors.java.messages b/test/transform/resource/messages-delombok/GetterOnMethodErrors.java.messages new file mode 100644 index 00000000..4c82f730 --- /dev/null +++ b/test/transform/resource/messages-delombok/GetterOnMethodErrors.java.messages @@ -0,0 +1 @@ +3:1 'onMethod' is not supported for @Getter on a type.
\ No newline at end of file diff --git a/test/transform/resource/messages-delombok/GetterOnMethodErrors2.java.messages b/test/transform/resource/messages-delombok/GetterOnMethodErrors2.java.messages new file mode 100644 index 00000000..ead040a5 --- /dev/null +++ b/test/transform/resource/messages-delombok/GetterOnMethodErrors2.java.messages @@ -0,0 +1,4 @@ +2:9 The correct format is @Getter(onMethod=@_({@SomeAnnotation, @SomeOtherAnnotation})) +3:9 The correct format is @Getter(onMethod=@_({@SomeAnnotation, @SomeOtherAnnotation})) +4:9 The correct format is @Getter(onMethod=@_({@SomeAnnotation, @SomeOtherAnnotation})) +5:9 The correct format is @Getter(onMethod=@_({@SomeAnnotation, @SomeOtherAnnotation})) diff --git a/test/transform/resource/messages-delombok/ValInBasicFor.java.messages b/test/transform/resource/messages-delombok/ValInBasicFor.java.messages index b69a4a13..9bca1be6 100644 --- a/test/transform/resource/messages-delombok/ValInBasicFor.java.messages +++ b/test/transform/resource/messages-delombok/ValInBasicFor.java.messages @@ -1,3 +1 @@ -6:26 'val' is not allowed in old-style for loops -6:40 'val' is not allowed in old-style for loops 6:53 'val' is not allowed in old-style for loops diff --git a/test/transform/resource/messages-ecj/GetterOnMethod.java.messages b/test/transform/resource/messages-ecj/GetterOnMethod.java.messages deleted file mode 100644 index 4b240da0..00000000 --- a/test/transform/resource/messages-ecj/GetterOnMethod.java.messages +++ /dev/null @@ -1,2 +0,0 @@ -6:0 'onMethod' is not supported for @Getter on a type. -11:0 'onMethod' is not supported for @Getter on a type.
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/GetterOnMethodErrors.java.messages b/test/transform/resource/messages-ecj/GetterOnMethodErrors.java.messages new file mode 100644 index 00000000..804e8a3c --- /dev/null +++ b/test/transform/resource/messages-ecj/GetterOnMethodErrors.java.messages @@ -0,0 +1 @@ +3:50 'onMethod' is not supported for @Getter on a type.
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/GetterOnMethodErrors2.java.messages b/test/transform/resource/messages-ecj/GetterOnMethodErrors2.java.messages new file mode 100644 index 00000000..6b949f41 --- /dev/null +++ b/test/transform/resource/messages-ecj/GetterOnMethodErrors2.java.messages @@ -0,0 +1,4 @@ +2:31 The correct format is @Getter(onMethod=@_({@SomeAnnotation, @SomeOtherAnnotation})) +3:93 The correct format is @Getter(onMethod=@_({@SomeAnnotation, @SomeOtherAnnotation})) +4:143 The correct format is @Getter(onMethod=@_({@SomeAnnotation, @SomeOtherAnnotation})) +5:208 The correct format is @Getter(onMethod=@_({@SomeAnnotation, @SomeOtherAnnotation})) diff --git a/test/transform/resource/messages-idempotent/ValInBasicFor.java.messages b/test/transform/resource/messages-idempotent/ValInBasicFor.java.messages index 313a33c0..fb675485 100644 --- a/test/transform/resource/messages-idempotent/ValInBasicFor.java.messages +++ b/test/transform/resource/messages-idempotent/ValInBasicFor.java.messages @@ -1,3 +1 @@ -5:26 'val' is not allowed in old-style for loops -5:40 'val' is not allowed in old-style for loops 5:53 'val' is not allowed in old-style for loops |