aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRawi01 <Rawi01@users.noreply.github.com>2021-03-24 19:22:37 +0100
committerRoel Spilker <r.spilker@gmail.com>2021-04-01 22:15:18 +0200
commit4637b9daf00e66f1f697613b4bb4d889951c298d (patch)
tree749ef813337f04c1885a614ae26b74e934752e11
parent462aedcfc3a6948d2f09659961122b8eb2e35fc7 (diff)
downloadlombok-4637b9daf00e66f1f697613b4bb4d889951c298d.tar.gz
lombok-4637b9daf00e66f1f697613b4bb4d889951c298d.tar.bz2
lombok-4637b9daf00e66f1f697613b4bb4d889951c298d.zip
[record] Print compact constructor after class name
-rw-r--r--src/delombok/lombok/delombok/PrettyPrinter.java5
-rw-r--r--test/pretty/resource/after/Record.java3
-rw-r--r--test/pretty/resource/before/Record.java4
3 files changed, 10 insertions, 2 deletions
diff --git a/src/delombok/lombok/delombok/PrettyPrinter.java b/src/delombok/lombok/delombok/PrettyPrinter.java
index c46a3298..bcf3f431 100644
--- a/src/delombok/lombok/delombok/PrettyPrinter.java
+++ b/src/delombok/lombok/delombok/PrettyPrinter.java
@@ -531,6 +531,9 @@ public class PrettyPrinter extends JCTree.Visitor {
print(tree.typarams, ", ");
print(">");
}
+
+ if (isRecord) printRecordConstructor(tree.defs);
+
JCTree extendsClause = getExtendsClause(tree);
if (extendsClause != null) {
print(" extends ");
@@ -542,8 +545,6 @@ public class PrettyPrinter extends JCTree.Visitor {
print(tree.implementing, ", ");
}
- if (isRecord) printRecordConstructor(tree.defs);
-
println(" {");
indent++;
printClassMembers(tree.defs, isEnum, isInterface);
diff --git a/test/pretty/resource/after/Record.java b/test/pretty/resource/after/Record.java
new file mode 100644
index 00000000..c19658af
--- /dev/null
+++ b/test/pretty/resource/after/Record.java
@@ -0,0 +1,3 @@
+public record Record<T>(T field) implements Cloneable {
+
+} \ No newline at end of file
diff --git a/test/pretty/resource/before/Record.java b/test/pretty/resource/before/Record.java
new file mode 100644
index 00000000..f4eee30d
--- /dev/null
+++ b/test/pretty/resource/before/Record.java
@@ -0,0 +1,4 @@
+// version 14:
+public record Record<T>(T field) implements Cloneable {
+
+} \ No newline at end of file