diff options
author | Roel Spilker <r.spilker@gmail.com> | 2020-05-07 23:26:51 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2020-05-07 23:27:17 +0200 |
commit | ca5bd2868af828ec6b26c91b2398e8c6dbf1c24e (patch) | |
tree | bd605bf38ab2cd97f6290370159e74887aaf2666 | |
parent | 20cce2049de56d5a71c6dcc376d6f4088d4552bc (diff) | |
download | lombok-ca5bd2868af828ec6b26c91b2398e8c6dbf1c24e.tar.gz lombok-ca5bd2868af828ec6b26c91b2398e8c6dbf1c24e.tar.bz2 lombok-ca5bd2868af828ec6b26c91b2398e8c6dbf1c24e.zip |
Delombok prints the ReceiverParameter (this), fixes #2444.
-rw-r--r-- | src/delombok/lombok/delombok/PrettyPrinter.java | 9 | ||||
-rw-r--r-- | test/pretty/resource/after/ThisParameter.java | 34 | ||||
-rw-r--r-- | test/pretty/resource/before/ThisParameter.java | 41 |
3 files changed, 83 insertions, 1 deletions
diff --git a/src/delombok/lombok/delombok/PrettyPrinter.java b/src/delombok/lombok/delombok/PrettyPrinter.java index 2db70f7f..7eb8410b 100644 --- a/src/delombok/lombok/delombok/PrettyPrinter.java +++ b/src/delombok/lombok/delombok/PrettyPrinter.java @@ -796,8 +796,15 @@ public class PrettyPrinter extends JCTree.Visitor { print(tree.name); } - print("("); boolean first = true; + print("("); + + JCVariableDecl recvparam = readObject(tree, "recvparam", null); + if (recvparam != null) { + printVarDefInline(recvparam); + first = false; + } + for (JCVariableDecl param : tree.params) { if (!first) print(", "); first = false; diff --git a/test/pretty/resource/after/ThisParameter.java b/test/pretty/resource/after/ThisParameter.java new file mode 100644 index 00000000..49452a59 --- /dev/null +++ b/test/pretty/resource/after/ThisParameter.java @@ -0,0 +1,34 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +class ThisParameter { + void untagged(ThisParameter this, int i) { + // no content + } + void sourceTagged(@SourceTagged("source") ThisParameter this) { + // no content + } + void classTagged(@ClassTagged("class") ThisParameter this) { + // no content + } + void runtimeTagged(@RuntimeTagged("runtime") ThisParameter this) { + // no content + } + @Target(ElementType.PARAMETER) + @Retention(RetentionPolicy.SOURCE) + @interface SourceTagged { + String value(); + } + @Target(ElementType.PARAMETER) + @Retention(RetentionPolicy.CLASS) + @interface ClassTagged { + String value(); + } + @Target(ElementType.PARAMETER) + @Retention(RetentionPolicy.RUNTIME) + @interface RuntimeTagged { + String value(); + } +} diff --git a/test/pretty/resource/before/ThisParameter.java b/test/pretty/resource/before/ThisParameter.java new file mode 100644 index 00000000..d95c0261 --- /dev/null +++ b/test/pretty/resource/before/ThisParameter.java @@ -0,0 +1,41 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +class ThisParameter { + + void untagged(ThisParameter this, int i) { + // no content + } + + void sourceTagged(@SourceTagged("source") ThisParameter this) { + // no content + } + + void classTagged(@ClassTagged("class") ThisParameter this) { + // no content + } + + void runtimeTagged(@RuntimeTagged("runtime") ThisParameter this) { + // no content + } + + @Target(ElementType.PARAMETER) + @Retention(RetentionPolicy.SOURCE) + @interface SourceTagged { + String value(); + } + + @Target(ElementType.PARAMETER) + @Retention(RetentionPolicy.CLASS) + @interface ClassTagged { + String value(); + } + + @Target(ElementType.PARAMETER) + @Retention(RetentionPolicy.RUNTIME) + @interface RuntimeTagged { + String value(); + } +} |