Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/printers/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export function printArrayInitializer(
list.push(ifBreak(","));
}

return group(["{", indent([softline, ...list]), softline, "}"]);
return group(["{", indent([line, ...list]), line, "}"]);
}

export function printBlock(path: NamedNodePath, contents: Doc[]) {
Expand Down
6 changes: 3 additions & 3 deletions test/unit-test/expressions/_output.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ public void longFullyQualifiedName() {

public void unannTypePrimitiveWithMethodReferenceSuffix(String[] args) {
List.of(
new double[][] {1, 2, 3, 4.1, 5.6846465},
new double[][] {1, 2, 3, 4.1, 5.6846465},
new double[][] {1, 2, 3, 4.1, 5.6846465}
new double[][] { 1, 2, 3, 4.1, 5.6846465 },
new double[][] { 1, 2, 3, 4.1, 5.6846465 },
new double[][] { 1, 2, 3, 4.1, 5.6846465 }
).toArray(double[][]::new);
}

Expand Down
8 changes: 4 additions & 4 deletions test/unit-test/marker_annotations/_output.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void postConstruct() {
System.out.println("post construct");
}

@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings2({
"rawtypes",
"unchecked",
Expand All @@ -43,9 +43,9 @@ public void elementValueArrayInitializer() {
}

@ArrayInitializersWithKey(
key = {"abc", "def"},
key2 = {"ghi", "jkl"},
key3 = {"mno", "pqr"}
key = { "abc", "def" },
key2 = { "ghi", "jkl" },
key3 = { "mno", "pqr" }
)
public void arrayInitializerWithKey() {
System.out.println("element value array initializer with key");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("VariableDeclarator", () => {
const snippet = "int[]i={alpha};";

const formattedText = await formatJavaSnippet({ snippet });
const expectedContents = "int[] i = {alpha};\n";
const expectedContents = "int[] i = { alpha };\n";
expect(formattedText).to.equal(expectedContents);
});

Expand Down
6 changes: 3 additions & 3 deletions test/unit-test/variables/_output.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ public class Variables {
private Object[] arrayVariable1 = new Object[3];
private Object[][] arrayVariable2 = new Object[3][3];
private Object[] arrayVariable3 = new Object[] {};
private Object[] arrayVariable4 = new Object[] {"abc", "def", "ghi"};
private Object[] arrayVariable4 = new Object[] { "abc", "def", "ghi" };
private Object[] arrayVariable5 = new Object[] {
"abc",
"def",
"ghi",
"jkl",
"mno",
};
private Object[] arrayVariable6 = {"abc", "def", "ghi"};
private Object[] arrayVariable6 = { "abc", "def", "ghi" };

private Range creator1 = this.dateRangeField.new Range(from, to);
private Range creator2 = this.dateRangeField.new <Integer>Range(from, to);
Expand Down Expand Up @@ -221,7 +221,7 @@ public void breakAfterEquals() {
new Object[10];

Object[] aParticularlyLongAndObnoxiousNameForIllustrativePurposes =
new Object[] {new Object(), new Object()};
new Object[] { new Object(), new Object() };

Object[] aParticularlyLongAndObnoxiousNameForIllustrativePurposes =
new Object[] {
Expand Down