-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix formatting records without an explicit constructor
- Loading branch information
Showing
13 changed files
with
129 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...va-format/src/test/resources/com/palantir/javaformat/java/testdata/ExpressionSwitch.input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class ExpressionSwitch { | ||
boolean odd(int x) { | ||
return switch (x) { | ||
case 0 -> true; | ||
case 1 -> false; | ||
default -> { int y = x - 1; return odd(y); } | ||
}; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...a-format/src/test/resources/com/palantir/javaformat/java/testdata/ExpressionSwitch.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class ExpressionSwitch { | ||
boolean odd(int x) { | ||
return switch (x) { | ||
case 0 -> true; | ||
case 1 -> false; | ||
default -> { | ||
int y = x - 1; | ||
return odd(y); | ||
} | ||
}; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/RSL.input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class RSLs { | ||
String s = """ | ||
lorem | ||
ipsum | ||
"""; | ||
} |
6 changes: 6 additions & 0 deletions
6
palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/RSL.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class RSLs { | ||
String s = """ | ||
lorem | ||
ipsum | ||
"""; | ||
} |
29 changes: 29 additions & 0 deletions
29
palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Records.input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
class Records { | ||
record R1() {} | ||
|
||
private record R2() {} | ||
|
||
@Deprecated | ||
private record R3() {} | ||
|
||
record R4<T>() {} | ||
|
||
record R5<T>(int x) {} | ||
|
||
record R6<T>(@Deprecated int x) {} | ||
|
||
record R7<T>(@Deprecated int x, int... y) {} | ||
|
||
record R8<T>() implements Comparable<R8<T>> { | ||
@Override | ||
public int compareTo(R8<T> other) { | ||
return 0; | ||
} | ||
} | ||
|
||
record R9(int x) { | ||
R9(int x) { | ||
this.x = x; | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Records.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
class Records { | ||
record R1() {} | ||
|
||
private record R2() {} | ||
|
||
@Deprecated | ||
private record R3() {} | ||
|
||
record R4<T>() {} | ||
|
||
record R5<T>(int x) {} | ||
|
||
record R6<T>(@Deprecated int x) {} | ||
|
||
record R7<T>(@Deprecated int x, int... y) {} | ||
|
||
record R8<T>() implements Comparable<R8<T>> { | ||
@Override | ||
public int compareTo(R8<T> other) { | ||
return 0; | ||
} | ||
} | ||
|
||
record R9(int x) { | ||
R9(int x) { | ||
this.x = x; | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Var.input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Var { | ||
void f() { | ||
for (var x : ImmutableList.of(42)) {} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Var.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Var { | ||
void f() { | ||
for (var x : ImmutableList.of(42)) {} | ||
} | ||
} |
38 changes: 0 additions & 38 deletions
38
palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/java14.input
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/java14.output
This file was deleted.
Oops, something went wrong.