aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/resources
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test/resources')
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/B20844369.input2
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/B20844369.output2
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/B21283374.output56
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/B26694550.output6
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/B27246427.output1
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/B28788559.input7
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/B28788559.output8
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/B308157568.input23
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/B308157568.output23
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/CL240367479.input6
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/CL240367479.output6
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/Fields.input7
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/Fields.output8
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/I880.input19
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/I880.output21
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/I959.input5
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/I959.output5
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/I981.input12
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/I981.output14
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/M.output108
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/ParameterComment.input29
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/ParameterComment.output38
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchDouble.input7
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchDouble.output7
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.input9
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.output9
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchRecord.input21
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchRecord.output46
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchUnderscore.input8
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchUnderscore.output8
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/Unnamed.input44
-rw-r--r--core/src/test/resources/com/google/googlejavaformat/java/testdata/Unnamed.output48
32 files changed, 535 insertions, 78 deletions
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B20844369.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B20844369.input
index 7317f17..86e46d5 100644
--- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B20844369.input
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B20844369.input
@@ -1,6 +1,6 @@
public class B20844369 {
private static final String ID_PATTERN =
- // TODO(user): add min/max lengths for the numbers here, e.g. android ID
+ // TODO(daw): add min/max lengths for the numbers here, e.g. android ID
"(?:(?<androidId>\\d+)\\+)?" // optional Android ID
+ "(?<type>\\d+)" // type
+ ":"
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B20844369.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B20844369.output
index 62f9721..982dc2b 100644
--- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B20844369.output
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B20844369.output
@@ -1,6 +1,6 @@
public class B20844369 {
private static final String ID_PATTERN =
- // TODO(user): add min/max lengths for the numbers here, e.g. android ID
+ // TODO(daw): add min/max lengths for the numbers here, e.g. android ID
"(?:(?<androidId>\\d+)\\+)?" // optional Android ID
+ "(?<type>\\d+)" // type
+ ":"
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B21283374.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B21283374.output
index f98a37b..777303e 100644
--- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B21283374.output
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B21283374.output
@@ -14,41 +14,41 @@ class B21283374 {
{
f(
- /*flagA=*/ Boolean.TRUE,
- /*flagB=*/ Boolean.FALSE,
- /*flagC=*/ Boolean.FALSE,
- /*flagD=*/ Boolean.FALSE,
- /*flagE=*/ Boolean.FALSE,
- /*flagF=*/ Boolean.FALSE,
- /*flagG=*/ Boolean.FALSE,
- /*flagH=*/ Boolean.FALSE,
- /*flagI=*/ Boolean.FALSE,
- /*flagJ=*/ Boolean.FALSE,
- /*flagK=*/ Boolean.FALSE);
+ /* flagA= */ Boolean.TRUE,
+ /* flagB= */ Boolean.FALSE,
+ /* flagC= */ Boolean.FALSE,
+ /* flagD= */ Boolean.FALSE,
+ /* flagE= */ Boolean.FALSE,
+ /* flagF= */ Boolean.FALSE,
+ /* flagG= */ Boolean.FALSE,
+ /* flagH= */ Boolean.FALSE,
+ /* flagI= */ Boolean.FALSE,
+ /* flagJ= */ Boolean.FALSE,
+ /* flagK= */ Boolean.FALSE);
f(
- /*flagA=*/ Boolean.TRUE,
- /*flagB=*/ Boolean.FALSE,
- /*flagC=*/ Boolean.FALSE,
- /*flagD=*/ Boolean.FALSE,
- /*flagE=*/ Boolean.FALSE,
- /*flagF=*/ Boolean.FALSE,
- /*flagG=*/ Boolean.FALSE,
- /*flagH=*/ Boolean.FALSE,
- /*flagI=*/ Boolean.FALSE,
- /*flagJ=*/ Boolean.FALSE,
- /*flagK=*/ Boolean.FALSE);
+ /* flagA= */ Boolean.TRUE,
+ /* flagB= */ Boolean.FALSE,
+ /* flagC= */ Boolean.FALSE,
+ /* flagD= */ Boolean.FALSE,
+ /* flagE= */ Boolean.FALSE,
+ /* flagF= */ Boolean.FALSE,
+ /* flagG= */ Boolean.FALSE,
+ /* flagH= */ Boolean.FALSE,
+ /* flagI= */ Boolean.FALSE,
+ /* flagJ= */ Boolean.FALSE,
+ /* flagK= */ Boolean.FALSE);
- assertThat(foo.barAndBaz(/*paramName=*/ false, thingy)).isEqualTo(new Something(""));
- assertThat(foo.barAndBaz(/*paramName=*/ false, thingy)).isEqualTo(new Something(""));
- assertThat(foo.barAndBaz(/*paramName=*/ false, thingy)).isEqualTo(new Something(""));
+ assertThat(foo.barAndBaz(/* paramName= */ false, thingy)).isEqualTo(new Something(""));
+ assertThat(foo.barAndBaz(/* paramName= */ false, thingy)).isEqualTo(new Something(""));
+ assertThat(foo.barAndBaz(/* paramName= */ false, thingy)).isEqualTo(new Something(""));
- f(/*paramName=*/ false);
+ f(/* paramName= */ false);
assertThat__________________________________________________________(
- /*paramName=*/ false, thingy);
+ /* paramName= */ false, thingy);
assertThat__________________________________________________________(
- /*paramName=*/ false, thingy);
+ /* paramName= */ false, thingy);
f(
arg1, /* which arg is this attached to? */
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B26694550.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B26694550.output
index 945a40f..aedafb7 100644
--- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B26694550.output
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B26694550.output
@@ -3,15 +3,15 @@ class B26694550 {
/* === not a param comment */
fffffffffffffffffffffffffffffff(
ImmutableList.copyOf(keys), /*&=*/
- /*keepGoing=*/ false,
+ /* keepGoing= */ false,
ggggggggggggggggggggggggggggggggggggggggggg);
fffffffffffffffffffffffffffffff(
ImmutableList.copyOf(keys),
- /*keepGoing=*/ false,
+ /* keepGoing= */ false,
ggggggggggggggggggggggggggggggggggggggggggg);
fffffffffffffffffffffffffffffff(
ImmutableList.copyOf(keys),
- /*foo_bar=*/ false,
+ /* foo_bar= */ false,
/*foo-bar=*/ false,
ggggggggggggggggggggggggggggggggggggggggggg);
}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B27246427.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B27246427.output
index b1e33e9..3d591f8 100644
--- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B27246427.output
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B27246427.output
@@ -6,6 +6,7 @@ enum TrailingComment {
/** a */
Object a;
+
/** b */
Object b;
}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B28788559.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B28788559.input
deleted file mode 100644
index a38d10b..0000000
--- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B28788559.input
+++ /dev/null
@@ -1,7 +0,0 @@
-import a.A;;
-import b.B;
-
-class Test {
- A a;
- B b;
-}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B28788559.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B28788559.output
deleted file mode 100644
index 8a1db80..0000000
--- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B28788559.output
+++ /dev/null
@@ -1,8 +0,0 @@
-import a.A;
-;
-import b.B;
-
-class Test {
- A a;
- B b;
-}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B308157568.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B308157568.input
new file mode 100644
index 0000000..089a3f1
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B308157568.input
@@ -0,0 +1,23 @@
+class C {
+ @A(0x14)
+ int f(Object o) {
+ @A(0x40)
+ int local;
+ try (@A(0x41)
+ JarFile jarFile = new JarFile("hello.jar")) {
+ } catch (
+ @A(0x42)
+ IOException e) {
+ }
+ if (o instanceof @A(0x43) String) {}
+ new @A(0x44) ArrayList<>();
+ Supplier<List<?>> a = @A(0x45) ArrayList::new;
+ Supplier<List<?>> b = @A(0x46) ImmutableList::of;
+ String s = (@A(0x47) String) o;
+ List<?> xs = new ArrayList<@A(0x48) String>();
+ xs = ImmutableList.<@A(0x49) String>of();
+ Supplier<List<?>> c = ArrayList<@A(0x4A) String>::new;
+ Supplier<List<?>> d = ImmutableList::<@A(0x4B) String>of;
+ return 0;
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/B308157568.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B308157568.output
new file mode 100644
index 0000000..089a3f1
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/B308157568.output
@@ -0,0 +1,23 @@
+class C {
+ @A(0x14)
+ int f(Object o) {
+ @A(0x40)
+ int local;
+ try (@A(0x41)
+ JarFile jarFile = new JarFile("hello.jar")) {
+ } catch (
+ @A(0x42)
+ IOException e) {
+ }
+ if (o instanceof @A(0x43) String) {}
+ new @A(0x44) ArrayList<>();
+ Supplier<List<?>> a = @A(0x45) ArrayList::new;
+ Supplier<List<?>> b = @A(0x46) ImmutableList::of;
+ String s = (@A(0x47) String) o;
+ List<?> xs = new ArrayList<@A(0x48) String>();
+ xs = ImmutableList.<@A(0x49) String>of();
+ Supplier<List<?>> c = ArrayList<@A(0x4A) String>::new;
+ Supplier<List<?>> d = ImmutableList::<@A(0x4B) String>of;
+ return 0;
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/CL240367479.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/CL240367479.input
deleted file mode 100644
index be76390..0000000
--- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/CL240367479.input
+++ /dev/null
@@ -1,6 +0,0 @@
-package foo;;
-
-import com.google.second.Foo;
-import com.google.first.Bar;
-
-public class Blim {}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/CL240367479.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/CL240367479.output
deleted file mode 100644
index 025d237..0000000
--- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/CL240367479.output
+++ /dev/null
@@ -1,6 +0,0 @@
-package foo;
-;
-import com.google.second.Foo;
-import com.google.first.Bar;
-
-public class Blim {}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/Fields.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Fields.input
index 9dc3426..d012d17 100644
--- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/Fields.input
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Fields.input
@@ -1,5 +1,12 @@
class Fields {
+ int a = 1;
+ int b = 1;
+
+ int c = 1;
+ /** Javadoc */
+ int d = 1;
+
int x = 1;
int y = 1;
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/Fields.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Fields.output
index 376e8b6..81ebd2a 100644
--- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/Fields.output
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Fields.output
@@ -1,5 +1,13 @@
class Fields {
+ int a = 1;
+ int b = 1;
+
+ int c = 1;
+
+ /** Javadoc */
+ int d = 1;
+
int x = 1;
int y = 1;
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/I880.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I880.input
new file mode 100644
index 0000000..dfc8a4c
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I880.input
@@ -0,0 +1,19 @@
+class I880 {
+ public String f(int i) {
+ return switch (i) {
+ case 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 -> "looooooooooooooooooooooooooooooooooooooooong expression";
+ default -> "looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong expression";
+ };
+ }
+
+ public boolean test(int i) {
+ return switch (i) {
+ case 0 -> // zero
+ false;
+ case 1 -> "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".length()
+ == 0;
+ default -> // otherwise
+ true;
+ };
+ }
+} \ No newline at end of file
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/I880.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I880.output
new file mode 100644
index 0000000..f918665
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I880.output
@@ -0,0 +1,21 @@
+class I880 {
+ public String f(int i) {
+ return switch (i) {
+ case 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ->
+ "looooooooooooooooooooooooooooooooooooooooong expression";
+ default ->
+ "looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong expression";
+ };
+ }
+
+ public boolean test(int i) {
+ return switch (i) {
+ case 0 -> // zero
+ false;
+ case 1 ->
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".length() == 0;
+ default -> // otherwise
+ true;
+ };
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/I959.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I959.input
new file mode 100644
index 0000000..0660079
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I959.input
@@ -0,0 +1,5 @@
+class I959 {
+ public void test() {
+ new File(".").listFiles((final var dir, final var name) -> true);
+ }
+} \ No newline at end of file
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/I959.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I959.output
new file mode 100644
index 0000000..76a07f4
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I959.output
@@ -0,0 +1,5 @@
+class I959 {
+ public void test() {
+ new File(".").listFiles((final var dir, final var name) -> true);
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/I981.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I981.input
new file mode 100644
index 0000000..bba0b72
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I981.input
@@ -0,0 +1,12 @@
+class Foo {
+ private static final int X = 42;
+ private static final String A = STR."\{X} = \{X}";
+ private static final String B = STR."";
+ private static final String C = STR."\{X}";
+ private static final String D = STR."\{X}\{X}";
+ private static final String E = STR."\{X}\{X}\{X}";
+ private static final String F = STR." \{X}";
+ private static final String G = STR."\{X} ";
+ private static final String H = STR."\{X} one long incredibly unbroken sentence moving from "+"topic to topic so that no-one had a chance to interrupt";
+ private static final String I = STR."\{X} \uD83D\uDCA9 ";
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/I981.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I981.output
new file mode 100644
index 0000000..ff173fb
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I981.output
@@ -0,0 +1,14 @@
+class Foo {
+ private static final int X = 42;
+ private static final String A = STR."\{X} = \{X}";
+ private static final String B = STR."";
+ private static final String C = STR."\{X}";
+ private static final String D = STR."\{X}\{X}";
+ private static final String E = STR."\{X}\{X}\{X}";
+ private static final String F = STR." \{X}";
+ private static final String G = STR."\{X} ";
+ private static final String H =
+ STR."\{X} one long incredibly unbroken sentence moving from "
+ + "topic to topic so that no-one had a chance to interrupt";
+ private static final String I = STR."\{X} \uD83D\uDCA9 ";
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/M.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/M.output
index dbad1bb..d28d5dd 100644
--- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/M.output
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/M.output
@@ -36,8 +36,16 @@ class M {
/** JavaDoc. */
void methodName3(int x)
- throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6,
- Exception7, Exception8, Exception9 {}
+ throws Exception0,
+ Exception1,
+ Exception2,
+ Exception3,
+ Exception4,
+ Exception5,
+ Exception6,
+ Exception7,
+ Exception8,
+ Exception9 {}
/** JavaDoc. */
void methodName4(
@@ -114,8 +122,16 @@ class M {
int t,
int u,
int v)
- throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6,
- Exception7, Exception8, Exception9 {}
+ throws Exception0,
+ Exception1,
+ Exception2,
+ Exception3,
+ Exception4,
+ Exception5,
+ Exception6,
+ Exception7,
+ Exception8,
+ Exception9 {}
Pair<
Pair<Pair<Pair<T, T>, Pair<T, T>>, Pair<Pair<T, T>, Pair<T, T>>>,
@@ -135,8 +151,16 @@ class M {
Pair<Pair<Pair<T, T>, Pair<T, T>>, Pair<Pair<T, T>, Pair<T, T>>>,
Pair<Pair<Pair<T, T>, Pair<T, T>>, Pair<Pair<T, T>, Pair<T, T>>>>
methodName11(int x)
- throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6,
- Exception7, Exception8, Exception9 {
+ throws Exception0,
+ Exception1,
+ Exception2,
+ Exception3,
+ Exception4,
+ Exception5,
+ Exception6,
+ Exception7,
+ Exception8,
+ Exception9 {
return null;
}
@@ -225,8 +249,16 @@ class M {
int t,
int u,
int v)
- throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6,
- Exception7, Exception8, Exception9 {
+ throws Exception0,
+ Exception1,
+ Exception2,
+ Exception3,
+ Exception4,
+ Exception5,
+ Exception6,
+ Exception7,
+ Exception8,
+ Exception9 {
return null;
}
@@ -338,8 +370,16 @@ class M {
T30,
T31>
T methodName22(int x)
- throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6,
- Exception7, Exception8, Exception9 {
+ throws Exception0,
+ Exception1,
+ Exception2,
+ Exception3,
+ Exception4,
+ Exception5,
+ Exception6,
+ Exception7,
+ Exception8,
+ Exception9 {
return null;
}
@@ -518,8 +558,16 @@ class M {
int t,
int u,
int v)
- throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6,
- Exception7, Exception8, Exception9 {
+ throws Exception0,
+ Exception1,
+ Exception2,
+ Exception3,
+ Exception4,
+ Exception5,
+ Exception6,
+ Exception7,
+ Exception8,
+ Exception9 {
return null;
}
@@ -640,8 +688,16 @@ class M {
Pair<Pair<Pair<T, T>, Pair<T, T>>, Pair<Pair<T, T>, Pair<T, T>>>,
Pair<Pair<Pair<T, T>, Pair<T, T>>, Pair<Pair<T, T>, Pair<T, T>>>>
methodName(int x)
- throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5,
- Exception6, Exception7, Exception8, Exception9 {
+ throws Exception0,
+ Exception1,
+ Exception2,
+ Exception3,
+ Exception4,
+ Exception5,
+ Exception6,
+ Exception7,
+ Exception8,
+ Exception9 {
return null;
}
@@ -829,8 +885,16 @@ class M {
int t,
int u,
int v)
- throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5,
- Exception6, Exception7, Exception8, Exception9 {
+ throws Exception0,
+ Exception1,
+ Exception2,
+ Exception3,
+ Exception4,
+ Exception5,
+ Exception6,
+ Exception7,
+ Exception8,
+ Exception9 {
return null;
}
@@ -1011,6 +1075,14 @@ class M {
ZZZZZZZZZZ z,
ZZZZZZZZZZ z,
ZZZZZZZZZZ z)
- throws EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE,
- EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE {}
+ throws EEEEEEEEEE,
+ EEEEEEEEEE,
+ EEEEEEEEEE,
+ EEEEEEEEEE,
+ EEEEEEEEEE,
+ EEEEEEEEEE,
+ EEEEEEEEEE,
+ EEEEEEEEEE,
+ EEEEEEEEEE,
+ EEEEEEEEEE {}
}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/ParameterComment.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/ParameterComment.input
new file mode 100644
index 0000000..decebe9
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/ParameterComment.input
@@ -0,0 +1,29 @@
+package com.google.googlejavaformat.java.test;
+
+/** Tests for formatting of ParameterComments. */
+class Q {
+ static void f(int a) {
+ f(/*a=*/ 1);
+ f(
+ /* a= */ 1
+ );
+ }
+ static void g(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k) {
+ g(
+ /*a=*/ 1,
+ /*b=*/ 1,
+ /*c=*/ 1,
+ /*d=*/ 1,
+ /*e=*/ 1,
+ /*f=*/ 1,
+ /*g=*/ 1,
+ /*h=*/ 1,
+ /*i=*/ 1,
+ /*j=*/ 1,
+ /*k=*/ 1);
+ g(/*a=*/ 1, /*b=*/ 1, /*c=*/ 1, /*d=*/ 1, /*e=*/ 1, /*f=*/ 1, /*g=*/ 1, /*h=*/ 1, /*i=*/ 1);
+ }
+ static void h(Object... xs) {
+ h(/*xs...=*/ null);
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/ParameterComment.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/ParameterComment.output
new file mode 100644
index 0000000..d26ca11
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/ParameterComment.output
@@ -0,0 +1,38 @@
+package com.google.googlejavaformat.java.test;
+
+/** Tests for formatting of ParameterComments. */
+class Q {
+ static void f(int a) {
+ f(/* a= */ 1);
+ f(/* a= */ 1);
+ }
+
+ static void g(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k) {
+ g(
+ /* a= */ 1,
+ /* b= */ 1,
+ /* c= */ 1,
+ /* d= */ 1,
+ /* e= */ 1,
+ /* f= */ 1,
+ /* g= */ 1,
+ /* h= */ 1,
+ /* i= */ 1,
+ /* j= */ 1,
+ /* k= */ 1);
+ g(
+ /* a= */ 1,
+ /* b= */ 1,
+ /* c= */ 1,
+ /* d= */ 1,
+ /* e= */ 1,
+ /* f= */ 1,
+ /* g= */ 1,
+ /* h= */ 1,
+ /* i= */ 1);
+ }
+
+ static void h(Object... xs) {
+ h(/* xs...= */ null);
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchDouble.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchDouble.input
new file mode 100644
index 0000000..54e22a7
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchDouble.input
@@ -0,0 +1,7 @@
+class SwitchDouble {
+ void x(Object o) {
+ switch (o) {
+ case null, default:
+ }
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchDouble.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchDouble.output
new file mode 100644
index 0000000..54e22a7
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchDouble.output
@@ -0,0 +1,7 @@
+class SwitchDouble {
+ void x(Object o) {
+ switch (o) {
+ case null, default:
+ }
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.input
new file mode 100644
index 0000000..25df580
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.input
@@ -0,0 +1,9 @@
+class SwitchGuardClause {
+ boolean test(Object x) {
+ return switch (x) {
+ case String s when s.length() < 5 -> true;
+ case Integer i -> false;
+ default -> true;
+ };
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.output
new file mode 100644
index 0000000..25df580
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.output
@@ -0,0 +1,9 @@
+class SwitchGuardClause {
+ boolean test(Object x) {
+ return switch (x) {
+ case String s when s.length() < 5 -> true;
+ case Integer i -> false;
+ default -> true;
+ };
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchRecord.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchRecord.input
new file mode 100644
index 0000000..2f4fb35
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchRecord.input
@@ -0,0 +1,21 @@
+record SwitchRecord(int i) {
+ int x(Object o) {
+ return switch (o) {
+ case SwitchRecord(int i) -> i;
+ default -> 0;
+ };
+ }
+ int f(Object o) {
+ return switch (o) {
+ case SwitchRecord(int one, int two, int three, int four, int five, int six, int seven, int eight, int nine) -> nine;
+ default -> 0;
+ };
+ }
+ int g(Object o) {
+ return switch (o) {
+ case SwitchRecord(int one, int two, int three, int four, int five, int six, int seven, int eight, int nine) ->
+ System.err.println("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.");
+ default -> 0;
+ };
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchRecord.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchRecord.output
new file mode 100644
index 0000000..89d212f
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchRecord.output
@@ -0,0 +1,46 @@
+record SwitchRecord(int i) {
+ int x(Object o) {
+ return switch (o) {
+ case SwitchRecord(int i) -> i;
+ default -> 0;
+ };
+ }
+
+ int f(Object o) {
+ return switch (o) {
+ case SwitchRecord(
+ int one,
+ int two,
+ int three,
+ int four,
+ int five,
+ int six,
+ int seven,
+ int eight,
+ int nine) ->
+ nine;
+ default -> 0;
+ };
+ }
+
+ int g(Object o) {
+ return switch (o) {
+ case SwitchRecord(
+ int one,
+ int two,
+ int three,
+ int four,
+ int five,
+ int six,
+ int seven,
+ int eight,
+ int nine) ->
+ System.err.println(
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor"
+ + " incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis"
+ + " nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo"
+ + " consequat.");
+ default -> 0;
+ };
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchUnderscore.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchUnderscore.input
new file mode 100644
index 0000000..8d611d2
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchUnderscore.input
@@ -0,0 +1,8 @@
+public class SwitchUnderscore {
+ void x(Object o) {
+ switch (o) {
+ case String _:
+ default:
+ }
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchUnderscore.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchUnderscore.output
new file mode 100644
index 0000000..8d611d2
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchUnderscore.output
@@ -0,0 +1,8 @@
+public class SwitchUnderscore {
+ void x(Object o) {
+ switch (o) {
+ case String _:
+ default:
+ }
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/Unnamed.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Unnamed.input
new file mode 100644
index 0000000..6c5efd1
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Unnamed.input
@@ -0,0 +1,44 @@
+class Unnamed {
+ {
+ int acc = 0;
+ for (Order _ : orders) {
+ if (acc < LIMIT) {
+ acc++;
+ }
+ }
+
+ for (int i = 0, _ = sideEffect(); i < 10; i++) { }
+
+ Queue<Integer> q = null;
+ while (q.size() >= 3) {
+ var x = q.remove();
+ var y = q.remove();
+ var _ = q.remove();
+ new Point(x, y);
+ }
+
+ while (q.size() >= 3) {
+ var x = q.remove();
+ var _ = q.remove();
+ var _ = q.remove();
+ new Point(x, 0) ;
+ }
+
+ String s = null;
+ try {
+ int i = Integer.parseInt(s);
+ } catch (NumberFormatException _) {
+ System.out.println("Bad number: " + s);
+ }
+
+ try { doSomething(); }
+ catch (Exception _) { doSomething(); }
+ catch (Throwable _) { doSomething(); }
+
+ try (var _ = ScopedContext.acquire()) {
+ doSomething();
+ }
+
+ stream.collect(Collectors.toMap(String::toUpperCase, _ -> "NODATA"));
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/Unnamed.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Unnamed.output
new file mode 100644
index 0000000..84d8f87
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Unnamed.output
@@ -0,0 +1,48 @@
+class Unnamed {
+ {
+ int acc = 0;
+ for (Order _ : orders) {
+ if (acc < LIMIT) {
+ acc++;
+ }
+ }
+
+ for (int i = 0, _ = sideEffect(); i < 10; i++) {}
+
+ Queue<Integer> q = null;
+ while (q.size() >= 3) {
+ var x = q.remove();
+ var y = q.remove();
+ var _ = q.remove();
+ new Point(x, y);
+ }
+
+ while (q.size() >= 3) {
+ var x = q.remove();
+ var _ = q.remove();
+ var _ = q.remove();
+ new Point(x, 0);
+ }
+
+ String s = null;
+ try {
+ int i = Integer.parseInt(s);
+ } catch (NumberFormatException _) {
+ System.out.println("Bad number: " + s);
+ }
+
+ try {
+ doSomething();
+ } catch (Exception _) {
+ doSomething();
+ } catch (Throwable _) {
+ doSomething();
+ }
+
+ try (var _ = ScopedContext.acquire()) {
+ doSomething();
+ }
+
+ stream.collect(Collectors.toMap(String::toUpperCase, _ -> "NODATA"));
+ }
+}