Delombok prints the ReceiverParameter (this), fixes #2444.

This commit is contained in:
Roel Spilker committed 2020-05-07 23:27:17 +02:00
1 parent 20cce2049d
commit ca5bd2868a
3 files changed
+83 -1

No files matched your search

@@ -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;
@@ -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();
}
}
@@ -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();
}
}