diff options
author | Roel Spilker <r.spilker@gmail.com> | 2018-11-06 00:27:02 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2018-11-06 00:37:07 +0100 |
commit | 7e79316a1f28d1eb1ef8569119b97a70387fd6c6 (patch) | |
tree | a4251e266a99984b569f70bbb2e8baee6b55b177 /test/transform/resource/after-ecj | |
parent | dc641cc3696e63c46c9693ccdfd296f173afec53 (diff) | |
download | lombok-7e79316a1f28d1eb1ef8569119b97a70387fd6c6.tar.gz lombok-7e79316a1f28d1eb1ef8569119b97a70387fd6c6.tar.bz2 lombok-7e79316a1f28d1eb1ef8569119b97a70387fd6c6.zip |
Improve toString generation for enums. Fixes #1916
Diffstat (limited to 'test/transform/resource/after-ecj')
-rw-r--r-- | test/transform/resource/after-ecj/DataOnEnum.java | 2 | ||||
-rw-r--r-- | test/transform/resource/after-ecj/ToStringEnum.java | 41 |
2 files changed, 42 insertions, 1 deletions
diff --git a/test/transform/resource/after-ecj/DataOnEnum.java b/test/transform/resource/after-ecj/DataOnEnum.java index 0f07088e..31eb12ec 100644 --- a/test/transform/resource/after-ecj/DataOnEnum.java +++ b/test/transform/resource/after-ecj/DataOnEnum.java @@ -7,7 +7,7 @@ public @lombok.Getter @lombok.ToString @lombok.RequiredArgsConstructor enum Data return this.someField; } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("DataOnEnum(someField=" + this.getSomeField()) + ")"); + return (((("DataOnEnum." + this.name()) + "(someField=") + this.getSomeField()) + ")"); } private @java.lang.SuppressWarnings("all") DataOnEnum(final String someField) { super(); diff --git a/test/transform/resource/after-ecj/ToStringEnum.java b/test/transform/resource/after-ecj/ToStringEnum.java new file mode 100644 index 00000000..d4ab5a93 --- /dev/null +++ b/test/transform/resource/after-ecj/ToStringEnum.java @@ -0,0 +1,41 @@ +import lombok.ToString; +@ToString enum ToStringEnum1 { + CONSTANT(), + <clinit>() { + } + ToStringEnum1() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return ("ToStringEnum1." + this.name()); + } +} +@ToString enum ToStringEnum2 { + CONSTANT(), + int x; + String name; + <clinit>() { + } + ToStringEnum2() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("ToStringEnum2." + this.name()) + "(x=") + this.x) + ", name=") + this.name) + ")"); + } +} +class ToStringEnum3 { + @ToString enum MemberEnum { + CONSTANT(), + <clinit>() { + } + MemberEnum() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return ("ToStringEnum3.MemberEnum." + this.name()); + } + } + ToStringEnum3() { + super(); + } +}
\ No newline at end of file |