From adcd6e7c6f639a1b281f08dd2d0c996c45a2dde3 Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Mon, 26 Oct 2026 10:19:19 +0300 Subject: [PATCH 1/9] Run formatter test cases from files under test-cases/ A formatter test was a Java method with two text blocks and a formatter around them, or an .input/.output pair in testdata/. Now it can be one file: src/test/resources/test-cases/.case holds the code before formatting and the code expected after it, separated by a line of six or more dashes. A file with two such lines starts with a settings block. There are no settings yet, so that block takes blank lines and # comments, which explain the case; any other line fails the case. FormatterCasesTest finds the .case files anywhere under test-cases/ on the test classpath and runs one test per file, named by its path without the extension. The before block through formatSourceAndFixImports in the OJF style must give the after block, and a second run must change nothing. A failure first names the line of the case file where the output departs from the after block, with what the case expects there and what the formatter wrote, and then shows both texts. A file with no separator or more than two fails its own test, and a missing or empty folder fails the suite rather than passing with no tests. CaseFile splits the file with String.lines(), so both blocks end their lines in \n whatever the file uses. nonNlsMarkersStayOnTheLineOfTheirLiteral moves from FormatterTest to the first case. Its blocks were generated from the method's text blocks and are byte for byte the strings it compared; its comment became the header. Changing one character of the expected output fails the case at its line. Tests on JDK 21: FormatterTest 43 -> 42, FormatterCasesTest 0 -> 1 under the same name, CaseFileTest 0 -> 12, every other class unchanged; the module goes from 1658 to 1670 tests, 15 skipped before and after. --- .../palantir/javaformat/java/CaseFile.java | 114 +++++++++++++++++ .../javaformat/java/CaseFileTest.java | 117 ++++++++++++++++++ .../javaformat/java/FormatterCasesTest.java | 75 +++++++++++ .../javaformat/java/FormatterTest.java | 39 ------ ...NlsMarkersStayOnTheLineOfTheirLiteral.case | 27 ++++ 5 files changed, 333 insertions(+), 39 deletions(-) create mode 100644 open-java-format/src/test/java/com/palantir/javaformat/java/CaseFile.java create mode 100644 open-java-format/src/test/java/com/palantir/javaformat/java/CaseFileTest.java create mode 100644 open-java-format/src/test/java/com/palantir/javaformat/java/FormatterCasesTest.java create mode 100644 open-java-format/src/test/resources/test-cases/nonNlsMarkersStayOnTheLineOfTheirLiteral.case diff --git a/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFile.java b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFile.java new file mode 100644 index 000000000..cccafbaa1 --- /dev/null +++ b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFile.java @@ -0,0 +1,114 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.palantir.javaformat.java; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; + +/** + * A formatter test case written as a file: the code before formatting and the code expected after it, separated by a + * line of six or more dashes. A file with two such lines starts with a settings block. There are no settings yet, so + * the block holds only blank lines and {@code #} comments, which explain the case. + * + *

Lines end in {@code \n} in both blocks, whatever the file uses. {@code afterLine} is the line of the file the + * after block starts on, so that a failure can name the line of the file where the output departs from it. + */ +record CaseFile(String before, String after, int afterLine) { + static final String EXTENSION = ".case"; + + private static final Pattern SEPARATOR = Pattern.compile("-{6,}"); + + /** Splits the text of the case file at {@code path}, which only names the file in an error. */ + static CaseFile parse(String path, String text) { + var blocks = new ArrayList(); + blocks.add(new StringBuilder()); + var number = 0; + var afterLine = 0; + + for (var line : text.lines().toList()) { + number++; + + if (SEPARATOR.matcher(line).matches()) { + blocks.add(new StringBuilder()); + afterLine = number + 1; + } else { + blocks.getLast().append(line).append('\n'); + } + } + + var separators = blocks.size() - 1; + + if (separators != 1 && separators != 2) { + throw new IllegalArgumentException( + path + ": a case has one or two lines of six or more dashes, found " + separators); + } + + if (separators == 2) { + for (var line : blocks.getFirst().toString().lines().toList()) { + if (!line.isBlank() && !line.startsWith("#")) { + throw new IllegalArgumentException(path + + ": there are no settings yet, the first block takes blank lines and # comments only: " + + line); + } + } + } + + return new CaseFile( + blocks.get(separators - 1).toString(), blocks.get(separators).toString(), afterLine); + } + + /** + * Describes where {@code actual} first departs from the after block: the line, numbered as in the file, with what + * the case expects there and what {@code actual} has. + */ + String firstDifference(String actual) { + var expectedLines = after.lines().toList(); + var actualLines = actual.lines().toList(); + var i = 0; + + while (i < expectedLines.size() + && i < actualLines.size() + && expectedLines.get(i).equals(actualLines.get(i))) { + i++; + } + + if (i == expectedLines.size() && i == actualLines.size()) { + return "the lines are the same, their line breaks differ"; + } + + return "line " + (afterLine + i) + "\n expected: " + lineOrEnd(expectedLines, i) + "\n actual: " + + lineOrEnd(actualLines, i); + } + + private static String lineOrEnd(List lines, int index) { + return index < lines.size() ? lines.get(index) : "(no more lines)"; + } + + /** Returns the case files under {@code root}, as paths relative to it with {@code /} between names, in order. */ + static List pathsIn(Path root) throws IOException { + try (var files = Files.walk(root)) { + return files.filter(Files::isRegularFile) + .filter(file -> file.toString().endsWith(EXTENSION)) + .map(file -> root.relativize(file).toString().replace(File.separatorChar, '/')) + .sorted() + .toList(); + } + } +} diff --git a/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFileTest.java b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFileTest.java new file mode 100644 index 000000000..c94efe5fd --- /dev/null +++ b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFileTest.java @@ -0,0 +1,117 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.palantir.javaformat.java; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +final class CaseFileTest { + @Test + void oneSeparatorSplitsBeforeFromAfter() { + assertThat(CaseFile.parse("a.case", "class A{}\n------\nclass A {}\n")) + .isEqualTo(new CaseFile("class A{}\n", "class A {}\n", 3)); + } + + @Test + void twoSeparatorsStartWithTheSettingsBlock() { + var text = "# Why this case exists.\n\n----------\nclass A{}\n----------\nclass A {}\n"; + + assertThat(CaseFile.parse("a.case", text)).isEqualTo(new CaseFile("class A{}\n", "class A {}\n", 6)); + } + + @Test + void aFileWithoutASeparatorIsNotACase() { + assertThatThrownBy(() -> CaseFile.parse("dir/a.case", "class A {}\n")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("dir/a.case") + .hasMessageContaining("found 0"); + } + + @Test + void aFileWithThreeSeparatorsIsNotACase() { + assertThatThrownBy(() -> CaseFile.parse("a.case", "x\n------\ny\n------\nz\n------\nw\n")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("a.case") + .hasMessageContaining("found 3"); + } + + @Test + void fiveDashesOrATrailingSpaceAreNotASeparator() { + assertThat(CaseFile.parse("a.case", "a\n-----\nb\n------ \nc\n------\nd\n")) + .isEqualTo(new CaseFile("a\n-----\nb\n------ \nc\n", "d\n", 7)); + } + + @Test + void linesEndInLfWhileTabsAndTrailingSpacesStay() { + var text = "class A {\r\n\tint x; \r\n}\r\n------\r\nclass A {\r\n int x;\r\n}"; + + assertThat(CaseFile.parse("a.case", text)) + .isEqualTo(new CaseFile("class A {\n\tint x; \n}\n", "class A {\n int x;\n}\n", 5)); + } + + @Test + void aSettingIsRejectedWhileThereAreNone() { + assertThatThrownBy(() -> CaseFile.parse("a.case", "# fine\nstyle: google\n------\na\n------\nb\n")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("a.case") + .hasMessageContaining("style: google"); + } + + @Test + void findsCaseFilesByExtensionInSubfolders(@TempDir Path root) throws Exception { + Files.createDirectories(root.resolve("sub")); + for (var name : List.of("b.case", "sub/a.case", "notes.txt", ".DS_Store", "sub/c.case.txt")) { + Files.writeString(root.resolve(name), ""); + } + + assertThat(CaseFile.pathsIn(root)).containsExactly("b.case", "sub/a.case"); + } + + @Test + void aDifferenceNamesItsLineInTheFile() { + var testCase = new CaseFile("x\n", "a\nb\nc\n", 10); + + assertThat(testCase.firstDifference("a\nB\nc\n")).isEqualTo("line 11\n expected: b\n actual: B"); + } + + @Test + void aShorterOutputNamesTheFirstMissingLine() { + var testCase = new CaseFile("x\n", "a\nb\nc\n", 10); + + assertThat(testCase.firstDifference("a\n")).isEqualTo("line 11\n expected: b\n actual: (no more lines)"); + } + + @Test + void aLongerOutputNamesTheFirstExtraLine() { + var testCase = new CaseFile("x\n", "a\nb\nc\n", 10); + + assertThat(testCase.firstDifference("a\nb\nc\nd\n")) + .isEqualTo("line 13\n expected: (no more lines)\n actual: d"); + } + + @Test + void sameLinesWithOtherLineBreaksAreSaidToBeSo() { + var testCase = new CaseFile("x\n", "a\nb\n", 10); + + assertThat(testCase.firstDifference("a\r\nb\r\n")) + .isEqualTo("the lines are the same, their line breaks differ"); + } +} diff --git a/open-java-format/src/test/java/com/palantir/javaformat/java/FormatterCasesTest.java b/open-java-format/src/test/java/com/palantir/javaformat/java/FormatterCasesTest.java new file mode 100644 index 000000000..89b20e1c9 --- /dev/null +++ b/open-java-format/src/test/java/com/palantir/javaformat/java/FormatterCasesTest.java @@ -0,0 +1,75 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.palantir.javaformat.java; + +import static java.util.Objects.requireNonNull; +import static org.assertj.core.api.Assertions.assertThat; + +import com.palantir.javaformat.java.JavaFormatterOptions.Style; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.DynamicTest; +import org.junit.jupiter.api.TestFactory; +import org.junit.jupiter.api.parallel.Execution; +import org.junit.jupiter.api.parallel.ExecutionMode; + +/** + * One test for each {@link CaseFile} under {@code test-cases} on the test classpath: formatting the before block gives + * the after block, and formatting that again changes nothing. Adding a case is adding a file. + */ +@Execution(ExecutionMode.CONCURRENT) +final class FormatterCasesTest { + private static final String CASES = "test-cases"; + + private static final Formatter FORMATTER = Formatter.createFormatter( + JavaFormatterOptions.builder().style(Style.OJF).build()); + + @TestFactory + List cases() throws Exception { + var folder = requireNonNull( + FormatterCasesTest.class.getClassLoader().getResource(CASES), + "no " + CASES + " folder on the test classpath"); + var root = Path.of(folder.toURI()); + var paths = CaseFile.pathsIn(root); + + // A wrong folder or a resource filter would otherwise pass with no tests at all. + assertThat(paths).as("the case files under %s", root).isNotEmpty(); + + var tests = new ArrayList(); + + for (var path : paths) { + var name = path.substring(0, path.length() - CaseFile.EXTENSION.length()); + + tests.add(DynamicTest.dynamicTest(name, () -> { + var testCase = CaseFile.parse(path, Files.readString(root.resolve(path))); + var once = FORMATTER.formatSourceAndFixImports(testCase.before()); + + assertThat(once) + .as(() -> CASES + "/" + path + ", first run, " + testCase.firstDifference(once)) + .isEqualTo(testCase.after()); + + var twice = FORMATTER.formatSourceAndFixImports(once); + + assertThat(twice) + .as(() -> CASES + "/" + path + ", second run, " + testCase.firstDifference(twice)) + .isEqualTo(once); + })); + } + + return tests; + } +} diff --git a/open-java-format/src/test/java/com/palantir/javaformat/java/FormatterTest.java b/open-java-format/src/test/java/com/palantir/javaformat/java/FormatterTest.java index 3f75b8ea8..0efde6577 100644 --- a/open-java-format/src/test/java/com/palantir/javaformat/java/FormatterTest.java +++ b/open-java-format/src/test/java/com/palantir/javaformat/java/FormatterTest.java @@ -433,45 +433,6 @@ void m() { assertThat(Formatter.create().formatSource(once)).isEqualTo(once); } - @Test - void nonNlsMarkersStayOnTheLineOfTheirLiteral() throws Exception { - // Eclipse numbers a marker by the position of its literal on the line. When a statement is wrapped, each - // marker moves to the line of its literal and is renumbered for that line; when a literal is reflowed, every - // piece gets one (#23). A marker whose number has no literal stays where it is. - var input = """ - class T { - void m() { - String s = Messages.format("first argument that is long enough to matter", "second argument that is also rather long", "third one"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - String reflowed = "a single string literal that is far too long to fit into one hundred and twenty columns, so the formatter reflows it"; //$NON-NLS-1$ - String n = Messages.format("first argument that is long enough to matter", "second argument that is also rather long", "third one"); //$NON-NLS-5$ - } - } - """; - var expected = """ - class T { - void m() { - String s = Messages.format( - "first argument that is long enough to matter", //$NON-NLS-1$ - "second argument that is also rather long", //$NON-NLS-1$ - "third one"); //$NON-NLS-1$ - String reflowed = - "a single string literal that is far too long to fit into one hundred and twenty" //$NON-NLS-1$ - + " columns, so the formatter reflows it"; //$NON-NLS-1$ - String n = Messages.format( - "first argument that is long enough to matter", - "second argument that is also rather long", - "third one"); //$NON-NLS-5$ - } - } - """; - - var formatter = Formatter.createFormatter( - JavaFormatterOptions.builder().style(Style.OJF).build()); - var once = formatter.formatSourceAndFixImports(input); - assertThat(once).isEqualTo(expected); - assertThat(formatter.formatSourceAndFixImports(once)).isEqualTo(once); - } - @Test void throwsFormatterException() throws Exception { assertThatThrownBy(() -> Formatter.create().formatSourceAndFixImports("package foo; public class {")) diff --git a/open-java-format/src/test/resources/test-cases/nonNlsMarkersStayOnTheLineOfTheirLiteral.case b/open-java-format/src/test/resources/test-cases/nonNlsMarkersStayOnTheLineOfTheirLiteral.case new file mode 100644 index 000000000..1749b737a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/nonNlsMarkersStayOnTheLineOfTheirLiteral.case @@ -0,0 +1,27 @@ +# Eclipse numbers a marker by the position of its literal on the line. When a statement is wrapped, +# each marker moves to the line of its literal and is renumbered for that line; when a literal is +# reflowed, every piece gets one (#23). A marker whose number has no literal stays where it is. +---------- +class T { + void m() { + String s = Messages.format("first argument that is long enough to matter", "second argument that is also rather long", "third one"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String reflowed = "a single string literal that is far too long to fit into one hundred and twenty columns, so the formatter reflows it"; //$NON-NLS-1$ + String n = Messages.format("first argument that is long enough to matter", "second argument that is also rather long", "third one"); //$NON-NLS-5$ + } +} +---------- +class T { + void m() { + String s = Messages.format( + "first argument that is long enough to matter", //$NON-NLS-1$ + "second argument that is also rather long", //$NON-NLS-1$ + "third one"); //$NON-NLS-1$ + String reflowed = + "a single string literal that is far too long to fit into one hundred and twenty" //$NON-NLS-1$ + + " columns, so the formatter reflows it"; //$NON-NLS-1$ + String n = Messages.format( + "first argument that is long enough to matter", + "second argument that is also rather long", + "third one"); //$NON-NLS-5$ + } +} From cabb918d0a8b622d5f36bfbd92dcdcf5e6d066b1 Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Mon, 26 Oct 2026 12:33:48 +0300 Subject: [PATCH 2/9] Move the before-and-after tests of FormatterTest and JBangDirectivesTest into test-cases/ Every test that formatted a string and compared the result with a second string in the code becomes a case file, one per test and one per row of a parameterized test: 23 tests of FormatterTest and all 40 of JBangDirectivesTest, which goes. A one-off generator read the strings from the test sources through javac's tree, so none was retyped, and the comments of the tests became the # headers of their cases. The 19 of them that formatted in the GOOGLE style now run in OJF, the one style the formatter has. Their inputs are unchanged and each expected output is the OJF one; for all but two it equals the old one with every indent doubled, so the test checks the same thing. The two that wrap at the line limit were checked by hand. wrapMarkdownDocstringComment fitted in 120 columns, so its sentence got three more words and wraps again. wrapMarkdownDocstringRunKeepsTheSlashPrefix now wraps right before @Deprecated; on JDK 25 a formatter from before the fix for palantir/palantir-java-format#1803 drops the /// there, so the case still catches it. It was skipped below JDK 23 and now runs on every JDK, with the same output on 21, 25 and 27, as all the cases. wrapLineComment stays in FormatterTest: its output, in GOOGLE as in OJF, changes on a second run, which the cases check. It and the seven other tests that stay in FormatterTest but formatted in GOOGLE use an OJF formatter now; only wrapLineComment and blankLinesImportComment change their expected text. Tests on JDK 21: FormatterTest 42 -> 19, JBangDirectivesTest 40 -> 0, FormatterCasesTest 1 -> 64, every other class unchanged; 1670 tests before and after, 14 skipped instead of 15. Each of the 63 old test names maps to one case. --- .../javaformat/java/FormatterTest.java | 378 ++---------------- .../javaformat/java/JBangDirectivesTest.java | 121 ------ .../resources/test-cases/badConstructor.case | 5 + .../test-cases/blankInClassBody.case | 8 + .../blockCommentInteriorTrailingBlank.case | 17 + .../test-cases/blockCommentTrailingBlank.case | 11 + .../contextualKeywordAsIdentifier-non.case | 30 ++ .../contextualKeywordAsIdentifier-sealed.case | 30 ++ .../contextualKeywordAsIdentifier-value.case | 30 ++ .../test-cases/docCommentTrailingBlank.case | 10 + .../test/resources/test-cases/emptyArray.case | 5 + .../test-cases/importsFixedIfRequested.case | 25 ++ ...ineThatRunsNoCommandAsOrdinaryComment.case | 7 + ...LookalikeAsOrdinaryComment-DEPS-colon.case | 10 + ...matsLookalikeAsOrdinaryComment-DEPSSS.case | 10 + ...rmatsLookalikeAsOrdinaryComment-DEPS_.case | 10 + ...likeAsOrdinaryComment-Deps-mixed-case.case | 10 + ...ookalikeAsOrdinaryComment-JAVA21-plus.case | 10 + ...ormatsLookalikeAsOrdinaryComment-TODO.case | 10 + ...dinaryComment-commented-out-directive.case | 10 + ...likeAsOrdinaryComment-deps-lower-case.case | 10 + ...AsOrdinaryComment-space-after-slashes.case | 10 + ...kalikeAsOrdinaryComment-three-slashes.case | 10 + ...llLineAfterFirstLineAsOrdinaryComment.case | 9 + ...epsDirectiveBeforeFirstLineOfCode-CDS.case | 11 + ...BeforeFirstLineOfCode-COMPILE_OPTIONS.case | 11 + ...ctiveBeforeFirstLineOfCode-DEPS-alone.case | 11 + ...FirstLineOfCode-DEPS-over-120-columns.case | 11 + ...LineOfCode-DEPS-property-with-default.case | 11 + ...rectiveBeforeFirstLineOfCode-DEPS-tab.case | 11 + ...FirstLineOfCode-DEPS-trailing-comment.case | 11 + ...psDirectiveBeforeFirstLineOfCode-DEPS.case | 11 + ...tiveBeforeFirstLineOfCode-DESCRIPTION.case | 11 + ...psDirectiveBeforeFirstLineOfCode-DOCS.case | 11 + ...sDirectiveBeforeFirstLineOfCode-FILES.case | 11 + ...epsDirectiveBeforeFirstLineOfCode-GAV.case | 11 + ...DirectiveBeforeFirstLineOfCode-GROOVY.case | 11 + ...psDirectiveBeforeFirstLineOfCode-JAVA.case | 11 + ...ectiveBeforeFirstLineOfCode-JAVAAGENT.case | 11 + ...veBeforeFirstLineOfCode-JAVAC_OPTIONS.case | 11 + ...iveBeforeFirstLineOfCode-JAVA_OPTIONS.case | 11 + ...DirectiveBeforeFirstLineOfCode-KOTLIN.case | 11 + ...psDirectiveBeforeFirstLineOfCode-MAIN.case | 11 + ...rectiveBeforeFirstLineOfCode-MANIFEST.case | 11 + ...DirectiveBeforeFirstLineOfCode-MODULE.case | 11 + ...eBeforeFirstLineOfCode-NATIVE_OPTIONS.case | 11 + ...eBeforeFirstLineOfCode-NOINTEGRATIONS.case | 11 + ...irectiveBeforeFirstLineOfCode-PREVIEW.case | 11 + ...rectiveBeforeFirstLineOfCode-Q-CONFIG.case | 11 + ...sDirectiveBeforeFirstLineOfCode-REPOS.case | 11 + ...BeforeFirstLineOfCode-RUNTIME_OPTIONS.case | 11 + ...irectiveBeforeFirstLineOfCode-SOURCES.case | 11 + ...ntGetsItsMissingSpaceExceptIdeMarkers.case | 24 ++ .../test-cases/lineCommentTrailingBlank.case | 11 + .../lineCommentTrailingThinSpace.case | 10 + ...AfterLineCommentWithInteriorBlankLine.case | 13 + .../onlyWrapLineCommentOnWhitespace.case | 11 + ...mmentOnWhitespace_noLeadingWhitespace.case | 11 + .../removeTrailingTabsInComments.case | 13 + .../test-cases/stringEscapeLength.case | 7 + ...lingCommentAfterOpenBraceIsIdempotent.case | 24 ++ ...ntGetsItsMissingSpaceExceptIdeMarkers.case | 24 ++ .../test/resources/test-cases/voidMethod.case | 5 + .../wrapMarkdownDocstringComment.case | 10 + ...rkdownDocstringRunKeepsTheSlashPrefix.case | 15 + 65 files changed, 806 insertions(+), 466 deletions(-) delete mode 100644 open-java-format/src/test/java/com/palantir/javaformat/java/JBangDirectivesTest.java create mode 100644 open-java-format/src/test/resources/test-cases/badConstructor.case create mode 100644 open-java-format/src/test/resources/test-cases/blankInClassBody.case create mode 100644 open-java-format/src/test/resources/test-cases/blockCommentInteriorTrailingBlank.case create mode 100644 open-java-format/src/test/resources/test-cases/blockCommentTrailingBlank.case create mode 100644 open-java-format/src/test/resources/test-cases/contextualKeywordAsIdentifier-non.case create mode 100644 open-java-format/src/test/resources/test-cases/contextualKeywordAsIdentifier-sealed.case create mode 100644 open-java-format/src/test/resources/test-cases/contextualKeywordAsIdentifier-value.case create mode 100644 open-java-format/src/test/resources/test-cases/docCommentTrailingBlank.case create mode 100644 open-java-format/src/test/resources/test-cases/emptyArray.case create mode 100644 open-java-format/src/test/resources/test-cases/importsFixedIfRequested.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/formatsFirstLineThatRunsNoCommandAsOrdinaryComment.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-DEPS-colon.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-DEPSSS.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-DEPS_.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-Deps-mixed-case.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-JAVA21-plus.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-TODO.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-commented-out-directive.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-deps-lower-case.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-space-after-slashes.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-three-slashes.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/formatsShellLineAfterFirstLineAsOrdinaryComment.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-CDS.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-COMPILE_OPTIONS.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-alone.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-over-120-columns.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-property-with-default.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-tab.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-trailing-comment.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DESCRIPTION.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DOCS.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-FILES.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-GAV.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-GROOVY.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVA.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVAAGENT.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVAC_OPTIONS.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVA_OPTIONS.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-KOTLIN.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-MAIN.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-MANIFEST.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-MODULE.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-NATIVE_OPTIONS.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-NOINTEGRATIONS.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-PREVIEW.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-Q-CONFIG.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-REPOS.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-RUNTIME_OPTIONS.case create mode 100644 open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-SOURCES.case create mode 100644 open-java-format/src/test/resources/test-cases/lineCommentGetsItsMissingSpaceExceptIdeMarkers.case create mode 100644 open-java-format/src/test/resources/test-cases/lineCommentTrailingBlank.case create mode 100644 open-java-format/src/test/resources/test-cases/lineCommentTrailingThinSpace.case create mode 100644 open-java-format/src/test/resources/test-cases/noBlankAfterLineCommentWithInteriorBlankLine.case create mode 100644 open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace.case create mode 100644 open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace_noLeadingWhitespace.case create mode 100644 open-java-format/src/test/resources/test-cases/removeTrailingTabsInComments.case create mode 100644 open-java-format/src/test/resources/test-cases/stringEscapeLength.case create mode 100644 open-java-format/src/test/resources/test-cases/trailingCommentAfterOpenBraceIsIdempotent.case create mode 100644 open-java-format/src/test/resources/test-cases/trailingLineCommentGetsItsMissingSpaceExceptIdeMarkers.case create mode 100644 open-java-format/src/test/resources/test-cases/voidMethod.case create mode 100644 open-java-format/src/test/resources/test-cases/wrapMarkdownDocstringComment.case create mode 100644 open-java-format/src/test/resources/test-cases/wrapMarkdownDocstringRunKeepsTheSlashPrefix.case diff --git a/open-java-format/src/test/java/com/palantir/javaformat/java/FormatterTest.java b/open-java-format/src/test/java/com/palantir/javaformat/java/FormatterTest.java index 0efde6577..e4e0f0ef3 100644 --- a/open-java-format/src/test/java/com/palantir/javaformat/java/FormatterTest.java +++ b/open-java-format/src/test/java/com/palantir/javaformat/java/FormatterTest.java @@ -42,12 +42,13 @@ import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.ExecutionMode; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; @Execution(ExecutionMode.CONCURRENT) final class FormatterTest { + private static final Formatter FORMATTER = Formatter.createFormatter( + JavaFormatterOptions.builder().style(Style.OJF).build()); + @TempDir public Path testFolder; @@ -122,87 +123,14 @@ void formatLengthOutOfRange() throws Exception { assertThat(err.toString()).contains("error: invalid length 9999, offset + length (9999) is outside the file"); } - @Test - void blankInClassBody() throws FormatterException { - String input = "package test;\nclass T {\n\n}\n"; - String output = Formatter.create().formatSource(input); - String expect = "package test;\n\nclass T {}\n"; - assertThat(output).isEqualTo(expect); - } - @Test void blankInClassBodyNoTrailing() throws FormatterException { String input = "package test;\nclass T {\n\n}"; - String output = Formatter.create().formatSource(input); + String output = FORMATTER.formatSource(input); String expect = "package test;\n\nclass T {}\n"; assertThat(output).isEqualTo(expect); } - @Test - void docCommentTrailingBlank() throws FormatterException { - String input = "class T {\n/** asd */\n\nint x;\n}"; - String output = Formatter.create().formatSource(input); - String expect = "class T {\n /** asd */\n int x;\n}\n"; - assertThat(output).isEqualTo(expect); - } - - @Test - void blockCommentInteriorTrailingBlank() throws FormatterException { - String input = "class T {\n/*\n* asd \n* fgh\n*/ \n\nint x;\n}"; - String output = Formatter.create().formatSource(input); - String expect = "class T {\n /*\n * asd\n * fgh\n */\n\n int x;\n}\n"; - assertThat(output).isEqualTo(expect); - } - - @Test - void blockCommentTrailingBlank() throws FormatterException { - String input = "class T {\n/* asd */ \n\nint x;\n}"; - String output = Formatter.create().formatSource(input); - String expect = "class T {\n /* asd */\n\n int x;\n}\n"; - assertThat(output).isEqualTo(expect); - } - - @Test - void lineCommentTrailingBlank() throws FormatterException { - String input = "class T {\n// asd \n\nint x;\n}"; - String output = Formatter.create().formatSource(input); - String expect = "class T {\n // asd\n\n int x;\n}\n"; - assertThat(output).isEqualTo(expect); - } - - @Test - void lineCommentTrailingThinSpace() throws FormatterException { - // The Unicode thin space is matched by CharMatcher.whitespace() but not trim(). - String input = "class T {\n // asd\u2009\n}\n"; - String output = Formatter.create().formatSource(input); - String expect = "class T {\n // asd\n}\n"; - assertThat(output).isEqualTo(expect); - } - - @Test - void noBlankAfterLineCommentWithInteriorBlankLine() throws FormatterException { - String input = "class T {\n// asd \n\n// dsa \nint x;\n}"; - String output = Formatter.create().formatSource(input); - String expect = "class T {\n // asd\n\n // dsa\n int x;\n}\n"; - assertThat(output).isEqualTo(expect); - } - - @Test - void badConstructor() throws FormatterException { - String input = "class X { Y() {} }"; - String output = Formatter.create().formatSource(input); - String expect = "class X {\n Y() {}\n}\n"; - assertThat(output).isEqualTo(expect); - } - - @Test - void voidMethod() throws FormatterException { - String input = "class X { void Y() {} }"; - String output = Formatter.create().formatSource(input); - String expect = "class X {\n void Y() {}\n}\n"; - assertThat(output).isEqualTo(expect); - } - @SuppressWarnings("for-rollout:StringConcatToTextBlock") private static final String UNORDERED_IMPORTS = Joiner.on('\n') .join( @@ -221,30 +149,11 @@ void voidMethod() throws FormatterException { @Test void importsNotReorderedByDefault() throws FormatterException { String input = "package com.google.example;\n" + UNORDERED_IMPORTS + "\npublic class ExampleTest {}\n"; - String output = Formatter.create().formatSource(input); + String output = FORMATTER.formatSource(input); String expect = "package com.google.example;\n\n" + UNORDERED_IMPORTS + "\n\npublic class ExampleTest {}\n"; assertThat(output).isEqualTo(expect); } - @Test - void importsFixedIfRequested() throws FormatterException { - String input = "package com.google.example;\n" - + UNORDERED_IMPORTS - + "\npublic class ExampleTest {\n" - + " @Nullable List xs;\n" - + "}\n"; - String output = Formatter.create().formatSourceAndFixImports(input); - @SuppressWarnings("for-rollout:StringConcatToTextBlock") - String expect = "package com.google.example;\n\n" - + "import java.util.List;\n" - + "import javax.annotations.Nullable;\n\n" - + "public class ExampleTest {\n" - + " @Nullable\n" - + " List xs;\n" - + "}\n"; - assertThat(output).isEqualTo(expect); - } - @Test void importOrderingWithoutFormatting() throws IOException, UsageException { importOrdering("--fix-imports-only", "com/palantir/javaformat/java/testimports/A.imports-only"); @@ -300,142 +209,32 @@ private String getResource(String resourceName) throws IOException { // regression test for google-java-format#47 @Test void trailingCommentWithoutTerminalNewline() throws Exception { - assertThat(Formatter.create().formatSource("/*\n * my comment */")).isEqualTo("/*\n * my comment */\n"); - } - - @Test - void emptyArray() throws Exception { - assertThat(Formatter.create().formatSource("class T { int x[] = {,}; }")) - .isEqualTo("class T {\n int x[] = {,};\n}\n"); - } - - @Test - void stringEscapeLength() throws Exception { - assertThat(Formatter.create().formatSource("class T {{ f(\"\\\"\"); }}")) - .isEqualTo("class T {\n {\n f(\"\\\"\");\n }\n}\n"); + assertThat(FORMATTER.formatSource("/*\n * my comment */")).isEqualTo("/*\n * my comment */\n"); } @Test void wrapLineComment() throws Exception { - assertThat(Formatter.create() - .formatSource("class T {\n" - + " public static void main(String[] args) { // one long incredibly" - + " unbroken sentence moving from topic to topic so that no-one had a" - + " chance to interrupt;\n" - + " }\n" - + "}\n")) - .isEqualTo("class T {\n" - + " public static void main(\n" - + " String[]\n" - + " args) { // one long incredibly unbroken sentence moving" - + " from topic to topic so that no-one\n" - + " // had a chance to interrupt;\n" + // Not a case in test-cases yet: a second run moves the wrapped part of the comment to the indent of the block, + // and the cases check that a second run changes nothing. + assertThat(FORMATTER.formatSource("class T {\n" + + " public static void main(String[] args) { // one long incredibly" + + " unbroken sentence moving from topic to topic so that no-one had a" + + " chance to interrupt;\n" + " }\n" - + "}\n"); - } - - @Test - void onlyWrapLineCommentOnWhitespace() throws Exception { - assertThat(Formatter.create() - .formatSource("class T {\n" - + " public static void main(String[] args) { // one_long_incredibly" - + "_unbroken_sentence_moving_from_topic_to_topic_so_that_no-one_had_a" - + "_chance_to_interrupt;\n" - + " }\n" - + "}\n")) - .isEqualTo("class T {\n" - + " public static void main(\n" - + " String[]\n" - + " args) { // one_long_incredibly" - + "_unbroken_sentence_moving_from_topic_to_topic_so_that_no-one_had_a" - + "_chance_to_interrupt;\n" - + " }\n" - + "}\n"); - } - - @Test - void onlyWrapLineCommentOnWhitespace_noLeadingWhitespace() throws Exception { - assertThat(Formatter.create() - .formatSource("class T {\n" - + " public static void main(String[] args) { //one_long_incredibly" - + "_unbroken_sentence_moving_from_topic_to_topic_so_that_no-one_had_a" - + "_chance_to_interrupt;\n" - + " }\n" - + "}\n")) + + "}\n")) .isEqualTo("class T {\n" - + " public static void main(\n" - + " String[]\n" - + " args) { // one_long_incredibly" - + "_unbroken_sentence_moving_from_topic_to_topic_so_that_no-one_had_a" - + "_chance_to_interrupt;\n" - + " }\n" + + " public static void main(\n" + + " String[]\n" + + " args) { // one long incredibly unbroken sentence moving" + + " from topic to topic so that no-one had a\n" + + " // chance to interrupt;\n" + + " }\n" + "}\n"); } - @Test - void lineCommentGetsItsMissingSpaceExceptIdeMarkers() throws Exception { - // `//foo` gets a space after any number of slashes, while the IDE markers `//noinspection` and `//$NON-NLS-n$` - // are recognised by their tools only without one and stay as written. - String input = "class T {\n" - + " //noinspection unchecked\n" - + " //$NON-NLS-1$ //$NON-NLS-2$\n" - + " //$NON-NLS-12$ and more\n" - + " //foo\n" - + " ///foo\n" - + " // bar\n" - + " // two spaces\n" - + " void m() {}\n" - + "}\n"; - String expected = "class T {\n" - + " //noinspection unchecked\n" - + " //$NON-NLS-1$ //$NON-NLS-2$\n" - + " //$NON-NLS-12$ and more\n" - + " // foo\n" - + " /// foo\n" - + " // bar\n" - + " // two spaces\n" - + " void m() {}\n" - + "}\n"; - assertThat(Formatter.create().formatSource(input)).isEqualTo(expected); - } - - @Test - void trailingLineCommentGetsItsMissingSpaceExceptIdeMarkers() throws Exception { - // The same rule for a comment that trails a statement which fits on one line. Such a statement is written - // from its flat text, which skips the comment rewriting, so the IDE markers used to get the space too (#23). - var input = """ - class T { - void m() { - String a = "x"; //$NON-NLS-1$ - String b = "y"; //noinspection unchecked - String c = "z"; //foo - String d = "w"; ///foo - String e = "v"; // bar - String f = "u"; /// baz - } - } - """; - var expected = """ - class T { - void m() { - String a = "x"; //$NON-NLS-1$ - String b = "y"; //noinspection unchecked - String c = "z"; // foo - String d = "w"; /// foo - String e = "v"; // bar - String f = "u"; /// baz - } - } - """; - - var once = Formatter.create().formatSource(input); - assertThat(once).isEqualTo(expected); - assertThat(Formatter.create().formatSource(once)).isEqualTo(once); - } - @Test void throwsFormatterException() throws Exception { - assertThatThrownBy(() -> Formatter.create().formatSourceAndFixImports("package foo; public class {")) + assertThatThrownBy(() -> FORMATTER.formatSourceAndFixImports("package foo; public class {")) .isInstanceOf(FormatterException.class); } @@ -449,76 +248,37 @@ void blankLinesImportComment() throws FormatterException { + "import a.A;\n" + "\n" + "class T {\n" - + " A a;\n" + + " A a;\n" + "}\n"; @SuppressWarnings("for-rollout:StringConcatToTextBlock") String withoutBlank = - "package p;\n" + "\n" + "/** test */\n" + "import a.A;\n" + "\n" + "class T {\n" + " A a;\n" + "}\n"; + "package p;\n" + "\n" + "/** test */\n" + "import a.A;\n" + "\n" + "class T {\n" + " A a;\n" + "}\n"; // Formatting deletes the blank line between the "javadoc" and the first import. - assertThat(Formatter.create().formatSource(withBlank)).isEqualTo(withoutBlank); - assertThat(Formatter.create().formatSourceAndFixImports(withBlank)).isEqualTo(withoutBlank); - assertThat(Formatter.create().formatSource(withoutBlank)).isEqualTo(withoutBlank); - assertThat(Formatter.create().formatSourceAndFixImports(withoutBlank)).isEqualTo(withoutBlank); + assertThat(FORMATTER.formatSource(withBlank)).isEqualTo(withoutBlank); + assertThat(FORMATTER.formatSourceAndFixImports(withBlank)).isEqualTo(withoutBlank); + assertThat(FORMATTER.formatSource(withoutBlank)).isEqualTo(withoutBlank); + assertThat(FORMATTER.formatSourceAndFixImports(withoutBlank)).isEqualTo(withoutBlank); // Just fixing imports preserves whitespace around imports. assertThat(RemoveUnusedImports.removeUnusedImports(withBlank)).isEqualTo(withBlank); - assertThat(ImportOrderer.reorderImports(withBlank, Style.GOOGLE)).isEqualTo(withBlank); + assertThat(ImportOrderer.reorderImports(withBlank, Style.OJF)).isEqualTo(withBlank); assertThat(RemoveUnusedImports.removeUnusedImports(withoutBlank)).isEqualTo(withoutBlank); - assertThat(ImportOrderer.reorderImports(withoutBlank, Style.GOOGLE)).isEqualTo(withoutBlank); - } - - @Test - void wrapMarkdownDocstringComment() throws Exception { - String input = "class T {\n" - + " /// one long incredibly unbroken sentence moving from topic to topic so that no-one" - + " had a chance to interrupt;\n" - + " void m() {}\n" - + "}\n"; - String expected = "class T {\n" - + " /// one long incredibly unbroken sentence moving from topic to topic so that no-one" - + " had a chance\n" - + " /// to interrupt;\n" - + " void m() {}\n" - + "}\n"; - assertThat(Formatter.create().formatSource(input)).isEqualTo(expected); - } - - @Test - void wrapMarkdownDocstringRunKeepsTheSlashPrefix() throws Exception { - // javac returns a run of `///` lines as one comment token from JDK 23 on; before that each line is its - // own token and the wrapped line is always the first of its token, which is never misread. - Assumptions.assumeTrue( - Formatter.getRuntimeVersion() >= 23, "a `///` run is one comment token only from JDK 23 on"); - String input = "class T {\n" - + " /// Summary line.\n" - + " /// one long incredibly unbroken sentence moving from topic to topic so that no-one had a" - + " chance to interrupt; @Deprecated\n" - + " void m() {}\n" - + "}\n"; - String expected = "class T {\n" - + " /// Summary line.\n" - + " /// one long incredibly unbroken sentence moving from topic to topic so that no-one had a" - + " chance\n" - + " /// to interrupt; @Deprecated\n" - + " void m() {}\n" - + "}\n"; - assertThat(Formatter.create().formatSource(input)).isEqualTo(expected); + assertThat(ImportOrderer.reorderImports(withoutBlank, Style.OJF)).isEqualTo(withoutBlank); } @Test void canParse_java9_private_interface_methods() { - assertThatCode(() -> Formatter.create() - .formatSourceAndFixImports("" - + "interface T {\n" - + " private static void foo() {}\n" // - + "}")) + assertThatCode(() -> FORMATTER.formatSourceAndFixImports("" + + "interface T {\n" + + " private static void foo() {}\n" // + + "}")) .doesNotThrowAnyException(); } @Test void producesFormattingChangesOnAlreadyFormattedFiles() throws FormatterException { - Formatter formatter = Formatter.create(); + Formatter formatter = FORMATTER; @SuppressWarnings("for-rollout:StringConcatToTextBlock") String simpleClass = "package com.palantir;\n" + "\n" @@ -582,16 +342,6 @@ void indentsCommentsThatShareALineLinearly() throws FormatterException { assertThat(formatter.formatSource(input.toString()).length()).isLessThan(10_000); } - @Test - void removeTrailingTabsInComments() throws FormatterException { - String input = "class Foo {\n void f() {\n int x = 0; // comment\t\t\t\n return;\n }\n}\n"; - String expected = "class Foo {\n void f() {\n int x = 0; // comment\n return;\n }\n}\n"; - Formatter formatter = Formatter.createFormatter( - JavaFormatterOptions.builder().style(Style.OJF).build()); - - assertThat(formatter.formatSource(input)).isEqualTo(expected); - } - @Test void valueClassAndRecord() throws FormatterException { Assumptions.assumeTrue( @@ -629,66 +379,4 @@ public value record PointValueRecord(int x, int y) {} assertThat(formatter.formatSource(input)).isEqualTo(expected); } - - @ParameterizedTest - @ValueSource(strings = {"non", "sealed", "value"}) - void contextualKeywordAsIdentifier(String name) throws FormatterException { - // `value`, `sealed` and `non-sealed` are modifiers only in front of a declaration that carries them. Anywhere - // else they are identifiers, and a lambda parameter is the one declaration that starts with its name. - String input = """ - import java.util.Map; - - class T { - private final int NAME; - - T(int NAME) { - this.NAME = NAME; - } - - void f(Map map) { - map.forEach((key, NAME) -> System.err.println(key + NAME)); - } - } - """.replace("NAME", name); - Formatter formatter = Formatter.createFormatter( - JavaFormatterOptions.builder().style(Style.OJF).build()); - - assertThat(formatter.formatSource(input)).isEqualTo(input); - } - - @Test - void trailingCommentAfterOpenBraceIsIdempotent() throws FormatterException { - // A block comment that trails `{` is broken onto its own line. It used to land one indent deeper than the - // statements that follow, and only a second run moved it back (google-java-format#1260, #129). - String input = """ - class T { - void f() { - { /* c */ int x = 1; } - } - - int[] a = { /* c */ 1 }; - } - """; - String expected = """ - class T { - void f() { - { - /* c */ - int x = 1; - } - } - - int[] a = { - /* c */ - 1 - }; - } - """; - Formatter formatter = Formatter.createFormatter( - JavaFormatterOptions.builder().style(Style.GOOGLE).build()); - - String once = formatter.formatSource(input); - assertThat(once).isEqualTo(expected); - assertThat(formatter.formatSource(once)).isEqualTo(once); - } } diff --git a/open-java-format/src/test/java/com/palantir/javaformat/java/JBangDirectivesTest.java b/open-java-format/src/test/java/com/palantir/javaformat/java/JBangDirectivesTest.java deleted file mode 100644 index 1c49d6323..000000000 --- a/open-java-format/src/test/java/com/palantir/javaformat/java/JBangDirectivesTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * (c) Copyright 2026 Palantir Technologies Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.palantir.javaformat.java; - -import static org.assertj.core.api.Assertions.assertThat; - -import com.palantir.javaformat.java.JavaFormatterOptions.Style; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.parallel.Execution; -import org.junit.jupiter.api.parallel.ExecutionMode; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.CsvSource; -import org.junit.jupiter.params.provider.ValueSource; - -/** - * JBang reads its directives from the line comments before the first line of code, and a shell runs the first line of - * a script, so those lines are left exactly as written. The goldens {@code ojf-issue-24-jbang-*} show whole scripts, - * with the same directives after the first line of code formatted like any other comment. - */ -@Execution(ExecutionMode.CONCURRENT) -final class JBangDirectivesTest { - - private static final Formatter FORMATTER = Formatter.createFormatter( - JavaFormatterOptions.builder().style(Style.OJF).build()); - - @ParameterizedTest - @ValueSource( - strings = { - // Every name JBang knows. - "//CDS", - "//COMPILE_OPTIONS -Xlint:all", - "//DEPS info.picocli:picocli:4.7.6", - "//DESCRIPTION Prints a greeting", - "//DOCS guide=./readme.md", - "//FILES application.properties", - "//GAV org.example:hello:1.0", - "//GROOVY 3.0.19", - "//JAVA 21+", - "//JAVAAGENT myagent.jar=option1,option2", - "//JAVAC_OPTIONS -parameters", - "//JAVA_OPTIONS -Xmx512m", - "//KOTLIN 2.0.21", - "//MAIN org.example.Hello", - "//MANIFEST Built-By=jbang", - "//MODULE org.example.hello", - "//NATIVE_OPTIONS --no-fallback", - "//NOINTEGRATIONS", - "//PREVIEW", - "//REPOS central,jitpack", - "//RUNTIME_OPTIONS -XX:+UseSerialGC", - "//SOURCES Helper.java", - // A directive for a build integration: Quarkus reads //Q:CONFIG. - "//Q:CONFIG quarkus.banner.enabled=false", - // What JBang's syntax allows after the name. - "//DEPS\tinfo.picocli:picocli:4.7.6", - "//DEPS info.picocli:picocli:4.7.6 // parses the command line", - "//DEPS org.postgresql:postgresql:${env.DB_VERSION:42.6.0}", - "//DEPS", - // Longer than the 120 columns at which a line comment is wrapped. - "//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13" - + " com.squareup.okhttp3:okhttp:4.12.0", - }) - void keepsDirectiveBeforeFirstLineOfCode(String directive) throws FormatterException { - String script = directive + "\n\nclass Hello {}\n"; - assertThat(FORMATTER.formatSource(script)).isEqualTo(script); - } - - @ParameterizedTest - @CsvSource( - delimiterString = " => ", - value = { - // Not a name JBang knows. - "//DEPSSS a:b:1 => // DEPSSS a:b:1", - "//DEPS_ a:b:1 => // DEPS_ a:b:1", - "//TODO pin the versions => // TODO pin the versions", - // No whitespace after the name. - "//JAVA21+ => // JAVA21+", - "//DEPS:a:b:1 => // DEPS:a:b:1", - // Directive names are upper case. - "//deps a:b:1 => // deps a:b:1", - "//Deps a:b:1 => // Deps a:b:1", - // Three slashes, as in a Markdown doc comment. - "///DEPS a:b:1 => /// DEPS a:b:1", - // Switched off on purpose: JBang's own templates list optional dependencies this way. - "// DEPS a:b:1 => // DEPS a:b:1", - "// //DEPS a:b:1 => // //DEPS a:b:1", - }) - void formatsLookalikeAsOrdinaryComment(String comment, String expected) throws FormatterException { - assertThat(FORMATTER.formatSource(comment + "\n\nclass Hello {}\n")) - .isEqualTo(expected + "\n\nclass Hello {}\n"); - } - - @Test - void formatsShellLineAfterFirstLineAsOrdinaryComment() throws FormatterException { - // The shell runs the first line of the file only. - String script = "/* License */\n///usr/bin/env jbang \"$0\" \"$@\" ; exit $?\nclass Hello {}\n"; - assertThat(FORMATTER.formatSource(script)) - .isEqualTo("/* License */\n/// usr/bin/env jbang \"$0\" \"$@\" ; exit $?\nclass Hello {}\n"); - } - - @Test - void formatsFirstLineThatRunsNoCommandAsOrdinaryComment() throws FormatterException { - // The first word is not a path, so the shell would have nothing to run. - assertThat(FORMATTER.formatSource("//Hello from JBang\nclass Hello {}\n")) - .isEqualTo("// Hello from JBang\nclass Hello {}\n"); - } -} diff --git a/open-java-format/src/test/resources/test-cases/badConstructor.case b/open-java-format/src/test/resources/test-cases/badConstructor.case new file mode 100644 index 000000000..ee165fd6b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/badConstructor.case @@ -0,0 +1,5 @@ +class X { Y() {} } +---------- +class X { + Y() {} +} diff --git a/open-java-format/src/test/resources/test-cases/blankInClassBody.case b/open-java-format/src/test/resources/test-cases/blankInClassBody.case new file mode 100644 index 000000000..abab5e1eb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/blankInClassBody.case @@ -0,0 +1,8 @@ +package test; +class T { + +} +---------- +package test; + +class T {} diff --git a/open-java-format/src/test/resources/test-cases/blockCommentInteriorTrailingBlank.case b/open-java-format/src/test/resources/test-cases/blockCommentInteriorTrailingBlank.case new file mode 100644 index 000000000..14514e16d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/blockCommentInteriorTrailingBlank.case @@ -0,0 +1,17 @@ +class T { +/* +* asd +* fgh +*/ + +int x; +} +---------- +class T { + /* + * asd + * fgh + */ + + int x; +} diff --git a/open-java-format/src/test/resources/test-cases/blockCommentTrailingBlank.case b/open-java-format/src/test/resources/test-cases/blockCommentTrailingBlank.case new file mode 100644 index 000000000..37bd01fc1 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/blockCommentTrailingBlank.case @@ -0,0 +1,11 @@ +class T { +/* asd */ + +int x; +} +---------- +class T { + /* asd */ + + int x; +} diff --git a/open-java-format/src/test/resources/test-cases/contextualKeywordAsIdentifier-non.case b/open-java-format/src/test/resources/test-cases/contextualKeywordAsIdentifier-non.case new file mode 100644 index 000000000..c72f33543 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/contextualKeywordAsIdentifier-non.case @@ -0,0 +1,30 @@ +# `value`, `sealed` and `non-sealed` are modifiers only in front of a declaration that carries them. Anywhere +# else they are identifiers, and a lambda parameter is the one declaration that starts with its name. +---------- +import java.util.Map; + +class T { + private final int non; + + T(int non) { + this.non = non; + } + + void f(Map map) { + map.forEach((key, non) -> System.err.println(key + non)); + } +} +---------- +import java.util.Map; + +class T { + private final int non; + + T(int non) { + this.non = non; + } + + void f(Map map) { + map.forEach((key, non) -> System.err.println(key + non)); + } +} diff --git a/open-java-format/src/test/resources/test-cases/contextualKeywordAsIdentifier-sealed.case b/open-java-format/src/test/resources/test-cases/contextualKeywordAsIdentifier-sealed.case new file mode 100644 index 000000000..96713180c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/contextualKeywordAsIdentifier-sealed.case @@ -0,0 +1,30 @@ +# `value`, `sealed` and `non-sealed` are modifiers only in front of a declaration that carries them. Anywhere +# else they are identifiers, and a lambda parameter is the one declaration that starts with its name. +---------- +import java.util.Map; + +class T { + private final int sealed; + + T(int sealed) { + this.sealed = sealed; + } + + void f(Map map) { + map.forEach((key, sealed) -> System.err.println(key + sealed)); + } +} +---------- +import java.util.Map; + +class T { + private final int sealed; + + T(int sealed) { + this.sealed = sealed; + } + + void f(Map map) { + map.forEach((key, sealed) -> System.err.println(key + sealed)); + } +} diff --git a/open-java-format/src/test/resources/test-cases/contextualKeywordAsIdentifier-value.case b/open-java-format/src/test/resources/test-cases/contextualKeywordAsIdentifier-value.case new file mode 100644 index 000000000..4510d3302 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/contextualKeywordAsIdentifier-value.case @@ -0,0 +1,30 @@ +# `value`, `sealed` and `non-sealed` are modifiers only in front of a declaration that carries them. Anywhere +# else they are identifiers, and a lambda parameter is the one declaration that starts with its name. +---------- +import java.util.Map; + +class T { + private final int value; + + T(int value) { + this.value = value; + } + + void f(Map map) { + map.forEach((key, value) -> System.err.println(key + value)); + } +} +---------- +import java.util.Map; + +class T { + private final int value; + + T(int value) { + this.value = value; + } + + void f(Map map) { + map.forEach((key, value) -> System.err.println(key + value)); + } +} diff --git a/open-java-format/src/test/resources/test-cases/docCommentTrailingBlank.case b/open-java-format/src/test/resources/test-cases/docCommentTrailingBlank.case new file mode 100644 index 000000000..7033d81be --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/docCommentTrailingBlank.case @@ -0,0 +1,10 @@ +class T { +/** asd */ + +int x; +} +---------- +class T { + /** asd */ + int x; +} diff --git a/open-java-format/src/test/resources/test-cases/emptyArray.case b/open-java-format/src/test/resources/test-cases/emptyArray.case new file mode 100644 index 000000000..da134890e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/emptyArray.case @@ -0,0 +1,5 @@ +class T { int x[] = {,}; } +---------- +class T { + int x[] = {,}; +} diff --git a/open-java-format/src/test/resources/test-cases/importsFixedIfRequested.case b/open-java-format/src/test/resources/test-cases/importsFixedIfRequested.case new file mode 100644 index 000000000..7eb551b46 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/importsFixedIfRequested.case @@ -0,0 +1,25 @@ +package com.google.example; +import com.google.common.base.Preconditions; + +import static org.junit.Assert.fail; +import static com.google.truth.Truth.assertThat; + +import org.junit.runners.JUnit4; +import org.junit.runner.RunWith; + +import java.util.List; + +import javax.annotations.Nullable; +public class ExampleTest { + @Nullable List xs; +} +---------- +package com.google.example; + +import java.util.List; +import javax.annotations.Nullable; + +public class ExampleTest { + @Nullable + List xs; +} diff --git a/open-java-format/src/test/resources/test-cases/jbang/formatsFirstLineThatRunsNoCommandAsOrdinaryComment.case b/open-java-format/src/test/resources/test-cases/jbang/formatsFirstLineThatRunsNoCommandAsOrdinaryComment.case new file mode 100644 index 000000000..38065ad0e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/formatsFirstLineThatRunsNoCommandAsOrdinaryComment.case @@ -0,0 +1,7 @@ +# The first word is not a path, so the shell would have nothing to run. +---------- +//Hello from JBang +class Hello {} +---------- +// Hello from JBang +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-DEPS-colon.case b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-DEPS-colon.case new file mode 100644 index 000000000..236892c00 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-DEPS-colon.case @@ -0,0 +1,10 @@ +# A line comment that only looks like a JBang directive is formatted like any other. +# No whitespace after the name. +---------- +//DEPS:a:b:1 + +class Hello {} +---------- +// DEPS:a:b:1 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-DEPSSS.case b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-DEPSSS.case new file mode 100644 index 000000000..01fbd7825 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-DEPSSS.case @@ -0,0 +1,10 @@ +# A line comment that only looks like a JBang directive is formatted like any other. +# Not a name JBang knows. +---------- +//DEPSSS a:b:1 + +class Hello {} +---------- +// DEPSSS a:b:1 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-DEPS_.case b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-DEPS_.case new file mode 100644 index 000000000..fc4bbdad1 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-DEPS_.case @@ -0,0 +1,10 @@ +# A line comment that only looks like a JBang directive is formatted like any other. +# Not a name JBang knows. +---------- +//DEPS_ a:b:1 + +class Hello {} +---------- +// DEPS_ a:b:1 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-Deps-mixed-case.case b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-Deps-mixed-case.case new file mode 100644 index 000000000..9fe1f57f8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-Deps-mixed-case.case @@ -0,0 +1,10 @@ +# A line comment that only looks like a JBang directive is formatted like any other. +# Directive names are upper case. +---------- +//Deps a:b:1 + +class Hello {} +---------- +// Deps a:b:1 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-JAVA21-plus.case b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-JAVA21-plus.case new file mode 100644 index 000000000..78d9ec416 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-JAVA21-plus.case @@ -0,0 +1,10 @@ +# A line comment that only looks like a JBang directive is formatted like any other. +# No whitespace after the name. +---------- +//JAVA21+ + +class Hello {} +---------- +// JAVA21+ + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-TODO.case b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-TODO.case new file mode 100644 index 000000000..b4e8d97b4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-TODO.case @@ -0,0 +1,10 @@ +# A line comment that only looks like a JBang directive is formatted like any other. +# Not a name JBang knows. +---------- +//TODO pin the versions + +class Hello {} +---------- +// TODO pin the versions + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-commented-out-directive.case b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-commented-out-directive.case new file mode 100644 index 000000000..0c5255055 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-commented-out-directive.case @@ -0,0 +1,10 @@ +# A line comment that only looks like a JBang directive is formatted like any other. +# Switched off on purpose: JBang's own templates list optional dependencies this way. +---------- +// //DEPS a:b:1 + +class Hello {} +---------- +// //DEPS a:b:1 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-deps-lower-case.case b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-deps-lower-case.case new file mode 100644 index 000000000..3005695c7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-deps-lower-case.case @@ -0,0 +1,10 @@ +# A line comment that only looks like a JBang directive is formatted like any other. +# Directive names are upper case. +---------- +//deps a:b:1 + +class Hello {} +---------- +// deps a:b:1 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-space-after-slashes.case b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-space-after-slashes.case new file mode 100644 index 000000000..f4319d99a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-space-after-slashes.case @@ -0,0 +1,10 @@ +# A line comment that only looks like a JBang directive is formatted like any other. +# Switched off on purpose: JBang's own templates list optional dependencies this way. +---------- +// DEPS a:b:1 + +class Hello {} +---------- +// DEPS a:b:1 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-three-slashes.case b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-three-slashes.case new file mode 100644 index 000000000..599dc4259 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/formatsLookalikeAsOrdinaryComment-three-slashes.case @@ -0,0 +1,10 @@ +# A line comment that only looks like a JBang directive is formatted like any other. +# Three slashes, as in a Markdown doc comment. +---------- +///DEPS a:b:1 + +class Hello {} +---------- +/// DEPS a:b:1 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/formatsShellLineAfterFirstLineAsOrdinaryComment.case b/open-java-format/src/test/resources/test-cases/jbang/formatsShellLineAfterFirstLineAsOrdinaryComment.case new file mode 100644 index 000000000..982c7a0c8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/formatsShellLineAfterFirstLineAsOrdinaryComment.case @@ -0,0 +1,9 @@ +# The shell runs the first line of the file only. +---------- +/* License */ +///usr/bin/env jbang "$0" "$@" ; exit $? +class Hello {} +---------- +/* License */ +/// usr/bin/env jbang "$0" "$@" ; exit $? +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-CDS.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-CDS.case new file mode 100644 index 000000000..e50631c62 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-CDS.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//CDS + +class Hello {} +---------- +//CDS + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-COMPILE_OPTIONS.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-COMPILE_OPTIONS.case new file mode 100644 index 000000000..d35613e54 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-COMPILE_OPTIONS.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//COMPILE_OPTIONS -Xlint:all + +class Hello {} +---------- +//COMPILE_OPTIONS -Xlint:all + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-alone.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-alone.case new file mode 100644 index 000000000..fe0069fd6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-alone.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# What JBang's syntax allows after the name. +---------- +//DEPS + +class Hello {} +---------- +//DEPS + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-over-120-columns.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-over-120-columns.case new file mode 100644 index 000000000..dabcf6c03 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-over-120-columns.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Longer than the 120 columns at which a line comment is wrapped. +---------- +//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13 com.squareup.okhttp3:okhttp:4.12.0 + +class Hello {} +---------- +//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13 com.squareup.okhttp3:okhttp:4.12.0 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-property-with-default.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-property-with-default.case new file mode 100644 index 000000000..4d6909752 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-property-with-default.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# What JBang's syntax allows after the name. +---------- +//DEPS org.postgresql:postgresql:${env.DB_VERSION:42.6.0} + +class Hello {} +---------- +//DEPS org.postgresql:postgresql:${env.DB_VERSION:42.6.0} + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-tab.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-tab.case new file mode 100644 index 000000000..2316e405b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-tab.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# What JBang's syntax allows after the name. +---------- +//DEPS info.picocli:picocli:4.7.6 + +class Hello {} +---------- +//DEPS info.picocli:picocli:4.7.6 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-trailing-comment.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-trailing-comment.case new file mode 100644 index 000000000..c348a9397 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS-trailing-comment.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# What JBang's syntax allows after the name. +---------- +//DEPS info.picocli:picocli:4.7.6 // parses the command line + +class Hello {} +---------- +//DEPS info.picocli:picocli:4.7.6 // parses the command line + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS.case new file mode 100644 index 000000000..1bf033d8c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DEPS.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//DEPS info.picocli:picocli:4.7.6 + +class Hello {} +---------- +//DEPS info.picocli:picocli:4.7.6 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DESCRIPTION.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DESCRIPTION.case new file mode 100644 index 000000000..bc23334c1 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DESCRIPTION.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//DESCRIPTION Prints a greeting + +class Hello {} +---------- +//DESCRIPTION Prints a greeting + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DOCS.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DOCS.case new file mode 100644 index 000000000..128274a3f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-DOCS.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//DOCS guide=./readme.md + +class Hello {} +---------- +//DOCS guide=./readme.md + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-FILES.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-FILES.case new file mode 100644 index 000000000..544595e1f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-FILES.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//FILES application.properties + +class Hello {} +---------- +//FILES application.properties + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-GAV.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-GAV.case new file mode 100644 index 000000000..da3ffd777 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-GAV.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//GAV org.example:hello:1.0 + +class Hello {} +---------- +//GAV org.example:hello:1.0 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-GROOVY.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-GROOVY.case new file mode 100644 index 000000000..78c549fc8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-GROOVY.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//GROOVY 3.0.19 + +class Hello {} +---------- +//GROOVY 3.0.19 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVA.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVA.case new file mode 100644 index 000000000..6ecea077b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVA.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//JAVA 21+ + +class Hello {} +---------- +//JAVA 21+ + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVAAGENT.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVAAGENT.case new file mode 100644 index 000000000..92a42e813 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVAAGENT.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//JAVAAGENT myagent.jar=option1,option2 + +class Hello {} +---------- +//JAVAAGENT myagent.jar=option1,option2 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVAC_OPTIONS.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVAC_OPTIONS.case new file mode 100644 index 000000000..16e421edc --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVAC_OPTIONS.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//JAVAC_OPTIONS -parameters + +class Hello {} +---------- +//JAVAC_OPTIONS -parameters + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVA_OPTIONS.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVA_OPTIONS.case new file mode 100644 index 000000000..691370381 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-JAVA_OPTIONS.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//JAVA_OPTIONS -Xmx512m + +class Hello {} +---------- +//JAVA_OPTIONS -Xmx512m + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-KOTLIN.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-KOTLIN.case new file mode 100644 index 000000000..484ce4eeb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-KOTLIN.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//KOTLIN 2.0.21 + +class Hello {} +---------- +//KOTLIN 2.0.21 + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-MAIN.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-MAIN.case new file mode 100644 index 000000000..fc06dd951 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-MAIN.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//MAIN org.example.Hello + +class Hello {} +---------- +//MAIN org.example.Hello + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-MANIFEST.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-MANIFEST.case new file mode 100644 index 000000000..ce847326b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-MANIFEST.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//MANIFEST Built-By=jbang + +class Hello {} +---------- +//MANIFEST Built-By=jbang + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-MODULE.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-MODULE.case new file mode 100644 index 000000000..612a312fe --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-MODULE.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//MODULE org.example.hello + +class Hello {} +---------- +//MODULE org.example.hello + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-NATIVE_OPTIONS.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-NATIVE_OPTIONS.case new file mode 100644 index 000000000..7639fc848 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-NATIVE_OPTIONS.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//NATIVE_OPTIONS --no-fallback + +class Hello {} +---------- +//NATIVE_OPTIONS --no-fallback + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-NOINTEGRATIONS.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-NOINTEGRATIONS.case new file mode 100644 index 000000000..96bbf0246 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-NOINTEGRATIONS.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//NOINTEGRATIONS + +class Hello {} +---------- +//NOINTEGRATIONS + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-PREVIEW.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-PREVIEW.case new file mode 100644 index 000000000..f812e9c38 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-PREVIEW.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//PREVIEW + +class Hello {} +---------- +//PREVIEW + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-Q-CONFIG.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-Q-CONFIG.case new file mode 100644 index 000000000..0d08b8a9b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-Q-CONFIG.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# A directive for a build integration: Quarkus reads //Q:CONFIG. +---------- +//Q:CONFIG quarkus.banner.enabled=false + +class Hello {} +---------- +//Q:CONFIG quarkus.banner.enabled=false + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-REPOS.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-REPOS.case new file mode 100644 index 000000000..9f1f6041c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-REPOS.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//REPOS central,jitpack + +class Hello {} +---------- +//REPOS central,jitpack + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-RUNTIME_OPTIONS.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-RUNTIME_OPTIONS.case new file mode 100644 index 000000000..569589ae5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-RUNTIME_OPTIONS.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//RUNTIME_OPTIONS -XX:+UseSerialGC + +class Hello {} +---------- +//RUNTIME_OPTIONS -XX:+UseSerialGC + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-SOURCES.case b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-SOURCES.case new file mode 100644 index 000000000..f27dabc47 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/jbang/keepsDirectiveBeforeFirstLineOfCode-SOURCES.case @@ -0,0 +1,11 @@ +# JBang reads its directives from the line comments before the first line of code, +# and they stay exactly as written. +# Every name JBang knows. +---------- +//SOURCES Helper.java + +class Hello {} +---------- +//SOURCES Helper.java + +class Hello {} diff --git a/open-java-format/src/test/resources/test-cases/lineCommentGetsItsMissingSpaceExceptIdeMarkers.case b/open-java-format/src/test/resources/test-cases/lineCommentGetsItsMissingSpaceExceptIdeMarkers.case new file mode 100644 index 000000000..2b0bf04ab --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/lineCommentGetsItsMissingSpaceExceptIdeMarkers.case @@ -0,0 +1,24 @@ +# `//foo` gets a space after any number of slashes, while the IDE markers `//noinspection` and `//$NON-NLS-n$` +# are recognised by their tools only without one and stay as written. +---------- +class T { + //noinspection unchecked + //$NON-NLS-1$ //$NON-NLS-2$ + //$NON-NLS-12$ and more + //foo + ///foo + // bar + // two spaces + void m() {} +} +---------- +class T { + //noinspection unchecked + //$NON-NLS-1$ //$NON-NLS-2$ + //$NON-NLS-12$ and more + // foo + /// foo + // bar + // two spaces + void m() {} +} diff --git a/open-java-format/src/test/resources/test-cases/lineCommentTrailingBlank.case b/open-java-format/src/test/resources/test-cases/lineCommentTrailingBlank.case new file mode 100644 index 000000000..76d6f2ca3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/lineCommentTrailingBlank.case @@ -0,0 +1,11 @@ +class T { +// asd + +int x; +} +---------- +class T { + // asd + + int x; +} diff --git a/open-java-format/src/test/resources/test-cases/lineCommentTrailingThinSpace.case b/open-java-format/src/test/resources/test-cases/lineCommentTrailingThinSpace.case new file mode 100644 index 000000000..c771ed271 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/lineCommentTrailingThinSpace.case @@ -0,0 +1,10 @@ +# The Unicode thin space is matched by CharMatcher.whitespace() but not trim(). +# The comment below ends in one, U+2009. +---------- +class T { + // asd  +} +---------- +class T { + // asd +} diff --git a/open-java-format/src/test/resources/test-cases/noBlankAfterLineCommentWithInteriorBlankLine.case b/open-java-format/src/test/resources/test-cases/noBlankAfterLineCommentWithInteriorBlankLine.case new file mode 100644 index 000000000..c8c41dd0d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/noBlankAfterLineCommentWithInteriorBlankLine.case @@ -0,0 +1,13 @@ +class T { +// asd + +// dsa +int x; +} +---------- +class T { + // asd + + // dsa + int x; +} diff --git a/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace.case b/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace.case new file mode 100644 index 000000000..fbe682f45 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace.case @@ -0,0 +1,11 @@ +class T { + public static void main(String[] args) { // one_long_incredibly_unbroken_sentence_moving_from_topic_to_topic_so_that_no-one_had_a_chance_to_interrupt; + } +} +---------- +class T { + public static void main( + String[] + args) { // one_long_incredibly_unbroken_sentence_moving_from_topic_to_topic_so_that_no-one_had_a_chance_to_interrupt; + } +} diff --git a/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace_noLeadingWhitespace.case b/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace_noLeadingWhitespace.case new file mode 100644 index 000000000..1a25366b8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace_noLeadingWhitespace.case @@ -0,0 +1,11 @@ +class T { + public static void main(String[] args) { //one_long_incredibly_unbroken_sentence_moving_from_topic_to_topic_so_that_no-one_had_a_chance_to_interrupt; + } +} +---------- +class T { + public static void main( + String[] + args) { // one_long_incredibly_unbroken_sentence_moving_from_topic_to_topic_so_that_no-one_had_a_chance_to_interrupt; + } +} diff --git a/open-java-format/src/test/resources/test-cases/removeTrailingTabsInComments.case b/open-java-format/src/test/resources/test-cases/removeTrailingTabsInComments.case new file mode 100644 index 000000000..5e458ed7b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/removeTrailingTabsInComments.case @@ -0,0 +1,13 @@ +class Foo { + void f() { + int x = 0; // comment + return; + } +} +---------- +class Foo { + void f() { + int x = 0; // comment + return; + } +} diff --git a/open-java-format/src/test/resources/test-cases/stringEscapeLength.case b/open-java-format/src/test/resources/test-cases/stringEscapeLength.case new file mode 100644 index 000000000..66450c052 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringEscapeLength.case @@ -0,0 +1,7 @@ +class T {{ f("\""); }} +---------- +class T { + { + f("\""); + } +} diff --git a/open-java-format/src/test/resources/test-cases/trailingCommentAfterOpenBraceIsIdempotent.case b/open-java-format/src/test/resources/test-cases/trailingCommentAfterOpenBraceIsIdempotent.case new file mode 100644 index 000000000..359bd2d07 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/trailingCommentAfterOpenBraceIsIdempotent.case @@ -0,0 +1,24 @@ +# A block comment that trails `{` is broken onto its own line. It used to land one indent deeper than the +# statements that follow, and only a second run moved it back (google-java-format#1260, #129). +---------- +class T { + void f() { + { /* c */ int x = 1; } + } + + int[] a = { /* c */ 1 }; +} +---------- +class T { + void f() { + { + /* c */ + int x = 1; + } + } + + int[] a = { + /* c */ + 1 + }; +} diff --git a/open-java-format/src/test/resources/test-cases/trailingLineCommentGetsItsMissingSpaceExceptIdeMarkers.case b/open-java-format/src/test/resources/test-cases/trailingLineCommentGetsItsMissingSpaceExceptIdeMarkers.case new file mode 100644 index 000000000..715e45d2c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/trailingLineCommentGetsItsMissingSpaceExceptIdeMarkers.case @@ -0,0 +1,24 @@ +# The same rule for a comment that trails a statement which fits on one line. Such a statement is written +# from its flat text, which skips the comment rewriting, so the IDE markers used to get the space too (#23). +---------- +class T { + void m() { + String a = "x"; //$NON-NLS-1$ + String b = "y"; //noinspection unchecked + String c = "z"; //foo + String d = "w"; ///foo + String e = "v"; // bar + String f = "u"; /// baz + } +} +---------- +class T { + void m() { + String a = "x"; //$NON-NLS-1$ + String b = "y"; //noinspection unchecked + String c = "z"; // foo + String d = "w"; /// foo + String e = "v"; // bar + String f = "u"; /// baz + } +} diff --git a/open-java-format/src/test/resources/test-cases/voidMethod.case b/open-java-format/src/test/resources/test-cases/voidMethod.case new file mode 100644 index 000000000..abce607eb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/voidMethod.case @@ -0,0 +1,5 @@ +class X { void Y() {} } +---------- +class X { + void Y() {} +} diff --git a/open-java-format/src/test/resources/test-cases/wrapMarkdownDocstringComment.case b/open-java-format/src/test/resources/test-cases/wrapMarkdownDocstringComment.case new file mode 100644 index 000000000..3429a6a98 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/wrapMarkdownDocstringComment.case @@ -0,0 +1,10 @@ +class T { + /// one long incredibly unbroken sentence moving from topic to topic so that no-one in the room had a chance to interrupt; + void m() {} +} +---------- +class T { + /// one long incredibly unbroken sentence moving from topic to topic so that no-one in the room had a chance to + /// interrupt; + void m() {} +} diff --git a/open-java-format/src/test/resources/test-cases/wrapMarkdownDocstringRunKeepsTheSlashPrefix.case b/open-java-format/src/test/resources/test-cases/wrapMarkdownDocstringRunKeepsTheSlashPrefix.case new file mode 100644 index 000000000..be25b3178 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/wrapMarkdownDocstringRunKeepsTheSlashPrefix.case @@ -0,0 +1,15 @@ +# javac returns a run of `///` lines as one comment token from JDK 23 on; before that each line is its +# own token and the wrapped line is always the first of its token, which is never misread. +---------- +class T { + /// Summary line. + /// one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt; @Deprecated + void m() {} +} +---------- +class T { + /// Summary line. + /// one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt; + /// @Deprecated + void m() {} +} From 4745c4ed1012aef12fe843f21fc0b3195d894be2 Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Mon, 26 Oct 2026 23:56:03 +0300 Subject: [PATCH 3/9] Read test cases byte for byte, line breaks included A case went through String.lines() and came back with \n after every line, so a file written with \r\n or \r tested the same thing as one with \n, and a line break was added where a file had none at its end. CaseFile now cuts the blocks out of the text as it is: the before block runs from the line after the first line of dashes to the second, its last line break included, and the after block from the line after the second to the end of the file, and the formatter's output has to match it byte for byte. Every case therefore has exactly two lines of dashes, and one without a header starts with them: the 15 cases that started with their code got the leading line, the other 49 had a header already. .gitattributes keeps git from converting the line breaks of *.case files, which the comparison now sees. Tests on JDK 21 and 25: CaseFileTest 12 -> 14, the 64 cases unchanged and passing, 1672 tests in the module. Copies of a case with \r\n and with \r pass as well. --- .gitattributes | 2 + .../palantir/javaformat/java/CaseFile.java | 56 ++++++++----------- .../javaformat/java/CaseFileTest.java | 34 +++++++---- .../resources/test-cases/badConstructor.case | 1 + .../test-cases/blankInClassBody.case | 1 + .../blockCommentInteriorTrailingBlank.case | 1 + .../test-cases/blockCommentTrailingBlank.case | 1 + .../test-cases/docCommentTrailingBlank.case | 1 + .../test/resources/test-cases/emptyArray.case | 1 + .../test-cases/importsFixedIfRequested.case | 1 + .../test-cases/lineCommentTrailingBlank.case | 1 + ...AfterLineCommentWithInteriorBlankLine.case | 1 + .../onlyWrapLineCommentOnWhitespace.case | 1 + ...mmentOnWhitespace_noLeadingWhitespace.case | 1 + .../removeTrailingTabsInComments.case | 1 + .../test-cases/stringEscapeLength.case | 1 + .../test/resources/test-cases/voidMethod.case | 1 + .../wrapMarkdownDocstringComment.case | 1 + 18 files changed, 63 insertions(+), 44 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..7bc32384a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# A formatter test case is compared byte for byte, line breaks included, so git must not convert them. +*.case -text diff --git a/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFile.java b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFile.java index cccafbaa1..0db2bd577 100644 --- a/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFile.java +++ b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFile.java @@ -18,60 +18,48 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; /** - * A formatter test case written as a file: the code before formatting and the code expected after it, separated by a - * line of six or more dashes. A file with two such lines starts with a settings block. There are no settings yet, so - * the block holds only blank lines and {@code #} comments, which explain the case. + * A formatter test case written as a file: an optional header, a line of six or more dashes, the code before + * formatting, a second such line and the code expected after it. There are no settings yet, so the header holds only + * blank lines and {@code #} comments, which explain the case; a file without one starts with the first dashes. * - *

Lines end in {@code \n} in both blocks, whatever the file uses. {@code afterLine} is the line of the file the - * after block starts on, so that a failure can name the line of the file where the output departs from it. + *

The blocks are the text of the file as written. The before block runs from the line after the first dashes to + * the second, its last line break included, and the after block from the line after the second dashes to the end of + * the file. Line breaks stay {@code \n}, {@code \r\n} or {@code \r}, whichever the file has. {@code afterLine} is the + * line of the file the after block starts on, so that a failure can name the line where the output departs from it. */ record CaseFile(String before, String after, int afterLine) { static final String EXTENSION = ".case"; - private static final Pattern SEPARATOR = Pattern.compile("-{6,}"); + /** Six or more dashes on a line of their own, with the line break that ends them. */ + private static final Pattern SEPARATOR = Pattern.compile("(?:\\A|(?<=[\\r\\n]))-{6,}(?:\\r\\n|\\r|\\n|\\z)"); /** Splits the text of the case file at {@code path}, which only names the file in an error. */ static CaseFile parse(String path, String text) { - var blocks = new ArrayList(); - blocks.add(new StringBuilder()); - var number = 0; - var afterLine = 0; + var separators = SEPARATOR.matcher(text).results().toList(); - for (var line : text.lines().toList()) { - number++; - - if (SEPARATOR.matcher(line).matches()) { - blocks.add(new StringBuilder()); - afterLine = number + 1; - } else { - blocks.getLast().append(line).append('\n'); - } - } - - var separators = blocks.size() - 1; - - if (separators != 1 && separators != 2) { + if (separators.size() != 2) { throw new IllegalArgumentException( - path + ": a case has one or two lines of six or more dashes, found " + separators); + path + ": a case has two lines of six or more dashes, found " + separators.size()); } - if (separators == 2) { - for (var line : blocks.getFirst().toString().lines().toList()) { - if (!line.isBlank() && !line.startsWith("#")) { - throw new IllegalArgumentException(path - + ": there are no settings yet, the first block takes blank lines and # comments only: " - + line); - } + for (var line : text.substring(0, separators.getFirst().start()).lines().toList()) { + if (!line.isBlank() && !line.startsWith("#")) { + throw new IllegalArgumentException(path + + ": there are no settings yet, the header takes blank lines and # comments only: " + line); } } + var afterStart = separators.getLast().end(); + var afterLine = (int) text.substring(0, afterStart).lines().count() + 1; + return new CaseFile( - blocks.get(separators - 1).toString(), blocks.get(separators).toString(), afterLine); + text.substring(separators.getFirst().end(), separators.getLast().start()), + text.substring(afterStart), + afterLine); } /** diff --git a/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFileTest.java b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFileTest.java index c94efe5fd..1ac2fbce2 100644 --- a/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFileTest.java +++ b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFileTest.java @@ -25,13 +25,13 @@ final class CaseFileTest { @Test - void oneSeparatorSplitsBeforeFromAfter() { - assertThat(CaseFile.parse("a.case", "class A{}\n------\nclass A {}\n")) - .isEqualTo(new CaseFile("class A{}\n", "class A {}\n", 3)); + void theBlocksLieBetweenTheTwoSeparatorLines() { + assertThat(CaseFile.parse("a.case", "------\nclass A{}\n------\nclass A {}\n")) + .isEqualTo(new CaseFile("class A{}\n", "class A {}\n", 4)); } @Test - void twoSeparatorsStartWithTheSettingsBlock() { + void aHeaderBeforeTheFirstSeparatorExplainsTheCase() { var text = "# Why this case exists.\n\n----------\nclass A{}\n----------\nclass A {}\n"; assertThat(CaseFile.parse("a.case", text)).isEqualTo(new CaseFile("class A{}\n", "class A {}\n", 6)); @@ -45,9 +45,17 @@ void aFileWithoutASeparatorIsNotACase() { .hasMessageContaining("found 0"); } + @Test + void aFileWithOneSeparatorIsNotACase() { + assertThatThrownBy(() -> CaseFile.parse("a.case", "class A{}\n------\nclass A {}\n")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("a.case") + .hasMessageContaining("found 1"); + } + @Test void aFileWithThreeSeparatorsIsNotACase() { - assertThatThrownBy(() -> CaseFile.parse("a.case", "x\n------\ny\n------\nz\n------\nw\n")) + assertThatThrownBy(() -> CaseFile.parse("a.case", "------\ny\n------\nz\n------\nw\n")) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("a.case") .hasMessageContaining("found 3"); @@ -55,16 +63,22 @@ void aFileWithThreeSeparatorsIsNotACase() { @Test void fiveDashesOrATrailingSpaceAreNotASeparator() { - assertThat(CaseFile.parse("a.case", "a\n-----\nb\n------ \nc\n------\nd\n")) - .isEqualTo(new CaseFile("a\n-----\nb\n------ \nc\n", "d\n", 7)); + assertThat(CaseFile.parse("a.case", "------\na\n-----\nb\n------ \nc\n------\nd\n")) + .isEqualTo(new CaseFile("a\n-----\nb\n------ \nc\n", "d\n", 8)); } @Test - void linesEndInLfWhileTabsAndTrailingSpacesStay() { - var text = "class A {\r\n\tint x; \r\n}\r\n------\r\nclass A {\r\n int x;\r\n}"; + void lineBreaksTabsAndTrailingSpacesStayAsWritten() { + var text = "------\r\nclass A {\r\n\tint x; \r\n}\r\n------\r\nclass A {\r\n int x;\r\n}"; assertThat(CaseFile.parse("a.case", text)) - .isEqualTo(new CaseFile("class A {\n\tint x; \n}\n", "class A {\n int x;\n}\n", 5)); + .isEqualTo(new CaseFile("class A {\r\n\tint x; \r\n}\r\n", "class A {\r\n int x;\r\n}", 6)); + } + + @Test + void carriageReturnsAloneBreakLinesToo() { + assertThat(CaseFile.parse("a.case", "------\rclass A{}\r------\rclass A {}\r")) + .isEqualTo(new CaseFile("class A{}\r", "class A {}\r", 4)); } @Test diff --git a/open-java-format/src/test/resources/test-cases/badConstructor.case b/open-java-format/src/test/resources/test-cases/badConstructor.case index ee165fd6b..4a72f8073 100644 --- a/open-java-format/src/test/resources/test-cases/badConstructor.case +++ b/open-java-format/src/test/resources/test-cases/badConstructor.case @@ -1,3 +1,4 @@ +---------- class X { Y() {} } ---------- class X { diff --git a/open-java-format/src/test/resources/test-cases/blankInClassBody.case b/open-java-format/src/test/resources/test-cases/blankInClassBody.case index abab5e1eb..2ba6f3d36 100644 --- a/open-java-format/src/test/resources/test-cases/blankInClassBody.case +++ b/open-java-format/src/test/resources/test-cases/blankInClassBody.case @@ -1,3 +1,4 @@ +---------- package test; class T { diff --git a/open-java-format/src/test/resources/test-cases/blockCommentInteriorTrailingBlank.case b/open-java-format/src/test/resources/test-cases/blockCommentInteriorTrailingBlank.case index 14514e16d..7c4f8fba7 100644 --- a/open-java-format/src/test/resources/test-cases/blockCommentInteriorTrailingBlank.case +++ b/open-java-format/src/test/resources/test-cases/blockCommentInteriorTrailingBlank.case @@ -1,3 +1,4 @@ +---------- class T { /* * asd diff --git a/open-java-format/src/test/resources/test-cases/blockCommentTrailingBlank.case b/open-java-format/src/test/resources/test-cases/blockCommentTrailingBlank.case index 37bd01fc1..d8889295b 100644 --- a/open-java-format/src/test/resources/test-cases/blockCommentTrailingBlank.case +++ b/open-java-format/src/test/resources/test-cases/blockCommentTrailingBlank.case @@ -1,3 +1,4 @@ +---------- class T { /* asd */ diff --git a/open-java-format/src/test/resources/test-cases/docCommentTrailingBlank.case b/open-java-format/src/test/resources/test-cases/docCommentTrailingBlank.case index 7033d81be..e0f703f3c 100644 --- a/open-java-format/src/test/resources/test-cases/docCommentTrailingBlank.case +++ b/open-java-format/src/test/resources/test-cases/docCommentTrailingBlank.case @@ -1,3 +1,4 @@ +---------- class T { /** asd */ diff --git a/open-java-format/src/test/resources/test-cases/emptyArray.case b/open-java-format/src/test/resources/test-cases/emptyArray.case index da134890e..6de6f16ed 100644 --- a/open-java-format/src/test/resources/test-cases/emptyArray.case +++ b/open-java-format/src/test/resources/test-cases/emptyArray.case @@ -1,3 +1,4 @@ +---------- class T { int x[] = {,}; } ---------- class T { diff --git a/open-java-format/src/test/resources/test-cases/importsFixedIfRequested.case b/open-java-format/src/test/resources/test-cases/importsFixedIfRequested.case index 7eb551b46..3735bfd7f 100644 --- a/open-java-format/src/test/resources/test-cases/importsFixedIfRequested.case +++ b/open-java-format/src/test/resources/test-cases/importsFixedIfRequested.case @@ -1,3 +1,4 @@ +---------- package com.google.example; import com.google.common.base.Preconditions; diff --git a/open-java-format/src/test/resources/test-cases/lineCommentTrailingBlank.case b/open-java-format/src/test/resources/test-cases/lineCommentTrailingBlank.case index 76d6f2ca3..328c55ca7 100644 --- a/open-java-format/src/test/resources/test-cases/lineCommentTrailingBlank.case +++ b/open-java-format/src/test/resources/test-cases/lineCommentTrailingBlank.case @@ -1,3 +1,4 @@ +---------- class T { // asd diff --git a/open-java-format/src/test/resources/test-cases/noBlankAfterLineCommentWithInteriorBlankLine.case b/open-java-format/src/test/resources/test-cases/noBlankAfterLineCommentWithInteriorBlankLine.case index c8c41dd0d..761680c72 100644 --- a/open-java-format/src/test/resources/test-cases/noBlankAfterLineCommentWithInteriorBlankLine.case +++ b/open-java-format/src/test/resources/test-cases/noBlankAfterLineCommentWithInteriorBlankLine.case @@ -1,3 +1,4 @@ +---------- class T { // asd diff --git a/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace.case b/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace.case index fbe682f45..3cfb3fa12 100644 --- a/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace.case +++ b/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace.case @@ -1,3 +1,4 @@ +---------- class T { public static void main(String[] args) { // one_long_incredibly_unbroken_sentence_moving_from_topic_to_topic_so_that_no-one_had_a_chance_to_interrupt; } diff --git a/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace_noLeadingWhitespace.case b/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace_noLeadingWhitespace.case index 1a25366b8..3387ff71e 100644 --- a/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace_noLeadingWhitespace.case +++ b/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace_noLeadingWhitespace.case @@ -1,3 +1,4 @@ +---------- class T { public static void main(String[] args) { //one_long_incredibly_unbroken_sentence_moving_from_topic_to_topic_so_that_no-one_had_a_chance_to_interrupt; } diff --git a/open-java-format/src/test/resources/test-cases/removeTrailingTabsInComments.case b/open-java-format/src/test/resources/test-cases/removeTrailingTabsInComments.case index 5e458ed7b..548bf658a 100644 --- a/open-java-format/src/test/resources/test-cases/removeTrailingTabsInComments.case +++ b/open-java-format/src/test/resources/test-cases/removeTrailingTabsInComments.case @@ -1,3 +1,4 @@ +---------- class Foo { void f() { int x = 0; // comment diff --git a/open-java-format/src/test/resources/test-cases/stringEscapeLength.case b/open-java-format/src/test/resources/test-cases/stringEscapeLength.case index 66450c052..e87d2d7eb 100644 --- a/open-java-format/src/test/resources/test-cases/stringEscapeLength.case +++ b/open-java-format/src/test/resources/test-cases/stringEscapeLength.case @@ -1,3 +1,4 @@ +---------- class T {{ f("\""); }} ---------- class T { diff --git a/open-java-format/src/test/resources/test-cases/voidMethod.case b/open-java-format/src/test/resources/test-cases/voidMethod.case index abce607eb..ef2807b29 100644 --- a/open-java-format/src/test/resources/test-cases/voidMethod.case +++ b/open-java-format/src/test/resources/test-cases/voidMethod.case @@ -1,3 +1,4 @@ +---------- class X { void Y() {} } ---------- class X { diff --git a/open-java-format/src/test/resources/test-cases/wrapMarkdownDocstringComment.case b/open-java-format/src/test/resources/test-cases/wrapMarkdownDocstringComment.case index 3429a6a98..2992cbcbd 100644 --- a/open-java-format/src/test/resources/test-cases/wrapMarkdownDocstringComment.case +++ b/open-java-format/src/test/resources/test-cases/wrapMarkdownDocstringComment.case @@ -1,3 +1,4 @@ +---------- class T { /// one long incredibly unbroken sentence moving from topic to topic so that no-one in the room had a chance to interrupt; void m() {} From 762c5c725f8a4ddea0b068f557c2a691f5656b2f Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Tue, 27 Oct 2026 00:00:46 +0300 Subject: [PATCH 4/9] Move the testdata pairs that need no settings into test-cases/, with LF, CRLF and CR copies FormatterIntegrationTest checked each pair four times: the formatted input against the output, then the output with LF, CR and CRLF line breaks against itself. 223 of the 256 pairs become three cases each, testdata/-lf, -crlf and -cr, the pair byte for byte with those line breaks. A case formats its before block and has to give the after block, then formats that again and has to change nothing, so the CR and CRLF copies check a whole run with their line breaks, not only the output. 33 pairs stay. ModuleImport needs JDK 23. Under formatSourceAndFixImports B21647014 loses an unused import, Unformatted gets its imports sorted, and M and ojf-issue-24-jbang-script change the blank lines around them. And 28 inputs, JavaFileNoNewLine among them, do not end in a line break, which a case cannot hold: its before block ends where the second line of dashes starts. FileBasedTests.VERSIONED_TESTS keeps the entries of the pairs that stay. Tests on JDK 21: FormatterIntegrationTest 1024 -> 132, FormatterCasesTest 64 -> 733, every other class unchanged; the module goes from 1672 to 1449 tests, as four checks per pair become three cases. --- .../javaformat/java/FileBasedTests.java | 21 +- .../palantir/javaformat/java/testdata/A.input | 97 --- .../palantir/javaformat/java/testdata/B.input | 18 - .../javaformat/java/testdata/B.output | 16 - .../javaformat/java/testdata/B112853497.input | 12 - .../java/testdata/B112853497.output | 9 - .../javaformat/java/testdata/B124394008.input | 8 - .../javaformat/java/testdata/B126411718.input | 10 - .../java/testdata/B126411718.output | 7 - .../javaformat/java/testdata/B183431894.input | 4 - .../java/testdata/B183431894.output | 4 - .../javaformat/java/testdata/B19950219.input | 8 - .../javaformat/java/testdata/B19950219.output | 9 - .../javaformat/java/testdata/B19950468.input | 5 - .../javaformat/java/testdata/B19950468.output | 5 - .../javaformat/java/testdata/B19950815.input | 12 - .../javaformat/java/testdata/B19996259.input | 16 - .../javaformat/java/testdata/B20128174.input | 8 - .../javaformat/java/testdata/B20128588.input | 84 -- .../javaformat/java/testdata/B20128760.input | 107 --- .../javaformat/java/testdata/B20128921.input | 10 - .../javaformat/java/testdata/B20128921.output | 10 - .../javaformat/java/testdata/B20341001.input | 54 -- .../javaformat/java/testdata/B20524742.input | 3 - .../javaformat/java/testdata/B20524742.output | 5 - .../javaformat/java/testdata/B20529113.input | 12 - .../javaformat/java/testdata/B20531711.input | 16 - .../javaformat/java/testdata/B20531711.output | 12 - .../javaformat/java/testdata/B20535125.input | 146 ---- .../javaformat/java/testdata/B20567842.input | 10 - .../javaformat/java/testdata/B20569245.input | 35 - .../javaformat/java/testdata/B20569245.output | 27 - .../javaformat/java/testdata/B20577626.input | 18 - .../javaformat/java/testdata/B20577626.output | 14 - .../javaformat/java/testdata/B20578077.input | 13 - .../javaformat/java/testdata/B20580212.input | 16 - .../javaformat/java/testdata/B20701054.input | 185 ---- .../javaformat/java/testdata/B20844369.input | 31 - .../javaformat/java/testdata/B20915776.input | 10 - .../javaformat/java/testdata/B21031147.input | 6 - .../javaformat/java/testdata/B21105569.input | 9 - .../javaformat/java/testdata/B21185365.input | 5 - .../javaformat/java/testdata/B21185365.output | 5 - .../javaformat/java/testdata/B21192435.input | 12 - .../javaformat/java/testdata/B21278211.output | 15 - .../javaformat/java/testdata/B21283374.input | 57 -- .../javaformat/java/testdata/B21305044.input | 32 - .../javaformat/java/testdata/B21327412.input | 3 - .../javaformat/java/testdata/B21327412.output | 3 - .../javaformat/java/testdata/B21329312.input | 6 - .../javaformat/java/testdata/B21331232.input | 13 - .../javaformat/java/testdata/B21331232.output | 10 - .../javaformat/java/testdata/B21465217.input | 12 - .../javaformat/java/testdata/B21465477.input | 10 - .../javaformat/java/testdata/B21585653.input | 6 - .../javaformat/java/testdata/B21585653.output | 5 - .../javaformat/java/testdata/B21954779.output | 36 - .../javaformat/java/testdata/B22169269.input | 14 - .../javaformat/java/testdata/B22424362.input | 8 - .../javaformat/java/testdata/B22424362.output | 5 - .../javaformat/java/testdata/B22469536.input | 6 - .../javaformat/java/testdata/B22469536.output | 6 - .../javaformat/java/testdata/B22488373.input | 11 - .../javaformat/java/testdata/B22610221.output | 8 - .../javaformat/java/testdata/B22815364.input | 46 - .../javaformat/java/testdata/B22848286.input | 8 - .../javaformat/java/testdata/B22848286.output | 8 - .../javaformat/java/testdata/B22873322.input | 14 - .../javaformat/java/testdata/B22913048.input | 9 - .../javaformat/java/testdata/B22913048.output | 9 - .../javaformat/java/testdata/B23349153.input | 28 - .../javaformat/java/testdata/B23514513.input | 7 - .../javaformat/java/testdata/B23514513.output | 5 - .../javaformat/java/testdata/B23626035.input | 1 - .../javaformat/java/testdata/B23626035.output | 3 - .../javaformat/java/testdata/B23708487.input | 10 - .../javaformat/java/testdata/B23749160.input | 43 - .../javaformat/java/testdata/B23804934.input | 34 - .../javaformat/java/testdata/B24202287.input | 35 - .../javaformat/java/testdata/B24494875.input | 4 - .../javaformat/java/testdata/B24494875.output | 4 - .../javaformat/java/testdata/B24543625.output | 76 -- .../javaformat/java/testdata/B24702438.input | 54 -- .../javaformat/java/testdata/B24862959.input | 8 - .../javaformat/java/testdata/B24862959.output | 6 - .../javaformat/java/testdata/B24909927.input | 353 -------- .../javaformat/java/testdata/B24988078.input | 7 - .../javaformat/java/testdata/B24988078.output | 7 - .../javaformat/java/testdata/B25372815.input | 32 - .../javaformat/java/testdata/B25749989.input | 4 - .../javaformat/java/testdata/B25787055.input | 30 - .../javaformat/java/testdata/B25811323.input | 5 - .../javaformat/java/testdata/B25811323.output | 6 - .../javaformat/java/testdata/B26159561.input | 6 - .../javaformat/java/testdata/B26207047.input | 49 -- .../javaformat/java/testdata/B26275739.input | 18 - .../javaformat/java/testdata/B26275739.output | 12 - .../javaformat/java/testdata/B26293162.input | 43 - .../javaformat/java/testdata/B26694550.input | 21 - .../javaformat/java/testdata/B26694550.output | 14 - .../javaformat/java/testdata/B26884608.output | 19 - .../javaformat/java/testdata/B26952926.input | 51 -- .../javaformat/java/testdata/B27078833.input | 19 - .../javaformat/java/testdata/B27246427.input | 7 - .../javaformat/java/testdata/B27602933.input | 11 - .../javaformat/java/testdata/B28774859.input | 3 - .../javaformat/java/testdata/B28774859.output | 3 - .../javaformat/java/testdata/B28786284.input | 5 - .../javaformat/java/testdata/B28786284.output | 5 - .../javaformat/java/testdata/B29368546.input | 60 -- .../javaformat/java/testdata/B29618429.input | 13 - .../javaformat/java/testdata/B29705613.input | 8 - .../javaformat/java/testdata/B29705613.output | 8 - .../javaformat/java/testdata/B30153869.input | 26 - .../javaformat/java/testdata/B30789352.input | 6 - .../javaformat/java/testdata/B30789352.output | 6 - .../javaformat/java/testdata/B308157568.input | 23 - .../javaformat/java/testdata/B32114928.input | 9 - .../javaformat/java/testdata/B32114928.output | 7 - .../javaformat/java/testdata/B32284705.input | 8 - .../javaformat/java/testdata/B32284705.output | 8 - .../javaformat/java/testdata/B32729600.input | 5 - .../javaformat/java/testdata/B32729600.output | 5 - .../javaformat/java/testdata/B33358723.input | 24 - .../javaformat/java/testdata/B35644813.input | 19 - .../javaformat/java/testdata/B35644813.output | 15 - .../javaformat/java/testdata/B35797074.input | 4 - .../javaformat/java/testdata/B35797074.output | 4 - .../javaformat/java/testdata/B36194204.input | 5 - .../javaformat/java/testdata/B36194204.output | 5 - .../javaformat/java/testdata/B37629610.input | 16 - .../javaformat/java/testdata/B377585941.input | 8 - .../java/testdata/B377585941.output | 7 - .../javaformat/java/testdata/B37895033.output | 13 - .../javaformat/java/testdata/B380299722.input | 10 - .../java/testdata/B380299722.output | 10 - .../javaformat/java/testdata/B38203081.input | 5 - .../javaformat/java/testdata/B38203081.output | 5 - .../javaformat/java/testdata/B38352414.input | 2 - .../javaformat/java/testdata/B38352414.output | 2 - .../javaformat/java/testdata/B64493529.input | 10 - .../javaformat/java/testdata/B64493529.output | 10 - .../javaformat/java/testdata/B65214682.input | 17 - .../javaformat/java/testdata/B72507902.input | 6 - .../javaformat/java/testdata/B72507902.output | 5 - .../palantir/javaformat/java/testdata/C.input | 81 -- .../java/testdata/CompactSource.input | 15 - .../java/testdata/CompactSource.output | 15 - .../palantir/javaformat/java/testdata/D.input | 20 - .../palantir/javaformat/java/testdata/E.input | 87 -- .../java/testdata/EnumAnnotation.input | 5 - .../java/testdata/EnumAnnotation.output | 8 - .../java/testdata/ExpressionSwitch.input | 84 -- .../palantir/javaformat/java/testdata/F.input | 61 -- .../javaformat/java/testdata/Fields.input | 7 - .../javaformat/java/testdata/Fields.output | 6 - .../java/testdata/FlexibleConstructor.input | 12 - .../javaformat/java/testdata/ForMany.input | 6 - .../javaformat/java/testdata/ForMany.output | 6 - .../palantir/javaformat/java/testdata/I.input | 77 -- .../javaformat/java/testdata/I1.input | 49 -- .../javaformat/java/testdata/I12.input | 19 - .../javaformat/java/testdata/I12.output | 9 - .../javaformat/java/testdata/I1205.input | 7 - .../javaformat/java/testdata/I1205.output | 7 - .../javaformat/java/testdata/I1260.input | 18 - .../java/testdata/I1260EmptyBlocks.input | 13 - .../javaformat/java/testdata/I13.input | 10 - .../javaformat/java/testdata/I13.output | 8 - .../javaformat/java/testdata/I1309.input | 9 - .../javaformat/java/testdata/I202.input | 6 - .../javaformat/java/testdata/I202.output | 6 - .../javaformat/java/testdata/I365.input | 10 - .../javaformat/java/testdata/I365.output | 7 - .../javaformat/java/testdata/I374.input | 9 - .../javaformat/java/testdata/I374.output | 9 - .../javaformat/java/testdata/I594.input | 7 - .../javaformat/java/testdata/I594.output | 7 - .../javaformat/java/testdata/I603.input | 16 - .../javaformat/java/testdata/I603.output | 11 - .../javaformat/java/testdata/I643.input | 15 - .../javaformat/java/testdata/I683.input | 14 - .../javaformat/java/testdata/I684.input | 14 - .../javaformat/java/testdata/I696.input | 11 - .../javaformat/java/testdata/I696.output | 8 - .../javaformat/java/testdata/I959.input | 5 - .../javaformat/java/testdata/I959.output | 5 - .../testdata/JavaFileWithMultipleLines.input | 7 - .../testdata/JavaFileWithMultipleLines.output | 3 - .../palantir/javaformat/java/testdata/L.input | 11 - .../javaformat/java/testdata/L.output | 11 - .../java/testdata/LocalAnnotations.input | 7 - .../javaformat/java/testdata/M1.input | 22 - .../javaformat/java/testdata/M2.input | 2 - .../javaformat/java/testdata/M2.output | 1 - .../java/testdata/MarkdownDoc.input | 10 - .../java/testdata/MarkdownDoc.output | 10 - .../java/testdata/MarkerAnnotation.input | 4 - .../java/testdata/MarkerAnnotation.output | 4 - .../java/testdata/Multivariables.input | 17 - .../palantir/javaformat/java/testdata/N.input | 13 - .../javaformat/java/testdata/NON-NLS.output | 14 - .../java/testdata/NormalAnnotation.input | 56 -- .../palantir/javaformat/java/testdata/P.input | 21 - .../javaformat/java/testdata/Pair.input | 12 - .../javaformat/java/testdata/Pair.output | 12 - .../java/testdata/PairedArguments.input | 40 - .../palantir/javaformat/java/testdata/Q.input | 15 - .../palantir/javaformat/java/testdata/R.input | 13 - .../palantir/javaformat/java/testdata/S.input | 46 - .../javaformat/java/testdata/Sealed.input | 6 - .../javaformat/java/testdata/Sealed.output | 9 - .../java/testdata/SemicolonInClass.input | 3 - .../java/testdata/SemicolonInClass.output | 3 - .../testdata/SingleMemberAnnotation.input | 5 - .../testdata/SingleMemberAnnotation.output | 5 - .../java/testdata/SuperQualifier.input | 18 - .../java/testdata/SwitchDouble.input | 7 - .../java/testdata/SwitchDouble.output | 7 - .../java/testdata/SwitchGuardClause.input | 9 - .../java/testdata/SwitchRecord.input | 21 - .../java/testdata/SwitchUnderscore.input | 8 - .../palantir/javaformat/java/testdata/T.input | 19 - .../TabularMixedSignInitializer.input | 17 - .../java/testdata/TryWithResources.input | 21 - .../palantir/javaformat/java/testdata/U.input | 47 - .../javaformat/java/testdata/UnaryMinus.input | 5 - .../java/testdata/UnaryMinus.output | 5 - .../java/testdata/Unformatted2.input | 16 - .../java/testdata/Unformatted2.output | 16 - .../java/testdata/Unformatted3.input | 9 - .../java/testdata/Unformatted3.output | 9 - .../javaformat/java/testdata/Unnamed.input | 46 - .../java/testdata/UnnamedPattern.input | 34 - .../palantir/javaformat/java/testdata/V.input | 13 - .../javaformat/java/testdata/V.output | 13 - .../palantir/javaformat/java/testdata/W.input | 9 - .../javaformat/java/testdata/W.output | 8 - .../javaformat/java/testdata/WildBound.input | 5 - .../javaformat/java/testdata/WildBound.output | 5 - .../javaformat/java/testdata/b26306390.input | 3 - .../javaformat/java/testdata/b26306390.output | 4 - .../javaformat/java/testdata/i100.input | 7 - .../javaformat/java/testdata/i100.output | 7 - .../javaformat/java/testdata/i101.input | 1 - .../javaformat/java/testdata/i101.output | 1 - .../javaformat/java/testdata/i155.input | 5 - .../javaformat/java/testdata/i155.output | 5 - .../javaformat/java/testdata/i176.input | 6 - .../javaformat/java/testdata/i176.output | 7 - .../javaformat/java/testdata/i221.input | 8 - .../javaformat/java/testdata/i281.input | 8 - .../javaformat/java/testdata/i282.input | 11 - .../javaformat/java/testdata/i282.output | 16 - .../javaformat/java/testdata/i55.input | 13 - .../javaformat/java/testdata/i55.output | 11 - .../javaformat/java/testdata/i59.input | 10 - .../javaformat/java/testdata/i60.input | 9 - .../javaformat/java/testdata/i60.output | 8 - .../javaformat/java/testdata/i65.input | 5 - .../javaformat/java/testdata/i65.output | 5 - .../javaformat/java/testdata/i66.input | 7 - .../javaformat/java/testdata/i66.output | 6 - .../javaformat/java/testdata/i71.output | 6 - .../javaformat/java/testdata/i95.input | 3 - .../javaformat/java/testdata/i95.output | 3 - .../javaformat/java/testdata/i98.input | 8 - .../javaformat/java/testdata/i98.output | 6 - ...ssue-101-annotated-lambda-parameters.input | 29 - ...sue-101-annotated-lambda-parameters.output | 30 - ...ojf-issue-23-non-nls-trailing-marker.input | 20 - .../ojf-issue-23-reflowed-literal.input | 9 - .../ojf-issue-23-wrapped-arguments.input | 11 - .../ojf-issue-24-jbang-compact-source.input | 9 - .../ojf-issue-24-jbang-compact-source.output | 12 - .../testdata/ojf-issue-24-jbang-package.input | 20 - .../ojf-issue-24-jbang-package.output | 22 - .../ojf-issue-34-text-block-argument.output | 9 - .../ojf-issue-34-text-block-ternary.input | 11 - .../ojf-issue-34-text-block-ternary.output | 9 - ...ue-36-multiline-comments-on-one-line.input | 14 - .../ojf-issue-38-nbsp-line-comment.input | 7 - ...f-issue-60-cast-type-in-inline-chain.input | 36 - ...2-comment-before-lambda-close-parens.input | 24 - .../ojf-long-generic-field-type.input | 7 - .../testdata/ojf-semicolon-only-body.input | 13 - .../javaformat/java/testdata/palantir-1.input | 8 - .../java/testdata/palantir-1.output | 8 - .../java/testdata/palantir-10.output | 23 - .../java/testdata/palantir-11.output | 12 - .../java/testdata/palantir-12.output | 21 - .../javaformat/java/testdata/palantir-2.input | 14 - .../javaformat/java/testdata/palantir-3.input | 17 - .../java/testdata/palantir-3.output | 17 - .../javaformat/java/testdata/palantir-4.input | 9 - .../javaformat/java/testdata/palantir-5.input | 14 - .../java/testdata/palantir-5.output | 13 - .../javaformat/java/testdata/palantir-6.input | 8 - .../java/testdata/palantir-6.output | 7 - .../javaformat/java/testdata/palantir-7.input | 10 - .../java/testdata/palantir-7.output | 9 - .../javaformat/java/testdata/palantir-8.input | 9 - .../java/testdata/palantir-8.output | 8 - .../palantir-break-lambda-arg-no-chain.output | 8 - .../testdata/palantir-break-lambda-arg.input | 11 - .../testdata/palantir-break-lambda-arg.output | 11 - .../palantir-break-lambda-expr.output | 5 - .../palantir-case-statements-block.input | 26 - .../palantir-case-statements-block.output | 24 - .../testdata/palantir-chain-next-line.input | 7 - .../testdata/palantir-chain-next-line.output | 6 - .../palantir-dangling-method-reference.input | 7 - .../palantir-deeply-nested-calls.input | 93 -- .../palantir-deeply-nested-calls.output | 93 -- .../palantir-expression-lambda-1.input | 6 - .../palantir-expression-lambda-2.input | 6 - .../palantir-expression-lambdas-2.input | 7 - .../palantir-expression-lambdas.input | 7 - ...issue-1343-text-block-indent-stable.output | 21 - ...lantir-lambda-inlining-prefers-break.input | 11 - ...antir-lambda-inlining-prefers-break.output | 12 - .../palantir-lambda-multiline-arg.output | 68 -- .../java/testdata/palantir-lamda-cast.output | 16 - .../palantir-long-method-chain-arg.input | 5 - .../resources/test-cases/testdata/A-cr.case | 1 + .../resources/test-cases/testdata/A-crlf.case | 186 ++++ .../testdata/A-lf.case} | 99 +++ .../resources/test-cases/testdata/B-cr.case | 1 + .../resources/test-cases/testdata/B-crlf.case | 36 + .../resources/test-cases/testdata/B-lf.case | 36 + .../test-cases/testdata/B112853497-cr.case | 1 + .../test-cases/testdata/B112853497-crlf.case | 23 + .../test-cases/testdata/B112853497-lf.case | 23 + .../test-cases/testdata/B124394008-cr.case | 1 + .../test-cases/testdata/B124394008-crlf.case | 19 + .../testdata/B124394008-lf.case} | 10 + .../test-cases/testdata/B126411718-cr.case | 1 + .../test-cases/testdata/B126411718-crlf.case | 19 + .../test-cases/testdata/B126411718-lf.case | 19 + .../test-cases/testdata/B183431894-cr.case | 1 + .../test-cases/testdata/B183431894-crlf.case | 10 + .../test-cases/testdata/B183431894-lf.case | 10 + .../test-cases/testdata/B19950219-cr.case | 1 + .../test-cases/testdata/B19950219-crlf.case | 19 + .../test-cases/testdata/B19950219-lf.case | 19 + .../test-cases/testdata/B19950468-cr.case | 1 + .../test-cases/testdata/B19950468-crlf.case | 12 + .../test-cases/testdata/B19950468-lf.case | 12 + .../test-cases/testdata/B19950815-cr.case | 1 + .../test-cases/testdata/B19950815-crlf.case | 31 + .../testdata/B19950815-lf.case} | 14 + .../test-cases/testdata/B19996259-cr.case | 1 + .../test-cases/testdata/B19996259-crlf.case | 34 + .../testdata/B19996259-lf.case} | 18 + .../test-cases/testdata/B20128174-cr.case | 1 + .../test-cases/testdata/B20128174-crlf.case | 34 + .../testdata/B20128174-lf.case} | 10 + .../test-cases/testdata/B20128588-cr.case | 1 + .../test-cases/testdata/B20128588-crlf.case | 233 +++++ .../testdata/B20128588-lf.case} | 86 ++ .../test-cases/testdata/B20128760-cr.case | 1 + .../test-cases/testdata/B20128760-crlf.case | 189 +++++ .../testdata/B20128760-lf.case} | 109 +++ .../test-cases/testdata/B20128921-cr.case | 1 + .../test-cases/testdata/B20128921-crlf.case | 22 + .../test-cases/testdata/B20128921-lf.case | 22 + .../test-cases/testdata/B20341001-cr.case | 1 + .../test-cases/testdata/B20341001-crlf.case | 352 ++++++++ .../testdata/B20341001-lf.case} | 56 ++ .../test-cases/testdata/B20524742-cr.case | 1 + .../test-cases/testdata/B20524742-crlf.case | 10 + .../test-cases/testdata/B20524742-lf.case | 10 + .../test-cases/testdata/B20529113-cr.case | 1 + .../test-cases/testdata/B20529113-crlf.case | 30 + .../testdata/B20529113-lf.case} | 14 + .../test-cases/testdata/B20531711-cr.case | 1 + .../test-cases/testdata/B20531711-crlf.case | 30 + .../test-cases/testdata/B20531711-lf.case | 30 + .../test-cases/testdata/B20535125-cr.case | 1 + .../test-cases/testdata/B20535125-crlf.case | 308 +++++++ .../testdata/B20535125-lf.case} | 148 ++++ .../test-cases/testdata/B20567842-cr.case | 1 + .../test-cases/testdata/B20567842-crlf.case | 26 + .../testdata/B20567842-lf.case} | 12 + .../test-cases/testdata/B20569245-cr.case | 1 + .../test-cases/testdata/B20569245-crlf.case | 64 ++ .../test-cases/testdata/B20569245-lf.case | 64 ++ .../test-cases/testdata/B20577626-cr.case | 1 + .../test-cases/testdata/B20577626-crlf.case | 34 + .../test-cases/testdata/B20577626-lf.case | 34 + .../test-cases/testdata/B20578077-cr.case | 1 + .../test-cases/testdata/B20578077-crlf.case | 26 + .../testdata/B20578077-lf.case} | 15 + .../test-cases/testdata/B20580212-cr.case | 1 + .../test-cases/testdata/B20580212-crlf.case | 37 + .../testdata/B20580212-lf.case} | 18 + .../test-cases/testdata/B20701054-cr.case | 1 + .../test-cases/testdata/B20701054-crlf.case | 367 ++++++++ .../testdata/B20701054-lf.case} | 187 ++++ .../test-cases/testdata/B20844369-cr.case | 1 + .../test-cases/testdata/B20844369-crlf.case | 65 ++ .../testdata/B20844369-lf.case} | 33 + .../test-cases/testdata/B20915776-cr.case | 1 + .../test-cases/testdata/B20915776-crlf.case | 21 + .../testdata/B20915776-lf.case} | 12 + .../test-cases/testdata/B21031147-cr.case | 1 + .../test-cases/testdata/B21031147-crlf.case | 16 + .../testdata/B21031147-lf.case} | 8 + .../test-cases/testdata/B21105569-cr.case | 1 + .../test-cases/testdata/B21105569-crlf.case | 24 + .../testdata/B21105569-lf.case} | 11 + .../test-cases/testdata/B21185365-cr.case | 1 + .../test-cases/testdata/B21185365-crlf.case | 12 + .../test-cases/testdata/B21185365-lf.case | 12 + .../test-cases/testdata/B21192435-cr.case | 1 + .../test-cases/testdata/B21192435-crlf.case | 29 + .../testdata/B21192435-lf.case} | 14 + .../test-cases/testdata/B21278211-cr.case | 1 + .../test-cases/testdata/B21278211-crlf.case | 40 + .../testdata/B21278211-lf.case} | 17 + .../test-cases/testdata/B21283374-cr.case | 1 + .../test-cases/testdata/B21283374-crlf.case | 125 +++ .../testdata/B21283374-lf.case} | 59 ++ .../test-cases/testdata/B21305044-cr.case | 1 + .../test-cases/testdata/B21305044-crlf.case | 83 ++ .../testdata/B21305044-lf.case} | 34 + .../test-cases/testdata/B21327412-cr.case | 1 + .../test-cases/testdata/B21327412-crlf.case | 8 + .../test-cases/testdata/B21327412-lf.case | 8 + .../test-cases/testdata/B21329312-cr.case | 1 + .../test-cases/testdata/B21329312-crlf.case | 16 + .../testdata/B21329312-lf.case} | 8 + .../test-cases/testdata/B21331232-cr.case | 1 + .../test-cases/testdata/B21331232-crlf.case | 25 + .../test-cases/testdata/B21331232-lf.case | 25 + .../test-cases/testdata/B21465217-cr.case | 1 + .../test-cases/testdata/B21465217-crlf.case | 26 + .../testdata/B21465217-lf.case} | 14 + .../test-cases/testdata/B21465477-cr.case | 1 + .../test-cases/testdata/B21465477-crlf.case | 28 + .../testdata/B21465477-lf.case} | 12 + .../test-cases/testdata/B21585653-cr.case | 1 + .../test-cases/testdata/B21585653-crlf.case | 13 + .../test-cases/testdata/B21585653-lf.case | 13 + .../test-cases/testdata/B21954779-cr.case | 1 + .../test-cases/testdata/B21954779-crlf.case | 84 ++ .../testdata/B21954779-lf.case} | 38 + .../test-cases/testdata/B22169269-cr.case | 1 + .../test-cases/testdata/B22169269-crlf.case | 29 + .../testdata/B22169269-lf.case} | 16 + .../test-cases/testdata/B22424362-cr.case | 1 + .../test-cases/testdata/B22424362-crlf.case | 15 + .../test-cases/testdata/B22424362-lf.case | 15 + .../test-cases/testdata/B22469536-cr.case | 1 + .../test-cases/testdata/B22469536-crlf.case | 14 + .../test-cases/testdata/B22469536-lf.case | 14 + .../test-cases/testdata/B22488373-cr.case | 1 + .../test-cases/testdata/B22488373-crlf.case | 22 + .../testdata/B22488373-lf.case} | 13 + .../test-cases/testdata/B22610221-cr.case | 1 + .../test-cases/testdata/B22610221-crlf.case | 22 + .../testdata/B22610221-lf.case} | 10 + .../test-cases/testdata/B22815364-cr.case | 1 + .../test-cases/testdata/B22815364-crlf.case | 121 +++ .../testdata/B22815364-lf.case} | 48 ++ .../test-cases/testdata/B22848286-cr.case | 1 + .../test-cases/testdata/B22848286-crlf.case | 18 + .../test-cases/testdata/B22848286-lf.case | 18 + .../test-cases/testdata/B22873322-cr.case | 1 + .../test-cases/testdata/B22873322-crlf.case | 30 + .../testdata/B22873322-lf.case} | 16 + .../test-cases/testdata/B22913048-cr.case | 1 + .../test-cases/testdata/B22913048-crlf.case | 20 + .../test-cases/testdata/B22913048-lf.case | 20 + .../test-cases/testdata/B23349153-cr.case | 1 + .../test-cases/testdata/B23349153-crlf.case | 61 ++ .../testdata/B23349153-lf.case} | 30 + .../test-cases/testdata/B23514513-cr.case | 1 + .../test-cases/testdata/B23514513-crlf.case | 14 + .../test-cases/testdata/B23514513-lf.case | 14 + .../test-cases/testdata/B23626035-cr.case | 1 + .../test-cases/testdata/B23626035-crlf.case | 6 + .../test-cases/testdata/B23626035-lf.case | 6 + .../test-cases/testdata/B23708487-cr.case | 1 + .../test-cases/testdata/B23708487-crlf.case | 21 + .../testdata/B23708487-lf.case} | 12 + .../test-cases/testdata/B23749160-cr.case | 1 + .../test-cases/testdata/B23749160-crlf.case | 80 ++ .../testdata/B23749160-lf.case} | 45 + .../test-cases/testdata/B23804934-cr.case | 1 + .../test-cases/testdata/B23804934-crlf.case | 67 ++ .../testdata/B23804934-lf.case} | 36 + .../test-cases/testdata/B24202287-cr.case | 1 + .../test-cases/testdata/B24202287-crlf.case | 70 ++ .../testdata/B24202287-lf.case} | 37 + .../test-cases/testdata/B24494875-cr.case | 1 + .../test-cases/testdata/B24494875-crlf.case | 10 + .../test-cases/testdata/B24494875-lf.case | 10 + .../test-cases/testdata/B24543625-cr.case | 1 + .../test-cases/testdata/B24543625-crlf.case | 154 ++++ .../testdata/B24543625-lf.case} | 78 ++ .../test-cases/testdata/B24702438-cr.case | 1 + .../test-cases/testdata/B24702438-crlf.case | 119 +++ .../testdata/B24702438-lf.case} | 56 ++ .../test-cases/testdata/B24862959-cr.case | 1 + .../test-cases/testdata/B24862959-crlf.case | 16 + .../test-cases/testdata/B24862959-lf.case | 16 + .../test-cases/testdata/B24909927-cr.case | 1 + .../test-cases/testdata/B24909927-crlf.case | 800 ++++++++++++++++++ .../testdata/B24909927-lf.case} | 355 ++++++++ .../test-cases/testdata/B24988078-cr.case | 1 + .../test-cases/testdata/B24988078-crlf.case | 16 + .../test-cases/testdata/B24988078-lf.case | 16 + .../test-cases/testdata/B25372815-cr.case | 1 + .../test-cases/testdata/B25372815-crlf.case | 66 ++ .../testdata/B25372815-lf.case} | 34 + .../test-cases/testdata/B25749989-cr.case | 1 + .../test-cases/testdata/B25749989-crlf.case | 13 + .../testdata/B25749989-lf.case} | 6 + .../test-cases/testdata/B25787055-cr.case | 1 + .../test-cases/testdata/B25787055-crlf.case | 54 ++ .../testdata/B25787055-lf.case} | 32 + .../test-cases/testdata/B25811323-cr.case | 1 + .../test-cases/testdata/B25811323-crlf.case | 13 + .../test-cases/testdata/B25811323-lf.case | 13 + .../test-cases/testdata/B26159561-cr.case | 1 + .../test-cases/testdata/B26159561-crlf.case | 15 + .../testdata/B26159561-lf.case} | 8 + .../test-cases/testdata/B26207047-cr.case | 1 + .../test-cases/testdata/B26207047-crlf.case | 100 +++ .../testdata/B26207047-lf.case} | 51 ++ .../test-cases/testdata/B26275739-cr.case | 1 + .../test-cases/testdata/B26275739-crlf.case | 32 + .../test-cases/testdata/B26275739-lf.case | 32 + .../test-cases/testdata/B26293162-cr.case | 1 + .../test-cases/testdata/B26293162-crlf.case | 87 ++ .../testdata/B26293162-lf.case} | 45 + .../test-cases/testdata/B26694550-cr.case | 1 + .../test-cases/testdata/B26694550-crlf.case | 37 + .../test-cases/testdata/B26694550-lf.case | 37 + .../test-cases/testdata/B26884608-cr.case | 1 + .../test-cases/testdata/B26884608-crlf.case | 55 ++ .../testdata/B26884608-lf.case} | 21 + .../test-cases/testdata/B26952926-cr.case | 1 + .../test-cases/testdata/B26952926-crlf.case | 109 +++ .../testdata/B26952926-lf.case} | 53 ++ .../test-cases/testdata/B27078833-cr.case | 1 + .../test-cases/testdata/B27078833-crlf.case | 39 + .../testdata/B27078833-lf.case} | 21 + .../test-cases/testdata/B27246427-cr.case | 1 + .../test-cases/testdata/B27246427-crlf.case | 20 + .../testdata/B27246427-lf.case} | 9 + .../test-cases/testdata/B27602933-cr.case | 1 + .../test-cases/testdata/B27602933-crlf.case | 24 + .../testdata/B27602933-lf.case} | 13 + .../test-cases/testdata/B28774859-cr.case | 1 + .../test-cases/testdata/B28774859-crlf.case | 8 + .../test-cases/testdata/B28774859-lf.case | 8 + .../test-cases/testdata/B28786284-cr.case | 1 + .../test-cases/testdata/B28786284-crlf.case | 12 + .../test-cases/testdata/B28786284-lf.case | 12 + .../test-cases/testdata/B29368546-cr.case | 1 + .../test-cases/testdata/B29368546-crlf.case | 122 +++ .../testdata/B29368546-lf.case} | 62 ++ .../test-cases/testdata/B29618429-cr.case | 1 + .../test-cases/testdata/B29618429-crlf.case | 28 + .../testdata/B29618429-lf.case} | 15 + .../test-cases/testdata/B29705613-cr.case | 1 + .../test-cases/testdata/B29705613-crlf.case | 18 + .../test-cases/testdata/B29705613-lf.case | 18 + .../test-cases/testdata/B30153869-cr.case | 1 + .../test-cases/testdata/B30153869-crlf.case | 54 ++ .../testdata/B30153869-lf.case} | 28 + .../test-cases/testdata/B30789352-cr.case | 1 + .../test-cases/testdata/B30789352-crlf.case | 14 + .../test-cases/testdata/B30789352-lf.case | 14 + .../test-cases/testdata/B308157568-cr.case | 1 + .../test-cases/testdata/B308157568-crlf.case | 48 ++ .../testdata/B308157568-lf.case} | 25 + .../test-cases/testdata/B32114928-cr.case | 1 + .../test-cases/testdata/B32114928-crlf.case | 18 + .../test-cases/testdata/B32114928-lf.case | 18 + .../test-cases/testdata/B32284705-cr.case | 1 + .../test-cases/testdata/B32284705-crlf.case | 18 + .../test-cases/testdata/B32284705-lf.case | 18 + .../test-cases/testdata/B32729600-cr.case | 1 + .../test-cases/testdata/B32729600-crlf.case | 12 + .../test-cases/testdata/B32729600-lf.case | 12 + .../test-cases/testdata/B33358723-cr.case | 1 + .../test-cases/testdata/B33358723-crlf.case | 47 + .../testdata/B33358723-lf.case} | 26 + .../test-cases/testdata/B35644813-cr.case | 1 + .../test-cases/testdata/B35644813-crlf.case | 36 + .../test-cases/testdata/B35644813-lf.case | 36 + .../test-cases/testdata/B35797074-cr.case | 1 + .../test-cases/testdata/B35797074-crlf.case | 10 + .../test-cases/testdata/B35797074-lf.case | 10 + .../test-cases/testdata/B36194204-cr.case | 1 + .../test-cases/testdata/B36194204-crlf.case | 12 + .../test-cases/testdata/B36194204-lf.case | 12 + .../test-cases/testdata/B37629610-cr.case | 1 + .../test-cases/testdata/B37629610-crlf.case | 31 + .../testdata/B37629610-lf.case} | 18 + .../test-cases/testdata/B377585941-cr.case | 1 + .../test-cases/testdata/B377585941-crlf.case | 17 + .../test-cases/testdata/B377585941-lf.case | 17 + .../test-cases/testdata/B37895033-cr.case | 1 + .../test-cases/testdata/B37895033-crlf.case | 35 + .../testdata/B37895033-lf.case} | 15 + .../test-cases/testdata/B380299722-cr.case | 1 + .../test-cases/testdata/B380299722-crlf.case | 22 + .../test-cases/testdata/B380299722-lf.case | 22 + .../test-cases/testdata/B38203081-cr.case | 1 + .../test-cases/testdata/B38203081-crlf.case | 12 + .../test-cases/testdata/B38203081-lf.case | 12 + .../test-cases/testdata/B38352414-cr.case | 1 + .../test-cases/testdata/B38352414-crlf.case | 6 + .../test-cases/testdata/B38352414-lf.case | 6 + .../test-cases/testdata/B64493529-cr.case | 1 + .../test-cases/testdata/B64493529-crlf.case | 22 + .../test-cases/testdata/B64493529-lf.case | 22 + .../test-cases/testdata/B65214682-cr.case | 1 + .../test-cases/testdata/B65214682-crlf.case | 34 + .../testdata/B65214682-lf.case} | 19 + .../test-cases/testdata/B72507902-cr.case | 1 + .../test-cases/testdata/B72507902-crlf.case | 13 + .../test-cases/testdata/B72507902-lf.case | 13 + .../resources/test-cases/testdata/C-cr.case | 1 + .../resources/test-cases/testdata/C-crlf.case | 157 ++++ .../testdata/C-lf.case} | 83 ++ .../test-cases/testdata/CompactSource-cr.case | 1 + .../testdata/CompactSource-crlf.case | 32 + .../test-cases/testdata/CompactSource-lf.case | 32 + .../resources/test-cases/testdata/D-cr.case | 1 + .../resources/test-cases/testdata/D-crlf.case | 40 + .../testdata/D-lf.case} | 22 + .../resources/test-cases/testdata/E-cr.case | 1 + .../resources/test-cases/testdata/E-crlf.case | 169 ++++ .../testdata/E-lf.case} | 89 ++ .../testdata/EnumAnnotation-cr.case | 1 + .../testdata/EnumAnnotation-crlf.case | 15 + .../testdata/EnumAnnotation-lf.case | 15 + .../testdata/ExpressionSwitch-cr.case | 1 + .../testdata/ExpressionSwitch-crlf.case | 170 ++++ .../testdata/ExpressionSwitch-lf.case} | 86 ++ .../resources/test-cases/testdata/F-cr.case | 1 + .../resources/test-cases/testdata/F-crlf.case | 111 +++ .../testdata/F-lf.case} | 63 ++ .../test-cases/testdata/Fields-cr.case | 1 + .../test-cases/testdata/Fields-crlf.case | 15 + .../test-cases/testdata/Fields-lf.case | 15 + .../testdata/FlexibleConstructor-cr.case | 1 + .../testdata/FlexibleConstructor-crlf.case | 26 + .../testdata/FlexibleConstructor-lf.case} | 14 + .../test-cases/testdata/ForMany-cr.case | 1 + .../test-cases/testdata/ForMany-crlf.case | 14 + .../test-cases/testdata/ForMany-lf.case | 14 + .../resources/test-cases/testdata/I-cr.case | 1 + .../resources/test-cases/testdata/I-crlf.case | 154 ++++ .../testdata/I-lf.case} | 79 ++ .../resources/test-cases/testdata/I1-cr.case | 1 + .../test-cases/testdata/I1-crlf.case | 102 +++ .../testdata/I1-lf.case} | 51 ++ .../resources/test-cases/testdata/I12-cr.case | 1 + .../test-cases/testdata/I12-crlf.case | 30 + .../resources/test-cases/testdata/I12-lf.case | 30 + .../test-cases/testdata/I1205-cr.case | 1 + .../test-cases/testdata/I1205-crlf.case | 16 + .../test-cases/testdata/I1205-lf.case | 16 + .../test-cases/testdata/I1260-cr.case | 1 + .../test-cases/testdata/I1260-crlf.case | 49 ++ .../testdata/I1260-lf.case} | 20 + .../testdata/I1260EmptyBlocks-cr.case | 1 + .../testdata/I1260EmptyBlocks-crlf.case | 55 ++ .../testdata/I1260EmptyBlocks-lf.case} | 15 + .../resources/test-cases/testdata/I13-cr.case | 1 + .../test-cases/testdata/I13-crlf.case | 20 + .../resources/test-cases/testdata/I13-lf.case | 20 + .../test-cases/testdata/I1309-cr.case | 1 + .../test-cases/testdata/I1309-crlf.case | 38 + .../testdata/I1309-lf.case} | 11 + .../test-cases/testdata/I202-cr.case | 1 + .../test-cases/testdata/I202-crlf.case | 14 + .../test-cases/testdata/I202-lf.case | 14 + .../test-cases/testdata/I365-cr.case | 1 + .../test-cases/testdata/I365-crlf.case | 19 + .../test-cases/testdata/I365-lf.case | 19 + .../test-cases/testdata/I374-cr.case | 1 + .../test-cases/testdata/I374-crlf.case | 20 + .../test-cases/testdata/I374-lf.case | 20 + .../test-cases/testdata/I594-cr.case | 1 + .../test-cases/testdata/I594-crlf.case | 16 + .../test-cases/testdata/I594-lf.case | 16 + .../test-cases/testdata/I603-cr.case | 1 + .../test-cases/testdata/I603-crlf.case | 29 + .../test-cases/testdata/I603-lf.case | 29 + .../test-cases/testdata/I643-cr.case | 1 + .../test-cases/testdata/I643-crlf.case | 35 + .../testdata/I643-lf.case} | 17 + .../test-cases/testdata/I683-cr.case | 1 + .../test-cases/testdata/I683-crlf.case | 31 + .../testdata/I683-lf.case} | 16 + .../test-cases/testdata/I684-cr.case | 1 + .../test-cases/testdata/I684-crlf.case | 30 + .../testdata/I684-lf.case} | 16 + .../test-cases/testdata/I696-cr.case | 1 + .../test-cases/testdata/I696-crlf.case | 21 + .../test-cases/testdata/I696-lf.case | 21 + .../test-cases/testdata/I959-cr.case | 1 + .../test-cases/testdata/I959-crlf.case | 12 + .../test-cases/testdata/I959-lf.case | 12 + .../JavaFileWithMultipleLines-cr.case | 1 + .../JavaFileWithMultipleLines-crlf.case | 12 + .../JavaFileWithMultipleLines-lf.case | 12 + .../resources/test-cases/testdata/L-cr.case | 1 + .../resources/test-cases/testdata/L-crlf.case | 24 + .../resources/test-cases/testdata/L-lf.case | 24 + .../testdata/LocalAnnotations-cr.case | 1 + .../testdata/LocalAnnotations-crlf.case | 18 + .../testdata/LocalAnnotations-lf.case} | 9 + .../resources/test-cases/testdata/M1-cr.case | 1 + .../test-cases/testdata/M1-crlf.case | 66 ++ .../testdata/M1-lf.case} | 24 + .../resources/test-cases/testdata/M2-cr.case | 1 + .../test-cases/testdata/M2-crlf.case | 5 + .../resources/test-cases/testdata/M2-lf.case | 5 + .../test-cases/testdata/MarkdownDoc-cr.case | 1 + .../test-cases/testdata/MarkdownDoc-crlf.case | 22 + .../test-cases/testdata/MarkdownDoc-lf.case | 22 + .../testdata/MarkerAnnotation-cr.case | 1 + .../testdata/MarkerAnnotation-crlf.case | 10 + .../testdata/MarkerAnnotation-lf.case | 10 + .../testdata/Multivariables-cr.case | 1 + .../testdata/Multivariables-crlf.case | 35 + .../testdata/Multivariables-lf.case} | 19 + .../resources/test-cases/testdata/N-cr.case | 1 + .../resources/test-cases/testdata/N-crlf.case | 51 ++ .../testdata/N-lf.case} | 15 + .../test-cases/testdata/NON-NLS-cr.case | 1 + .../test-cases/testdata/NON-NLS-crlf.case | 36 + .../testdata/NON-NLS-lf.case} | 16 + .../testdata/NormalAnnotation-cr.case | 1 + .../testdata/NormalAnnotation-crlf.case | 114 +++ .../testdata/NormalAnnotation-lf.case} | 58 ++ .../resources/test-cases/testdata/P-cr.case | 1 + .../resources/test-cases/testdata/P-crlf.case | 42 + .../testdata/P-lf.case} | 23 + .../test-cases/testdata/Pair-cr.case | 1 + .../test-cases/testdata/Pair-crlf.case | 26 + .../test-cases/testdata/Pair-lf.case | 26 + .../testdata/PairedArguments-cr.case | 1 + .../testdata/PairedArguments-crlf.case | 97 +++ .../testdata/PairedArguments-lf.case} | 42 + .../resources/test-cases/testdata/Q-cr.case | 1 + .../resources/test-cases/testdata/Q-crlf.case | 32 + .../testdata/Q-lf.case} | 17 + .../resources/test-cases/testdata/R-cr.case | 1 + .../resources/test-cases/testdata/R-crlf.case | 28 + .../testdata/R-lf.case} | 15 + .../resources/test-cases/testdata/S-cr.case | 1 + .../resources/test-cases/testdata/S-crlf.case | 93 ++ .../testdata/S-lf.case} | 48 ++ .../test-cases/testdata/Sealed-cr.case | 1 + .../test-cases/testdata/Sealed-crlf.case | 17 + .../test-cases/testdata/Sealed-lf.case | 17 + .../testdata/SemicolonInClass-cr.case | 1 + .../testdata/SemicolonInClass-crlf.case | 8 + .../testdata/SemicolonInClass-lf.case | 8 + .../testdata/SingleMemberAnnotation-cr.case | 1 + .../testdata/SingleMemberAnnotation-crlf.case | 12 + .../testdata/SingleMemberAnnotation-lf.case | 12 + .../testdata/SuperQualifier-cr.case | 1 + .../testdata/SuperQualifier-crlf.case | 37 + .../testdata/SuperQualifier-lf.case} | 20 + .../test-cases/testdata/SwitchDouble-cr.case | 1 + .../testdata/SwitchDouble-crlf.case | 16 + .../test-cases/testdata/SwitchDouble-lf.case | 16 + .../testdata/SwitchGuardClause-cr.case | 1 + .../testdata/SwitchGuardClause-crlf.case | 20 + .../testdata/SwitchGuardClause-lf.case} | 11 + .../test-cases/testdata/SwitchRecord-cr.case | 1 + .../testdata/SwitchRecord-crlf.case | 67 ++ .../testdata/SwitchRecord-lf.case} | 23 + .../testdata/SwitchUnderscore-cr.case | 1 + .../testdata/SwitchUnderscore-crlf.case | 18 + .../testdata/SwitchUnderscore-lf.case} | 10 + .../resources/test-cases/testdata/T-cr.case | 1 + .../resources/test-cases/testdata/T-crlf.case | 40 + .../testdata/T-lf.case} | 21 + .../TabularMixedSignInitializer-cr.case | 1 + .../TabularMixedSignInitializer-crlf.case | 36 + .../TabularMixedSignInitializer-lf.case} | 19 + .../testdata/TryWithResources-cr.case | 1 + .../testdata/TryWithResources-crlf.case | 44 + .../testdata/TryWithResources-lf.case} | 23 + .../resources/test-cases/testdata/U-cr.case | 1 + .../resources/test-cases/testdata/U-crlf.case | 102 +++ .../testdata/U-lf.case} | 49 ++ .../test-cases/testdata/UnaryMinus-cr.case | 1 + .../test-cases/testdata/UnaryMinus-crlf.case | 12 + .../test-cases/testdata/UnaryMinus-lf.case | 12 + .../test-cases/testdata/Unformatted2-cr.case | 1 + .../testdata/Unformatted2-crlf.case | 34 + .../test-cases/testdata/Unformatted2-lf.case | 34 + .../test-cases/testdata/Unformatted3-cr.case | 1 + .../testdata/Unformatted3-crlf.case | 20 + .../test-cases/testdata/Unformatted3-lf.case | 20 + .../test-cases/testdata/Unnamed-cr.case | 1 + .../test-cases/testdata/Unnamed-crlf.case | 96 +++ .../testdata/Unnamed-lf.case} | 48 ++ .../testdata/UnnamedPattern-cr.case | 1 + .../testdata/UnnamedPattern-crlf.case | 71 ++ .../testdata/UnnamedPattern-lf.case} | 36 + .../resources/test-cases/testdata/V-cr.case | 1 + .../resources/test-cases/testdata/V-crlf.case | 28 + .../resources/test-cases/testdata/V-lf.case | 28 + .../resources/test-cases/testdata/W-cr.case | 1 + .../resources/test-cases/testdata/W-crlf.case | 19 + .../resources/test-cases/testdata/W-lf.case | 19 + .../test-cases/testdata/WildBound-cr.case | 1 + .../test-cases/testdata/WildBound-crlf.case | 12 + .../test-cases/testdata/WildBound-lf.case | 12 + .../test-cases/testdata/b26306390-cr.case | 1 + .../test-cases/testdata/b26306390-crlf.case | 9 + .../test-cases/testdata/b26306390-lf.case | 9 + .../test-cases/testdata/i100-cr.case | 1 + .../test-cases/testdata/i100-crlf.case | 16 + .../test-cases/testdata/i100-lf.case | 16 + .../test-cases/testdata/i101-cr.case | 1 + .../test-cases/testdata/i101-crlf.case | 4 + .../test-cases/testdata/i101-lf.case | 4 + .../test-cases/testdata/i155-cr.case | 1 + .../test-cases/testdata/i155-crlf.case | 12 + .../test-cases/testdata/i155-lf.case | 12 + .../test-cases/testdata/i176-cr.case | 1 + .../test-cases/testdata/i176-crlf.case | 15 + .../test-cases/testdata/i176-lf.case | 15 + .../test-cases/testdata/i221-cr.case | 1 + .../test-cases/testdata/i221-crlf.case | 18 + .../testdata/i221-lf.case} | 10 + .../test-cases/testdata/i281-cr.case | 1 + .../test-cases/testdata/i281-crlf.case | 33 + .../testdata/i281-lf.case} | 10 + .../test-cases/testdata/i282-cr.case | 1 + .../test-cases/testdata/i282-crlf.case | 29 + .../test-cases/testdata/i282-lf.case | 29 + .../resources/test-cases/testdata/i55-cr.case | 1 + .../test-cases/testdata/i55-crlf.case | 26 + .../resources/test-cases/testdata/i55-lf.case | 26 + .../resources/test-cases/testdata/i59-cr.case | 1 + .../test-cases/testdata/i59-crlf.case | 24 + .../testdata/i59-lf.case} | 12 + .../resources/test-cases/testdata/i60-cr.case | 1 + .../test-cases/testdata/i60-crlf.case | 19 + .../resources/test-cases/testdata/i60-lf.case | 19 + .../resources/test-cases/testdata/i65-cr.case | 1 + .../test-cases/testdata/i65-crlf.case | 12 + .../resources/test-cases/testdata/i65-lf.case | 12 + .../resources/test-cases/testdata/i66-cr.case | 1 + .../test-cases/testdata/i66-crlf.case | 15 + .../resources/test-cases/testdata/i66-lf.case | 15 + .../resources/test-cases/testdata/i71-cr.case | 1 + .../test-cases/testdata/i71-crlf.case | 24 + .../testdata/i71-lf.case} | 8 + .../resources/test-cases/testdata/i95-cr.case | 1 + .../test-cases/testdata/i95-crlf.case | 8 + .../resources/test-cases/testdata/i95-lf.case | 8 + .../resources/test-cases/testdata/i98-cr.case | 1 + .../test-cases/testdata/i98-crlf.case | 16 + .../resources/test-cases/testdata/i98-lf.case | 16 + ...ue-101-annotated-lambda-parameters-cr.case | 1 + ...-101-annotated-lambda-parameters-crlf.case | 61 ++ ...ue-101-annotated-lambda-parameters-lf.case | 61 ++ ...f-issue-23-non-nls-trailing-marker-cr.case | 1 + ...issue-23-non-nls-trailing-marker-crlf.case | 42 + ...-issue-23-non-nls-trailing-marker-lf.case} | 22 + .../ojf-issue-23-reflowed-literal-cr.case | 1 + .../ojf-issue-23-reflowed-literal-crlf.case | 35 + .../ojf-issue-23-reflowed-literal-lf.case} | 11 + .../ojf-issue-23-wrapped-arguments-cr.case | 1 + .../ojf-issue-23-wrapped-arguments-crlf.case | 43 + .../ojf-issue-23-wrapped-arguments-lf.case} | 13 + .../ojf-issue-24-jbang-compact-source-cr.case | 1 + ...jf-issue-24-jbang-compact-source-crlf.case | 23 + .../ojf-issue-24-jbang-compact-source-lf.case | 23 + .../ojf-issue-24-jbang-package-cr.case | 1 + .../ojf-issue-24-jbang-package-crlf.case | 44 + .../ojf-issue-24-jbang-package-lf.case | 44 + .../ojf-issue-34-text-block-argument-cr.case | 1 + ...ojf-issue-34-text-block-argument-crlf.case | 19 + .../ojf-issue-34-text-block-argument-lf.case} | 11 + .../ojf-issue-34-text-block-ternary-cr.case | 1 + .../ojf-issue-34-text-block-ternary-crlf.case | 22 + .../ojf-issue-34-text-block-ternary-lf.case | 22 + ...-36-multiline-comments-on-one-line-cr.case | 1 + ...6-multiline-comments-on-one-line-crlf.case | 30 + ...36-multiline-comments-on-one-line-lf.case} | 16 + .../ojf-issue-38-nbsp-line-comment-cr.case | 1 + .../ojf-issue-38-nbsp-line-comment-crlf.case | 19 + .../ojf-issue-38-nbsp-line-comment-lf.case} | 9 + ...issue-60-cast-type-in-inline-chain-cr.case | 1 + ...sue-60-cast-type-in-inline-chain-crlf.case | 85 ++ ...ssue-60-cast-type-in-inline-chain-lf.case} | 38 + ...comment-before-lambda-close-parens-cr.case | 1 + ...mment-before-lambda-close-parens-crlf.case | 58 ++ ...omment-before-lambda-close-parens-lf.case} | 26 + .../ojf-long-generic-field-type-cr.case | 1 + .../ojf-long-generic-field-type-crlf.case | 25 + .../ojf-long-generic-field-type-lf.case} | 9 + .../testdata/ojf-semicolon-only-body-cr.case | 1 + .../ojf-semicolon-only-body-crlf.case | 51 ++ .../testdata/ojf-semicolon-only-body-lf.case} | 15 + .../test-cases/testdata/palantir-1-cr.case | 1 + .../test-cases/testdata/palantir-1-crlf.case | 18 + .../test-cases/testdata/palantir-1-lf.case | 18 + .../test-cases/testdata/palantir-10-cr.case | 1 + .../test-cases/testdata/palantir-10-crlf.case | 52 ++ .../testdata/palantir-10-lf.case} | 25 + .../test-cases/testdata/palantir-11-cr.case | 1 + .../test-cases/testdata/palantir-11-crlf.case | 27 + .../testdata/palantir-11-lf.case} | 14 + .../test-cases/testdata/palantir-12-cr.case | 1 + .../test-cases/testdata/palantir-12-crlf.case | 48 ++ .../testdata/palantir-12-lf.case} | 23 + .../test-cases/testdata/palantir-2-cr.case | 1 + .../test-cases/testdata/palantir-2-crlf.case | 31 + .../testdata/palantir-2-lf.case} | 16 + .../test-cases/testdata/palantir-3-cr.case | 1 + .../test-cases/testdata/palantir-3-crlf.case | 36 + .../test-cases/testdata/palantir-3-lf.case | 36 + .../test-cases/testdata/palantir-4-cr.case | 1 + .../test-cases/testdata/palantir-4-crlf.case | 21 + .../testdata/palantir-4-lf.case} | 11 + .../test-cases/testdata/palantir-5-cr.case | 1 + .../test-cases/testdata/palantir-5-crlf.case | 29 + .../test-cases/testdata/palantir-5-lf.case | 29 + .../test-cases/testdata/palantir-6-cr.case | 1 + .../test-cases/testdata/palantir-6-crlf.case | 17 + .../test-cases/testdata/palantir-6-lf.case | 17 + .../test-cases/testdata/palantir-7-cr.case | 1 + .../test-cases/testdata/palantir-7-crlf.case | 21 + .../test-cases/testdata/palantir-7-lf.case | 21 + .../test-cases/testdata/palantir-8-cr.case | 1 + .../test-cases/testdata/palantir-8-crlf.case | 19 + .../test-cases/testdata/palantir-8-lf.case | 19 + .../palantir-break-lambda-arg-cr.case | 1 + .../palantir-break-lambda-arg-crlf.case | 24 + .../palantir-break-lambda-arg-lf.case | 24 + ...palantir-break-lambda-arg-no-chain-cr.case | 1 + ...lantir-break-lambda-arg-no-chain-crlf.case | 18 + ...alantir-break-lambda-arg-no-chain-lf.case} | 10 + .../palantir-break-lambda-expr-cr.case | 1 + .../palantir-break-lambda-expr-crlf.case | 14 + .../palantir-break-lambda-expr-lf.case} | 7 + .../palantir-case-statements-block-cr.case | 1 + .../palantir-case-statements-block-crlf.case | 52 ++ .../palantir-case-statements-block-lf.case | 52 ++ .../testdata/palantir-chain-next-line-cr.case | 1 + .../palantir-chain-next-line-crlf.case | 15 + .../testdata/palantir-chain-next-line-lf.case | 15 + ...palantir-dangling-method-reference-cr.case | 1 + ...lantir-dangling-method-reference-crlf.case | 18 + ...alantir-dangling-method-reference-lf.case} | 9 + .../palantir-deeply-nested-calls-cr.case | 1 + .../palantir-deeply-nested-calls-crlf.case | 188 ++++ .../palantir-deeply-nested-calls-lf.case | 188 ++++ .../palantir-expression-lambda-1-cr.case | 1 + .../palantir-expression-lambda-1-crlf.case | 21 + .../palantir-expression-lambda-1-lf.case} | 8 + .../palantir-expression-lambda-2-cr.case | 1 + .../palantir-expression-lambda-2-crlf.case | 17 + .../palantir-expression-lambda-2-lf.case} | 8 + .../palantir-expression-lambdas-2-cr.case | 1 + .../palantir-expression-lambdas-2-crlf.case | 18 + .../palantir-expression-lambdas-2-lf.case} | 9 + .../palantir-expression-lambdas-cr.case | 1 + .../palantir-expression-lambdas-crlf.case | 18 + .../palantir-expression-lambdas-lf.case} | 9 + ...ssue-1343-text-block-indent-stable-cr.case | 1 + ...ue-1343-text-block-indent-stable-crlf.case | 58 ++ ...sue-1343-text-block-indent-stable-lf.case} | 23 + ...ntir-lambda-inlining-prefers-break-cr.case | 1 + ...ir-lambda-inlining-prefers-break-crlf.case | 25 + ...ntir-lambda-inlining-prefers-break-lf.case | 25 + .../palantir-lambda-multiline-arg-cr.case | 1 + .../palantir-lambda-multiline-arg-crlf.case | 136 +++ .../palantir-lambda-multiline-arg-lf.case} | 70 ++ .../testdata/palantir-lamda-cast-cr.case | 1 + .../testdata/palantir-lamda-cast-crlf.case | 36 + .../testdata/palantir-lamda-cast-lf.case} | 18 + .../palantir-long-method-chain-arg-cr.case | 1 + .../palantir-long-method-chain-arg-crlf.case | 16 + .../palantir-long-method-chain-arg-lf.case} | 7 + 993 files changed, 16757 insertions(+), 5609 deletions(-) delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B112853497.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B112853497.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B124394008.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B126411718.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B126411718.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B183431894.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B183431894.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950219.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950219.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950468.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950468.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950815.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19996259.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128174.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128588.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128760.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128921.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128921.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20341001.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20524742.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20524742.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20529113.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20531711.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20531711.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20535125.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20567842.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20569245.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20569245.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20577626.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20577626.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20578077.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20580212.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20701054.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20844369.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20915776.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21031147.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21105569.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21185365.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21185365.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21192435.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21278211.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21283374.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21305044.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21327412.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21327412.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21329312.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21331232.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21331232.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465217.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465477.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21585653.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21585653.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21954779.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22169269.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22424362.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22424362.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22469536.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22469536.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22488373.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22610221.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22815364.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22848286.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22848286.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22873322.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22913048.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22913048.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23349153.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23514513.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23514513.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23626035.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23626035.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23708487.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23749160.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23804934.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24202287.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24494875.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24494875.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24543625.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24702438.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24862959.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24862959.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24909927.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24988078.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24988078.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25372815.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25749989.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25787055.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25811323.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25811323.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26159561.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26207047.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26275739.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26275739.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26293162.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26694550.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26694550.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26884608.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26952926.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27078833.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27246427.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27602933.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28774859.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28774859.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28786284.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28786284.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29368546.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29618429.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29705613.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29705613.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30153869.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30789352.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30789352.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B308157568.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32114928.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32114928.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32284705.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32284705.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32729600.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32729600.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B33358723.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35644813.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35644813.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35797074.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35797074.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B36194204.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B36194204.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37629610.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B377585941.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B377585941.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37895033.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B380299722.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B380299722.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38203081.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38203081.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38352414.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38352414.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B64493529.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B64493529.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B65214682.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B72507902.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B72507902.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/C.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/CompactSource.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/CompactSource.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/D.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/E.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/EnumAnnotation.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/EnumAnnotation.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ExpressionSwitch.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/F.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Fields.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Fields.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/FlexibleConstructor.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ForMany.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ForMany.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I12.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I12.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1205.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1205.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260EmptyBlocks.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I13.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I13.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1309.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I202.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I202.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I365.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I365.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I374.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I374.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I594.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I594.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I603.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I603.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I643.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I683.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I684.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I696.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I696.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I959.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I959.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithMultipleLines.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithMultipleLines.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/L.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/L.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/LocalAnnotations.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M1.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M2.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M2.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkdownDoc.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkdownDoc.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkerAnnotation.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkerAnnotation.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Multivariables.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/N.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NON-NLS.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NormalAnnotation.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/P.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Pair.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Pair.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/PairedArguments.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Q.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/R.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/S.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Sealed.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Sealed.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SemicolonInClass.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SemicolonInClass.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SingleMemberAnnotation.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SingleMemberAnnotation.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SuperQualifier.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchDouble.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchDouble.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchGuardClause.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchRecord.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchUnderscore.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/T.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TabularMixedSignInitializer.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TryWithResources.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/U.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnaryMinus.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnaryMinus.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted2.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted2.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted3.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted3.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unnamed.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnnamedPattern.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/V.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/V.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/W.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/W.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/WildBound.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/WildBound.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/b26306390.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/b26306390.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i100.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i100.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i101.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i101.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i155.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i155.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i176.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i176.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i221.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i281.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i282.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i282.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i55.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i55.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i59.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i60.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i60.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i65.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i65.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i66.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i66.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i71.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i95.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i95.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i98.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i98.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-101-annotated-lambda-parameters.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-101-annotated-lambda-parameters.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-non-nls-trailing-marker.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-reflowed-literal.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-wrapped-arguments.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-compact-source.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-compact-source.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-package.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-package.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-argument.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-ternary.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-ternary.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-36-multiline-comments-on-one-line.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-38-nbsp-line-comment.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-60-cast-type-in-inline-chain.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-62-comment-before-lambda-close-parens.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-long-generic-field-type.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-semicolon-only-body.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-1.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-1.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-10.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-11.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-12.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-2.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-3.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-3.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-4.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-5.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-5.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-6.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-6.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-7.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-7.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-8.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-8.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg-no-chain.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-expr.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-case-statements-block.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-case-statements-block.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chain-next-line.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chain-next-line.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-dangling-method-reference.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-1.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-2.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas-2.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-issue-1343-text-block-indent-stable.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-inlining-prefers-break.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-inlining-prefers-break.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-multiline-arg.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lamda-cast.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain-arg.input create mode 100644 open-java-format/src/test/resources/test-cases/testdata/A-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/A-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/A.output => test-cases/testdata/A-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B112853497-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B112853497-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B112853497-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B124394008-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B124394008-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B124394008.output => test-cases/testdata/B124394008-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B126411718-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B126411718-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B126411718-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B183431894-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B183431894-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B183431894-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B19950219-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B19950219-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B19950219-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B19950468-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B19950468-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B19950468-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B19950815-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B19950815-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B19950815.output => test-cases/testdata/B19950815-lf.case} (55%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B19996259-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B19996259-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B19996259.output => test-cases/testdata/B19996259-lf.case} (62%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20128174-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20128174-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B20128174.output => test-cases/testdata/B20128174-lf.case} (60%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20128588-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20128588-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B20128588.output => test-cases/testdata/B20128588-lf.case} (54%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20128760-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20128760-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B20128760.output => test-cases/testdata/B20128760-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20128921-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20128921-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20128921-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20341001-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20341001-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B20341001.output => test-cases/testdata/B20341001-lf.case} (64%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20524742-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20524742-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20524742-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20529113-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20529113-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B20529113.output => test-cases/testdata/B20529113-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20531711-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20531711-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20531711-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20535125-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20535125-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B20535125.output => test-cases/testdata/B20535125-lf.case} (55%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20567842-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20567842-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B20567842.output => test-cases/testdata/B20567842-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20569245-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20569245-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20569245-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20577626-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20577626-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20577626-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20578077-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20578077-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B20578077.output => test-cases/testdata/B20578077-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20580212-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20580212-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B20580212.output => test-cases/testdata/B20580212-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20701054-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20701054-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B20701054.output => test-cases/testdata/B20701054-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20844369-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20844369-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B20844369.output => test-cases/testdata/B20844369-lf.case} (56%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20915776-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B20915776-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B20915776.output => test-cases/testdata/B20915776-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21031147-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21031147-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B21031147.output => test-cases/testdata/B21031147-lf.case} (53%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21105569-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21105569-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B21105569.output => test-cases/testdata/B21105569-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21185365-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21185365-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21185365-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21192435-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21192435-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B21192435.output => test-cases/testdata/B21192435-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21278211-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21278211-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B21278211.input => test-cases/testdata/B21278211-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21283374-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21283374-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B21283374.output => test-cases/testdata/B21283374-lf.case} (54%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21305044-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21305044-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B21305044.output => test-cases/testdata/B21305044-lf.case} (57%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21327412-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21327412-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21327412-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21329312-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21329312-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B21329312.output => test-cases/testdata/B21329312-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21331232-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21331232-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21331232-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21465217-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21465217-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B21465217.output => test-cases/testdata/B21465217-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21465477-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21465477-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B21465477.output => test-cases/testdata/B21465477-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21585653-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21585653-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21585653-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21954779-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21954779-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B21954779.input => test-cases/testdata/B21954779-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22169269-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22169269-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B22169269.output => test-cases/testdata/B22169269-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22424362-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22424362-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22424362-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22469536-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22469536-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22469536-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22488373-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22488373-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B22488373.output => test-cases/testdata/B22488373-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22610221-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22610221-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B22610221.input => test-cases/testdata/B22610221-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22815364-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22815364-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B22815364.output => test-cases/testdata/B22815364-lf.case} (56%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22848286-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22848286-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22848286-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22873322-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22873322-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B22873322.output => test-cases/testdata/B22873322-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22913048-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22913048-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22913048-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B23349153-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B23349153-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B23349153.output => test-cases/testdata/B23349153-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B23514513-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B23514513-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B23514513-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B23626035-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B23626035-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B23626035-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B23708487-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B23708487-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B23708487.output => test-cases/testdata/B23708487-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B23749160-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B23749160-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B23749160.output => test-cases/testdata/B23749160-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B23804934-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B23804934-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B23804934.output => test-cases/testdata/B23804934-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24202287-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24202287-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B24202287.output => test-cases/testdata/B24202287-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24494875-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24494875-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24494875-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24543625-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24543625-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B24543625.input => test-cases/testdata/B24543625-lf.case} (53%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24702438-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24702438-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B24702438.output => test-cases/testdata/B24702438-lf.case} (54%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24862959-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24862959-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24862959-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24909927-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24909927-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B24909927.output => test-cases/testdata/B24909927-lf.case} (67%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24988078-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24988078-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B24988078-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B25372815-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B25372815-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B25372815.output => test-cases/testdata/B25372815-lf.case} (54%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B25749989-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B25749989-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B25749989.output => test-cases/testdata/B25749989-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B25787055-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B25787055-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B25787055.output => test-cases/testdata/B25787055-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B25811323-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B25811323-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B25811323-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26159561-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26159561-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B26159561.output => test-cases/testdata/B26159561-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26207047-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26207047-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B26207047.output => test-cases/testdata/B26207047-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26275739-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26275739-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26275739-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26293162-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26293162-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B26293162.output => test-cases/testdata/B26293162-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26694550-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26694550-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26694550-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26884608-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26884608-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B26884608.input => test-cases/testdata/B26884608-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26952926-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26952926-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B26952926.output => test-cases/testdata/B26952926-lf.case} (60%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B27078833-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B27078833-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B27078833.output => test-cases/testdata/B27078833-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B27246427-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B27246427-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B27246427.output => test-cases/testdata/B27246427-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B27602933-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B27602933-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B27602933.output => test-cases/testdata/B27602933-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B28774859-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B28774859-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B28774859-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B28786284-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B28786284-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B28786284-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B29368546-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B29368546-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B29368546.output => test-cases/testdata/B29368546-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B29618429-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B29618429-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B29618429.output => test-cases/testdata/B29618429-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B29705613-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B29705613-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B29705613-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B30153869-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B30153869-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B30153869.output => test-cases/testdata/B30153869-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B30789352-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B30789352-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B30789352-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B308157568-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B308157568-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B308157568.output => test-cases/testdata/B308157568-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B32114928-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B32114928-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B32114928-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B32284705-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B32284705-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B32284705-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B32729600-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B32729600-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B32729600-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B33358723-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B33358723-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B33358723.output => test-cases/testdata/B33358723-lf.case} (59%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B35644813-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B35644813-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B35644813-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B35797074-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B35797074-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B35797074-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B36194204-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B36194204-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B36194204-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B37629610-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B37629610-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B37629610.output => test-cases/testdata/B37629610-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B377585941-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B377585941-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B377585941-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B37895033-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B37895033-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B37895033.input => test-cases/testdata/B37895033-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B380299722-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B380299722-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B380299722-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B38203081-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B38203081-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B38203081-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B38352414-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B38352414-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B38352414-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B64493529-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B64493529-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B64493529-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B65214682-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B65214682-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B65214682.output => test-cases/testdata/B65214682-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B72507902-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B72507902-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B72507902-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/C-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/C-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/C.output => test-cases/testdata/C-lf.case} (53%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/CompactSource-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/CompactSource-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/CompactSource-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/D-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/D-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/D.output => test-cases/testdata/D-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/E-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/E-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/E.output => test-cases/testdata/E-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/EnumAnnotation-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/EnumAnnotation-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/EnumAnnotation-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ExpressionSwitch-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ExpressionSwitch-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/ExpressionSwitch.output => test-cases/testdata/ExpressionSwitch-lf.case} (53%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/F-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/F-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/F.output => test-cases/testdata/F-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Fields-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Fields-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Fields-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/FlexibleConstructor-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/FlexibleConstructor-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/FlexibleConstructor.output => test-cases/testdata/FlexibleConstructor-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ForMany-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ForMany-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ForMany-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/I.output => test-cases/testdata/I-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I1-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I1-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/I1.output => test-cases/testdata/I1-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I12-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I12-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I12-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I1205-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I1205-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I1205-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I1260-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I1260-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/I1260.output => test-cases/testdata/I1260-lf.case} (57%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I1260EmptyBlocks-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I1260EmptyBlocks-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/I1260EmptyBlocks.output => test-cases/testdata/I1260EmptyBlocks-lf.case} (63%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I13-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I13-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I13-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I1309-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I1309-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/I1309.output => test-cases/testdata/I1309-lf.case} (67%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I202-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I202-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I202-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I365-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I365-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I365-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I374-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I374-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I374-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I594-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I594-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I594-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I603-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I603-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I603-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I643-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I643-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/I643.output => test-cases/testdata/I643-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I683-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I683-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/I683.output => test-cases/testdata/I683-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I684-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I684-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/I684.output => test-cases/testdata/I684-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I696-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I696-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I696-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I959-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I959-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I959-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/JavaFileWithMultipleLines-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/JavaFileWithMultipleLines-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/JavaFileWithMultipleLines-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/L-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/L-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/L-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/LocalAnnotations-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/LocalAnnotations-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/LocalAnnotations.output => test-cases/testdata/LocalAnnotations-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/M1-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/M1-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/M1.output => test-cases/testdata/M1-lf.case} (57%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/M2-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/M2-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/M2-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/MarkdownDoc-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/MarkdownDoc-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/MarkdownDoc-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/MarkerAnnotation-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/MarkerAnnotation-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/MarkerAnnotation-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Multivariables-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Multivariables-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/Multivariables.output => test-cases/testdata/Multivariables-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/N-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/N-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/N.output => test-cases/testdata/N-lf.case} (60%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/NON-NLS-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/NON-NLS-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/NON-NLS.input => test-cases/testdata/NON-NLS-lf.case} (54%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/NormalAnnotation-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/NormalAnnotation-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/NormalAnnotation.output => test-cases/testdata/NormalAnnotation-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/P-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/P-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/P.output => test-cases/testdata/P-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Pair-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Pair-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Pair-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/PairedArguments-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/PairedArguments-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/PairedArguments.output => test-cases/testdata/PairedArguments-lf.case} (55%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Q-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Q-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/Q.output => test-cases/testdata/Q-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/R-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/R-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/R.output => test-cases/testdata/R-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/S-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/S-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/S.output => test-cases/testdata/S-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Sealed-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Sealed-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Sealed-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SemicolonInClass-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SemicolonInClass-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SemicolonInClass-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SingleMemberAnnotation-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SingleMemberAnnotation-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SingleMemberAnnotation-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SuperQualifier-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SuperQualifier-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/SuperQualifier.output => test-cases/testdata/SuperQualifier-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SwitchDouble-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SwitchDouble-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SwitchDouble-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SwitchGuardClause-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SwitchGuardClause-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/SwitchGuardClause.output => test-cases/testdata/SwitchGuardClause-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SwitchRecord-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SwitchRecord-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/SwitchRecord.output => test-cases/testdata/SwitchRecord-lf.case} (62%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SwitchUnderscore-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/SwitchUnderscore-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/SwitchUnderscore.output => test-cases/testdata/SwitchUnderscore-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/T-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/T-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/T.output => test-cases/testdata/T-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/TabularMixedSignInitializer-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/TabularMixedSignInitializer-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/TabularMixedSignInitializer.output => test-cases/testdata/TabularMixedSignInitializer-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/TryWithResources-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/TryWithResources-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/TryWithResources.output => test-cases/testdata/TryWithResources-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/U-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/U-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/U.output => test-cases/testdata/U-lf.case} (55%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/UnaryMinus-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/UnaryMinus-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/UnaryMinus-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Unformatted2-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Unformatted2-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Unformatted2-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Unformatted3-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Unformatted3-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Unformatted3-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Unnamed-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Unnamed-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/Unnamed.output => test-cases/testdata/Unnamed-lf.case} (54%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/UnnamedPattern-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/UnnamedPattern-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/UnnamedPattern.output => test-cases/testdata/UnnamedPattern-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/V-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/V-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/V-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/W-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/W-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/W-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/WildBound-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/WildBound-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/WildBound-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/b26306390-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/b26306390-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/b26306390-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i100-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i100-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i100-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i101-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i101-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i101-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i155-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i155-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i155-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i176-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i176-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i176-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i221-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i221-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/i221.output => test-cases/testdata/i221-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i281-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i281-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/i281.output => test-cases/testdata/i281-lf.case} (54%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i282-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i282-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i282-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i55-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i55-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i55-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i59-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i59-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/i59.output => test-cases/testdata/i59-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i60-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i60-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i60-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i65-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i65-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i65-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i66-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i66-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i66-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i71-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i71-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/i71.input => test-cases/testdata/i71-lf.case} (56%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i95-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i95-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i95-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i98-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i98-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/i98-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-101-annotated-lambda-parameters-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-101-annotated-lambda-parameters-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-101-annotated-lambda-parameters-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/ojf-issue-23-non-nls-trailing-marker.output => test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-reflowed-literal-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-reflowed-literal-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/ojf-issue-23-reflowed-literal.output => test-cases/testdata/ojf-issue-23-reflowed-literal-lf.case} (58%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-wrapped-arguments-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-wrapped-arguments-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/ojf-issue-23-wrapped-arguments.output => test-cases/testdata/ojf-issue-23-wrapped-arguments-lf.case} (55%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-compact-source-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-compact-source-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-compact-source-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-package-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-package-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-package-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-argument-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-argument-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-argument.input => test-cases/testdata/ojf-issue-34-text-block-argument-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-ternary-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-ternary-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-ternary-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/ojf-issue-36-multiline-comments-on-one-line.output => test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-lf.case} (69%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-38-nbsp-line-comment-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-38-nbsp-line-comment-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/ojf-issue-38-nbsp-line-comment.output => test-cases/testdata/ojf-issue-38-nbsp-line-comment-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/ojf-issue-60-cast-type-in-inline-chain.output => test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/ojf-issue-62-comment-before-lambda-close-parens.output => test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-lf.case} (54%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-long-generic-field-type-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-long-generic-field-type-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/ojf-long-generic-field-type.output => test-cases/testdata/ojf-long-generic-field-type-lf.case} (55%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-semicolon-only-body-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-semicolon-only-body-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/ojf-semicolon-only-body.output => test-cases/testdata/ojf-semicolon-only-body-lf.case} (54%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-1-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-1-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-1-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-10-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-10-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-10.input => test-cases/testdata/palantir-10-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-11-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-11-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-11.input => test-cases/testdata/palantir-11-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-12-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-12-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-12.input => test-cases/testdata/palantir-12-lf.case} (57%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-2-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-2-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-2.output => test-cases/testdata/palantir-2-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-3-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-3-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-3-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-4-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-4-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-4.output => test-cases/testdata/palantir-4-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-5-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-5-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-5-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-6-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-6-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-6-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-7-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-7-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-7-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-8-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-8-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-8-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-no-chain-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-no-chain-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-break-lambda-arg-no-chain.input => test-cases/testdata/palantir-break-lambda-arg-no-chain-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-expr-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-expr-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-break-lambda-expr.input => test-cases/testdata/palantir-break-lambda-expr-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-case-statements-block-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-case-statements-block-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-case-statements-block-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-chain-next-line-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-chain-next-line-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-chain-next-line-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-dangling-method-reference-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-dangling-method-reference-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-dangling-method-reference.output => test-cases/testdata/palantir-dangling-method-reference-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-1-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-1-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-expression-lambda-1.output => test-cases/testdata/palantir-expression-lambda-1-lf.case} (56%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-2-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-2-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-expression-lambda-2.output => test-cases/testdata/palantir-expression-lambda-2-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-2-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-2-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-expression-lambdas-2.output => test-cases/testdata/palantir-expression-lambdas-2-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-expression-lambdas.output => test-cases/testdata/palantir-expression-lambdas-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-issue-1343-text-block-indent-stable-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-issue-1343-text-block-indent-stable-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-issue-1343-text-block-indent-stable.input => test-cases/testdata/palantir-issue-1343-text-block-indent-stable-lf.case} (56%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-inlining-prefers-break-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-inlining-prefers-break-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-inlining-prefers-break-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-multiline-arg-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-multiline-arg-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-lambda-multiline-arg.input => test-cases/testdata/palantir-lambda-multiline-arg-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-lamda-cast-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-lamda-cast-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-lamda-cast.input => test-cases/testdata/palantir-lamda-cast-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-arg-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-arg-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-long-method-chain-arg.output => test-cases/testdata/palantir-long-method-chain-arg-lf.case} (55%) diff --git a/open-java-format/src/test/java/com/palantir/javaformat/java/FileBasedTests.java b/open-java-format/src/test/java/com/palantir/javaformat/java/FileBasedTests.java index 4f876343b..5c1bab101 100644 --- a/open-java-format/src/test/java/com/palantir/javaformat/java/FileBasedTests.java +++ b/open-java-format/src/test/java/com/palantir/javaformat/java/FileBasedTests.java @@ -47,24 +47,9 @@ public final class FileBasedTests { // Test files that are only used when run with a minimum Java version private static final ImmutableMultimap VERSIONED_TESTS = ImmutableMultimap.builder() - .putAll(14, "Records", "RSL", "Var", "ExpressionSwitch", "I574", "I594") - .putAll(15, "I603") - .putAll(16, "I588", "Sealed") - .putAll(17, "I683", "I684", "I696") - .putAll( - 21, - "SwitchGuardClause", - "SwitchRecord", - "SwitchDouble", - "SwitchUnderscore", - "I880", - "I1309", - "Unnamed", - "UnnamedPattern", - "CompactSource", - "MarkdownDoc", - "FlexibleConstructor", - "ojf-issue-24-jbang-compact-source") + .putAll(14, "Records", "RSL", "Var", "I574") + .putAll(16, "I588") + .putAll(21, "I880") .putAll(23, "ModuleImport") .build(); diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.input deleted file mode 100644 index e9e13844e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.input +++ /dev/null @@ -1,97 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** - * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, - * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, - * ArrayTypes, AssertStatements, and Assignments. - */ -class A { - public @interface X { - int x(); - - int y() default - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; - } - - @X(x = 1) - private @interface Y {} - - // TODO(jdd): Add annotation declaration with empty body. - - @X(x = 1) - @Y - protected @interface Z {} - - // TODO(jdd): Include type annotations once we can include a higher language level. - - int[] array1 = new int[5]; - int[] array2 = - new int[] { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31 - }; - int[] array3 = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31 - }; - int[][] array4 = { - {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, - {20, 21}, {22, 23} - }; - int[][][] arrayWithLongName = - new int - [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - []; - - A a1 = - new A() { - int x = - array1[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - + array2[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - + array3[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - + array4[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0][ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0]; - }; - - void f(int something) { - assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; - assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - : "that was certainly unexpected!"; - arrayWithLongName[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = - arrayWithLongName[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; - something = - 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 - + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 - + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; - return StreamEx.of(itemsToCreate) - .append(itemsToEdit) - .append(itemsToDelete) - .distinct() - .mapToEntry(item -> getArgsGenerator() - .getNewArgs( - extendedItems.getOrDefault(item, Set.of()), - getOwningResource( - item, - getModificationContext()::getRestrictionStatusOrDefault, - RestrictionStatus::getPackageId, - getModificationContext()))) - .toImmutableMap(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B.input deleted file mode 100644 index 321f7214b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B.input +++ /dev/null @@ -1,18 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** Tests for Blocks, BodyDeclarations, BooleanLiterals, and BreakStatements. */ -class B { - int x; - private int y; - public int z; - - void f() { - LABEL: - while (true != false) { - if (false == true) - break; - if (false == false) - break LABEL; - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B.output deleted file mode 100644 index cf40f450f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B.output +++ /dev/null @@ -1,16 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** Tests for Blocks, BodyDeclarations, BooleanLiterals, and BreakStatements. */ -class B { - int x; - private int y; - public int z; - - void f() { - LABEL: - while (true != false) { - if (false == true) break; - if (false == false) break LABEL; - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B112853497.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B112853497.input deleted file mode 100644 index e38d0b32c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B112853497.input +++ /dev/null @@ -1,12 +0,0 @@ -class B112853497 { - { - XxxxxxxxxxXxxx xxxXxxxx = - xxxXxxxx - .xxxxXxXxxxx(xxxxXxxx, XXXXXX_XXXX_XXXXXXXX_XX_XXXXXXXX) - .toBuilder() - .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) - .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) - .xxxXxxxxx(xxxxxx.xxxXxxxxxXxxx()) - .xxxxx(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B112853497.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B112853497.output deleted file mode 100644 index df67e2f5b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B112853497.output +++ /dev/null @@ -1,9 +0,0 @@ -class B112853497 { - { - XxxxxxxxxxXxxx xxxXxxxx = xxxXxxxx.xxxxXxXxxxx(xxxxXxxx, XXXXXX_XXXX_XXXXXXXX_XX_XXXXXXXX).toBuilder() - .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) - .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) - .xxxXxxxxx(xxxxxx.xxxXxxxxxXxxx()) - .xxxxx(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B124394008.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B124394008.input deleted file mode 100644 index 0b51407d7..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B124394008.input +++ /dev/null @@ -1,8 +0,0 @@ -class B124394008 { - { - LocalReviewProto.Builder newReview = - readProfileResponse.flatMap(authorExtractor::extract) - .map(luReviewsExtractor::toLocalReviewProto) - .orElse(LocalReviewProto.getDefaultInstance()).toBuilder(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B126411718.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B126411718.input deleted file mode 100644 index c5cedba4b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B126411718.input +++ /dev/null @@ -1,10 +0,0 @@ -class B126411718 { - { - logger - .atDebug() - .log( - "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", - deletedPersistentNames.size(), - deletedPersistentNames); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B126411718.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B126411718.output deleted file mode 100644 index 972097faa..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B126411718.output +++ /dev/null @@ -1,7 +0,0 @@ -class B126411718 { - { - logger.atDebug().log( - "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", - deletedPersistentNames.size(), deletedPersistentNames); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B183431894.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B183431894.input deleted file mode 100644 index 7c220d519..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B183431894.input +++ /dev/null @@ -1,4 +0,0 @@ -class B183431894 { - int a = - -1; - int d = + +1; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B183431894.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B183431894.output deleted file mode 100644 index 2250359ba..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B183431894.output +++ /dev/null @@ -1,4 +0,0 @@ -class B183431894 { - int a = - -1; - int d = + +1; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950219.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950219.input deleted file mode 100644 index b4dd88499..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950219.input +++ /dev/null @@ -1,8 +0,0 @@ -class B19950219 { - @Override - String normalizeWord(String word) { - return Ascii.toLowerCase(word); - } - @Override - String convert(CaseFormat format, String s) { - }} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950219.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950219.output deleted file mode 100644 index 04d2f049b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950219.output +++ /dev/null @@ -1,9 +0,0 @@ -class B19950219 { - @Override - String normalizeWord(String word) { - return Ascii.toLowerCase(word); - } - - @Override - String convert(CaseFormat format, String s) {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950468.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950468.input deleted file mode 100644 index 9b4a8e239..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950468.input +++ /dev/null @@ -1,5 +0,0 @@ -class B19950468 { - int code() {} - - // comment -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950468.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950468.output deleted file mode 100644 index 334c34e3a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950468.output +++ /dev/null @@ -1,5 +0,0 @@ -class B19950468 { - int code() {} - - // comment -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950815.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950815.input deleted file mode 100644 index 369b8d1f1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950815.input +++ /dev/null @@ -1,12 +0,0 @@ -class B19950815 { - void m() { - checkArgument( - truncationLength >= 0, "maxLength (%s) must be >= length of the truncation indicator (%s)", - maxLength, truncationIndicator.length()); - } - - private String finishCollapseFrom( - CharSequence sequence, int start, int end, char replacement, StringBuilder builder, - boolean inMatchingGroup) { - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19996259.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19996259.input deleted file mode 100644 index a029186ee..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19996259.input +++ /dev/null @@ -1,16 +0,0 @@ -class B19996259 { - void g( // line comment - int x) {} - - void // - g // - ( // - int // - x // - , // - int // - y // - ) // - { // - } // -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128174.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128174.input deleted file mode 100644 index a4ae333e9..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128174.input +++ /dev/null @@ -1,8 +0,0 @@ -class B20128174 { - - enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES }; - - enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES; }; - - enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES,; }; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128588.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128588.input deleted file mode 100644 index 74ed3dbc4..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128588.input +++ /dev/null @@ -1,84 +0,0 @@ -@Foo @Bar @Baz package edu.oswego.cs.dl.util.concurrent; - -@Foo @Bar @Baz class Test { - - @Foo @Bar @Baz Object f() { - } - - @Foo @Bar @Baz public Object f() { - } - - @Foo @Bar @Baz void f() { - } - - @Foo @Bar @Baz static Object field; - - static @Foo @Bar @Baz Object field; - - @Foo @Bar @Baz Object field; - - @Foo(xs=42) @Bar @Baz Object field; - - { - @Foo @Bar @Baz final Object var; - - final @Foo @Bar @Baz Object var; - - @Foo @Bar @Baz Object var; - - @Foo(xs=42) @Bar @Baz Object var; - } - - void f( - @Foo @Bar @Baz final Object var, - final @Foo @Bar @Baz Object var, - @Foo @Bar @Baz Object var, - @Foo(xs=42) @Bar @Baz Object var) {} - - <@TA T extends @TA Object> @TA T f(List a, List b) throws @TA Exception {} - - @FooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BarXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BazXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX int x; - -@FooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BarXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BazXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX int x; - - @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated Object var; - - @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated Object var; - - @Deprecated(x=42) @Deprecated @Deprecated @Deprecated @Deprecated Object var; - - @Deprecated( - x = 42, - y = { - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - }) - Object var; - - @Deprecated( - y = { - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - }) - Object var; -} - -@Frozzle({ - @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), - @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), - @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, enable = false, methods = { - "foo", "foo", "foo", "foo", "foo", - "foo", "foo", "foo", "foo", "foo", - "foo", "foo", "foo", "foo", "foo", - }), - @Mirror( - in = edu.oswego.cs.dl.util.concurrent.F.class, - enable = false, - methods = {"foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo"}), - @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), -}) -class C {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128760.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128760.input deleted file mode 100644 index 30d17f43b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128760.input +++ /dev/null @@ -1,107 +0,0 @@ -class B20128760 { - void f() { - x = - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - - XxxxxxxxxXxx.xxxxxxx() - .xxx(XxxxxxxxxXxxXxxx.Xxxxx.XXXXX, "Xxxxx xxxxxxxxx xxxxx") - .xxx( - XxxxxxxxxXxxXxxx.Xxxxx.XXXXXxXXXXX, - XxxxXxxxxxxxxx.xxxXxxxxxxxxXxxxxXxxxxXxXxxxxx(Xxxxxxxxxx.xxxXxxxXxxxx(x))) - .xxxxx(); - - xxxxxxXxxx( - xxx - .xxxXxXxxxxxxx( - new XxxxxxxxxXxxxxxxx.Xxxxxxx() - .xxxxXxxxXxx( - Xxxxx.xxxXxxxxXxxx( - new XxxxXx( - xxxxxxxxx1.xxxXxxxXx().xxxXxxxx() - + xxxxxxxxx2.xxxXxxxXx().xxxXxxxx()))) - .xxxxx()) - .xxxXxxxxxx()) - .xxxxxxxxXxxxxxx(); - - XXxxxx xxxxxxxxxXxxXxxXxXxxxxxxxXx = - XX - .xxxxXxxXxxx2( - "XxxxXxxxxxxxXxxxXxxxXxxxxxxxXxxxXxxXxxxxxxXxxxxxxxx", - xxxxxxxxXxxxXxXxxxxxxxXx, - xxxxxxxxXxxxXxxxxXxxxXxXxxxxxxxXx) - .xxxxxxxxXx( - "XxxxxxxxXxxxxxxxxXxx", - xxxxxxxxXxxxxxxxxXxxXx, - XX.xxxxxXx(XX.xxxxx(), XX.xxxxxx(XxxxxxxXxxxxxxxxxxXxxxxxxxx.xxxxx))); - - xxXxxxxxxxXxxxXxxx = - (XxxxXxxx) - xxxxxxxxXxxxxxxxxx.xxx() - .xxxxxXxxxxxx - .xxxXxxxxxxx(xxxxxxxxXxxxxxxxxx.xxx().xxxxXxxxx.xxxXxxxxxxXxxx() - 1) - .xxxXxxx() - .xxxxXxxxXxXx(X.xx.xxxxxxxxxxxxxxxxxxxxxxxxxxx); - - xxxxxxXxxx( - xxxxxxxxxx - .xxxXxxxXxxxxXxxxxxxxxxxXxxxXxxxXxxxxXxxx(XXXxXXXXxXX, XXXXXXxXXXxXXXXxXX, XXXXXxXX) - .xxxxxxxxxxxXxxxXxxxXxxxxx()) - .xxxxxxxxXxxxxxx( - xxxxXxxxxxxxxxxXxxxXxxxXxxxx(xxxx1Xxxx, Xxxxx.XXxXXX), - xxxxXxxxxxxxxxxXxxxXxxxXxxxx(xxxx2Xxxx, Xxxxx.XXxXXX)); - - xxxx( - xxxx( - xxxx( - xxxx( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)))); - - assertThat( - main - .format("--offset", "0", "--length", String.valueOf(input.length()), path.toString())) - .isEqualTo(0); - } - - private static class GenerateDashboardRowFn - extends - XX.XxXx< - Xxxx< - Xxxx, - Xxxxx2.XxxXxxxXxxxxxxxxxx>>, - Xxxx> {} - - public class XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx - extends - XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx< - XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx, XxxxXxxxxxxXxxxxxxxx>> {} - - public class Foo - extends - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} - - public class Foo - extends - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - implements - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} - - public class Foo - extends - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - implements - Xxxxxxxxxxxxx, - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} - - { - Stream itemIdsStream = stream(members) - .flatMap(m -> m.getFieldValues() - .entrySet() - .stream() - .filter(fv -> itemLinkFieldIds.contains(fv.getKey())) - .flatMap(fv -> FieldDTO.deserializeStringToListOfStrings(fv.getValue()) - .stream() - .map(id -> new ItemKey(fieldsById.get(fv.getKey()).getItemTypeId(), id)))); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128921.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128921.input deleted file mode 100644 index 5d3a9eea3..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128921.input +++ /dev/null @@ -1,10 +0,0 @@ -public class B20128921 { - - void m(Iterable ax) { - - for (T a : ax) { - - System.err.println(x); - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128921.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128921.output deleted file mode 100644 index 79390fae9..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128921.output +++ /dev/null @@ -1,10 +0,0 @@ -public class B20128921 { - - void m(Iterable ax) { - - for (T a : ax) { - - System.err.println(x); - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20341001.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20341001.input deleted file mode 100644 index 504ba77bd..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20341001.input +++ /dev/null @@ -1,54 +0,0 @@ -public class B20341001 { - int[] xs = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 - }; - int[] xs = { - Foo.CONSTxx, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 - }; - int[] xs = { - Foo_CONST, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 - }; - int[] xs = { - "foo", - "0123456", - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 - }; - int[] xs = { - "foo", - "01234567", - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 - }; - { - return ImmutableList.of( - item1, - item2, - item3, - item4, - item5, - item6, - item7, - item8, - item9, - item10, - item11, - item12, - item13); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20524742.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20524742.input deleted file mode 100644 index 7ea5a299f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20524742.input +++ /dev/null @@ -1,3 +0,0 @@ -class Test {{ - int x; -}} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20524742.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20524742.output deleted file mode 100644 index 936f13d67..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20524742.output +++ /dev/null @@ -1,5 +0,0 @@ -class Test { - { - int x; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20529113.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20529113.input deleted file mode 100644 index 8f65948e8..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20529113.input +++ /dev/null @@ -1,12 +0,0 @@ -@BugPattern(category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) -@BugPattern( - name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, - category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) -@BugPattern( - name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, - explanation = - "If an AsyncFunction always returns immediateFuture() and never throws, it can " - + "be replaced with a Function.", - category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) -class Test { -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20531711.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20531711.input deleted file mode 100644 index 01f410f0b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20531711.input +++ /dev/null @@ -1,16 +0,0 @@ -class B20531711 { - void m() { - when(mLoginHelper.getAllAccounts()).thenReturn( - new Account[] { - new Account("test1", "test1"), - new Account("test2", "test2"), - }); - - when(mLoginHelper.getAllAccounts()).thenReturn( - new Account[] { - new Account("test1", "test1"), - new Account("test2", "test2"), -// asd - }); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20531711.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20531711.output deleted file mode 100644 index 2a84926ef..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20531711.output +++ /dev/null @@ -1,12 +0,0 @@ -class B20531711 { - void m() { - when(mLoginHelper.getAllAccounts()).thenReturn(new Account[] { - new Account("test1", "test1"), new Account("test2", "test2"), - }); - - when(mLoginHelper.getAllAccounts()).thenReturn(new Account[] { - new Account("test1", "test1"), new Account("test2", "test2"), - // asd - }); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20535125.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20535125.input deleted file mode 100644 index 30c232b56..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20535125.input +++ /dev/null @@ -1,146 +0,0 @@ -package com.google.googlejavaformat.java.test; - -class Test { - void m() { - if (!metadata.ignoreOutputTransformations() - && Producers.isListenableFutureMapKey(outputKey)) { - ImmutableList> nodes = createMapNodes((ProducerNode) node); - checkCollectionNodesAgainstWhitelist(nodes, whitelist); - return nodes; - - } else if (!metadata.ignoreOutputTransformations() - && Producers.isListenableFutureListKey(outputKey)) { - ImmutableList> nodes = createListNodes((ProducerNode) node); - return nodes; - } - - Set shorts = new HashSet<>(); - for (short i = 0; i < 99; ++i) { - - shorts.add(i); - shorts.remove(i - 1); - - } - - short i = 0; - do { - - shorts.add(i); - shorts.remove(i - 1); - i++; - - } while (i < 99); - - if (true) { - - System.err.println("Hi"); - - } - - if (true) { - - System.err.println("Hi"); - - } else { - - System.err.println("Hi"); - - } - - if (true) { - - System.err.println("Hi"); - - } else if (true) { - - System.err.println("Hi"); - - } else { - - System.err.println("Hi"); - - } - - try { - - throw new Exception(); - - } catch (Exception e) { - - System.err.println("Hi"); - - } - - try { - - throw new Exception(); - - } finally { - - System.err.println("Hi"); - - } - - try { - - throw new Exception(); - - } catch (Exception e) { - - System.err.println("Hi"); - - } finally { - - System.err.println("Hi"); - - } - - try { - - throw new Exception(); - - } catch (Exception e) { - - System.err.println("Hi"); - - } catch (Exception e) { - - System.err.println("Hi"); - - } finally { - - System.err.println("Hi"); - - } - - try (Lock l = lock.lock()) {} - - try (Lock l = lock.lock()) {} finally {} - - for (;;) {} - - while (true) {} - - do {} while (true); - - if (true) {} - - if (true) {} else if (true) {} - - if (true) {} else if (true) {} else if (true) {} - - if (true) {} else if (true) {} else {} - - if (true) {} else if (true) {} else if (true) {} else {} - - try {} catch (Exception e) {} catch (Exception e) {} finally {} - - try {} catch (Exception e) {} finally {} - - try {} catch (Exception e) {} catch (Exception e) {} - - try {} catch (Exception e) {} - - } - -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20567842.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20567842.input deleted file mode 100644 index 5a7b3c5ae..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20567842.input +++ /dev/null @@ -1,10 +0,0 @@ -public class B20567842 { - // don't try to wrap the rhs as '{1, 2, 3}', go to block-like initializer style: - int[] xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = {1, 2, 3}; - - // force block style, but not one-per-line for trailing ',': - int[] x = {a.b, true ? 1 : 2, CONST,}; - - // don't format one-per-line here: - int[] x = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20569245.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20569245.input deleted file mode 100644 index fcdf5edc7..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20569245.input +++ /dev/null @@ -1,35 +0,0 @@ -class B20569245 { - void m() { - if (true) System.err.println("asd"); - - if (true) System.err.println("asd"); - else if (true) System.err.println("asd"); - else System.err.println("asd"); - - if (true) System.err.println("asd"); - else if (true) System.err.println("asd"); - - if (true) System.err.println("asd"); - else System.err.println("asd"); - - if (true) - System.err.println("asd"); - - if (true) - System.err.println("asd"); - else if (true) - System.err.println("asd"); - else - System.err.println("asd"); - - if (true) - System.err.println("asd"); - else if (true) - System.err.println("asd"); - - if (true) - System.err.println("asd"); - else - System.err.println("asd"); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20569245.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20569245.output deleted file mode 100644 index 77a6ea0ff..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20569245.output +++ /dev/null @@ -1,27 +0,0 @@ -class B20569245 { - void m() { - if (true) System.err.println("asd"); - - if (true) System.err.println("asd"); - else if (true) System.err.println("asd"); - else System.err.println("asd"); - - if (true) System.err.println("asd"); - else if (true) System.err.println("asd"); - - if (true) System.err.println("asd"); - else System.err.println("asd"); - - if (true) System.err.println("asd"); - - if (true) System.err.println("asd"); - else if (true) System.err.println("asd"); - else System.err.println("asd"); - - if (true) System.err.println("asd"); - else if (true) System.err.println("asd"); - - if (true) System.err.println("asd"); - else System.err.println("asd"); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20577626.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20577626.input deleted file mode 100644 index b14efeb24..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20577626.input +++ /dev/null @@ -1,18 +0,0 @@ -class B20577626 { - private @Mock - GsaConfigFlags mGsaConfig; - - @Foo - @Bar - private @Mock - GsaConfigFlags mGsaConfig; - - @Foo - abstract @Bar - void m() {} - - @Foo - @Baz - abstract @Bar - void m() {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20577626.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20577626.output deleted file mode 100644 index 41811f23a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20577626.output +++ /dev/null @@ -1,14 +0,0 @@ -class B20577626 { - private @Mock GsaConfigFlags mGsaConfig; - - @Foo - @Bar - private @Mock GsaConfigFlags mGsaConfig; - - @Foo - abstract @Bar void m() {} - - @Foo - @Baz - abstract @Bar void m() {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20578077.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20578077.input deleted file mode 100644 index 11b12ed2a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20578077.input +++ /dev/null @@ -1,13 +0,0 @@ -class B20578077 { - { - new IteratorTester( - 4, MODIFIABLE, newArrayList(1, 2), IteratorTester.KnownOrder.KNOWN_ORDER) { - @Override - protected Iterator newTargetIterator() { - Iterator iterator = Lists.newArrayList(1, 2).iterator(); - return new IteratorWithSunJavaBug6529795(iterator); - } - } - .test(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20580212.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20580212.input deleted file mode 100644 index c203e3b0c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20580212.input +++ /dev/null @@ -1,16 +0,0 @@ -class B20580212 { - void m() { - GroupExpansionReply mockIsgReply = - buildRecipientListSubGroupReply( - RECIPIENT1, - alternatives /* isgExpansions */, - alternativesDeltas /* isgExpansionsScoreDeltas */, - false /* withRecipient */, - 0 /* recipientScoreDelta */); - - try { - } catch (IllegalStateException e) { /* expected */ } - } - - static class ThrowsAtEndException extends RuntimeException { /* nothing */ } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20701054.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20701054.input deleted file mode 100644 index 957c2df57..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20701054.input +++ /dev/null @@ -1,185 +0,0 @@ -class B20701054 { - void m() { - ImmutableList x = ImmutableList.builder().add(1).build(); - OptionalBinder.newOptionalBinder(binder(), InputWhitelist.class).setBinding().to( - AllInputWhitelist.class); - - Foo z = Foo.INSTANCE.field; - Foo z = Foo.INSTANCE.field.field; - Foo z = Foo.INSTANCE.field.field.field; - Foo z = Foo.INSTANCE.field.field.field.field; - Foo z = Foo.INSTANCE.field.field.field.field.field; - - ImmutableList x = ImmutableList.INSTANCE.add(1).build(); - ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).build(); - ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).add(3).build(); - ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).add(3).add(4).build(); - - ImmutableList x = ImmutableList.builder().add(1).build(); - ImmutableList x = ImmutableList.builder().add(1).add(2).build(); - ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).build(); - ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).add(4).build(); - ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).add(4).add(5).build(); - ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).add(4).add(5).add(6).build(); - - ImmutableList x = - new ImmutableList.Builder<>() - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .build(); - - ImmutableList x = - ImmutableList.new Builder<>() - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .add(xxxxx) - .build(); - - System.err.println( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - - Class.my.contrived.example.function( - veryLongArgumentxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - - PTable> latestResults = - FJ.joinOneShot2(accountSummaryProvider.get(), results).parallelDo( - "extractPageSpeedUrls", new ExtractPageSpeedUrlsFn(false)); - - PTable adImpressionsByAccount = - impressionExtractor.getImpressionBreakdownByAccountId().parallelDo( - "rekeyAdImpressionsByAccountId", new ExtractTotalImpressionsFn()); - - PTable crawlerErrorsByCode = - crawlReportSource.read("readCrawlReportTable").parallelDo( - "reKeyErrorsByPropertyCode", new RekeyErrorsByPropertyCodeFn()); - - if (ImmutableList.builder().add(1).add(2).add(3)) { - } - - if (ImmutableList.builder() - .add(1) - .add(2) - .add(3) - .add(4)) {} - - if (value.fst.name.toString().equals("value")) { - } - - analysis().analyze(compilationUnit, context, configuration, new DescriptionListener() { - @Override - public void onDescribed(Description description) { - listener.onDescribed(description.filterFixes(new Predicate() { - @Override - public boolean apply(Fix fix) { - return compiles(fix, (JCCompilationUnit) compilationUnit, context); - } - })); - } - }); - - (test ? xxx : yyy).zzz(xxx); - - (test ? xxx : yyy) - .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - - (test - ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) - .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - - zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - - zzzzzzzzzzzzzzzzzzzz.zzzzzzzzzzzzzzzzzzzzzzzzzzz.zzzzzzzzzzzzzzzzzzzzzzzzzzzzz( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - - field.field.field.field.field.field.field.field.field.field.field.field.field.field.field.field - .field.field.field.field.field.method( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - - (test - ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) - .field.field.field.field.field.field.field.field.field.field.field.field.field.method( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - - (test - ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) - .field.field.field.field.field.field.field.field.field.field.field.field.field.field.field - .field.field.field.field.field.field.method( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - - field.field.field.field.field.field.method( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - - field.field.field.field.field.field.method( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) - .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy - .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy - .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy - .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) - .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) - .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(); - - edu.oswego.cs.dl.util.concurrent.misc.ImmutableList.builder( - zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) - .zzzzzzz( - zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) - .zzzzzzz( - zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) - .zzzzzzz( - zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz); - - edu.oswego.cs.dl.util.concurrent.misc.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz - .ImmutableList.builder( - zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) - .zzzzzzz( - zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) - .zzzzzzz( - zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) - .zzzzzzz( - zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz); - - int u = - edu.oswego.cs.dl.util.concurrent.misc.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz - .ImmutableList.builder( - zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) - .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz - .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz - .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz - .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; - - for (String configured : errorProneOptions().getSeverityMap().keySet()) {} - - return fffffffffff( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - - return fffffffffff( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) - .fffffffffffff( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20844369.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20844369.input deleted file mode 100644 index 86e46d50e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20844369.input +++ /dev/null @@ -1,31 +0,0 @@ -public class B20844369 { - private static final String ID_PATTERN = - // TODO(daw): add min/max lengths for the numbers here, e.g. android ID - "(?:(?\\d+)\\+)?" // optional Android ID - + "(?\\d+)" // type - + ":" - + "(?\\d+)" // timestamp - + "(?%" // begin optional subtype - + "(?:(?\\d+)#)?" // subtype's optional user ID, followed by a hash - + "(?[0-9a-fA-F]{8})" // subtype's category hash - + "(?[0-9a-fA-F]{8})" // subtype's token hash - + ")?"; // end optional subtype - - int x = //foo - 42 + //bar - 1; - - int x = - //foo - 42 + //bar - 1; - - int x = /*foo*/ - 42 + //bar - 1; - - int x = - /*foo*/ - 42 + //bar - 1; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20915776.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20915776.input deleted file mode 100644 index 29d59e5a1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20915776.input +++ /dev/null @@ -1,10 +0,0 @@ -class B20915776 { - @Inject - void ChunkAnalysis( - // TODO(user) ... - @Parent DatasetSource supporters, - @Child DatasetSource children, - @Parent Provider parentSupportsDecider, - @Child Provider childSupportsDecider) { - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21031147.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21031147.input deleted file mode 100644 index ac2bf9840..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21031147.input +++ /dev/null @@ -1,6 +0,0 @@ -public class B21031147 { - { - return new StringBuilder(maxLength) - .append(seq, 0, truncationLength).append(truncationIndicator).toString(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21105569.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21105569.input deleted file mode 100644 index 49b6d1344..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21105569.input +++ /dev/null @@ -1,9 +0,0 @@ -class B21105569 { - void f() { - // asd - } - void g() { - /* asd */ - } - void h() { /* asd */ } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21185365.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21185365.input deleted file mode 100644 index 7ffc27cc3..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21185365.input +++ /dev/null @@ -1,5 +0,0 @@ -class B21185365 { - { - for (int i = 0; i < s.length();) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21185365.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21185365.output deleted file mode 100644 index 022049f75..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21185365.output +++ /dev/null @@ -1,5 +0,0 @@ -class B21185365 { - { - for (int i = 0; i < s.length(); ) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21192435.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21192435.input deleted file mode 100644 index ffebae4ac..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21192435.input +++ /dev/null @@ -1,12 +0,0 @@ -package testdata.output; - -public class B21192435 { - - static class Test extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{} - - static class Testxxxxxxxxx extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxx{} - - static class Testxxxxxxxxx extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxx{} - - static class Test extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21278211.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21278211.output deleted file mode 100644 index dae31abed..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21278211.output +++ /dev/null @@ -1,15 +0,0 @@ -class B21278211 { - void m() { - return names.isEmpty() || names.size() == 1 && names.get(0).toString().isEmpty(); - - // use unified breaks for all chained dereferences - - x.f().g(); - x.fzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz().gzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz(); - - x.f().g().h(); - x.f().g().hzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz(); - - x.f().g().h().i(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21283374.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21283374.input deleted file mode 100644 index 0402caa67..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21283374.input +++ /dev/null @@ -1,57 +0,0 @@ -class B21283374 { - void f(boolean flagA, boolean flagB, boolean flagC, boolean flagD, boolean flagE, boolean flagF, boolean flagG, boolean flagH, boolean flagI, boolean flagJ, boolean flagK) {} - - { - 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); - - 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); - - 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); - - assertThat__________________________________________________________(/*paramName=*/ false, thingy); - assertThat__________________________________________________________( - /*paramName=*/ false, thingy); - - f( - arg1, /* which arg is this attached to? */ - arg2, - arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - - - f( - /* paramName1 */ arg1, - /* paramName2 */ arg2, - arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - - f( - arg1, /* paramName1 */ - arg2, /* paramName2 */ - arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21305044.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21305044.input deleted file mode 100644 index 049233cff..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21305044.input +++ /dev/null @@ -1,32 +0,0 @@ -class B21305044 { - - class T<@Nullable X extends @Nullable Object, - @Nullable Y extends @Nullable Object, - @Nullable Z extends @Nullable Object> - extends Function<@Nullable X, @Nullable Y> - implements Predicate<@Nullable Z> { - public T(@Nullable T this, List<@Nullable X> xs) { - } - - public T(@Nullable T B21305044.this, List<@Nullable X> xs) { - } - - List<@Nullable ?> a; - List<@Nullable ? extends @Nullable Object> b; - List<@Nullable ? super @Nullable Object> c; - - List c; - } - - Function f = com.foo.bar.Baz::func; - Function g = new Baz()::func; - Function h = Baz::new; - Function i = com.foo.bar.VeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongBaz::new; - - { - Function f = () -> moderatelyLongResult; - Function f = () -> breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult; - Function f = () -> System.err.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); - Function f = (someParam) -> System.err.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21327412.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21327412.input deleted file mode 100644 index 2b2d4e0ca..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21327412.input +++ /dev/null @@ -1,3 +0,0 @@ -class B21327412 { - int i = Data._ID; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21327412.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21327412.output deleted file mode 100644 index 3776ef4d6..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21327412.output +++ /dev/null @@ -1,3 +0,0 @@ -class B21327412 { - int i = Data._ID; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21329312.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21329312.input deleted file mode 100644 index 8fa68c06a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21329312.input +++ /dev/null @@ -1,6 +0,0 @@ -public class B21329312 { - boolean test() { - return wasEdited || didContactsChange || medicalInfoManager.getTemporaryProfilePicture() != null - || inMemoryAccessMedicalProfileAboveKeyguard != originalAccessMedicalProfileAboveKeyguard; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21331232.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21331232.input deleted file mode 100644 index 3d2f94e58..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21331232.input +++ /dev/null @@ -1,13 +0,0 @@ -class B21331232 { - private - S instantiate( - Class wrapperType, Type t, FailureStrategy fs, SF factory, Iterable data) { - } - - public > - IterableSubject, T, C> that(@Nullable Iterable target) { - return IterableSubject.create(getFailureStrategy(), target); - } - - boolean mightContain(T object, Funnel funnels, int numHashFunctions, BitArray bits); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21331232.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21331232.output deleted file mode 100644 index 100ef0592..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21331232.output +++ /dev/null @@ -1,10 +0,0 @@ -class B21331232 { - private S instantiate(Class wrapperType, Type t, FailureStrategy fs, SF factory, Iterable data) {} - - public > IterableSubject, T, C> that( - @Nullable Iterable target) { - return IterableSubject.create(getFailureStrategy(), target); - } - - boolean mightContain(T object, Funnel funnels, int numHashFunctions, BitArray bits); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465217.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465217.input deleted file mode 100644 index 3973420b2..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465217.input +++ /dev/null @@ -1,12 +0,0 @@ -class B21465217 { - void m() { - try (JimfsOutputStream out2 = newOutputStream(false); - BufferedOutputStream bout = new BufferedOutputStream(out2); - OutputStreamWriter writer = new OutputStreamWriter(bout, UTF_8___________________________)) { - } - - try (Writer sourceWriter = env.getFiler().createSourceFile(qualifiedNamezzzzzzzz).openWriter()) { - sourceWriter.append(fileContents); - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465477.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465477.input deleted file mode 100644 index 3f0ca4b69..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465477.input +++ /dev/null @@ -1,10 +0,0 @@ -class B21465477 { - - @Nullable private final String simpleFieldName; - @Nullable private final String shortFlagName; - private final String containerClassName; - private final String type; - private final String doc; - private final DocLevel docLevel; - @Nullable private final String altName; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21585653.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21585653.input deleted file mode 100644 index 7c6a25b62..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21585653.input +++ /dev/null @@ -1,6 +0,0 @@ -class B21585653 { - { - try (X x = x;) { - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21585653.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21585653.output deleted file mode 100644 index febda9fda..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21585653.output +++ /dev/null @@ -1,5 +0,0 @@ -class B21585653 { - { - try (X x = x; ) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21954779.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21954779.output deleted file mode 100644 index f1cefc44e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21954779.output +++ /dev/null @@ -1,36 +0,0 @@ -class B21954779 { - { - when(computeApi.findOrCreateVm( - VM_METADATA, Optional.absent(), AssignReservedIp.YES, AttachDataDisk.YES)) - .thenReturn(OPERATION); - - fail(String.format( - " Experiment name %s is used multiple times in %s", - expName, envName, zzzzzzzzzzzz, zzzzzzzzzzzz)); - - new Handler(Looper.getMainLooper()).post(new Runnable() { - @Override - public void run() { - utils.showShortToast(application.getString( - R.string.working_on_project_format, Utils.getProjectDisplayName(selectedProject))); - } - }); - - (new Handler()).post(new Runnable() { - @Override - public void run() { - showErrorAndSetDone(error); - } - }); - - getContext() - .getErrorReporter() - .log(new RuntimeException("Called layout with a non-zero segment index: " + segmentIndex)); - - bind(new Key>() {}); - - // this isn't a feature; we'd prefer to keep `new Key...` as one unit - bind(new Key>() {}) - .then(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22169269.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22169269.input deleted file mode 100644 index 3caf93760..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22169269.input +++ /dev/null @@ -1,14 +0,0 @@ -class B22169269 { - { - try { - } catch ( - ClassNotFoundException - | NoSuchMethodException - | InvocationTargetException - | IllegalAccessException e) { - } - try { - } catch (ClassNotFoundException | NoSuchMethodException e) { - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22424362.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22424362.input deleted file mode 100644 index 800b1f0d8..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22424362.input +++ /dev/null @@ -1,8 +0,0 @@ -class Test { - { - int x = - 1 - - + 2; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22424362.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22424362.output deleted file mode 100644 index 18980ecff..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22424362.output +++ /dev/null @@ -1,5 +0,0 @@ -class Test { - { - int x = 1 + 2; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22469536.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22469536.input deleted file mode 100644 index 9f06d6f93..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22469536.input +++ /dev/null @@ -1,6 +0,0 @@ -public class Test { - public static void foo() { - long x = -9223372036854775808L; - int y = -2147483648; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22469536.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22469536.output deleted file mode 100644 index 4944ba245..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22469536.output +++ /dev/null @@ -1,6 +0,0 @@ -public class Test { - public static void foo() { - long x = -9223372036854775808L; - int y = -2147483648; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22488373.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22488373.input deleted file mode 100644 index 11747bef0..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22488373.input +++ /dev/null @@ -1,11 +0,0 @@ -class B22488373 { - { - if (enumBindingKeys.contains(bindingKey) - && (bindingKey - .key() - .type() - .getKind() - .equals(DECLARED) - && !((DeclaredType) bindingKey.key().type()).getTypeArguments().isEmpty())) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22610221.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22610221.output deleted file mode 100644 index 3874024f4..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22610221.output +++ /dev/null @@ -1,8 +0,0 @@ -class B22610221 { - { - for (Map.Entry, Object> entry : - FOO.bar().bazs().thing(someThing).entrySet()) { - output.put(entry.getKey(), entry.getValue()); - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22815364.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22815364.input deleted file mode 100644 index 85fbf6402..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22815364.input +++ /dev/null @@ -1,46 +0,0 @@ -class B22815364 { - @Xxx({ - "=0|=0", "Xxx xxxx xx xxxxxxxx xx xxxxxxxxxxxxx.", - "=0|xxx", "Xxx xxxx x xxxxxxxxxxxx.", - "xxx|=0", "Xxx xxxx x xxxxxxx.", - "xxx|xxx", "Xxx xxxx xxx xxxxxxx xxx xxx xxxxxxxxxxxx.", - "xxxxx|xxx", "Xxx xxxx {0} xxxxxxxx xxx xxx xxxxxxxxxxxx.", - "xxx|xxxxx", "Xxx xxxx xxx xxxxxxx xxx {1} xxxxxxxxxxxxx." - }) - int x; - - @Xxx({ - "a", "b", - "c", "d", - // - }) - int y; - - int[] xs = { - 1, 2, 3, - 1, 2, 3, - 1, 2, 3, - }; - - int[] xs = { - 1, 2, 3, - 1, 2, 3, - 1, 2, - }; - - int[] xs = { - 1, 2, - 1, - }; - - int[][] xs = { - {0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, - 0b111111111111111111, 0b111111111111111111, 0b111111111111111111}, {0b111111111111111111, - 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, - 0b111111111111111111, 0b111111111111111111}, - {0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, - 0b111111111111111111, 0b111111111111111111, 0b111111111111111111}, {0b111111111111111111, - 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, - 0b111111111111111111, 0b111111111111111111}, - }; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22848286.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22848286.input deleted file mode 100644 index 18796c128..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22848286.input +++ /dev/null @@ -1,8 +0,0 @@ -class B22848286 { - - @FxxxSxxx(xxxx = "xxxxxx_xxxxxxx_xxxxxxxxx_xxxx", xxxx = "Xxxxx xxxx xx xxxxxx xxxxxxx xxxxxxxxx.") - int x; - - @FxxxGxxxxxxxx(xxxx = "Xxx xxxxxx xxxxxxxxy xxx xxx xxxxxxxxx, x.x. xxx xxxxxx xxxxxxxx xxxxxxxxy") - int y; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22848286.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22848286.output deleted file mode 100644 index ea8533989..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22848286.output +++ /dev/null @@ -1,8 +0,0 @@ -class B22848286 { - - @FxxxSxxx(xxxx = "xxxxxx_xxxxxxx_xxxxxxxxx_xxxx", xxxx = "Xxxxx xxxx xx xxxxxx xxxxxxx xxxxxxxxx.") - int x; - - @FxxxGxxxxxxxx(xxxx = "Xxx xxxxxx xxxxxxxxy xxx xxx xxxxxxxxx, x.x. xxx xxxxxx xxxxxxxx xxxxxxxxy") - int y; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22873322.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22873322.input deleted file mode 100644 index 48984c42c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22873322.input +++ /dev/null @@ -1,14 +0,0 @@ -class B22873322 { - { - f(param -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); - f((param1, param2) -> veryLooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param1, param2)); - f((int param) -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); - f((param1, param2) -> { - return expr(param1, param2); - }); - f((param1, param2) -> { - Object foo = expr(param1, param2); - return foo; - }); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22913048.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22913048.input deleted file mode 100644 index 512c2b3d4..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22913048.input +++ /dev/null @@ -1,9 +0,0 @@ -private class Yellow extends Red.Orange { - Yellow(Red red) { - red.super(); - } - - Class getClassB() { - return new TypeToken(getClass()) {}.getRawType(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22913048.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22913048.output deleted file mode 100644 index 4c192a6a0..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22913048.output +++ /dev/null @@ -1,9 +0,0 @@ -private class Yellow extends Red.Orange { - Yellow(Red red) { - red.super(); - } - - Class getClassB() { - return new TypeToken(getClass()) {}.getRawType(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23349153.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23349153.input deleted file mode 100644 index 574e3454d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23349153.input +++ /dev/null @@ -1,28 +0,0 @@ -class B23349153 { - enum Foo { - A, B,; - } - { - System.err.println("Hello");; - } -} - -private enum UnsafeAtomicHelperFactory { - REALLY_TRY_TO_CREATE { - @Override - AtomicHelper tryCreateUnsafeAtomicHelper() { - return new UnsafeAtomicHelper(); - } - }, - - DONT_EVEN_TRY_TO_CREATE { - @Override - AtomicHelper tryCreateUnsafeAtomicHelper() { - return null; - } - }, - - ; - - abstract AtomicHelper tryCreateUnsafeAtomicHelper(); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23514513.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23514513.input deleted file mode 100644 index b8351cb7d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23514513.input +++ /dev/null @@ -1,7 +0,0 @@ -class Test { - { - f( - rrr.kkkkk.uuuuuuuu, rrr.iiiiii.ggggggggggggggggg, - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23514513.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23514513.output deleted file mode 100644 index 673233b23..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23514513.output +++ /dev/null @@ -1,5 +0,0 @@ -class Test { - { - f(rrr.kkkkk.uuuuuuuu, rrr.iiiiii.ggggggggggggggggg, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23626035.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23626035.input deleted file mode 100644 index bfcedc51e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23626035.input +++ /dev/null @@ -1 +0,0 @@ -class Test2 { void f(Test2... xs) {} } diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23626035.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23626035.output deleted file mode 100644 index a4eb26262..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23626035.output +++ /dev/null @@ -1,3 +0,0 @@ -class Test2 { - void f(Test2... xs) {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23708487.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23708487.input deleted file mode 100644 index e08556a59..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23708487.input +++ /dev/null @@ -1,10 +0,0 @@ -class B23708487 { - static { - TASK_AS_OWNER = - com.google.security.acl.proto2api.ACL.Entry.newBuilder() - .setRole(com.google.security.acl.proto2api.ACL.Entry.ROLE.OWNER.getNumber()) - .setScope(com.google.security.acl.proto2api.ACL.Scope.newBuilder() - .setMdbUser(BorgTaskInfo.getMdbUser().getMdbUserName())) - .build(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23749160.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23749160.input deleted file mode 100644 index b624e8d5b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23749160.input +++ /dev/null @@ -1,43 +0,0 @@ -class B23749160 { - { - mockDailySummaryModuleListFiller - .buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( - anyInt(), anyInt(), anyInt()); - - mockDailySummaryModuleListFiller - . - buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( - anyInt(), anyInt(), anyInt()); - - foo - . - buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( - anyInt(), anyInt(), anyInt()) - .bar(); - - // `.build`... and `anotherThing`... are technically at different syntactic - // levels, but the indentation required to express that starts to get out - // of hand - MockDailySummaryModuleListFiller - .buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( - anyInt(), anyInt(), anyInt()) - .anotherThing(); - - when( - mockDailySummaryModuleListFiller - .buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDay( - anyInt(), anyInt(), anyInt())) - .then(); - - final List XXXXXXXX = - ImmutableList.of( - XXXXXXX, // - XXXXXXX, // - XXXXXXX, // - XXXXXXX, // - XXXXXXX // - ); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23804934.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23804934.input deleted file mode 100644 index 87b75ab70..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23804934.input +++ /dev/null @@ -1,34 +0,0 @@ -class B23804934{ - - @Zzzzzz - B23804934( - ZzzzzzzzZzzzzzZzzzzZzzzzzzz zzzzzzzzZzzzzzZzzzzZzzzzzzz, - ZzzzzzzZzzzzzzz zzzzzzZzzzZzzzZzzzzzzz, - @ZzzzZzzzzZzzzzzz Zzzzzz zzzzzZzzzzzz, - @ZzzzzzzzzzzZzzzzzz(Zz.ZZZZZZZ_ZZZZZ_ZZZZ_ZZZZZZ_ZZZZ_ZZZZZZZZZZ) - Zzzzzzzz zzzzzZzzzZzzzzzZzzzZzzzzzzzzz) { - zzzz.zzzzzzzzZzzzzzZzzzzZzzzzzzz = zzzzzzzzZzzzzzZzzzzZzzzzzzz; - zzzz.zzzzzzZzzzZzzzZzzzzzzz = zzzzzzZzzzZzzzZzzzzzzz; - zzzz.zzzzzZzzzzzz = zzzzzZzzzzzz; - zzzz.zzzzzZzzzZzzzzzZzzzZzzzzzzzzz = zzzzzZzzzZzzzzzZzzzZzzzzzzzzz; - } - - zzzz z( - zzz z, - @Zzzzzzzz @Zzzzzzzzzz - ZzzzzzzzzZzzz - zzzzZzzzZzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) {} - - @ZzzZzzzZzzzzzzzzzz - @Zzzzzzzz(zzzzzzzzz = Zzzzzzzzz.ZZ) - ZzzzzzzzzzZzzzzz zzzzzzzZzzzzzzzzzz( - @Zzz @Zzz zzzz zzzzZzzzZz, - @Zzz @ZzzzzzzzzzZzzzz(zzzz = ZzzzzZzzzzzZzzzz.ZZZZZZ_ZZZ_ZZZ_ZZZZZZZ) - zzzzzzz zzzzzzZzzZzzZzzzzzz, - @Zzzzz @ZzzzzzzzzzZzzzz(zzzz = ZzzzzZzzzzzZzzzz.ZZZZZ_ZZZ_ZZZZZZZZZZZ) - zzzzzzz zzzzzZzzZzzzzzzzzzz, - @Zzzzz ZzzzzZzzz zzzzzZzzz) {} - - void fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff( - final zzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24202287.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24202287.input deleted file mode 100644 index ea421549c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24202287.input +++ /dev/null @@ -1,35 +0,0 @@ -class B24202287 { - { - this.overflowContactCompositeSupportedRenderers = - this.getSharePanelResponse.contents.unifiedSharePanelRenderer.contents[0] - .connectionSection - .connectionsOverflowMenu - .connectionsOverflowMenuRenderer - .contents[ - 0] - .overflowConnectionSectionRenderer - .contacts[ - 0]; - - int y = ((int[]) null)[0]; - } - - IntentSource getSource() { - return mIntent.isPresent() && mIntent.get().hasExtra(INTENT_SOURCE_KEY) - ? IntentSource.values()[ - mIntent.get().getIntExtra(INTENT_SOURCE_KEY, IntentSource.OTHER.ordinal())] - : IntentSource.OTHER; - } - - { - mTabUiParts[mRenderedTabIndex] - .setData( - tabs[mRenderedTabIndex], - true /* isSelected */, - mIsLoadingState, - mErrorMessageType, - mOnDailySummaryHeaderClickListener, - mShowSpacerForSnackbar, - mResetScrollAndAnimationAndReplaceDoodle); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24494875.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24494875.input deleted file mode 100644 index c96fcbb2c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24494875.input +++ /dev/null @@ -1,4 +0,0 @@ -public enum B24494875 { - ; - public static final String ONE = "ONE"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24494875.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24494875.output deleted file mode 100644 index 704ffee9e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24494875.output +++ /dev/null @@ -1,4 +0,0 @@ -public enum B24494875 { - ; - public static final String ONE = "ONE"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24543625.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24543625.output deleted file mode 100644 index 6de74ce3b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24543625.output +++ /dev/null @@ -1,76 +0,0 @@ -/** - * This
- * is
- * a
- * train. - */ -class TheTrain { - /* - ______ - .-"""".._'. _,## - _..__ |.-"""-.| | _,##'`-._ - (_____)||_____|| |_,##'`-._,##'` - _| |.;-""-. | |#'`-._,##'` - _.;_ `--' `\ \ |.'`\._,##'` - /.-.\ `\ |.-";.`_, |##'` - |\__/ | _..;__ |'-' / - '.____.'_.-`)\--' /'-'` - //||\\(_.-'_,'-'` - (`-...-')_,##'` - jgs _,##`-..,-;##` - _,##'`-._,##'` - _,##'`-._,##'` - `-._,##'` - */ - public static final Object THE_TRAIN = null; - - /* - BLOCK COMMENT - - */ - int x; - - /* . - BLOCK COMMENT . - - */ - int y; - - /* . - BLOCK COMMENT . - - */ - int z; - - /* . - BLOCK COMMENT . - - */ - int z; - - /* - * This is almost javadoc. - * - */ - int z; - - /** - * This is (was) malformed javadoc. - *
-     * System.err.println
-     * 
- */ - int z; - - private Object f; /*-{ - System.err.println("asd"); - }-*/ - - private native Object f() /*-{ - System.err.println("asd"); - }-*/; - - private native Object f() /*-{ -System.err.println("asd"); -}-*/; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24702438.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24702438.input deleted file mode 100644 index 631f0769e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24702438.input +++ /dev/null @@ -1,54 +0,0 @@ -class B24702438 { - - @Inject int x; - - @Inject int y; - - @Inject int z; - - @Inject int x; - @Inject int y; - @Inject int z; - - // this is a comment - - // another comment - int x; - - // another comment - - int y; - - { - switch (x) { - - case 1: - - break; - - case 1: - - break; - - default: - - break; - - } - - // this is a comment - - // another comment - System.err.println("asd"); - } - - void f( - int a, - @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, - @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, - @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, - int c) {} - void g( - @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, - @Nullable @Deprecated ImmutableList veryVeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooong) {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24862959.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24862959.input deleted file mode 100644 index 6f729a54f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24862959.input +++ /dev/null @@ -1,8 +0,0 @@ -public enum XxxxxxxXxxx implements XxxxxxXxxxxxxXxxx { - XXXXXXXXX_XXXX_XXX_XXXXXXXX( - " ", Xxxxxx.XXXXXXX, XxxxXxxxxxxXxxxxxxx.XXXXX), - // - // - // -} - diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24862959.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24862959.output deleted file mode 100644 index bda5fe2d3..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24862959.output +++ /dev/null @@ -1,6 +0,0 @@ -public enum XxxxxxxXxxx implements XxxxxxXxxxxxxXxxx { - XXXXXXXXX_XXXX_XXX_XXXXXXXX(" ", Xxxxxx.XXXXXXX, XxxxXxxxxxxXxxxxxxx.XXXXX), - // - // - // -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24909927.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24909927.input deleted file mode 100644 index c9d4fbbd2..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24909927.input +++ /dev/null @@ -1,353 +0,0 @@ -class Xxx { - - public xxxx xxx() { - XxxxxxXxxx xxxxxxxxXxxx = XxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxXxxx(XxxxxxXxxx.XXXXXXX) - .xxxXxxxxxXxxx(" ") - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXXX) - .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxXxxx( - XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) - .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxxxx( - XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx - .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) - .xxxxx()) - .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(-42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx - .xxxXxxxxxx() - .xxxXxxxxxxxxxXxxxXx(42) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXXX) - .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxXxxx( - XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) - .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxxxx( - XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx - .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) - .xxxxx()) - .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(-42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx - .xxxXxxxxxx() - .xxxXxxxxxxxxxXxxxXx(42) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXXX) - .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) - .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxxxx(XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx - .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) - .xxxxx()) - .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(-42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxxxXxxxXx(42) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXXX) - .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxXxxx( - XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) - .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxxxx( - XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx - .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) - .xxxxx()) - .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(-42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx - .xxxXxxxxxx() - .xxxXxxxxxxxxxXxxxXx(42) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXXX) - .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxXxxx( - XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) - .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxxxx( - XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx - .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) - .xxxxx()) - .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(-42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx - .xxxXxxxxxx() - .xxxXxxxxxxxxxXxxxXx(42) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXXX) - .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) - .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxxxx(XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx - .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) - .xxxxx()) - .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(-42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxxxXxxxXx(42) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXXX) - .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxXxxx( - XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) - .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxxxx( - XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx - .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) - .xxxxx()) - .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(-42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx - .xxxXxxxxxx() - .xxxXxxxxxxxxxXxxxXx(42) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXXX) - .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxXxxx( - XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) - .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxxxx( - XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx - .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) - .xxxxx()) - .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(-42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx - .xxxXxxxxxx() - .xxxXxxxxxxxxxXxxxXx(42) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXXX) - .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) - .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxxxx( - XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx - .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) - .xxxxx()) - .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(-42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxxxXxxxXx(42) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxxx(Xxxxxxxx.XXXX) - .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() - .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) - .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxXxxxxxxxx( - XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx - .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) - .xxxxx()) - .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(-42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() - .xxxXxxxx(42) - .xxxXxxx(XxxxXxxx.XXX) - .xxxxx()) - .xxxxx()) - .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() - .xxxXxxxxxxxxxXxxxXx(42) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx()) - .xxxxx(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24988078.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24988078.input deleted file mode 100644 index 1a69ffc3a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24988078.input +++ /dev/null @@ -1,7 +0,0 @@ -class B24988078 { - public static Optional fromNullable(@Nullable T nullableReference) {} - - public static Optional fromNullable(@Nullable T nullableReference) {} - - Table< /*@Nullable*/ Object, /*@Nullable*/ Object, /*@Nullable*/ Object > foo; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24988078.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24988078.output deleted file mode 100644 index cca8b0f2f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24988078.output +++ /dev/null @@ -1,7 +0,0 @@ -class B24988078 { - public static Optional fromNullable(@Nullable T nullableReference) {} - - public static Optional fromNullable(@Nullable T nullableReference) {} - - Table foo; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25372815.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25372815.input deleted file mode 100644 index c03a6ea47..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25372815.input +++ /dev/null @@ -1,32 +0,0 @@ -class Test { - { - // For "All goals" view, show only advertiser goals tab. - return newPageTypeSet( - false /* advertisers */, - false /* userManagement */, - false /* campaigns */, - false /* adGroups */, - false /* ads */, - false /* keywords */, - false /* negativeKeywords */, - false /* advertiserBidStrategies */, - false /* bidStrategies */, - false /* bidStrategyRecommendations */, - false /* bidKeywords */, - false /* engineBidStrategies */, - false /* conversionTrackers */, - false /* labels */, - false /* labelKeywords */, - false /* evergreen labels */, - false /* searchQueries */, - false /* engineSearchQueries */, - false /* remarketingTarget */, - false /* sitelinks */, - false /* feedSitelinks */, - false /* locationExtensions */, - false /* callExtensions */, - false /* calloutExtensions */, - false /* appExtensions */, - false /* events */); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25749989.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25749989.input deleted file mode 100644 index ca0e0ae2f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25749989.input +++ /dev/null @@ -1,4 +0,0 @@ -class Dummy { - /** - */private static void method(){MISSING();} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25787055.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25787055.input deleted file mode 100644 index 4aae1ce33..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25787055.input +++ /dev/null @@ -1,30 +0,0 @@ -class B25787055 { - { - logger - .atInfo() - .log( - "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", - deletedPersistentNames.size(), - deletedPersistentNames); - logger.atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo() - .log( - "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", - deletedPersistentNames.size(), - deletedPersistentNames); - logger // interior - .atInfo() // comments - .log( // are best comments - "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", - deletedPersistentNames.size(), - deletedPersistentNames); - logger - .log( - "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", - deletedPersistentNames.size(), - deletedPersistentNames) - .log( - "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", - deletedPersistentNames.size(), - deletedPersistentNames); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25811323.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25811323.input deleted file mode 100644 index 291e34c26..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25811323.input +++ /dev/null @@ -1,5 +0,0 @@ -class B25811323 { - void f() { - class Inner {}; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25811323.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25811323.output deleted file mode 100644 index 1cf1e065f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25811323.output +++ /dev/null @@ -1,6 +0,0 @@ -class B25811323 { - void f() { - class Inner {} - ; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26159561.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26159561.input deleted file mode 100644 index 853202ddb..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26159561.input +++ /dev/null @@ -1,6 +0,0 @@ -class B26159561 { - { - try (A a = a(); B b = b()) {} - try (A a = a();) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26207047.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26207047.input deleted file mode 100644 index 5f53f8c4b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26207047.input +++ /dev/null @@ -1,49 +0,0 @@ -class B26207047 { - { - String.format( - "%s ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); - String.format( - "%s ", - xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); - String.format( - "{0} ", - xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); - String.format( - "%s " - + " ", - xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); - String.format( - "%s ", - xxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxx); - String.format( - "%s ", - xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, - xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, - xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx); - String.format( - "%s ", " ", " ", " ", " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", " ", " ", " ", " "); - Set ZONES = - ImmutableSet.of( - TimeZone.getTimeZone("EST"), - // TODO: - TimeZone.getTimeZone("GMT"), - TimeZone.getTimeZone("HST"), - TimeZone.getTimeZone("MST")); - String.format( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + "%s", - xxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxx); - String.format( - " ", - xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26275739.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26275739.input deleted file mode 100644 index 70fdd90e1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26275739.input +++ /dev/null @@ -1,18 +0,0 @@ -public class B26275739 { - { - f( - /* x */ 1, - /* xx */ 2, - /* x */ 3, - /* xx */ 4); - f( - 1, - 2, - 3, - 4); - f( - /* asd */ - 1, 2, - 3, 4); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26275739.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26275739.output deleted file mode 100644 index be62715e9..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26275739.output +++ /dev/null @@ -1,12 +0,0 @@ -public class B26275739 { - { - f(/* x */ 1, /* xx */ 2, /* x */ 3, /* xx */ 4); - f( - 1, 2, - 3, 4); - f( - /* asd */ - 1, 2, - 3, 4); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26293162.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26293162.input deleted file mode 100644 index 691bebe25..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26293162.input +++ /dev/null @@ -1,43 +0,0 @@ -class Xxxx { - - public static final class XxxxXxxxxxxxXxxxxxxxxXxxxxxXxxxxxxx< - X, X, X extends XxxxxxxxxXxxxxxxxxXxxxxxxx> { - - int x; - } - - public static final class XxxxXxxxxxxxXxxxxxxxxXxxxxxXxxxxxxx< - X, X, X extends XxxxxxxxxXxxxxxxxxXxxxxxxx> extends Xxxxx { - - int x; - } - - class XxxxxxxxXxxxxxxxxXxxxXxxx< - X extends XxxxxxxxxXxxxxxx, X extends XxxxxxxxxXxxxxx, X extends Xxxxxxxxxxxxx, X> - extends XxxxXxxx { - - int x; - } - - @Xxx - class XxxxxxxxxxxXxxxxxXx< - X extends XxxxxxXxxxxxxxxxxXxxxxxXxxxxx, X extends Xxxxxxx, XX extends Xxxxxxxxx> - extends XxxxxxxxXx { - - int x; - } - - static class XxxxxXxxxxXxxx< - XXXXX extends XxxxxxxxXxxxxxx, XXX extends XxxxxxxxXxxxxxx> { - - int x; - } - - @Xxx - class XxxxxxxxxxxXxxxxxXx< - X extends XxxxxxXxxxxxxxxxxXxxxxxXxxxxx, X extends Xxxxxxx, X extends Xxxxxxx, - XX extends Xxxxxxxxx> extends XxxxxxxxXx { - - int x; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26694550.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26694550.input deleted file mode 100644 index 7af690a3e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26694550.input +++ /dev/null @@ -1,21 +0,0 @@ -class B26694550 { - { - /* === not a param comment */ - fffffffffffffffffffffffffffffff( - ImmutableList.copyOf(keys), /*&=*//*keepGoing=*/ - false, - ggggggggggggggggggggggggggggggggggggggggggg); - fffffffffffffffffffffffffffffff( - ImmutableList.copyOf(keys), - /*keepGoing=*/ - false, - ggggggggggggggggggggggggggggggggggggggggggg); - fffffffffffffffffffffffffffffff( - ImmutableList.copyOf(keys), - /*foo_bar=*/ - false, - /*foo-bar=*/ - false, - ggggggggggggggggggggggggggggggggggggggggggg); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26694550.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26694550.output deleted file mode 100644 index 9f9282747..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26694550.output +++ /dev/null @@ -1,14 +0,0 @@ -class B26694550 { - { - /* === not a param comment */ - fffffffffffffffffffffffffffffff( - ImmutableList.copyOf(keys), /*&=*/ /*keepGoing=*/ false, ggggggggggggggggggggggggggggggggggggggggggg); - fffffffffffffffffffffffffffffff( - ImmutableList.copyOf(keys), /*keepGoing=*/ false, ggggggggggggggggggggggggggggggggggggggggggg); - fffffffffffffffffffffffffffffff( - ImmutableList.copyOf(keys), - /*foo_bar=*/ false, - /*foo-bar=*/ false, - ggggggggggggggggggggggggggggggggggggggggggg); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26884608.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26884608.output deleted file mode 100644 index 47dc355f2..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26884608.output +++ /dev/null @@ -1,19 +0,0 @@ -class X26884608 { - { - this.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); - this.xxxXxxxxXxxxxxx(XxxxxXxxx.xxxxxXxxxx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); - Xxxxx.this.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); - Xxxxx.this.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); - xxx.xxxxxx.Xxxxx.this.xxxxxxxxxXxxxxxXxxxxxxXxxxxx( - XXXXXXXXX_XXXXXXXXX); - xxx.xxxxxx.Xxxxx.this.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); - - super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); - super.xxxXxxxxXxxx(XxxxxXxxxx.xxxxxXxxxx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); - Xxxxx.super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); - Xxxxx.super.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); - xxx.xxxxxx.Xxxxx.super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx( - XXXXXXXXX_XXXXXXXXX); - xxx.xxxxxx.Xxxxx.super.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26952926.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26952926.input deleted file mode 100644 index dd3451dff..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26952926.input +++ /dev/null @@ -1,51 +0,0 @@ -class T { - { - this( - x, // line comment - x // line comment - ); - super( - x, // line comment - x // line comment - ); - new t( - x, // line comment - x // line comment - ); - f( - x, // line comment - x // line comment - ); - fffff.fffff( - x, // line comment - x // line comment - ); - fffff - .fffff( - x, // line comment - x // line comment - ) - .fffff( - x, // line comment - x // line comment - ); - } - - { - this(x // line comment - ); - super(x // line comment - ); - new t(x // line comment - ); - f(x // line comment - ); - fffff.fffff(x // line comment - ); - fffff - .fffff(x // line comment - ) - .fffff(x // line comment - ); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27078833.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27078833.input deleted file mode 100644 index 597c63547..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27078833.input +++ /dev/null @@ -1,19 +0,0 @@ -enum OpKind { - - POST_INCR(Precedence.POSTFIX), - POST_DECR(Precedence.POSTFIX), - - PRE_INCR(Precedence.UNARY), - PRE_DECR(Precedence.UNARY), - PLUS(Precedence.UNARY), - NEG(Precedence.UNARY), - COMP(Precedence.UNARY), - NOT(Precedence.UNARY), - - MULT(Precedence.MULTIPLICATIVE), - DIVIDE(Precedence.MULTIPLICATIVE), - MODULO(Precedence.MULTIPLICATIVE), - ; - - // ... -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27246427.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27246427.input deleted file mode 100644 index bf4076daf..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27246427.input +++ /dev/null @@ -1,7 +0,0 @@ -enum TrailingComment { - /** foo */ FOO, /** bar */ - BAR; - - /** a */ Object a; /** b */ - Object b; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27602933.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27602933.input deleted file mode 100644 index 1046a636d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27602933.input +++ /dev/null @@ -1,11 +0,0 @@ -class B27602933 { - { - try { - } catch (final A | B x) { - } - - try { - } catch (@SuppressWarnings("unused") IllegalArgumentException | RuntimeException e) { - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28774859.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28774859.input deleted file mode 100644 index 796e7d4d4..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28774859.input +++ /dev/null @@ -1,3 +0,0 @@ -class B28774859 { - java.util. /*comment*/ Map. /*comment*/ Entry e; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28774859.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28774859.output deleted file mode 100644 index f43b3a165..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28774859.output +++ /dev/null @@ -1,3 +0,0 @@ -class B28774859 { - java.util./*comment*/ Map./*comment*/ Entry e; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28786284.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28786284.input deleted file mode 100644 index 18ac2d73c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28786284.input +++ /dev/null @@ -1,5 +0,0 @@ -enum E { - ONE, - TWO; - ; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28786284.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28786284.output deleted file mode 100644 index 3e074939c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28786284.output +++ /dev/null @@ -1,5 +0,0 @@ -enum E { - ONE, - TWO; - ; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29368546.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29368546.input deleted file mode 100644 index 32da76cff..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29368546.input +++ /dev/null @@ -1,60 +0,0 @@ -public class B29368546 { - /** - * Example: - * - *
{@code
-   *     class T {
-   *     }
-   * }
- */ - int x; - - /** - * Example: - * - *
    {@code
-   *   class T {
-   *   }
-   * }
- */ - int x; - - /** - * Example: - * - *
{@code
-   *   class T {
-   *   }}
- */ - int x; - - /** - * Example: - * - *
{@code
-   * foo bar
-   * }
-   *
-   * more stuff
-   * 
- * - *
{@code
-   * foo bar
-   * }
-   *
-   * more stuff that ends with {}
-   * 
- */ - int x; - - /** - * Example: - * - *
{@code
-   * class T {}
-   * 
// oops, we forgot the close brace - * - * more stuff that ends with {} - */ - int x; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29618429.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29618429.input deleted file mode 100644 index 2beb2a718..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29618429.input +++ /dev/null @@ -1,13 +0,0 @@ -class B29618429 { - /** - * Hello - * - *

World - *

-   * @LooksLikeATag(
-   *   foo = "bar"
-   * )
-   * 
- */ - int x; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29705613.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29705613.input deleted file mode 100644 index 0adb8846d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29705613.input +++ /dev/null @@ -1,8 +0,0 @@ -class B29705613 { - /** - * This tag isn't closed: {@link Foo - * - *

A paragraph - */ - int x; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29705613.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29705613.output deleted file mode 100644 index d041c62cf..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29705613.output +++ /dev/null @@ -1,8 +0,0 @@ -class B29705613 { - /** - * This tag isn't closed: {@link Foo - * - *

A paragraph - */ - int x; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30153869.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30153869.input deleted file mode 100644 index d5fae20b4..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30153869.input +++ /dev/null @@ -1,26 +0,0 @@ -/** - * one - * - *

    - *
  1. two - *
- * - *

- *

  • four - */ -class T { - - /** - * One - * - *
      - *
    • a - *
        - *
      • b - *
      • c - *
      - *
    • e - *
    - */ - int x; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30789352.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30789352.input deleted file mode 100644 index 2559b1f7f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30789352.input +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Body. - * - * @param

    the protobuf type - */ -class B30789352

    {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30789352.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30789352.output deleted file mode 100644 index 2559b1f7f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30789352.output +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Body. - * - * @param

    the protobuf type - */ -class B30789352

    {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B308157568.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B308157568.input deleted file mode 100644 index 089a3f1e8..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B308157568.input +++ /dev/null @@ -1,23 +0,0 @@ -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> a = @A(0x45) ArrayList::new; - Supplier> 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> c = ArrayList<@A(0x4A) String>::new; - Supplier> d = ImmutableList::<@A(0x4B) String>of; - return 0; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32114928.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32114928.input deleted file mode 100644 index 95da03c63..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32114928.input +++ /dev/null @@ -1,9 +0,0 @@ -class B32114928 { - { - Class tClass = - (Class) - verifyNotNull((ParameterizedType) getClass().getGenericSuperclass()) - .getActualTypeArguments()[ - 0]; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32114928.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32114928.output deleted file mode 100644 index 6aeced75d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32114928.output +++ /dev/null @@ -1,7 +0,0 @@ -class B32114928 { - { - Class tClass = - (Class) verifyNotNull((ParameterizedType) getClass().getGenericSuperclass()) - .getActualTypeArguments()[0]; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32284705.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32284705.input deleted file mode 100644 index 916c58854..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32284705.input +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Foo - *

    - * bar
    - * 
    - * - */ -class B32284705 {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32284705.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32284705.output deleted file mode 100644 index 916c58854..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32284705.output +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Foo - *
    - * bar
    - * 
    - *
    - */ -class B32284705 {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32729600.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32729600.input deleted file mode 100644 index 4fd5fc51e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32729600.input +++ /dev/null @@ -1,5 +0,0 @@ -class B32729600 { - { - f(() -> {}); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32729600.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32729600.output deleted file mode 100644 index 749990ec7..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32729600.output +++ /dev/null @@ -1,5 +0,0 @@ -class B32729600 { - { - f(() -> {}); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B33358723.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B33358723.input deleted file mode 100644 index 5d461e09a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B33358723.input +++ /dev/null @@ -1,24 +0,0 @@ -class B33358723 { - { - f( - // - x -> - System.err.println( - // - "hello")); - f( - // - ( // - x) -> - System.err.println( - // - "hello")); - f( - // - (int // - x) -> - System.err.println( - // - "hello")); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35644813.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35644813.input deleted file mode 100644 index 37ae3226f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35644813.input +++ /dev/null @@ -1,19 +0,0 @@ -class B35644813 { - { - return foo____________ - .bar__________() - .baz____________() - .stream() - .map(Baz::getId) - .collect(toList()); - } - - private static final ImmutableSet SCANDINAVIA = - ImmutableSet.of( - DENMARK____________________________________________________, - NORWAY_____________________________________________________, - SWEDEN_____________________________________________________) - .stream() - .map(x -> String.format("country: %s", x.toLowerCase())) - .collect(toImmutableSet()); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35644813.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35644813.output deleted file mode 100644 index 6f3f019b3..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35644813.output +++ /dev/null @@ -1,15 +0,0 @@ -class B35644813 { - { - return foo____________.bar__________().baz____________().stream() - .map(Baz::getId) - .collect(toList()); - } - - private static final ImmutableSet SCANDINAVIA = ImmutableSet.of( - DENMARK____________________________________________________, - NORWAY_____________________________________________________, - SWEDEN_____________________________________________________) - .stream() - .map(x -> String.format("country: %s", x.toLowerCase())) - .collect(toImmutableSet()); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35797074.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35797074.input deleted file mode 100644 index aa4dc09cb..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35797074.input +++ /dev/null @@ -1,4 +0,0 @@ -class B35797074 { - /** javadoc */ - /* package */ final int x; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35797074.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35797074.output deleted file mode 100644 index 187065fef..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35797074.output +++ /dev/null @@ -1,4 +0,0 @@ -class B35797074 { - /** javadoc */ - /* package */ final int x; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B36194204.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B36194204.input deleted file mode 100644 index 2a3c702cc..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B36194204.input +++ /dev/null @@ -1,5 +0,0 @@ -class B36194204 { - { - Function f = (String... s) -> s[0]; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B36194204.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B36194204.output deleted file mode 100644 index 3e6d0b332..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B36194204.output +++ /dev/null @@ -1,5 +0,0 @@ -class B36194204 { - { - Function f = (String... s) -> s[0]; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37629610.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37629610.input deleted file mode 100644 index 65d9d47fc..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37629610.input +++ /dev/null @@ -1,16 +0,0 @@ -class B37629610 { - private static ImmutableList toInputOutputPairs(Options options) { - for (Iterator inputIt = options.inputJars.iterator(), - outputIt = options.outputJars.iterator(); - inputIt.hasNext(); - ) {} - for (Iterator inputIt = options.inputJars.iterator(), - outputIt = options.outputJars.iterator(); - ; - inputIt.next()) {} - for (inputIt = options.inputJars.iterator(), // - outputIt = options.outputJars.iterator(); - ; - inputIt.next()) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B377585941.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B377585941.input deleted file mode 100644 index bd3107be4..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B377585941.input +++ /dev/null @@ -1,8 +0,0 @@ -class T { - { - f( - /* foo */ """ - hello - """); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B377585941.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B377585941.output deleted file mode 100644 index 29991ef70..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B377585941.output +++ /dev/null @@ -1,7 +0,0 @@ -class T { - { - f(/* foo */ """ - hello - """); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37895033.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37895033.output deleted file mode 100644 index 0b067e58c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37895033.output +++ /dev/null @@ -1,13 +0,0 @@ -class B37895033 { - String[][] xs = new String[][] { - {"B3", "C3", "D3"}, - {"B4", "C4", "D4"}, - {"B5", "C5", "D5"} - }; - String[] ys = new String[] { - "B3", "B4", "B5", - }; - String[][] zs = new String[][] { - {"B3"}, {"B4"}, {"B5"}, - }; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B380299722.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B380299722.input deleted file mode 100644 index 52fb54d1a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B380299722.input +++ /dev/null @@ -1,10 +0,0 @@ -package com.helloworld; - -class Foo { - void foo() { - var bar = """ - bar\ - bar\ - """; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B380299722.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B380299722.output deleted file mode 100644 index 495cee02f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B380299722.output +++ /dev/null @@ -1,10 +0,0 @@ -package com.helloworld; - -class Foo { - void foo() { - var bar = """ - bar\ - bar\ - """; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38203081.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38203081.input deleted file mode 100644 index 12419871f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38203081.input +++ /dev/null @@ -1,5 +0,0 @@ -class B38203081 { - void f(int @A []... xs) {} - - void g(int @A [] @B... xs) {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38203081.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38203081.output deleted file mode 100644 index 8abf09805..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38203081.output +++ /dev/null @@ -1,5 +0,0 @@ -class B38203081 { - void f(int @A []... xs) {} - - void g(int @A [] @B ... xs) {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38352414.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38352414.input deleted file mode 100644 index 60726fb72..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38352414.input +++ /dev/null @@ -1,2 +0,0 @@ -@Redacted(Redacted.REDACTED + "/redacted", redacted = Redacted.class) -class B38352414 {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38352414.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38352414.output deleted file mode 100644 index 60726fb72..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38352414.output +++ /dev/null @@ -1,2 +0,0 @@ -@Redacted(Redacted.REDACTED + "/redacted", redacted = Redacted.class) -class B38352414 {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B64493529.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B64493529.input deleted file mode 100644 index e0d65cbc1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B64493529.input +++ /dev/null @@ -1,10 +0,0 @@ -/** Copies from {@link Foo} to {@link Bar}. */ -// XXXX.XxXxxxxx() -class B64493529 { - // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ - // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) - // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ - // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) -} -// XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ -// XxxxxxXxxxxxXXxxxxxxXxxxxx.java) diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B64493529.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B64493529.output deleted file mode 100644 index 720660d4c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B64493529.output +++ /dev/null @@ -1,10 +0,0 @@ -/** Copies from {@link Foo} to {@link Bar}. */ -// XXXX.XxXxxxxx() -class B64493529 { - // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ - // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) - // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ - // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) -} -// XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ -// XxxxxxXxxxxxXXxxxxxxXxxxxx.java) diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B65214682.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B65214682.input deleted file mode 100644 index d6e22f613..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B65214682.input +++ /dev/null @@ -1,17 +0,0 @@ -@BugPattern( - name = "AsyncFunctionReturnsImmediate", - summary = SIMPLIFY, - category = GUAVA, - severity = NOT_A_PROBLEM, - maturity = EXPERIMENTAL -) -@BugPattern( - name = "AsyncFunctionReturnsImmediate", - summary = SIMPLIFY, - explanation = - "If an AsyncFunction always returns immediateFuture() and never throws, it can " - + "be replaced with a Function.", - category = GUAVA, - severity = NOT_A_PROBLEM, - maturity = EXPERIMENTAL) -class Test {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B72507902.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B72507902.input deleted file mode 100644 index 18d1900cf..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B72507902.input +++ /dev/null @@ -1,6 +0,0 @@ -class B72507902 { - private static class Xxxxxxxxxxxxxxxxxxxx - extends Xxxxxxxxxxx< - Pair>, Xxxxxxxxxxxxxxxxxxxx, - List> {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B72507902.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B72507902.output deleted file mode 100644 index 73821c4bf..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B72507902.output +++ /dev/null @@ -1,5 +0,0 @@ -class B72507902 { - private static class Xxxxxxxxxxxxxxxxxxxx - extends Xxxxxxxxxxx< - Pair>, Xxxxxxxxxxxxxxxxxxxx, List> {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/C.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/C.input deleted file mode 100644 index 7baed6cfe..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/C.input +++ /dev/null @@ -1,81 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** - * Tests for CastExpressions, CatchClauses, CharacterLiterals, ClassInstanceCreations, - * CommentHelper, ConditionalExpressions, ConstructorInvocations, ContinueStatements, and - * CreationReferences. - */ -class C { - // TODO(jdd): Test higher-language-level constructs. - - C() { - this( - 0, 1, - 2, 3, - 4, 5, - 6, 7, - 8, 9, - 10, 11, - 12, 13, - 14, 15, - 16, 17, - 18, 19, - 20, 21, - 22, 23, - 24, 25, - 26, 27, - 28, 29, - 30, 31); - } - - C(int... x) {} - - void f() { - try { - } catch (RuntimeException e) { - Object x = - (Pair< - Pair< - Pair, Pair>, - Pair, Pair>>, - Pair< - Pair, Pair>, - Pair, Pair>>>) - null; - C c = - new C( - 0, 1, - 2, 3, - 4, 5, - 6, 7, - 8, 9, - 10, 11, - 12, 13, - 14, 15, - 16, 17, - 18, 19, - 20, 21, - 22, 23, - 24, 25, - 26, 27, - 28, 29, - 30, 31); - int i = 0; - int j = - i == 0 - ? 0 - : i == 1 - ? 1 - : i == 2 ? 2 : i == 3 ? 3 : i == 4 ? 4 : i == 5 ? 5 : i == 6 ? 6 : i == 7 ? 7 : i; - LABEL: - while (true != false) { - if (false == true) - continue; - if (false == false) - continue LABEL; - // Comment indented +2 - // Comment indented +2 - } - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/CompactSource.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/CompactSource.input deleted file mode 100644 index 8ab254240..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/CompactSource.input +++ /dev/null @@ -1,15 +0,0 @@ -import java.util.List; - -/// A field with a markdown doc comment. -String greeting = "hello"; - -record Pair(String first, String second) {} - -/** Javadoc on a top-level member of a compact source file. */ -List names() { - return List.of(greeting, new Pair(greeting, greeting).second()); -} - -void main() { - System.out.println(names()); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/CompactSource.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/CompactSource.output deleted file mode 100644 index 26ef3e586..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/CompactSource.output +++ /dev/null @@ -1,15 +0,0 @@ -import java.util.List; - -/// A field with a markdown doc comment. -String greeting = "hello"; - -record Pair(String first, String second) {} - -/** Javadoc on a top-level member of a compact source file. */ -List names() { - return List.of(greeting, new Pair(greeting, greeting).second()); -} - -void main() { - System.out.println(names()); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/D.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/D.input deleted file mode 100644 index daca973b6..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/D.input +++ /dev/null @@ -1,20 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** Tests for Dimensions and DoStatements. */ -class D { - // TODO(jdd): Test higher-language-level features. - - int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][] - [][][][] - array[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][] - [][][][][][][]; - - void f() { - do { - assert false; - } while (1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/E.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/E.input deleted file mode 100644 index 0e98139a6..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/E.input +++ /dev/null @@ -1,87 +0,0 @@ -package com.google.googlejavaformat.java.test; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; - -/** - * Tests for EmptyStatements, EnhancedForStatements, EnumConstantDeclarations, EnumDeclarations, - * ExpressionMethodReferences, ExpressionStatements, Expressions, and ExtendedModifiers. - */ -@MarkerAnnotation -class E { - // TODO(jdd): Test higher language-level features. - - enum Enum1 { - A, B, C, D; - - Enum1() {} - } - - @MarkerAnnotation - public enum Enum2 { - A, - B, - C, - D, - ; - - Enum2() {} - } - - enum Enum3 { - A( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0), - B( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1), - C( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2), - D( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3); - - Enum3(int x) {} - } - - enum Enum4 { - A( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0), - B( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1), - C( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2), - D( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3), - ; - - Enum4(int x) {} - } - - int f(int value) { - ; - ; - ; - ; - ; - for (Integer x : - ImmutableList.of( - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) {} - for (Pair< - Pair, Pair>, Pair, Pair>>, - Pair, Pair>, Pair, Pair>>> - x : - Lists - ., Pair>, Pair, Pair>>, - Pair, Pair>, Pair, Pair>>>> - newArrayList()) {} - f(10); - return f(20); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/EnumAnnotation.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/EnumAnnotation.input deleted file mode 100644 index 43384fd64..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/EnumAnnotation.input +++ /dev/null @@ -1,5 +0,0 @@ -enum E { - @A ONE, - TWO, - @B @C THREE; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/EnumAnnotation.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/EnumAnnotation.output deleted file mode 100644 index 1f2289596..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/EnumAnnotation.output +++ /dev/null @@ -1,8 +0,0 @@ -enum E { - @A - ONE, - TWO, - @B - @C - THREE; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ExpressionSwitch.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ExpressionSwitch.input deleted file mode 100644 index bb439589c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ExpressionSwitch.input +++ /dev/null @@ -1,84 +0,0 @@ -class ExpressionSwitch { - boolean odd(int x) { - return switch (x) { - case 0 -> true; - case 1 -> false; - default -> { int y = x - 1; return odd(y); } - }; - } - - int yield(int i) { - return switch (i) { - case 0: yield 0; - default: yield n/i; - }; - } - - int assignment(int j) { - boolean val = switch (j) { - case 0 -> true; - case 1 -> false; - default -> false; - }; - return val; - } - - static final int FIELD = - switch (KIND) { - case 0 -> 1; - case 1 -> 2; - default -> throw new IllegalStateException(); - }; - - int wrapping(Wrapping w) { - switch (w) { - case THIS_IS_A_VERY_LONG_ENUM_VALUE_ONE, - THIS_IS_A_VERY_LONG_ENUM_VALUE_TWO, - THIS_IS_A_VERY_LONG_ENUM_VALUE_THREE -> {} - } - - switch (w) { - case CASE_A, CASE_B, CASE_C -> {} - } - } - - Supplier lambda(int k) { - return () -> switch (k) { - case 0 -> true; - default -> false; - }; - } - - public void test1(int y) { - int x = - switch (y) { - case 1 -> 1; - case 2 -> throw new IllegalArgumentException(); - default -> throw new IllegalStateException(); - }; - } - - public void test2(int y) { - int x; - x = switch (y) { - case 1 -> 1; - case 2 -> throw new IllegalArgumentException(); - default -> throw new IllegalStateException();}; - } - - - public void testWithComments(int y) { - int x; - x = switch (y) { - case 1 -> -1; -// after case 1 - case 2 -> -throw new IllegalArgumentException(); -// after case 2 - default -> -throw new IllegalStateException(); -// after default case -}; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/F.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/F.input deleted file mode 100644 index dbefdafd3..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/F.input +++ /dev/null @@ -1,61 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** Tests for FieldAccesses, FieldDeclarations, and ForStatements. */ -class F { - int x; - int x1 = 0; - int y, z; - int y1 = 0, z1 = 0; - F f = null; - Object field0 = - true - ? true ? true ? null : null : true ? null : null - : true ? true ? null : null : true ? null : null; - - Pair< - Pair, Pair>, - Pair, Pair>> - field1 = null; - Pair< - Pair, Pair>, - Pair, Pair>> - field2 = - true - ? true ? true ? null : null : true ? null : null - : true ? true ? null : null : true ? null : null; - - @MarkerAnnotation - Pair< - Pair, Pair>, - Pair, Pair>> - field3 = - true - ? true ? true ? null : null : true ? null : null - : true ? true ? null : null : true ? null : null; - - void f() { - for (int i = - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0; - i - < 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 10; - i++) { - f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.Ff = null; - } - for (int i = - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0; - i - < 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 10; - i++) { - f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.Ff = - null; - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Fields.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Fields.input deleted file mode 100644 index 9dc342663..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Fields.input +++ /dev/null @@ -1,7 +0,0 @@ -class Fields { - - int x = 1; - - int y = 1; - -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Fields.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Fields.output deleted file mode 100644 index d81e36746..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Fields.output +++ /dev/null @@ -1,6 +0,0 @@ -class Fields { - - int x = 1; - - int y = 1; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/FlexibleConstructor.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/FlexibleConstructor.input deleted file mode 100644 index e01857a19..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/FlexibleConstructor.input +++ /dev/null @@ -1,12 +0,0 @@ -class FlexibleConstructor { - private final int value; - - FlexibleConstructor(int raw) { - if (raw < 0) { - throw new IllegalArgumentException("negative"); - } - var normalized = Math.max(raw, 1); - super(); - this.value = normalized; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ForMany.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ForMany.input deleted file mode 100644 index 6927ee98c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ForMany.input +++ /dev/null @@ -1,6 +0,0 @@ -class ForMany { - { - A a; - for (b = B; c != C; d = D) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ForMany.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ForMany.output deleted file mode 100644 index 50f51859d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ForMany.output +++ /dev/null @@ -1,6 +0,0 @@ -class ForMany { - { - A a; - for (b = B; c != C; d = D) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I.input deleted file mode 100644 index 9f5376027..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I.input +++ /dev/null @@ -1,77 +0,0 @@ -package com.google.googlejavaformat.java.test; - -import java.util.List; - -/** - * Tests for IfStatements, ImportDeclarations, InfixExpressions, Initializers, - * InstanceofExpressions, and IntersectionTypes. - */ -class I { - interface I0 {} - - interface I1 {} - - interface I2 {} - - interface I3 {} - - interface I4 {} - - interface I5 {} - - interface I6 {} - - interface I7 {} - - interface I8 {} - - interface I9 {} - - interface I10 {} - - interface I11 {} - - interface I12 {} - - interface I13 {} - - interface I14 {} - - interface I15 {} - - interface I16 {} - - interface I17 {} - - interface I18 {} - - interface I19 {} - - class II< - T extends - I0 & I1 & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9 & I10 & I11 & I12 & I13 & I14 & I15 & I16 - & I17 & I18 & I19> {} - - static class CC { - static { - int i = 0; - } - } - - int x = - 0 >>> 0 + 0 / 0 * 0 - 0 & 0 << 0 * 0 / 0 >> 0 - 0 ^ 0 * 0 / 0 >>> 0 << 0 * 0 - 0 / 0 - | 0 * 0 >> 0 + 0 / 0 * 0 - 0 << 0 - & 0 * 0 / 0 >>> 0 - 0 * 0 >> 0 / 0 << 0 * 0 + 0 - 0 / 0 * 0 - | 0 - 0 * 0 >>> 0 << 0 / 0 * 0 >> 0 - 0 ^ 0 * 0 / 0 & 0 << 0 + 0; - - void f() { - if (0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - == 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) { - } else if (null instanceof List) { - } else { - } - if (true) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1.input deleted file mode 100644 index 7a1cd14ea..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1.input +++ /dev/null @@ -1,49 +0,0 @@ -class Test { - final CreationMechanism creationMechanism; - final @Nullable String creationUserAgent; - final ClientId clientId; - final @Nullable String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; - final Token externalId; - - { - final CreationMechanism creationMechanism; - final @Nullable String creationUserAgent; - final ClientId clientId; - final @Nullable String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; - final Token externalId; - } -} - -class Test { - final CreationMechanism creationMechanism; - @Nullable final String creationUserAgent; - final ClientId clientId; - @Nullable final String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; - final Token externalId; - - { - final CreationMechanism creationMechanism; - @Nullable final String creationUserAgent; - final ClientId clientId; - @Nullable final String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; - final Token externalId; - } -} - -class Test { - - @Nullable - final String creationUserAgent; - - { - @Nullable - final String creationUserAgent; - } - - { - - @Nullable - final String creationUserAgent; - - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I12.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I12.input deleted file mode 100644 index 5d8a058ae..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I12.input +++ /dev/null @@ -1,19 +0,0 @@ -public class Test { - - - -} - -public class Test { - - -} - -public class Test { - -} - -public class Test { -} - -public class Test {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I12.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I12.output deleted file mode 100644 index 0b72fabb6..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I12.output +++ /dev/null @@ -1,9 +0,0 @@ -public class Test {} - -public class Test {} - -public class Test {} - -public class Test {} - -public class Test {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1205.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1205.input deleted file mode 100644 index 8f8acaa16..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1205.input +++ /dev/null @@ -1,7 +0,0 @@ -public interface Foo { - - private static String foo = - """ - foo\ - bar """; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1205.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1205.output deleted file mode 100644 index 985b92f8d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1205.output +++ /dev/null @@ -1,7 +0,0 @@ -public interface Foo { - - private static String foo = """ - foo\ - bar\ - """; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260.input deleted file mode 100644 index a1504cf3c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260.input +++ /dev/null @@ -1,18 +0,0 @@ -class I1260 { - void block() { - { /* trailing on open brace */ int x = 1; } - } - - void switchCase() { - switch (0) { - case 1: { /* Break so we don't hit fall-through warning: */ break;/* ignore STRING */ - } - } - } - - void lambda() { - Runnable r = () -> { /* trailing on lambda brace */ block(); }; - } - - int[] array = { /* trailing on array brace */ 1, 2 }; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260EmptyBlocks.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260EmptyBlocks.input deleted file mode 100644 index 5eb3a3e92..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260EmptyBlocks.input +++ /dev/null @@ -1,13 +0,0 @@ -class I1260EmptyBlocks { - void f() { - { /* c */ } - try { /* t */ } catch (Exception e) { /* c */ } - try { /* t */ } finally { /* f */ } - if (true) { /* i */ } - while (true) { /* w */ } - switch (0) { case 1: { /* s */ } } - int[] a = { /* a */ }; - } - void g() { /* body */ } - void h() { /* body */ int x; } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I13.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I13.input deleted file mode 100644 index 079e78b1f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I13.input +++ /dev/null @@ -1,10 +0,0 @@ -class I13 { - - @Nullable - - public int f; - - @Override - - public void m() {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I13.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I13.output deleted file mode 100644 index bd526afd0..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I13.output +++ /dev/null @@ -1,8 +0,0 @@ -class I13 { - - @Nullable - public int f; - - @Override - public void m() {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1309.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1309.input deleted file mode 100644 index e43591ba3..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1309.input +++ /dev/null @@ -1,9 +0,0 @@ -public class I1309 { - void x(Object o) { - if (o instanceof Record(Nested(var i), var j)) {} - switch (o) { - case Record(Nested(var i), var j, int k, char l, java.lang.String m, var n, var o, var p, var q, var r, var s, var t, var u, var v, var w, var x, var y, var z): - default: - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I202.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I202.input deleted file mode 100644 index c3766ec55..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I202.input +++ /dev/null @@ -1,6 +0,0 @@ -class I202 { - { - //noinspection CheckResult - methodWhoseResultShouldBeChecked(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I202.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I202.output deleted file mode 100644 index 57238a122..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I202.output +++ /dev/null @@ -1,6 +0,0 @@ -class I202 { - { - //noinspection CheckResult - methodWhoseResultShouldBeChecked(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I365.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I365.input deleted file mode 100644 index e3866d891..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I365.input +++ /dev/null @@ -1,10 +0,0 @@ -class I365 { - { - return foo____________ - .bar__________() - .baz____________() - .parallelStream() - .map(Baz::getId) - .collect(toList()); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I365.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I365.output deleted file mode 100644 index 90a57f975..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I365.output +++ /dev/null @@ -1,7 +0,0 @@ -class I365 { - { - return foo____________.bar__________().baz____________().parallelStream() - .map(Baz::getId) - .collect(toList()); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I374.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I374.input deleted file mode 100644 index a36919e4d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I374.input +++ /dev/null @@ -1,9 +0,0 @@ -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) -@interface MyTypeAnno {} - -public class GjfFailure { - void m(int a @MyTypeAnno []) {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I374.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I374.output deleted file mode 100644 index 50a731dc6..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I374.output +++ /dev/null @@ -1,9 +0,0 @@ -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) -@interface MyTypeAnno {} - -public class GjfFailure { - void m(int a @MyTypeAnno []) {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I594.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I594.input deleted file mode 100644 index 98f667e39..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I594.input +++ /dev/null @@ -1,7 +0,0 @@ -public class I594 { - public void thisIsNotFormattedCorrectly(Object something){ - if(something instanceof String somethingAsString){ - return; - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I594.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I594.output deleted file mode 100644 index 202918b15..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I594.output +++ /dev/null @@ -1,7 +0,0 @@ -public class I594 { - public void thisIsNotFormattedCorrectly(Object something) { - if (something instanceof String somethingAsString) { - return; - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I603.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I603.input deleted file mode 100644 index 6cedc5300..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I603.input +++ /dev/null @@ -1,16 +0,0 @@ -class I603 { - sealed abstract class T1 {} - - sealed class T2 extends X implements Y permits Z {} - - sealed class T3 - permits - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} - - sealed class T4 - implements - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - permits - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, - Yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I603.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I603.output deleted file mode 100644 index f16f46675..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I603.output +++ /dev/null @@ -1,11 +0,0 @@ -class I603 { - abstract sealed class T1 {} - - sealed class T2 extends X implements Y permits Z {} - - sealed class T3 permits Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} - - sealed class T4 implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - permits Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, - Yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I643.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I643.input deleted file mode 100644 index 76a2ff371..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I643.input +++ /dev/null @@ -1,15 +0,0 @@ -public class Foo { - static final int VERBOSE_WORDY_AND_LENGTHY_ONE = 1; - static final int VERBOSE_WORDY_AND_LENGTHY_TWO = 2; - static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 4; - static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 5; - - public static int fn(int x) { - switch (x) { - case VERBOSE_WORDY_AND_LENGTHY_ONE | VERBOSE_WORDY_AND_LENGTHY_TWO | VERBOSE_WORDY_AND_LENGTHY_FOUR | VERBOSE_WORDY_AND_LENGTHY_FIVE: - return 0; - default: - return 1; - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I683.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I683.input deleted file mode 100644 index 9104f1903..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I683.input +++ /dev/null @@ -1,14 +0,0 @@ -interface Test { - - static class Test1 implements Test{} - static class Test2 implements Test{} - - public static void main(String[] args) { - Test test = new Test1(); - switch (test) { - case Test1 test1 -> {} - case Test2 test2 -> {} - default -> throw new IllegalStateException("Unexpected value: " + test); - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I684.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I684.input deleted file mode 100644 index cbce0ddd5..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I684.input +++ /dev/null @@ -1,14 +0,0 @@ -package example; - -import example.model.SealedInterface; -import example.model.TypeA; -import example.model.TypeB; - -public class Main { - public void apply(SealedInterface sealedInterface) { - switch(sealedInterface) { - case TypeA a -> System.out.println("A!"); - case TypeB b -> System.out.println("B!"); - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I696.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I696.input deleted file mode 100644 index 156e6efc9..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I696.input +++ /dev/null @@ -1,11 +0,0 @@ -public abstract non-sealed class A extends SealedClass { -} - -non-sealed class B extends SealedClass { -} - -non-sealed @A class B extends SealedClass { -} - -@A non-sealed class B extends SealedClass { -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I696.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I696.output deleted file mode 100644 index 14721c378..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I696.output +++ /dev/null @@ -1,8 +0,0 @@ -public abstract non-sealed class A extends SealedClass {} - -non-sealed class B extends SealedClass {} - -non-sealed @A class B extends SealedClass {} - -@A -non-sealed class B extends SealedClass {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I959.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I959.input deleted file mode 100644 index e39300406..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I959.input +++ /dev/null @@ -1,5 +0,0 @@ -class I959 { - public void test() { - new File(".").listFiles((final var dir, final var name) -> true); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I959.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I959.output deleted file mode 100644 index 80ba99016..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I959.output +++ /dev/null @@ -1,5 +0,0 @@ -class I959 { - public void test() { - new File(".").listFiles((final var dir, final var name) -> true); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithMultipleLines.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithMultipleLines.input deleted file mode 100644 index da11d49c0..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithMultipleLines.input +++ /dev/null @@ -1,7 +0,0 @@ -class MyClass { - private void myFile() {} -} - - - - diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithMultipleLines.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithMultipleLines.output deleted file mode 100644 index 5c185e344..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithMultipleLines.output +++ /dev/null @@ -1,3 +0,0 @@ -class MyClass { - private void myFile() {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/L.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/L.input deleted file mode 100644 index f0b3e6681..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/L.input +++ /dev/null @@ -1,11 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** Tests for LabeledStatements and LambdaExpressions. */ -class L { - // TODO(jdd): Include high language-level tests. - - void f() { - LABEL: - for (int i = 0; i < 10; i++) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/L.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/L.output deleted file mode 100644 index 964b3ced0..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/L.output +++ /dev/null @@ -1,11 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** Tests for LabeledStatements and LambdaExpressions. */ -class L { - // TODO(jdd): Include high language-level tests. - - void f() { - LABEL: - for (int i = 0; i < 10; i++) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/LocalAnnotations.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/LocalAnnotations.input deleted file mode 100644 index 87b9aa2bf..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/LocalAnnotations.input +++ /dev/null @@ -1,7 +0,0 @@ -class LocalAnnotations { - { - @Foo final Object x; - @Foo(1) final Object y; - @Foo(x=1) final Object y; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M1.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M1.input deleted file mode 100644 index c5ff9b54d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M1.input +++ /dev/null @@ -1,22 +0,0 @@ -import a.A; -import a.B; -import com.google.Foo; - -@A @B -module com.google.m { -requires com.google.r1; -requires transitive com.google.r2; -requires static com.google.r3; -exports com.google.e1; -exports com.google.e1 to com.google.e2; -exports com.google.e1 to com.google.e2, com.google.e3; -exports com.google.e1 to com.google.e2, com.google.e3, com.google.e4; -opens com.google.o1; -opens com.google.o1 to com.google.o2; -opens com.google.o1 to com.google.o2, com.google.o3; -opens com.google.o1 to com.google.o2, com.google.o3, com.googleoe4; -uses Foo; -uses com.google.Bar; -provides com.google.Baz with Foo; -provides com.google.Baz with Foo, com.google.Bar; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M2.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M2.input deleted file mode 100644 index c7d8b16b9..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M2.input +++ /dev/null @@ -1,2 +0,0 @@ -open module com.google.m { -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M2.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M2.output deleted file mode 100644 index dd22a0c66..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M2.output +++ /dev/null @@ -1 +0,0 @@ -open module com.google.m {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkdownDoc.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkdownDoc.input deleted file mode 100644 index 557fd468e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkdownDoc.input +++ /dev/null @@ -1,10 +0,0 @@ -/// A greeter. -/// -/// Says hello. See [String]. -class MarkdownDoc { - /// Returns the greeting. - /// @return the text - String greeting() { - return "hi"; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkdownDoc.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkdownDoc.output deleted file mode 100644 index 2b5d30db2..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkdownDoc.output +++ /dev/null @@ -1,10 +0,0 @@ -/// A greeter. -/// -/// Says hello. See [String]. -class MarkdownDoc { - /// Returns the greeting. - /// @return the text - String greeting() { - return "hi"; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkerAnnotation.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkerAnnotation.input deleted file mode 100644 index b8dd3e379..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkerAnnotation.input +++ /dev/null @@ -1,4 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** JavaDoc comment. */ -public @interface MarkerAnnotation {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkerAnnotation.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkerAnnotation.output deleted file mode 100644 index b8dd3e379..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkerAnnotation.output +++ /dev/null @@ -1,4 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** JavaDoc comment. */ -public @interface MarkerAnnotation {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Multivariables.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Multivariables.input deleted file mode 100644 index a5e0b4dfb..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Multivariables.input +++ /dev/null @@ -1,17 +0,0 @@ -class Multivariables { - int xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, - yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy, - zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; - - // Horizontal and veritcal paddings used for most cells in the standings table. - private final int hpad, vpad; - - { - { - for (c = cx.iterator(), m = mx.iterator(); - c.hasNext() && m.hasNext(); ) { - f(c, m); - } - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/N.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/N.input deleted file mode 100644 index 03591418d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/N.input +++ /dev/null @@ -1,13 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** Tests for NameQualifiedTypes, Names, NormalAnnotations, NullLiterals, and NumberLiterals. */ -class N { - @NormalAnnotation( - a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7, h = 8, i = 9, j = 10, k = 11, l = 12, m = 13, - n = 14, o = 15, p = 16, q = 17, r = 18, s = 19, t = 20, u = 21, v = 22, w = 23, x = 24, - y = 25, z = 26) - void f() { - assert 00 == 0 && 0x0 == 0 && 1.0e0f == 1.00e0f && 0.2D == .2D; - java.lang. /* @MarkerAnnotation */String s = null; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NON-NLS.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NON-NLS.output deleted file mode 100644 index 8792cfbb2..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NON-NLS.output +++ /dev/null @@ -1,14 +0,0 @@ -package test; - -class MultilineStringConstant { - - // NON-NLS comments are required for i18n, it's important they are kept with their strings. - private static final String MULTIPLE_LINE_NON_NLS = "field_0," //$NON-NLS-1$ - + "field_1," //$NON-NLS-1$ - + "field_2," //$NON-NLS-1$ - + "field_3," //$NON-NLS-1$ - + "field_4"; //$NON-NLS-1$ - - private static final String MULTIPLE_LINE_NO_COMMENT = - "field_0," + "field_1," + "field_2," + "field_3," + "field_4"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NormalAnnotation.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NormalAnnotation.input deleted file mode 100644 index 4a3a07e39..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NormalAnnotation.input +++ /dev/null @@ -1,56 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** JavaDoc comment. */ -public @interface NormalAnnotation { - int a(); - - int b(); - - int c(); - - int d(); - - int e(); - - int f(); - - int g(); - - int h(); - - int i(); - - int j(); - - int k(); - - int l(); - - int m(); - - int n(); - - int o(); - - int p(); - - int q(); - - int r(); - - int s(); - - int t(); - - int u(); - - int v(); - - int w(); - - int x(); - - int y(); - - int z(); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/P.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/P.input deleted file mode 100644 index 8cc377cce..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/P.input +++ /dev/null @@ -1,21 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** - * Tests for PackageDeclarations, ParameterizedTypes, ParenthesizedExpressions, PostfixExpressions, - * PrefixExpressions, and PrimitiveTypes. - */ -class P< - T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, - T22, T23, T24> { - void f() { - int x = (1 + 2) * 3; - ++x; - x++; - int j = + + +x; - int k = + + ++x; - int jj = - - -x; - int kk = - - --x; - boolean b = false; - boolean bb = !!b; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Pair.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Pair.input deleted file mode 100644 index a596748fd..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Pair.input +++ /dev/null @@ -1,12 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** JavaDoc comment. */ -public class Pair { - public final T1 x; - public final T2 y; - - Pair(T1 x, T2 y) { - this.x = x; - this.y = y; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Pair.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Pair.output deleted file mode 100644 index 670f76856..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Pair.output +++ /dev/null @@ -1,12 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** JavaDoc comment. */ -public class Pair { - public final T1 x; - public final T2 y; - - Pair(T1 x, T2 y) { - this.x = x; - this.y = y; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/PairedArguments.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/PairedArguments.input deleted file mode 100644 index 1a654d06f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/PairedArguments.input +++ /dev/null @@ -1,40 +0,0 @@ -class T { - { - f( - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); - f( - xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx); - f( - xxxxxxxxxxxxxxxxxxxxxxx(), xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); - f( - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); - f( - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); - f( - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); - f( - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, - xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Q.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Q.input deleted file mode 100644 index f46720166..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Q.input +++ /dev/null @@ -1,15 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** Tests for QualifiedNames and QualifiedTypes. */ -class Q { - static final int zero = 0; - - class T {} - - static void f() { - Q. /* @MarkerAnnotation */T t; - int zero = Q.zero; - java.lang. /* @MarkerAnnotation */String s = null; - Q.f(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/R.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/R.input deleted file mode 100644 index 053d46e72..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/R.input +++ /dev/null @@ -1,13 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** Tests for ReturnStatements. */ -class R { - void f() { - return; - } - - int f(int x) { - return x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x - + x + x + x + x + x + x + x + x + x; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/S.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/S.input deleted file mode 100644 index a1e07d1c8..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/S.input +++ /dev/null @@ -1,46 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** - * Tests for SimpleNames, SimpleTypes, SingleMemberAnnotations, SingleVariableDeclarations, - * Statements, StringLiterals, SuperConstructorInvocations, SuperFieldAccesses, - * SuperMethodInvocations, SuperMethodReferences, SwitchCases, SwitchStatements, and - * SynchronizedStatements. - */ -class S { - // TODO(jdd): Add tests for higher language levels. - - int x = 0; - - @SingleMemberAnnotation( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) - S() { - super(); - } - - class SS extends S { - SS() { - super(); - super.x = 0; - super.foo(); - } - } - - void foo() { - Object[] object = null; - synchronized ( - object[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]) { - switch ("abc") { - case "one": - break; - case "two": - break; - case "three": - default: - break; - } - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Sealed.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Sealed.input deleted file mode 100644 index f19165843..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Sealed.input +++ /dev/null @@ -1,6 +0,0 @@ -class T { - sealed interface I extends A permits C, B {} - final class C implements I {} - sealed private interface A permits I {} - non-sealed private interface B extends I {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Sealed.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Sealed.output deleted file mode 100644 index 0d5d0b377..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Sealed.output +++ /dev/null @@ -1,9 +0,0 @@ -class T { - sealed interface I extends A permits C, B {} - - final class C implements I {} - - private sealed interface A permits I {} - - private non-sealed interface B extends I {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SemicolonInClass.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SemicolonInClass.input deleted file mode 100644 index 52d3c1226..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SemicolonInClass.input +++ /dev/null @@ -1,3 +0,0 @@ -class SemicolonInClass { - ; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SemicolonInClass.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SemicolonInClass.output deleted file mode 100644 index e5a5ed860..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SemicolonInClass.output +++ /dev/null @@ -1,3 +0,0 @@ -class SemicolonInClass { - ; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SingleMemberAnnotation.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SingleMemberAnnotation.input deleted file mode 100644 index 66045d5c0..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SingleMemberAnnotation.input +++ /dev/null @@ -1,5 +0,0 @@ -package com.google.googlejavaformat.java.test; - -public @interface SingleMemberAnnotation { - int value(); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SingleMemberAnnotation.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SingleMemberAnnotation.output deleted file mode 100644 index 9b0dc5ab3..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SingleMemberAnnotation.output +++ /dev/null @@ -1,5 +0,0 @@ -package com.google.googlejavaformat.java.test; - -public @interface SingleMemberAnnotation { - int value(); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SuperQualifier.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SuperQualifier.input deleted file mode 100644 index 993a96dee..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SuperQualifier.input +++ /dev/null @@ -1,18 +0,0 @@ -class SuperQualifier { - String a() { - return this.toStringHelper() - .add("foo", foo_________________________________________) - .add("bar", bar_________________________________________); - } - - String b() { - return super.toStringHelper() - .add("foo", foo_________________________________________) - .add("bar", bar_________________________________________); - } - - { - this.aaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb( - ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchDouble.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchDouble.input deleted file mode 100644 index 54e22a768..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchDouble.input +++ /dev/null @@ -1,7 +0,0 @@ -class SwitchDouble { - void x(Object o) { - switch (o) { - case null, default: - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchDouble.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchDouble.output deleted file mode 100644 index ed3119002..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchDouble.output +++ /dev/null @@ -1,7 +0,0 @@ -class SwitchDouble { - void x(Object o) { - switch (o) { - case null, default: - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchGuardClause.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchGuardClause.input deleted file mode 100644 index 25df58096..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchGuardClause.input +++ /dev/null @@ -1,9 +0,0 @@ -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/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchRecord.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchRecord.input deleted file mode 100644 index 2f4fb35d9..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchRecord.input +++ /dev/null @@ -1,21 +0,0 @@ -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/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchUnderscore.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchUnderscore.input deleted file mode 100644 index 8d611d24a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchUnderscore.input +++ /dev/null @@ -1,8 +0,0 @@ -public class SwitchUnderscore { - void x(Object o) { - switch (o) { - case String _: - default: - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/T.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/T.input deleted file mode 100644 index c8cd29316..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/T.input +++ /dev/null @@ -1,19 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** - * Tests for ThisExpressions, ThrowStatements, TryStatements, TypeDeclarationStatements, - * TypeDeclarations, TypeLiterals, TypeMethodReferences, TypeParameters, and Types. - */ -class T { - // TODO(jdd): Add tests for higher language levels. - - T f(int x) throws Exception { - class TT {} - if (x == 0 || T.class == null) { - return this; - } - try (AutoCloseable y = null) { - throw new RuntimeException(); - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TabularMixedSignInitializer.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TabularMixedSignInitializer.input deleted file mode 100644 index 2715158b1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TabularMixedSignInitializer.input +++ /dev/null @@ -1,17 +0,0 @@ -public class T { - private static final double[] f = { - 95.0, 75.0, -95.0, 75.0, - -95.0, 75.0, +95.0, 75.0 - }; - - private static final int[] g = { - x++, y, ++z, - x, y, ~z, - --x, ++y, z-- - }; - - private static final bool[] h = { - a, b, c, d, - !e, a, b, c - }; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TryWithResources.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TryWithResources.input deleted file mode 100644 index 5d294f94a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TryWithResources.input +++ /dev/null @@ -1,21 +0,0 @@ -class TryWtihResources { - { - try (@A C c = c(); ) {} - try (final @A C c = c(); ) {} - try (@A final C c = c(); ) {} - try (@A final @B C c = c(); ) {} - - try (final BufferedWriter writer = - new BufferedWriter(new OutputStreamWriter(testFile, Charset.defaultCharset()))) { - writer.append("tom cruise\n").append("avatar\n"); - writer.flush(); - } - - try (@SuppressWarnings("resource") - Scanner inputScanner = new Scanner(inputStream).useDelimiter("\\s+|,")) { - while (inputScanner.hasNextLong()) { - placementIds.add(inputScanner.nextLong()); - } - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/U.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/U.input deleted file mode 100644 index 555cbf87e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/U.input +++ /dev/null @@ -1,47 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** Tests for UnionTypes. */ -class U { - void f() { - class Exception0 extends Exception {} - class Exception1 extends Exception {} - class Exception2 extends Exception {} - class Exception3 extends Exception {} - class Exception4 extends Exception {} - class Exception5 extends Exception {} - class Exception6 extends Exception {} - class Exception7 extends Exception {} - class Exception8 extends Exception {} - class Exception9 extends Exception {} - try { - char c = '\123'; - switch (c) { - case '0': - throw new Exception0(); - case '1': - throw new Exception1(); - case '2': - throw new Exception2(); - case '3': - throw new Exception3(); - case '4': - throw new Exception4(); - case '5': - throw new Exception5(); - case '6': - throw new Exception6(); - case '7': - throw new Exception7(); - case '8': - throw new Exception8(); - case '9': - default: - throw new Exception9(); - } - } catch ( - Exception0 | Exception1 | Exception2 | Exception3 | Exception4 | Exception5 | Exception6 - | Exception7 | Exception8 | Exception9 - e) { - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnaryMinus.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnaryMinus.input deleted file mode 100644 index a512fe917..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnaryMinus.input +++ /dev/null @@ -1,5 +0,0 @@ -class UnaryMinus { - { - int b = - 1; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnaryMinus.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnaryMinus.output deleted file mode 100644 index 9b45ab453..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnaryMinus.output +++ /dev/null @@ -1,5 +0,0 @@ -class UnaryMinus { - { - int b = -1; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted2.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted2.input deleted file mode 100644 index d968aeb4d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted2.input +++ /dev/null @@ -1,16 +0,0 @@ -package com . google . googlejavaformat ; - -/** -* Rewrite comments. This interface is implemented by -* {@link com.google.googlejavaformat.java.JavaCommentsHelper JavaCommentsHelper}. -*/ -public interface CommentsHelper { - /** - * Try to rewrite comments, returning rewritten text. - * @param text0 the literal comment text to rewrite - * @param maxWidth the line length for the output - * @param column0 the current column - * @return the rewritten comment - */ - String rewrite ( String text0 , int maxWidth , int column0 ) ; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted2.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted2.output deleted file mode 100644 index 6a50f60da..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted2.output +++ /dev/null @@ -1,16 +0,0 @@ -package com.google.googlejavaformat; - -/** - * Rewrite comments. This interface is implemented by - * {@link com.google.googlejavaformat.java.JavaCommentsHelper JavaCommentsHelper}. - */ -public interface CommentsHelper { - /** - * Try to rewrite comments, returning rewritten text. - * @param text0 the literal comment text to rewrite - * @param maxWidth the line length for the output - * @param column0 the current column - * @return the rewritten comment - */ - String rewrite(String text0, int maxWidth, int column0); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted3.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted3.input deleted file mode 100644 index a2649f0bd..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted3.input +++ /dev/null @@ -1,9 +0,0 @@ -package com . google . googlejavaformat ; - -class Unformatted3 { - /** - * This comment is not reflowed - * because it contains
    preformatted
    - * content. - */ -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted3.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted3.output deleted file mode 100644 index c262ee4f3..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted3.output +++ /dev/null @@ -1,9 +0,0 @@ -package com.google.googlejavaformat; - -class Unformatted3 { - /** - * This comment is not reflowed - * because it contains
    preformatted
    - * content. - */ -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unnamed.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unnamed.input deleted file mode 100644 index d3b284b23..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unnamed.input +++ /dev/null @@ -1,46 +0,0 @@ -class Unnamed { - { - int acc = 0; - for (Order _ : orders) { - if (acc < LIMIT) { - acc++; - } - } - - - - for (int i = 0, _ = sideEffect(); i < 10; i++) { } - - Queue 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/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnnamedPattern.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnnamedPattern.input deleted file mode 100644 index 79c12d94a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnnamedPattern.input +++ /dev/null @@ -1,34 +0,0 @@ -class UnnamedPattern { - sealed interface Shape permits Box {} - record Box(Object a, Object b) implements Shape {} - - record Pair(Box first, Object second) {} - - int classify(Shape s) { - return switch (s) { - case Box(Integer i, _) when i > 0 -> i; - case Box(Integer i, _) -> i; - case Box(_, _) -> 0; - }; - } - - int nested(Object o) { - return switch (o) { - case Pair(Box(var _, Integer i), _) -> i; - case Pair(Box(_, _), _) -> 0; - default -> -1; - }; - } - - boolean isBox(Object o) { - return o instanceof Box(Integer _, _); - } - - void swallow(Runnable r) { - try { - r.run(); - } catch (Exception _) { - // ignored - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/V.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/V.input deleted file mode 100644 index b3e9d1b34..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/V.input +++ /dev/null @@ -1,13 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** - * Tests for VariableDeclarationExpressions, VariableDeclarationFragments, and - * VariableDeclarationStatements. - */ -class V { - int x = 0, y = 1; - - void f() { - for (int a = 0, b = 1; a < b;) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/V.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/V.output deleted file mode 100644 index 1abe418a1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/V.output +++ /dev/null @@ -1,13 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** - * Tests for VariableDeclarationExpressions, VariableDeclarationFragments, and - * VariableDeclarationStatements. - */ -class V { - int x = 0, y = 1; - - void f() { - for (int a = 0, b = 1; a < b; ) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/W.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/W.input deleted file mode 100644 index 53f50d4a3..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/W.input +++ /dev/null @@ -1,9 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** Tests for WhileStatements and WildcardTypes. */ -class W { - T f() { - while (true == true == true == true == true == true == true == true == true == true == true - == true == true) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/W.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/W.output deleted file mode 100644 index 5c42ff985..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/W.output +++ /dev/null @@ -1,8 +0,0 @@ -package com.google.googlejavaformat.java.test; - -/** Tests for WhileStatements and WildcardTypes. */ -class W { - T f() { - while (true == true == true == true == true == true == true == true == true == true == true == true == true) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/WildBound.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/WildBound.input deleted file mode 100644 index fa6138673..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/WildBound.input +++ /dev/null @@ -1,5 +0,0 @@ -class WildBound { - T f() { - return (T) X.class.newInstance((F) f, t); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/WildBound.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/WildBound.output deleted file mode 100644 index 16c866a39..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/WildBound.output +++ /dev/null @@ -1,5 +0,0 @@ -class WildBound { - T f() { - return (T) X.class.newInstance((F) f, t); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/b26306390.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/b26306390.input deleted file mode 100644 index da6c01b01..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/b26306390.input +++ /dev/null @@ -1,3 +0,0 @@ -class B26306390 { - int resourceId = com.some.extremely.verbose.pkg.name.R.string.some_extremely_long_resource_identifier_that_exceeds_the_column_limit; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/b26306390.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/b26306390.output deleted file mode 100644 index be9f7c82b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/b26306390.output +++ /dev/null @@ -1,4 +0,0 @@ -class B26306390 { - int resourceId = com.some.extremely.verbose.pkg.name.R.string - .some_extremely_long_resource_identifier_that_exceeds_the_column_limit; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i100.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i100.input deleted file mode 100644 index b7c88f8b5..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i100.input +++ /dev/null @@ -1,7 +0,0 @@ -public class I100 { - void f() { - Object o; - o = new String @A [] {"foo", "bar"}; - o = new String @A @B [] @C [] {"foo", "bar"}; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i100.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i100.output deleted file mode 100644 index fd5e6da6a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i100.output +++ /dev/null @@ -1,7 +0,0 @@ -public class I100 { - void f() { - Object o; - o = new String @A [] {"foo", "bar"}; - o = new String @A @B [] @C [] {"foo", "bar"}; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i101.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i101.input deleted file mode 100644 index 97c321ec1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i101.input +++ /dev/null @@ -1 +0,0 @@ -public @interface kHz {} // No prefix defined in the annotation itself diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i101.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i101.output deleted file mode 100644 index 97c321ec1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i101.output +++ /dev/null @@ -1 +0,0 @@ -public @interface kHz {} // No prefix defined in the annotation itself diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i155.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i155.input deleted file mode 100644 index 1a525de39..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i155.input +++ /dev/null @@ -1,5 +0,0 @@ -class I155 { - void walkAndClose(Stream stream) { - try (stream) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i155.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i155.output deleted file mode 100644 index 1754f0ef4..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i155.output +++ /dev/null @@ -1,5 +0,0 @@ -class I155 { - void walkAndClose(Stream stream) { - try (stream) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i176.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i176.input deleted file mode 100644 index 78aabff6d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i176.input +++ /dev/null @@ -1,6 +0,0 @@ -interface -InterfaceWithPrivateStaticMethod -{ - private static void bar() { } - default void foo() { bar(); } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i176.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i176.output deleted file mode 100644 index 558611afb..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i176.output +++ /dev/null @@ -1,7 +0,0 @@ -interface InterfaceWithPrivateStaticMethod { - private static void bar() {} - - default void foo() { - bar(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i221.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i221.input deleted file mode 100644 index 6320a38ec..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i221.input +++ /dev/null @@ -1,8 +0,0 @@ -class I221 { - { - logger.log( - Level.WARNING, - "Unable to obtain jst.web facet version from selected project", //$NON-NLS-1$ - ex); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i281.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i281.input deleted file mode 100644 index 0b42d0874..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i281.input +++ /dev/null @@ -1,8 +0,0 @@ -public enum Empty {} -public enum Empty {;} -public enum Empty {;;;} -public enum Empty {; // comment -;;} -public enum Empty {; -;; // comment -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i282.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i282.input deleted file mode 100644 index a8bf796c2..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i282.input +++ /dev/null @@ -1,11 +0,0 @@ -public class ArrayVsVarargs { - - void f(String[] arg) {} - void g(String... arg) {} - void h(String @A [] arg) {} - void i(String @B... arg) {} - void j(String @C [] @D [] arg) {} - void k(String @E [] @F... arg) {} - - Class c = byte[].class; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i282.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i282.output deleted file mode 100644 index 22755aaa7..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i282.output +++ /dev/null @@ -1,16 +0,0 @@ -public class ArrayVsVarargs { - - void f(String[] arg) {} - - void g(String... arg) {} - - void h(String @A [] arg) {} - - void i(String @B ... arg) {} - - void j(String @C [] @D [] arg) {} - - void k(String @E [] @F ... arg) {} - - Class c = byte[].class; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i55.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i55.input deleted file mode 100644 index 425f8ebfb..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i55.input +++ /dev/null @@ -1,13 +0,0 @@ -import java.lang.annotation.*; - -@Target(ElementType.TYPE_USE) -@interface Interned {} - -public class GjfTypeAnnotationOnArrayTest { - - public static void test() { - String @Interned [] iarray1 = new String @Interned [2]; - } - -} - diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i55.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i55.output deleted file mode 100644 index b298dbbc7..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i55.output +++ /dev/null @@ -1,11 +0,0 @@ -import java.lang.annotation.*; - -@Target(ElementType.TYPE_USE) -@interface Interned {} - -public class GjfTypeAnnotationOnArrayTest { - - public static void test() { - String @Interned [] iarray1 = new String @Interned [2]; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i59.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i59.input deleted file mode 100644 index 937f40ff2..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i59.input +++ /dev/null @@ -1,10 +0,0 @@ -import org.checkerframework.checker.tainting.qual.*; -class Outer { - class Nested { - class InnerMost { - @A Outer context(@B Outer.@C Nested.@D InnerMost this) { - return Outer.this; - } - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i60.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i60.input deleted file mode 100644 index 8b0a378b8..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i60.input +++ /dev/null @@ -1,9 +0,0 @@ -import org.checkerframework.checker.nullness.qual.*; - -public class FullyQualified { - - public void format1(java.lang.String a1, java.lang. @Nullable Object... a2) { - // body - } - -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i60.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i60.output deleted file mode 100644 index 2cb269518..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i60.output +++ /dev/null @@ -1,8 +0,0 @@ -import org.checkerframework.checker.nullness.qual.*; - -public class FullyQualified { - - public void format1(java.lang.String a1, java.lang.@Nullable Object... a2) { - // body - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i65.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i65.input deleted file mode 100644 index d4a459313..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i65.input +++ /dev/null @@ -1,5 +0,0 @@ -import org.checkerframework.checker.nullness.qual.*; - -class UnannoPrimitives { - Object ar = new @Nullable byte[] {4}; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i65.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i65.output deleted file mode 100644 index ead2c3d78..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i65.output +++ /dev/null @@ -1,5 +0,0 @@ -import org.checkerframework.checker.nullness.qual.*; - -class UnannoPrimitives { - Object ar = new @Nullable byte[] {4}; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i66.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i66.input deleted file mode 100644 index 54e3cce8f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i66.input +++ /dev/null @@ -1,7 +0,0 @@ -public class AnnotatedCast { - - public static @Sibling1 int convertSibling2ToSibling1(@Sibling2 int a) { - return (@Sibling1 int) 1; - } - -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i66.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i66.output deleted file mode 100644 index a8d7eabdc..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i66.output +++ /dev/null @@ -1,6 +0,0 @@ -public class AnnotatedCast { - - public static @Sibling1 int convertSibling2ToSibling1(@Sibling2 int a) { - return (@Sibling1 int) 1; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i71.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i71.output deleted file mode 100644 index 5abb5f693..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i71.output +++ /dev/null @@ -1,6 +0,0 @@ -import java.util.Arrays; - -class Test { - Wrapper w = new Wrapper(Arrays.asList("a", "b", "c", "d", "e"), 2); - Wrapper w = new Wrapper(Arrays.asList("a", "b", "c", "d", "e")); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i95.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i95.input deleted file mode 100644 index 624664e48..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i95.input +++ /dev/null @@ -1,3 +0,0 @@ -class I95 { - public void format2(Object @Nullable ... a2) {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i95.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i95.output deleted file mode 100644 index 182e128ad..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i95.output +++ /dev/null @@ -1,3 +0,0 @@ -class I95 { - public void format2(Object @Nullable ... a2) {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i98.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i98.input deleted file mode 100644 index abc1698a2..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i98.input +++ /dev/null @@ -1,8 +0,0 @@ -public class AnonInnerDefaults { - - public void tryStuff(final UIElement e) { - PolyIface p = - new @UI PolyIface() { - }; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i98.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i98.output deleted file mode 100644 index e793d9daf..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i98.output +++ /dev/null @@ -1,6 +0,0 @@ -public class AnonInnerDefaults { - - public void tryStuff(final UIElement e) { - PolyIface p = new @UI PolyIface() {}; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-101-annotated-lambda-parameters.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-101-annotated-lambda-parameters.input deleted file mode 100644 index e4c539989..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-101-annotated-lambda-parameters.input +++ /dev/null @@ -1,29 +0,0 @@ -import java.util.function.BiFunction; -import java.util.function.Consumer; -import java.util.function.Function; - -class AnnotatedLambdaParameters { - BiFunction withArgs = - (final var x, - @SuppressWarnings("unused") - var y) -> x + y; - - Function typed = ( @SuppressWarnings( "unused" ) String s )->s.length(); - - BiFunction two = (@Deprecated @SuppressWarnings("unused") - var x, var y) -> x + y; - - BiFunction marker = (@Deprecated var x, - @Deprecated final var y) -> x + y; - - Consumer block = (@SuppressWarnings({"unused", "rawtypes"}) - String s) -> { System.out.println(s); }; - - BiFunction tooLongForOneLine = (@SuppressWarnings("unused") Integer first, @SuppressWarnings("unused") Integer second) -> first + second; - - BiFunction parametersDoNotFitOnOneLine = (@SuppressWarnings("unused") Integer firstParameterWithAVeryLongName, @SuppressWarnings("unused") Integer secondParameterWithAVeryLongName) -> firstParameterWithAVeryLongName + secondParameterWithAVeryLongName; - - void method(@SuppressWarnings("unused") int y, @Deprecated int z) { - @SuppressWarnings("unchecked") Function local = o -> (String) o; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-101-annotated-lambda-parameters.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-101-annotated-lambda-parameters.output deleted file mode 100644 index 41a8338d1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-101-annotated-lambda-parameters.output +++ /dev/null @@ -1,30 +0,0 @@ -import java.util.function.BiFunction; -import java.util.function.Consumer; -import java.util.function.Function; - -class AnnotatedLambdaParameters { - BiFunction withArgs = (final var x, @SuppressWarnings("unused") var y) -> x + y; - - Function typed = (@SuppressWarnings("unused") String s) -> s.length(); - - BiFunction two = (@Deprecated @SuppressWarnings("unused") var x, var y) -> x + y; - - BiFunction marker = (@Deprecated var x, @Deprecated final var y) -> x + y; - - Consumer block = (@SuppressWarnings({"unused", "rawtypes"}) String s) -> { - System.out.println(s); - }; - - BiFunction tooLongForOneLine = - (@SuppressWarnings("unused") Integer first, @SuppressWarnings("unused") Integer second) -> first + second; - - BiFunction parametersDoNotFitOnOneLine = - (@SuppressWarnings("unused") Integer firstParameterWithAVeryLongName, - @SuppressWarnings("unused") Integer secondParameterWithAVeryLongName) -> - firstParameterWithAVeryLongName + secondParameterWithAVeryLongName; - - void method(@SuppressWarnings("unused") int y, @Deprecated int z) { - @SuppressWarnings("unchecked") - Function local = o -> (String) o; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-non-nls-trailing-marker.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-non-nls-trailing-marker.input deleted file mode 100644 index 19ef37cda..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-non-nls-trailing-marker.input +++ /dev/null @@ -1,20 +0,0 @@ -class NonNlsTrailingMarker { - private static final String FIELD = "field"; //$NON-NLS-1$ - - String markers() { - String a = "x"; //$NON-NLS-1$ - String two = "x" + "y"; //$NON-NLS-1$ //$NON-NLS-2$ - log( "message" ); //$NON-NLS-1$ - return a; //noinspection ReturnOfNull - } - - void ownLine() { - //$NON-NLS-1$ - String b = "x"; - } - - void otherComments() { - String c = "x"; //foo - String d = "x"; // bar - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-reflowed-literal.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-reflowed-literal.input deleted file mode 100644 index 15c3eb9ce..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-reflowed-literal.input +++ /dev/null @@ -1,9 +0,0 @@ -class ReflowedLiteral { - void markers() { - String reflowed = "a single string literal that is far too long to fit into one hundred and twenty columns, so the formatter reflows it"; //$NON-NLS-1$ - String unmarked = "a single string literal that is far too long to fit into one hundred and twenty columns, so the formatter reflows it"; - log( "short", "a string literal as the second argument that is far too long to fit into one hundred and twenty columns", "after" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - log(KEY, "a string literal as the second argument that is far too long to fit into one hundred and twenty columns, so it reflows", VALUE); //$NON-NLS-1$ - String chain = "a string literal that is far too long to fit into one hundred and twenty columns, so it reflows" + "with another literal"; //$NON-NLS-1$ //$NON-NLS-2$ - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-wrapped-arguments.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-wrapped-arguments.input deleted file mode 100644 index e13bb3e71..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-wrapped-arguments.input +++ /dev/null @@ -1,11 +0,0 @@ -class WrappedArguments { - void markers() { - String message = Messages.format("first argument that is long enough to matter", "second argument that is also rather long", "third one"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - String second = Messages.format( "first argument that is long enough to matter", "second argument that is also rather long", "third one" ); //$NON-NLS-2$ - String twoOnALine = Messages.format("first argument that is long enough to matter", "a" + "b", "third argument that is also rather long"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - String keyAndValue = Messages.format(KEY, "an argument that is long enough to matter", "second argument that is also rather long", VALUE); //$NON-NLS-1$ //$NON-NLS-2$ - String chained = builder.append("first argument that is long enough to matter").append("second argument that is also rather long").toString(); //$NON-NLS-1$ //$NON-NLS-2$ - String noSuchLiteral = Messages.format("first argument that is long enough to matter", "second argument that is also rather long", "third one"); //$NON-NLS-1$ //$NON-NLS-5$ - String fitsOnTheNextLine = Messages.format("first argument", "second one", "third"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-compact-source.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-compact-source.input deleted file mode 100644 index 9a229712d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-compact-source.input +++ /dev/null @@ -1,9 +0,0 @@ -//usr/bin/env jbang "$0" "$@" ; exit $? -//JAVA 25+ -//PREVIEW -//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 - -void main() { IO.println(greeting()); -} -//DEPS org.example:after-main:1.0 -String greeting() { return "Hello"; } diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-compact-source.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-compact-source.output deleted file mode 100644 index 0e66a7385..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-compact-source.output +++ /dev/null @@ -1,12 +0,0 @@ -//usr/bin/env jbang "$0" "$@" ; exit $? -//JAVA 25+ -//PREVIEW -//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 - -void main() { - IO.println(greeting()); -} -// DEPS org.example:after-main:1.0 -String greeting() { - return "Hello"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-package.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-package.input deleted file mode 100644 index 59337e999..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-package.input +++ /dev/null @@ -1,20 +0,0 @@ -///usr/bin/env bash -c 'command -v jbang >/dev/null 2>&1 || { echo "Bootstrapping JBang..." >&2; curl -Ls https://sh.jbang.dev | bash -s - app setup --quiet ; export PATH="$HOME/.jbang/bin:$PATH"; }; exec jbang "$0" "$@"' "$0" "$@"; exit $? -/* - * Licensed under the Apache License, Version 2.0. - */ -//DESCRIPTION Starts a Quarkus REST service that greets whoever calls it, with the startup banner switched off for scripts -//CDS -//DEPS io.quarkus:quarkus-bom:${quarkus.version:3.15.1}@pom -//DEPS io.quarkus:quarkus-rest // the JAX-RS endpoints -//Q:CONFIG quarkus.banner.enabled=false -package org.example; -//SOURCES model/Greeting.java - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; - -@Path("/hello") -public class GreetingResource { - @GET public String hello() { - return "Hello"; } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-package.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-package.output deleted file mode 100644 index ff8b80da4..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-package.output +++ /dev/null @@ -1,22 +0,0 @@ -///usr/bin/env bash -c 'command -v jbang >/dev/null 2>&1 || { echo "Bootstrapping JBang..." >&2; curl -Ls https://sh.jbang.dev | bash -s - app setup --quiet ; export PATH="$HOME/.jbang/bin:$PATH"; }; exec jbang "$0" "$@"' "$0" "$@"; exit $? -/* - * Licensed under the Apache License, Version 2.0. - */ -//DESCRIPTION Starts a Quarkus REST service that greets whoever calls it, with the startup banner switched off for scripts -//CDS -//DEPS io.quarkus:quarkus-bom:${quarkus.version:3.15.1}@pom -//DEPS io.quarkus:quarkus-rest // the JAX-RS endpoints -//Q:CONFIG quarkus.banner.enabled=false -package org.example; -// SOURCES model/Greeting.java - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; - -@Path("/hello") -public class GreetingResource { - @GET - public String hello() { - return "Hello"; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-argument.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-argument.output deleted file mode 100644 index f3be4f87c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-argument.output +++ /dev/null @@ -1,9 +0,0 @@ -class T { - void f() { - LOGGER.warning(String.format(""" - @Gauge is configured on a bean %s that is neither ApplicationScoped nor \ - Singleton. This is most likely a bug. You may set 'metrics.warn-dependent' \ - configuration option to 'false' to remove this warning.\ - """, clazz.getName())); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-ternary.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-ternary.input deleted file mode 100644 index 323fb518c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-ternary.input +++ /dev/null @@ -1,11 +0,0 @@ -class TernaryBug { - boolean flag = true; - - String a = flag - ? """ - yes - """ - : """ - no - """; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-ternary.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-ternary.output deleted file mode 100644 index 967170e72..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-ternary.output +++ /dev/null @@ -1,9 +0,0 @@ -class TernaryBug { - boolean flag = true; - - String a = flag ? """ - yes - """ : """ - no - """; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-36-multiline-comments-on-one-line.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-36-multiline-comments-on-one-line.input deleted file mode 100644 index d10f4fd61..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-36-multiline-comments-on-one-line.input +++ /dev/null @@ -1,14 +0,0 @@ -/* -class X { - *//** javadoc *//* - public void foo(Bar bar) {} - - *//** javadoc *//* - public void foo(Bar bar) {} - - *//** javadoc *//* - public void foo(Bar bar) {} - - *//** javadoc *//* - public void foo(Bar bar) {} -}*/ diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-38-nbsp-line-comment.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-38-nbsp-line-comment.input deleted file mode 100644 index 82fe33b19..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-38-nbsp-line-comment.input +++ /dev/null @@ -1,7 +0,0 @@ -class NbspLineComment { - // Batches are capped: the importer rejects any upstream export file whose total row count is at or above 1 000 000 000 rows, so split larger files first. - int rows; - - //String testString = " thisisnotaHYPERLINKandsoitshouldntbetruncatedinsteaditshouldbedroppedthisisnotaHYPERLINKandsoit \"http://www.example.com/\"" - String url; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-60-cast-type-in-inline-chain.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-60-cast-type-in-inline-chain.input deleted file mode 100644 index ef55c2ccc..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-60-cast-type-in-inline-chain.input +++ /dev/null @@ -1,36 +0,0 @@ -class TCPTransport { - @SuppressWarnings("removal") - static final Log tcpLog = Log.getLog( - "sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged((PrivilegedAction< - String>) - () -> System.getProperty("sun.rmi.transport.tcp.logLevel")))); - - static final Level level = LogStream.parseLevel(AccessController.doPrivileged((PrivilegedAction)()->System.getProperty("sun.rmi.transport.tcp.logLevel.and.some.more"))); - - static final Log methodReference = Log.getLog("sun.rmi.transport.tcp", - "tcp", - LogStream.parseLevel( - AccessController.doPrivileged( - ( PrivilegedAction ) - SomeVeryLongClassNameToFillTheLine - :: getTheTcpLogLevelProperty))); - - static final Log twoTypeArguments = - Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged((Function< String ,Integer >) s-> - System.getProperty("sun.rmi.transport.tcp.logLevel.x")))); - - static final Log nested = Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged((Map>) () -> System.getProperty("sun.rmi.transport.tcp.lv")))); - - static final Log qualified = Log.getLog("sun.rmi.transport.tcp", "tcp", - LogStream.parseLevel(AccessController.doPrivileged((java.util.function. - Function) s -> System.getProperty("sun.rmi.logLevel")))); - - static final Log intersection = Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel( - AccessController.doPrivileged((Runnable - &java.io.Serializable) () -> System.getProperty("sun.rmi.transport.tcp.logLevelxx")))); - - static final Log annotated = Log.getLog("sun.rmi.transport.tcp", "tcp", - LogStream.parseLevel(AccessController.doPrivileged((Function<@Nullable String, Integer [ ]>) - s -> System.getProperty("sun.rmi.transport.tcp.lvl")))); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-62-comment-before-lambda-close-parens.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-62-comment-before-lambda-close-parens.input deleted file mode 100644 index 750e34a5f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-62-comment-before-lambda-close-parens.input +++ /dev/null @@ -1,24 +0,0 @@ -import java.util.stream.IntStream; - -class Repro { - int find(Item[] items) { - return IntStream.range(0, items.length) - .filter(i -> (items[i].getName().equals("alpha") || items[i].getName().equals("beta") - || items[i].getName().equals("gamma") - // || (items[i].getName().equals("delta") && items.length > i - // && items[i + 1].getName().equals("epsilon")) - )).findFirst().orElse(-1); - } - - void plainCall() { - check(i -> (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(i) || bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(i) - // || c(i) - )); - } - - void blockComment() { - check(i -> (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(i) || bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(i) - /* block */ - )); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-long-generic-field-type.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-long-generic-field-type.input deleted file mode 100644 index 6a0ada6ad..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-long-generic-field-type.input +++ /dev/null @@ -1,7 +0,0 @@ -class LongGenericFieldType { - private final AtomicReference> gridViewConfigurations = new AtomicReference<>(ImmutableTable.of()); - - private final AtomicReference> gridViewConfigurationsWithDefault = new AtomicReference<>(ImmutableTable.of()); - - private final AtomicReference> gridViewConfigurationsWithLongNames = new AtomicReference<>(ImmutableTable.of()); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-semicolon-only-body.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-semicolon-only-body.input deleted file mode 100644 index 5be48bd82..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-semicolon-only-body.input +++ /dev/null @@ -1,13 +0,0 @@ -interface B { ; } -enum C { X; ; } -record R(int a) { ; } -class E { ;; } -class F { Object o = new Object() { ; }; } -class G { // comment - ; -} -@interface H { ; } -class I { - ; - int x; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-1.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-1.input deleted file mode 100644 index af96cda4b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-1.input +++ /dev/null @@ -1,8 +0,0 @@ -class Palantir1 { - void foo() { - for (Double d : Lists.newArrayList(5.0, 10.0, 1.0, 0.0)) { - list.add(new BinaryNumericConstantColumnInfoV1( - operation, SparkIntegrationTestRuleSets.column("x"), d, Optional.empty())); - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-1.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-1.output deleted file mode 100644 index af96cda4b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-1.output +++ /dev/null @@ -1,8 +0,0 @@ -class Palantir1 { - void foo() { - for (Double d : Lists.newArrayList(5.0, 10.0, 1.0, 0.0)) { - list.add(new BinaryNumericConstantColumnInfoV1( - operation, SparkIntegrationTestRuleSets.column("x"), d, Optional.empty())); - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-10.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-10.output deleted file mode 100644 index cea14b0a8..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-10.output +++ /dev/null @@ -1,23 +0,0 @@ -class Palantir10 { - // We preserve input newlines for this long string concatenation (more than 2 lines) - @SqlUpdate("CREATE TABLE things " - + "(id VARCHAR(" + MAX_LENGTH + ") NOT NULL, " - + "title VARCHAR(" + MAX_LENGTH + ") NOT NULL, " - + "description VARCHAR(" + MAX_DESCRIPTION_LENGTH + ") NOT NULL, " - + "standard BOOLEAN NOT NULL, " - + "documentJson VARCHAR(" + MAX_DOCUMENT_LENGTH + ") NOT NULL, " - + "PRIMARY KEY (id))") - void createTable(); - - void foo() { - // Test that we still reflow short string concatenations (spanning exactly 2 lines) - foo("foo" + "bar" + THING + "baz"); - foo("foo" + "bar" + THING + "baz"); - - // This causes an NPE if we're not careful when getting the last token of the binary expression - if (!partialDataSourceType.equals(dataSourceType)) { - throw new ClientException("You may not use a " + partialDataSourceType + " partial in a " + dataSourceType - + " query. Caused by partial \"" + partialName + "\""); - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-11.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-11.output deleted file mode 100644 index 5f262d92f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-11.output +++ /dev/null @@ -1,12 +0,0 @@ -public class Palantir11 { - private void foo() { - boolean answer = strategy.accept(Strategies.visitor( - greaterThan -> true, // we don't need to validate greaterThan because it'll roll up to a good version - exact -> !coordinates.contains(MavenCoordinate.of(productId, exact.getVersion())), - remove -> true, - stay -> true, - stayWithExceptions -> !coordinates.contains(MavenCoordinate.of( - productId, - stayWithExceptions.getDeploymentsExceptionVersion().getVersion())))); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-12.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-12.output deleted file mode 100644 index faf9e251a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-12.output +++ /dev/null @@ -1,21 +0,0 @@ -public class Palantir12 { - - @Override - public void foo() { - new DogWalker().walk(DogBreed.FOX_TERRIER, new RoadWalker() { - @Override - public Void call(Dog dog) { - routes.forEach((route) -> route.getCoordinates().forEach((coordinate) -> { - coordinate.getOtherDogs().forEach(otherDog -> { - if (!dog.likes(otherDog)) { - badEncounters - .computeIfAbsent(coordinate, _x -> new HashSet<>()) - .add(dog) - .add(otherDog); - } - }); - })); - } - }); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-2.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-2.input deleted file mode 100644 index ea095543c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-2.input +++ /dev/null @@ -1,14 +0,0 @@ -class Palantir2 { - void foo() { - operations.put(FunctionDefinition.LOREM_IPSUM_DOLOR_, (func, helper) -> new Column(new GetArrayItem( - helper.accessColumnFuncti(func.arguments().get(0)).expr(), - helper.accessColumnFuncti( - // Subtract 1 from the provided index to move from 1-indexed to 0-indexed. - FooBarClassName1.of( - func.arguments().get(1), - FooBarClassName1.BinaryOperation.SUBTRACT, - IntegerLiteral.of(1))) - .expr()))); - } -} - diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-3.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-3.input deleted file mode 100644 index 759a8ea7a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-3.input +++ /dev/null @@ -1,17 +0,0 @@ -class Palantir3 { - void foo() { - operations.put(FunctionDefinition.ARRAY_REGEX_REPLACE, (func, helper) -> { - return new Column(new ArrayTransform( - helper.expressionAsColumn(func.arguments().get(0)).expr(), new LambdaFunction( - new RegExpReplace( - var, - helper.expressionAsColumn(func.arguments().get(1)) - .expr(), - helper.expressionAsColumn(func.arguments().get(2)) - .expr()), - JavaConversions.asScalaBuffer(Arrays.asList(var)), - false))); - }); - } -} - diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-3.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-3.output deleted file mode 100644 index 018ce491d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-3.output +++ /dev/null @@ -1,17 +0,0 @@ -class Palantir3 { - void foo() { - operations.put(FunctionDefinition.ARRAY_REGEX_REPLACE, (func, helper) -> { - return new Column(new ArrayTransform( - helper.expressionAsColumn(func.arguments().get(0)).expr(), - new LambdaFunction( - new RegExpReplace( - var, - helper.expressionAsColumn(func.arguments().get(1)) - .expr(), - helper.expressionAsColumn(func.arguments().get(2)) - .expr()), - JavaConversions.asScalaBuffer(Arrays.asList(var)), - false))); - }); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-4.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-4.input deleted file mode 100644 index d759b2fee..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-4.input +++ /dev/null @@ -1,9 +0,0 @@ -class Palantir4 { - void foo() { - if (useAddedColumnsSetDesription) { - resultSet = spark.sparkSetCreator().resolve(initialSetResolver, new LoremIpsumLongClassNameWithDescription( - initialSet, list, Optional.empty())); - } - } -} - diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-5.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-5.input deleted file mode 100644 index e746b9b92..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-5.input +++ /dev/null @@ -1,14 +0,0 @@ -class Palantir5 { - void foo() { - ConfigurationBuilder configuration = new ConfigurationBuilder() - .addUrls(apiUrls) - .filterInputsBy(name -> name != null && !name.contains("Immutable")); - } - - void bar() { - TopologicallySortedList sortedNodes = TopologicallySortedList.create( - parentIdByNodeId.keySet(), - nodeId -> StreamEx.of(parentIdByNodeId.get(nodeId)).toSet()); - } -} - diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-5.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-5.output deleted file mode 100644 index 8e0d1f043..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-5.output +++ /dev/null @@ -1,13 +0,0 @@ -class Palantir5 { - void foo() { - ConfigurationBuilder configuration = new ConfigurationBuilder() - .addUrls(apiUrls) - .filterInputsBy(name -> name != null && !name.contains("Immutable")); - } - - void bar() { - TopologicallySortedList sortedNodes = TopologicallySortedList.create( - parentIdByNodeId.keySet(), - nodeId -> StreamEx.of(parentIdByNodeId.get(nodeId)).toSet()); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-6.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-6.input deleted file mode 100644 index 15761beee..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-6.input +++ /dev/null @@ -1,8 +0,0 @@ -class Palantir6 { - void foo() { - Optional> maybeCached = OptionalUtils.orElseGetOptional( - Optional.ofNullable(localRowsCache.getIfPresent(setDescription)), - () -> Optional.ofNullable(datasetCache.getIfPresent(setDescription))); - } -} - diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-6.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-6.output deleted file mode 100644 index 8b648b345..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-6.output +++ /dev/null @@ -1,7 +0,0 @@ -class Palantir6 { - void foo() { - Optional> maybeCached = OptionalUtils.orElseGetOptional( - Optional.ofNullable(localRowsCache.getIfPresent(setDescription)), - () -> Optional.ofNullable(datasetCache.getIfPresent(setDescription))); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-7.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-7.input deleted file mode 100644 index 404f55fd7..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-7.input +++ /dev/null @@ -1,10 +0,0 @@ -class Palantir7 { - void foo() { - when(graphService.getPathFromRootToNode(any(GraphId.class), any(NodeId.class))) - .thenAnswer(invocation -> invocation.getArguments().length == 2 - && invocation.getArguments()[1] != null - ? ImmutableList.of(invocation.getArgument(1)) - : ImmutableList.of(NodeId.create())); - } -} - diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-7.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-7.output deleted file mode 100644 index f5990bae8..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-7.output +++ /dev/null @@ -1,9 +0,0 @@ -class Palantir7 { - void foo() { - when(graphService.getPathFromRootToNode(any(GraphId.class), any(NodeId.class))) - .thenAnswer(invocation -> - invocation.getArguments().length == 2 && invocation.getArguments()[1] != null - ? ImmutableList.of(invocation.getArgument(1)) - : ImmutableList.of(NodeId.create())); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-8.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-8.input deleted file mode 100644 index 74ad3af94..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-8.input +++ /dev/null @@ -1,9 +0,0 @@ -class Palantir8 { - void foo() { - assertThatServiceExceptionThrownBy( - new Aggregation.Builder() - .max(max) - .aggregations(ImmutableMap.of("bountiful", bountifulAggregation))::build) - .hasType(MY_ERROR_TYPE); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-8.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-8.output deleted file mode 100644 index 5bf54eafd..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-8.output +++ /dev/null @@ -1,8 +0,0 @@ -class Palantir8 { - void foo() { - assertThatServiceExceptionThrownBy(new Aggregation.Builder() - .max(max) - .aggregations(ImmutableMap.of("bountiful", bountifulAggregation))::build) - .hasType(MY_ERROR_TYPE); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg-no-chain.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg-no-chain.output deleted file mode 100644 index d52d94edf..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg-no-chain.output +++ /dev/null @@ -1,8 +0,0 @@ -class PalantirLambdaBreakChain { - void foo() { - return hello.read(txn -> { - doSomeWork(); - doSomeMoreWork(); - }); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg.input deleted file mode 100644 index d4df67643..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg.input +++ /dev/null @@ -1,11 +0,0 @@ -class PalantirLambdaBreakChain { - void foo() { - return hello.read(txn -> { - doSomeWork(); - doSomeMoreWork(); - }) - .chainedCall(() -> { - doSomeWork(); - }); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg.output deleted file mode 100644 index d4df67643..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg.output +++ /dev/null @@ -1,11 +0,0 @@ -class PalantirLambdaBreakChain { - void foo() { - return hello.read(txn -> { - doSomeWork(); - doSomeMoreWork(); - }) - .chainedCall(() -> { - doSomeWork(); - }); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-expr.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-expr.output deleted file mode 100644 index 6ab2c9937..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-expr.output +++ /dev/null @@ -1,5 +0,0 @@ -class PalantirLambdaBreakChain { - void foo() { - return hello.read(txn -> doSomeWork()).doMoreWork(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-case-statements-block.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-case-statements-block.input deleted file mode 100644 index dfc745530..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-case-statements-block.input +++ /dev/null @@ -1,26 +0,0 @@ -public class PalantirCaseStatementsBlock { - private void foo() { - switch (true) { - case false: - { - String foo = "bar"; - return 5; - } - { - // second block should cause first one not to inline - } - case true: - { - String foo = "bar"; - return 5; - } - default: - { - { - String foo = "bar"; - } - return 5; - } - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-case-statements-block.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-case-statements-block.output deleted file mode 100644 index 4e9b97daf..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-case-statements-block.output +++ /dev/null @@ -1,24 +0,0 @@ -public class PalantirCaseStatementsBlock { - private void foo() { - switch (true) { - case false: - { - String foo = "bar"; - return 5; - } - { - // second block should cause first one not to inline - } - case true: { - String foo = "bar"; - return 5; - } - default: { - { - String foo = "bar"; - } - return 5; - } - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chain-next-line.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chain-next-line.input deleted file mode 100644 index 3c7dc637a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chain-next-line.input +++ /dev/null @@ -1,7 +0,0 @@ -class PalantirChainNextLine { - void foo() { - Iterator> delegateIterator = delegates - .entrySet() - .iterator(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chain-next-line.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chain-next-line.output deleted file mode 100644 index d57eb197d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chain-next-line.output +++ /dev/null @@ -1,6 +0,0 @@ -class PalantirChainNextLine { - void foo() { - Iterator> delegateIterator = - delegates.entrySet().iterator(); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-dangling-method-reference.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-dangling-method-reference.input deleted file mode 100644 index f8e2c8265..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-dangling-method-reference.input +++ /dev/null @@ -1,7 +0,0 @@ -class PalantirDanglingMethodReference { - void foo() { - return engageNicely( - staleForksFigureBark, staleForksFigureConsecutiveFailedExecutions, isStaleForksFigureInProgress, this - ::engageStaleForksUnsafely); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.input deleted file mode 100644 index af5ef3b31..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.input +++ /dev/null @@ -1,93 +0,0 @@ -class PalantirDeeplyNestedCalls { - private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldOneV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldFourV1)) - .build())) - .build())) - .build())) - .build())) - .build(); - - void testMethod() { - assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) - .containsExactlyInAnyOrderElementsOf(Set.of( - new ItemWithCustomLocator( - ItemConfigV1.DEFAULT_CONFIG.toCustomString(), - ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_ITEM_A)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) - .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 - .apiName() - .get())) - .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), - // Discovered items - new ItemWithCustomLocator( - TestModelCatalog.MODEL_ABC_456.toItemApi(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_API_NAME)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())))); - } - - public Map otherMethod( - FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { - return myCustomService - .get() - .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) - .entrySet() - .stream() - .collect(Collectors.toMap( - Map.Entry::getKey, entry -> entry.getValue().getMetrics())); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.output deleted file mode 100644 index af5ef3b31..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.output +++ /dev/null @@ -1,93 +0,0 @@ -class PalantirDeeplyNestedCalls { - private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldOneV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldFourV1)) - .build())) - .build())) - .build())) - .build())) - .build(); - - void testMethod() { - assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) - .containsExactlyInAnyOrderElementsOf(Set.of( - new ItemWithCustomLocator( - ItemConfigV1.DEFAULT_CONFIG.toCustomString(), - ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_ITEM_A)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) - .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 - .apiName() - .get())) - .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), - // Discovered items - new ItemWithCustomLocator( - TestModelCatalog.MODEL_ABC_456.toItemApi(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_API_NAME)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())))); - } - - public Map otherMethod( - FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { - return myCustomService - .get() - .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) - .entrySet() - .stream() - .collect(Collectors.toMap( - Map.Entry::getKey, entry -> entry.getValue().getMetrics())); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-1.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-1.input deleted file mode 100644 index ddbc79e0f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-1.input +++ /dev/null @@ -1,6 +0,0 @@ -class PalantirExpressionLambda1 { - void foo() { - return createInternal(client, config, userAgent, hostEventsSink, serviceClass, RANDOMIZE, reshuffle, () -> - new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize())); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-2.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-2.input deleted file mode 100644 index ca5e79f6f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-2.input +++ /dev/null @@ -1,6 +0,0 @@ -class PalantirExpressionLambda2 { - void foo() { - this(txnManager, foundryResources, commitLogHandler, timestamp -> - new UUID(timestamp, UUID.randomUUID().getLeastSignificantBits())); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas-2.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas-2.input deleted file mode 100644 index 438df5398..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas-2.input +++ /dev/null @@ -1,7 +0,0 @@ -class PalantirExpressionLambdas { - void foo() { - this.sequentialTableFactory = SequentialTableFactory.create( - ObjectMappers.newServerObjectMapper(), Event.class, txnManager::getTimestampService, () -> - SequentialTableFactory.Strategy.V1); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas.input deleted file mode 100644 index 806b6b8ec..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas.input +++ /dev/null @@ -1,7 +0,0 @@ -class PalantirExpressionLambdas { - void foo() { - publisher = new ThisThatEventPublisher( - txnManager, () -> Events.encoder(keyPair, new TestClock()), EventSeries.THING, () -> - DEFAULT_EVENT_BATCH_SIZE); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-issue-1343-text-block-indent-stable.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-issue-1343-text-block-indent-stable.output deleted file mode 100644 index 30b3a9625..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-issue-1343-text-block-indent-stable.output +++ /dev/null @@ -1,21 +0,0 @@ -class PalantirIssue1343TextBlockIndentStable { - String[][] withCommentFirstLine = {{""" - // tmp fix - @Deprecated - class Test {} - """}, {""" - - @Deprecated - class Test {} - """}}; - - String[][] blankLineInTheMiddle = {{""" - import java.util.List; - - @Deprecated - class Test {} - """}, {""" - - class Test {} - """}}; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-inlining-prefers-break.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-inlining-prefers-break.input deleted file mode 100644 index 3ba85be83..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-inlining-prefers-break.input +++ /dev/null @@ -1,11 +0,0 @@ -class PalantirLambdaInliningPrefersBreak { - void foo() { - endpointDefinition.getDeprecated().ifPresent(documentation -> endpointBuilder.addMethod( - MethodSpec.methodBuilder("deprecated") - .addModifiers(Modifier.PUBLIC) - .addAnnotation(Override.class) - .returns(ParameterizedTypeName.get(ClassName.get(Optional.class), ClassName.get(String.class))) - .addStatement("return $1T.of($2S)", Optional.class, documentation) - .build())); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-inlining-prefers-break.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-inlining-prefers-break.output deleted file mode 100644 index d2d5d53cf..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-inlining-prefers-break.output +++ /dev/null @@ -1,12 +0,0 @@ -class PalantirLambdaInliningPrefersBreak { - void foo() { - endpointDefinition - .getDeprecated() - .ifPresent(documentation -> endpointBuilder.addMethod(MethodSpec.methodBuilder("deprecated") - .addModifiers(Modifier.PUBLIC) - .addAnnotation(Override.class) - .returns(ParameterizedTypeName.get(ClassName.get(Optional.class), ClassName.get(String.class))) - .addStatement("return $1T.of($2S)", Optional.class, documentation) - .build())); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-multiline-arg.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-multiline-arg.output deleted file mode 100644 index 7917c35bc..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-multiline-arg.output +++ /dev/null @@ -1,68 +0,0 @@ -public class Foo { - public static void main(String[] args) { - - String value = myMethod.accept(SomeCreator.Visitor.>builder() - .visitWebsite1( - () -> Optional.of( - "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")) - .visitWebsite2(() -> Optional.of( - "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") - .get()) - .visitWebsite3(() -> Optional.of("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")) - .build()); - - assertThat(resultThatIsQuiteLong) - .containsExactly(SomeResonse.getValue("1".repeat((int) (MyClass.CHAR_LIMIT * 0.5)))); - - someArgResulsts.forEach((key, value) -> value.sync().ifPresent(myvalue -> { - myvalue.put(foo, bar, baz); - })); - - Set convertedSet = castedObj.stream() - .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments()[0])) - .collect(Collectors.toSet()); - - EntryStream.of(SOME_NAME_TO_JSON_STRING) - .forKeyValue((tableName, jsonString) -> doReturn( - getSelectJsonResponse(some(other(myValueTahatIsLong(jsonString))))) - .when(session) - .execute((Statement) argThat(statement -> statement instanceof Statement - && statement.toString().contains(tableName)))); - - return someService.runWithLock( - foo, - Set.of("Running bar"), - () -> getOperationLock(MyClass.DOWNLOAD).runWithLock(MyClass.DOWNLOAD, () -> { - return doStuff.builder().method1().method2().build(); - })); - } - - public static Value convertToFunctionValue(Object sourceObject, Type sourceType) { - if (sourceType instanceof ParameterizedType parameterizedType) { - if (sourceObject instanceof Optional castedObj) { - if (castedObj.isEmpty()) { - return NULL_VALUE; - } - return convertToFunctionValue(castedObj.get(), parameterizedType.getActualTypeArguments()[0]); - } else if (sourceObject instanceof List castedObj) { - List convertedList = castedObj.stream() - .map(val -> - convertToFunctionValue(val, parameterizedType.getActualTypeArguments()[0])) - .toList(); - return Value.list(ListValue.of(convertedList)); - } else if (sourceObject instanceof Set castedObj) { - Set convertedSet = castedObj.stream() - .map(val -> convertToFunctionValue( - val, parameterizedType.getActualTypeArguments().get())) - .collect(Collectors.toSet()); - return Value.set(SetValue.of(convertedSet)); - } else if (sourceObject instanceof Set castedObj) { - Set convertedSet = castedObj.stream() - .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments())) - .collect(Collectors.toSet()); - return Value.set(SetValue.of(convertedSet)); - } - } - return null; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lamda-cast.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lamda-cast.output deleted file mode 100644 index 1815adc76..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lamda-cast.output +++ /dev/null @@ -1,16 +0,0 @@ -public class Foo { - static String foo(Optional optional) { - return optional.orElseGet((String) () -> { - throw new NotFoundException(); - }); - } - - static String bar(Optional optional) { - return optional.orElseGet((String) () -> ""); - } - - static String baz(Optional optional) { - return optional.orElseGet((String) () -> - bar(Optional.of("some thing that is very very very looooooong")).get()); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain-arg.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain-arg.input deleted file mode 100644 index d8a7aeea1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain-arg.input +++ /dev/null @@ -1,5 +0,0 @@ -class PalantirLongMethodChainArg { - void foo() { - return cache.get(ImmutableRequest.builder().group(group).name(artifact).addRepositories("release-jar").build()); - } -} diff --git a/open-java-format/src/test/resources/test-cases/testdata/A-cr.case b/open-java-format/src/test/resources/test-cases/testdata/A-cr.case new file mode 100644 index 000000000..3800b6cbf --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/A-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, * ArrayTypes, AssertStatements, and Assignments. */ class A { public @interface X { int x(); int y() default 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; } @X(x = 1) private @interface Y {} // TODO(jdd): Add annotation declaration with empty body. @X(x = 1) @Y protected @interface Z {} // TODO(jdd): Include type annotations once we can include a higher language level. int[] array1 = new int[5]; int[] array2 = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; int[] array3 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; int[][] array4 = { {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, {20, 21}, {22, 23} }; int[][][] arrayWithLongName = new int [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] []; A a1 = new A() { int x = array1[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array2[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array3[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array4[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0][ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; }; void f(int something) { assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 : "that was certainly unexpected!"; arrayWithLongName[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = arrayWithLongName[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; something = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; return StreamEx.of(itemsToCreate) .append(itemsToEdit) .append(itemsToDelete) .distinct() .mapToEntry(item -> getArgsGenerator() .getNewArgs( extendedItems.getOrDefault(item, Set.of()), getOwningResource( item, getModificationContext()::getRestrictionStatusOrDefault, RestrictionStatus::getPackageId, getModificationContext()))) .toImmutableMap(); } } ---------- package com.google.googlejavaformat.java.test; /** * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, * ArrayTypes, AssertStatements, and Assignments. */ class A { public @interface X { int x(); int y() default 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; } @X(x = 1) private @interface Y {} // TODO(jdd): Add annotation declaration with empty body. @X(x = 1) @Y protected @interface Z {} // TODO(jdd): Include type annotations once we can include a higher language level. int[] array1 = new int[5]; int[] array2 = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; int[] array3 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; int[][] array4 = { {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, {20, 21}, {22, 23} }; int[][][] arrayWithLongName = new int [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] []; A a1 = new A() { int x = array1[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array2[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array3[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array4[0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0][ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; }; void f(int something) { assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 : "that was certainly unexpected!"; arrayWithLongName[0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = arrayWithLongName[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; something = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; return StreamEx.of(itemsToCreate) .append(itemsToEdit) .append(itemsToDelete) .distinct() .mapToEntry(item -> getArgsGenerator() .getNewArgs( extendedItems.getOrDefault(item, Set.of()), getOwningResource( item, getModificationContext()::getRestrictionStatusOrDefault, RestrictionStatus::getPackageId, getModificationContext()))) .toImmutableMap(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/A-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/A-crlf.case new file mode 100644 index 000000000..b0b1633bd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/A-crlf.case @@ -0,0 +1,186 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, + * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, + * ArrayTypes, AssertStatements, and Assignments. + */ +class A { + public @interface X { + int x(); + + int y() default + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; + } + + @X(x = 1) + private @interface Y {} + + // TODO(jdd): Add annotation declaration with empty body. + + @X(x = 1) + @Y + protected @interface Z {} + + // TODO(jdd): Include type annotations once we can include a higher language level. + + int[] array1 = new int[5]; + int[] array2 = + new int[] { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31 + }; + int[] array3 = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31 + }; + int[][] array4 = { + {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, + {20, 21}, {22, 23} + }; + int[][][] arrayWithLongName = + new int + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + []; + + A a1 = + new A() { + int x = + array1[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array2[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array3[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array4[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0][ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0]; + }; + + void f(int something) { + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + : "that was certainly unexpected!"; + arrayWithLongName[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = + arrayWithLongName[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; + something = + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; + return StreamEx.of(itemsToCreate) + .append(itemsToEdit) + .append(itemsToDelete) + .distinct() + .mapToEntry(item -> getArgsGenerator() + .getNewArgs( + extendedItems.getOrDefault(item, Set.of()), + getOwningResource( + item, + getModificationContext()::getRestrictionStatusOrDefault, + RestrictionStatus::getPackageId, + getModificationContext()))) + .toImmutableMap(); + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, + * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, + * ArrayTypes, AssertStatements, and Assignments. + */ +class A { + public @interface X { + int x(); + + int y() default + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + 1 + 1; + } + + @X(x = 1) + private @interface Y {} + + // TODO(jdd): Add annotation declaration with empty body. + + @X(x = 1) + @Y + protected @interface Z {} + + // TODO(jdd): Include type annotations once we can include a higher language level. + + int[] array1 = new int[5]; + int[] array2 = new int[] { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31 + }; + int[] array3 = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31 + }; + int[][] array4 = { + {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, {20, 21}, {22, 23} + }; + int[][][] arrayWithLongName = new int + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0] + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0] + []; + + A a1 = new A() { + int x = array1[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array2[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array3[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array4[0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0][ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; + }; + + void f(int something) { + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + : "that was certainly unexpected!"; + arrayWithLongName[0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = + arrayWithLongName[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; + something = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; + return StreamEx.of(itemsToCreate) + .append(itemsToEdit) + .append(itemsToDelete) + .distinct() + .mapToEntry(item -> getArgsGenerator() + .getNewArgs( + extendedItems.getOrDefault(item, Set.of()), + getOwningResource( + item, + getModificationContext()::getRestrictionStatusOrDefault, + RestrictionStatus::getPackageId, + getModificationContext()))) + .toImmutableMap(); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.output b/open-java-format/src/test/resources/test-cases/testdata/A-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.output rename to open-java-format/src/test/resources/test-cases/testdata/A-lf.case index 3c44e08e4..c9af28291 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.output +++ b/open-java-format/src/test/resources/test-cases/testdata/A-lf.case @@ -1,3 +1,102 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, + * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, + * ArrayTypes, AssertStatements, and Assignments. + */ +class A { + public @interface X { + int x(); + + int y() default + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; + } + + @X(x = 1) + private @interface Y {} + + // TODO(jdd): Add annotation declaration with empty body. + + @X(x = 1) + @Y + protected @interface Z {} + + // TODO(jdd): Include type annotations once we can include a higher language level. + + int[] array1 = new int[5]; + int[] array2 = + new int[] { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31 + }; + int[] array3 = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31 + }; + int[][] array4 = { + {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, + {20, 21}, {22, 23} + }; + int[][][] arrayWithLongName = + new int + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + []; + + A a1 = + new A() { + int x = + array1[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array2[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array3[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array4[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0][ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0]; + }; + + void f(int something) { + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + : "that was certainly unexpected!"; + arrayWithLongName[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = + arrayWithLongName[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; + something = + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; + return StreamEx.of(itemsToCreate) + .append(itemsToEdit) + .append(itemsToDelete) + .distinct() + .mapToEntry(item -> getArgsGenerator() + .getNewArgs( + extendedItems.getOrDefault(item, Set.of()), + getOwningResource( + item, + getModificationContext()::getRestrictionStatusOrDefault, + RestrictionStatus::getPackageId, + getModificationContext()))) + .toImmutableMap(); + } +} +---------- package com.google.googlejavaformat.java.test; /** diff --git a/open-java-format/src/test/resources/test-cases/testdata/B-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B-cr.case new file mode 100644 index 000000000..8743198d5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** Tests for Blocks, BodyDeclarations, BooleanLiterals, and BreakStatements. */ class B { int x; private int y; public int z; void f() { LABEL: while (true != false) { if (false == true) break; if (false == false) break LABEL; } } } ---------- package com.google.googlejavaformat.java.test; /** Tests for Blocks, BodyDeclarations, BooleanLiterals, and BreakStatements. */ class B { int x; private int y; public int z; void f() { LABEL: while (true != false) { if (false == true) break; if (false == false) break LABEL; } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B-crlf.case new file mode 100644 index 000000000..cfb80792d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B-crlf.case @@ -0,0 +1,36 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for Blocks, BodyDeclarations, BooleanLiterals, and BreakStatements. */ +class B { + int x; + private int y; + public int z; + + void f() { + LABEL: + while (true != false) { + if (false == true) + break; + if (false == false) + break LABEL; + } + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for Blocks, BodyDeclarations, BooleanLiterals, and BreakStatements. */ +class B { + int x; + private int y; + public int z; + + void f() { + LABEL: + while (true != false) { + if (false == true) break; + if (false == false) break LABEL; + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B-lf.case new file mode 100644 index 000000000..84ddafd21 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B-lf.case @@ -0,0 +1,36 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for Blocks, BodyDeclarations, BooleanLiterals, and BreakStatements. */ +class B { + int x; + private int y; + public int z; + + void f() { + LABEL: + while (true != false) { + if (false == true) + break; + if (false == false) + break LABEL; + } + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for Blocks, BodyDeclarations, BooleanLiterals, and BreakStatements. */ +class B { + int x; + private int y; + public int z; + + void f() { + LABEL: + while (true != false) { + if (false == true) break; + if (false == false) break LABEL; + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B112853497-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B112853497-cr.case new file mode 100644 index 000000000..1e70f8765 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B112853497-cr.case @@ -0,0 +1 @@ +---------- class B112853497 { { XxxxxxxxxxXxxx xxxXxxxx = xxxXxxxx .xxxxXxXxxxx(xxxxXxxx, XXXXXX_XXXX_XXXXXXXX_XX_XXXXXXXX) .toBuilder() .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) .xxxXxxxxx(xxxxxx.xxxXxxxxxXxxx()) .xxxxx(); } } ---------- class B112853497 { { XxxxxxxxxxXxxx xxxXxxxx = xxxXxxxx.xxxxXxXxxxx(xxxxXxxx, XXXXXX_XXXX_XXXXXXXX_XX_XXXXXXXX).toBuilder() .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) .xxxXxxxxx(xxxxxx.xxxXxxxxxXxxx()) .xxxxx(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B112853497-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B112853497-crlf.case new file mode 100644 index 000000000..0b6f155bb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B112853497-crlf.case @@ -0,0 +1,23 @@ +---------- +class B112853497 { + { + XxxxxxxxxxXxxx xxxXxxxx = + xxxXxxxx + .xxxxXxXxxxx(xxxxXxxx, XXXXXX_XXXX_XXXXXXXX_XX_XXXXXXXX) + .toBuilder() + .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) + .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) + .xxxXxxxxx(xxxxxx.xxxXxxxxxXxxx()) + .xxxxx(); + } +} +---------- +class B112853497 { + { + XxxxxxxxxxXxxx xxxXxxxx = xxxXxxxx.xxxxXxXxxxx(xxxxXxxx, XXXXXX_XXXX_XXXXXXXX_XX_XXXXXXXX).toBuilder() + .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) + .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) + .xxxXxxxxx(xxxxxx.xxxXxxxxxXxxx()) + .xxxxx(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B112853497-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B112853497-lf.case new file mode 100644 index 000000000..33254d3b5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B112853497-lf.case @@ -0,0 +1,23 @@ +---------- +class B112853497 { + { + XxxxxxxxxxXxxx xxxXxxxx = + xxxXxxxx + .xxxxXxXxxxx(xxxxXxxx, XXXXXX_XXXX_XXXXXXXX_XX_XXXXXXXX) + .toBuilder() + .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) + .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) + .xxxXxxxxx(xxxxxx.xxxXxxxxxXxxx()) + .xxxxx(); + } +} +---------- +class B112853497 { + { + XxxxxxxxxxXxxx xxxXxxxx = xxxXxxxx.xxxxXxXxxxx(xxxxXxxx, XXXXXX_XXXX_XXXXXXXX_XX_XXXXXXXX).toBuilder() + .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) + .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) + .xxxXxxxxx(xxxxxx.xxxXxxxxxXxxx()) + .xxxxx(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B124394008-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B124394008-cr.case new file mode 100644 index 000000000..96e9bc1a1 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B124394008-cr.case @@ -0,0 +1 @@ +---------- class B124394008 { { LocalReviewProto.Builder newReview = readProfileResponse.flatMap(authorExtractor::extract) .map(luReviewsExtractor::toLocalReviewProto) .orElse(LocalReviewProto.getDefaultInstance()).toBuilder(); } } ---------- class B124394008 { { LocalReviewProto.Builder newReview = readProfileResponse .flatMap(authorExtractor::extract) .map(luReviewsExtractor::toLocalReviewProto) .orElse(LocalReviewProto.getDefaultInstance()) .toBuilder(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B124394008-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B124394008-crlf.case new file mode 100644 index 000000000..cd96bd712 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B124394008-crlf.case @@ -0,0 +1,19 @@ +---------- +class B124394008 { + { + LocalReviewProto.Builder newReview = + readProfileResponse.flatMap(authorExtractor::extract) + .map(luReviewsExtractor::toLocalReviewProto) + .orElse(LocalReviewProto.getDefaultInstance()).toBuilder(); + } +} +---------- +class B124394008 { + { + LocalReviewProto.Builder newReview = readProfileResponse + .flatMap(authorExtractor::extract) + .map(luReviewsExtractor::toLocalReviewProto) + .orElse(LocalReviewProto.getDefaultInstance()) + .toBuilder(); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B124394008.output b/open-java-format/src/test/resources/test-cases/testdata/B124394008-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B124394008.output rename to open-java-format/src/test/resources/test-cases/testdata/B124394008-lf.case index 506511917..a8a3f45df 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B124394008.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B124394008-lf.case @@ -1,3 +1,13 @@ +---------- +class B124394008 { + { + LocalReviewProto.Builder newReview = + readProfileResponse.flatMap(authorExtractor::extract) + .map(luReviewsExtractor::toLocalReviewProto) + .orElse(LocalReviewProto.getDefaultInstance()).toBuilder(); + } +} +---------- class B124394008 { { LocalReviewProto.Builder newReview = readProfileResponse diff --git a/open-java-format/src/test/resources/test-cases/testdata/B126411718-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B126411718-cr.case new file mode 100644 index 000000000..ef097ef24 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B126411718-cr.case @@ -0,0 +1 @@ +---------- class B126411718 { { logger .atDebug() .log( "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", deletedPersistentNames.size(), deletedPersistentNames); } } ---------- class B126411718 { { logger.atDebug().log( "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", deletedPersistentNames.size(), deletedPersistentNames); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B126411718-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B126411718-crlf.case new file mode 100644 index 000000000..4eec0d83c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B126411718-crlf.case @@ -0,0 +1,19 @@ +---------- +class B126411718 { + { + logger + .atDebug() + .log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), + deletedPersistentNames); + } +} +---------- +class B126411718 { + { + logger.atDebug().log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), deletedPersistentNames); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B126411718-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B126411718-lf.case new file mode 100644 index 000000000..5da0a06ae --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B126411718-lf.case @@ -0,0 +1,19 @@ +---------- +class B126411718 { + { + logger + .atDebug() + .log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), + deletedPersistentNames); + } +} +---------- +class B126411718 { + { + logger.atDebug().log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), deletedPersistentNames); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B183431894-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B183431894-cr.case new file mode 100644 index 000000000..7f39a88df --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B183431894-cr.case @@ -0,0 +1 @@ +---------- class B183431894 { int a = - -1; int d = + +1; } ---------- class B183431894 { int a = - -1; int d = + +1; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B183431894-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B183431894-crlf.case new file mode 100644 index 000000000..c4b5e626e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B183431894-crlf.case @@ -0,0 +1,10 @@ +---------- +class B183431894 { + int a = - -1; + int d = + +1; +} +---------- +class B183431894 { + int a = - -1; + int d = + +1; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B183431894-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B183431894-lf.case new file mode 100644 index 000000000..4b9b4fcdd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B183431894-lf.case @@ -0,0 +1,10 @@ +---------- +class B183431894 { + int a = - -1; + int d = + +1; +} +---------- +class B183431894 { + int a = - -1; + int d = + +1; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B19950219-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B19950219-cr.case new file mode 100644 index 000000000..b695bcb01 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B19950219-cr.case @@ -0,0 +1 @@ +---------- class B19950219 { @Override String normalizeWord(String word) { return Ascii.toLowerCase(word); } @Override String convert(CaseFormat format, String s) { }} ---------- class B19950219 { @Override String normalizeWord(String word) { return Ascii.toLowerCase(word); } @Override String convert(CaseFormat format, String s) {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B19950219-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B19950219-crlf.case new file mode 100644 index 000000000..a6e9eca7f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B19950219-crlf.case @@ -0,0 +1,19 @@ +---------- +class B19950219 { + @Override + String normalizeWord(String word) { + return Ascii.toLowerCase(word); + } + @Override + String convert(CaseFormat format, String s) { + }} +---------- +class B19950219 { + @Override + String normalizeWord(String word) { + return Ascii.toLowerCase(word); + } + + @Override + String convert(CaseFormat format, String s) {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B19950219-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B19950219-lf.case new file mode 100644 index 000000000..37c69cc27 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B19950219-lf.case @@ -0,0 +1,19 @@ +---------- +class B19950219 { + @Override + String normalizeWord(String word) { + return Ascii.toLowerCase(word); + } + @Override + String convert(CaseFormat format, String s) { + }} +---------- +class B19950219 { + @Override + String normalizeWord(String word) { + return Ascii.toLowerCase(word); + } + + @Override + String convert(CaseFormat format, String s) {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B19950468-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B19950468-cr.case new file mode 100644 index 000000000..44feebd78 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B19950468-cr.case @@ -0,0 +1 @@ +---------- class B19950468 { int code() {} // comment } ---------- class B19950468 { int code() {} // comment } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B19950468-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B19950468-crlf.case new file mode 100644 index 000000000..3989e8188 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B19950468-crlf.case @@ -0,0 +1,12 @@ +---------- +class B19950468 { + int code() {} + + // comment +} +---------- +class B19950468 { + int code() {} + + // comment +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B19950468-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B19950468-lf.case new file mode 100644 index 000000000..73eb419db --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B19950468-lf.case @@ -0,0 +1,12 @@ +---------- +class B19950468 { + int code() {} + + // comment +} +---------- +class B19950468 { + int code() {} + + // comment +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B19950815-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B19950815-cr.case new file mode 100644 index 000000000..c90fdf819 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B19950815-cr.case @@ -0,0 +1 @@ +---------- class B19950815 { void m() { checkArgument( truncationLength >= 0, "maxLength (%s) must be >= length of the truncation indicator (%s)", maxLength, truncationIndicator.length()); } private String finishCollapseFrom( CharSequence sequence, int start, int end, char replacement, StringBuilder builder, boolean inMatchingGroup) { } } ---------- class B19950815 { void m() { checkArgument( truncationLength >= 0, "maxLength (%s) must be >= length of the truncation indicator (%s)", maxLength, truncationIndicator.length()); } private String finishCollapseFrom( CharSequence sequence, int start, int end, char replacement, StringBuilder builder, boolean inMatchingGroup) {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B19950815-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B19950815-crlf.case new file mode 100644 index 000000000..d023344c7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B19950815-crlf.case @@ -0,0 +1,31 @@ +---------- +class B19950815 { + void m() { + checkArgument( + truncationLength >= 0, "maxLength (%s) must be >= length of the truncation indicator (%s)", + maxLength, truncationIndicator.length()); + } + + private String finishCollapseFrom( + CharSequence sequence, int start, int end, char replacement, StringBuilder builder, + boolean inMatchingGroup) { + } +} +---------- +class B19950815 { + void m() { + checkArgument( + truncationLength >= 0, + "maxLength (%s) must be >= length of the truncation indicator (%s)", + maxLength, + truncationIndicator.length()); + } + + private String finishCollapseFrom( + CharSequence sequence, + int start, + int end, + char replacement, + StringBuilder builder, + boolean inMatchingGroup) {} +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950815.output b/open-java-format/src/test/resources/test-cases/testdata/B19950815-lf.case similarity index 55% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950815.output rename to open-java-format/src/test/resources/test-cases/testdata/B19950815-lf.case index af7c123f5..12c2f242f 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950815.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B19950815-lf.case @@ -1,3 +1,17 @@ +---------- +class B19950815 { + void m() { + checkArgument( + truncationLength >= 0, "maxLength (%s) must be >= length of the truncation indicator (%s)", + maxLength, truncationIndicator.length()); + } + + private String finishCollapseFrom( + CharSequence sequence, int start, int end, char replacement, StringBuilder builder, + boolean inMatchingGroup) { + } +} +---------- class B19950815 { void m() { checkArgument( diff --git a/open-java-format/src/test/resources/test-cases/testdata/B19996259-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B19996259-cr.case new file mode 100644 index 000000000..f39450c4e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B19996259-cr.case @@ -0,0 +1 @@ +---------- class B19996259 { void g( // line comment int x) {} void // g // ( // int // x // , // int // y // ) // { // } // } ---------- class B19996259 { void g( // line comment int x) {} void // g // ( // int // x // , // int // y // ) // { // } // } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B19996259-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B19996259-crlf.case new file mode 100644 index 000000000..b85823897 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B19996259-crlf.case @@ -0,0 +1,34 @@ +---------- +class B19996259 { + void g( // line comment + int x) {} + + void // + g // + ( // + int // + x // + , // + int // + y // + ) // + { // + } // +} +---------- +class B19996259 { + void g( // line comment + int x) {} + + void // + g // + ( // + int // + x // + , // + int // + y // + ) // + { // + } // +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19996259.output b/open-java-format/src/test/resources/test-cases/testdata/B19996259-lf.case similarity index 62% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19996259.output rename to open-java-format/src/test/resources/test-cases/testdata/B19996259-lf.case index fd6c1a122..dc856faab 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19996259.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B19996259-lf.case @@ -1,3 +1,21 @@ +---------- +class B19996259 { + void g( // line comment + int x) {} + + void // + g // + ( // + int // + x // + , // + int // + y // + ) // + { // + } // +} +---------- class B19996259 { void g( // line comment int x) {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20128174-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20128174-cr.case new file mode 100644 index 000000000..1c247efb7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128174-cr.case @@ -0,0 +1 @@ +---------- class B20128174 { enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES }; enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES; }; enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES,; }; } ---------- class B20128174 { enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES }; enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES; }; enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES, ; }; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20128174-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20128174-crlf.case new file mode 100644 index 000000000..953b2a696 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128174-crlf.case @@ -0,0 +1,34 @@ +---------- +class B20128174 { + + enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES }; + + enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES; }; + + enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES,; }; +} +---------- +class B20128174 { + + enum Suit { + DIAMONDS, + HEARTS, + CLUBS, + SPADES + }; + + enum Suit { + DIAMONDS, + HEARTS, + CLUBS, + SPADES; + }; + + enum Suit { + DIAMONDS, + HEARTS, + CLUBS, + SPADES, + ; + }; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128174.output b/open-java-format/src/test/resources/test-cases/testdata/B20128174-lf.case similarity index 60% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128174.output rename to open-java-format/src/test/resources/test-cases/testdata/B20128174-lf.case index 302fa2f6d..bb8cb5955 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128174.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128174-lf.case @@ -1,3 +1,13 @@ +---------- +class B20128174 { + + enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES }; + + enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES; }; + + enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES,; }; +} +---------- class B20128174 { enum Suit { diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20128588-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20128588-cr.case new file mode 100644 index 000000000..10a9d1818 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128588-cr.case @@ -0,0 +1 @@ +---------- @Foo @Bar @Baz package edu.oswego.cs.dl.util.concurrent; @Foo @Bar @Baz class Test { @Foo @Bar @Baz Object f() { } @Foo @Bar @Baz public Object f() { } @Foo @Bar @Baz void f() { } @Foo @Bar @Baz static Object field; static @Foo @Bar @Baz Object field; @Foo @Bar @Baz Object field; @Foo(xs=42) @Bar @Baz Object field; { @Foo @Bar @Baz final Object var; final @Foo @Bar @Baz Object var; @Foo @Bar @Baz Object var; @Foo(xs=42) @Bar @Baz Object var; } void f( @Foo @Bar @Baz final Object var, final @Foo @Bar @Baz Object var, @Foo @Bar @Baz Object var, @Foo(xs=42) @Bar @Baz Object var) {} <@TA T extends @TA Object> @TA T f(List a, List b) throws @TA Exception {} @FooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BarXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BazXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX int x; @FooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BarXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BazXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX int x; @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated Object var; @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated Object var; @Deprecated(x=42) @Deprecated @Deprecated @Deprecated @Deprecated Object var; @Deprecated( x = 42, y = { XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX }) Object var; @Deprecated( y = { XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX }) Object var; } @Frozzle({ @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, enable = false, methods = { "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", }), @Mirror( in = edu.oswego.cs.dl.util.concurrent.F.class, enable = false, methods = {"foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo"}), @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), }) class C {} ---------- @Foo @Bar @Baz package edu.oswego.cs.dl.util.concurrent; @Foo @Bar @Baz class Test { @Foo @Bar @Baz Object f() {} @Foo @Bar @Baz public Object f() {} @Foo @Bar @Baz void f() {} @Foo @Bar @Baz static Object field; static @Foo @Bar @Baz Object field; @Foo @Bar @Baz Object field; @Foo(xs = 42) @Bar @Baz Object field; { @Foo @Bar @Baz final Object var; final @Foo @Bar @Baz Object var; @Foo @Bar @Baz Object var; @Foo(xs = 42) @Bar @Baz Object var; } void f( @Foo @Bar @Baz final Object var, final @Foo @Bar @Baz Object var, @Foo @Bar @Baz Object var, @Foo(xs = 42) @Bar @Baz Object var) {} <@TA T extends @TA Object> @TA T f(List a, List b) throws @TA Exception {} @FooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BarXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BazXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX int x; @FooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BarXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BazXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX int x; @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated Object var; @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated Object var; @Deprecated(x = 42) @Deprecated @Deprecated @Deprecated @Deprecated Object var; @Deprecated( x = 42, y = { XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX }) Object var; @Deprecated( y = { XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX }) Object var; } @Frozzle({ @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), @Mirror( in = edu.oswego.cs.dl.util.concurrent.F.class, enable = false, methods = { "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", }), @Mirror( in = edu.oswego.cs.dl.util.concurrent.F.class, enable = false, methods = {"foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo"}), @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), }) class C {} \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20128588-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20128588-crlf.case new file mode 100644 index 000000000..eedcec020 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128588-crlf.case @@ -0,0 +1,233 @@ +---------- +@Foo @Bar @Baz package edu.oswego.cs.dl.util.concurrent; + +@Foo @Bar @Baz class Test { + + @Foo @Bar @Baz Object f() { + } + + @Foo @Bar @Baz public Object f() { + } + + @Foo @Bar @Baz void f() { + } + + @Foo @Bar @Baz static Object field; + + static @Foo @Bar @Baz Object field; + + @Foo @Bar @Baz Object field; + + @Foo(xs=42) @Bar @Baz Object field; + + { + @Foo @Bar @Baz final Object var; + + final @Foo @Bar @Baz Object var; + + @Foo @Bar @Baz Object var; + + @Foo(xs=42) @Bar @Baz Object var; + } + + void f( + @Foo @Bar @Baz final Object var, + final @Foo @Bar @Baz Object var, + @Foo @Bar @Baz Object var, + @Foo(xs=42) @Bar @Baz Object var) {} + + <@TA T extends @TA Object> @TA T f(List a, List b) throws @TA Exception {} + + @FooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BarXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BazXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX int x; + +@FooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BarXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BazXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX int x; + + @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated Object var; + + @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated Object var; + + @Deprecated(x=42) @Deprecated @Deprecated @Deprecated @Deprecated Object var; + + @Deprecated( + x = 42, + y = { + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + }) + Object var; + + @Deprecated( + y = { + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + }) + Object var; +} + +@Frozzle({ + @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), + @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), + @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, enable = false, methods = { + "foo", "foo", "foo", "foo", "foo", + "foo", "foo", "foo", "foo", "foo", + "foo", "foo", "foo", "foo", "foo", + }), + @Mirror( + in = edu.oswego.cs.dl.util.concurrent.F.class, + enable = false, + methods = {"foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo"}), + @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), +}) +class C {} +---------- +@Foo +@Bar +@Baz +package edu.oswego.cs.dl.util.concurrent; + +@Foo +@Bar +@Baz +class Test { + + @Foo + @Bar + @Baz + Object f() {} + + @Foo + @Bar + @Baz + public Object f() {} + + @Foo + @Bar + @Baz + void f() {} + + @Foo + @Bar + @Baz + static Object field; + + static @Foo @Bar @Baz Object field; + + @Foo + @Bar + @Baz + Object field; + + @Foo(xs = 42) + @Bar + @Baz + Object field; + + { + @Foo + @Bar + @Baz + final Object var; + + final @Foo @Bar @Baz Object var; + + @Foo + @Bar + @Baz + Object var; + + @Foo(xs = 42) + @Bar + @Baz + Object var; + } + + void f( + @Foo @Bar @Baz final Object var, + final @Foo @Bar @Baz Object var, + @Foo @Bar @Baz Object var, + @Foo(xs = 42) @Bar @Baz Object var) {} + + <@TA T extends @TA Object> @TA T f(List a, List b) throws @TA Exception {} + + @FooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + @BarXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + @BazXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + int x; + + @FooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + @BarXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + @BazXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + int x; + + @Deprecated + @Deprecated + @Deprecated + @Deprecated + @Deprecated + @Deprecated + @Deprecated + @Deprecated + @Deprecated + @Deprecated + @Deprecated + @Deprecated + @Deprecated + @Deprecated + Object var; + + @Deprecated + @Deprecated + @Deprecated + @Deprecated + @Deprecated + Object var; + + @Deprecated(x = 42) + @Deprecated + @Deprecated + @Deprecated + @Deprecated + Object var; + + @Deprecated( + x = 42, + y = { + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + }) + Object var; + + @Deprecated( + y = { + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + }) + Object var; +} + +@Frozzle({ + @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), + @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), + @Mirror( + in = edu.oswego.cs.dl.util.concurrent.F.class, + enable = false, + methods = { + "foo", "foo", "foo", "foo", "foo", + "foo", "foo", "foo", "foo", "foo", + "foo", "foo", "foo", "foo", "foo", + }), + @Mirror( + in = edu.oswego.cs.dl.util.concurrent.F.class, + enable = false, + methods = {"foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo"}), + @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), +}) +class C {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128588.output b/open-java-format/src/test/resources/test-cases/testdata/B20128588-lf.case similarity index 54% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128588.output rename to open-java-format/src/test/resources/test-cases/testdata/B20128588-lf.case index 4ead03c80..8dad99c62 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128588.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128588-lf.case @@ -1,3 +1,89 @@ +---------- +@Foo @Bar @Baz package edu.oswego.cs.dl.util.concurrent; + +@Foo @Bar @Baz class Test { + + @Foo @Bar @Baz Object f() { + } + + @Foo @Bar @Baz public Object f() { + } + + @Foo @Bar @Baz void f() { + } + + @Foo @Bar @Baz static Object field; + + static @Foo @Bar @Baz Object field; + + @Foo @Bar @Baz Object field; + + @Foo(xs=42) @Bar @Baz Object field; + + { + @Foo @Bar @Baz final Object var; + + final @Foo @Bar @Baz Object var; + + @Foo @Bar @Baz Object var; + + @Foo(xs=42) @Bar @Baz Object var; + } + + void f( + @Foo @Bar @Baz final Object var, + final @Foo @Bar @Baz Object var, + @Foo @Bar @Baz Object var, + @Foo(xs=42) @Bar @Baz Object var) {} + + <@TA T extends @TA Object> @TA T f(List a, List b) throws @TA Exception {} + + @FooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BarXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BazXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX int x; + +@FooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BarXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @BazXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX int x; + + @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated Object var; + + @Deprecated @Deprecated @Deprecated @Deprecated @Deprecated Object var; + + @Deprecated(x=42) @Deprecated @Deprecated @Deprecated @Deprecated Object var; + + @Deprecated( + x = 42, + y = { + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + }) + Object var; + + @Deprecated( + y = { + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + }) + Object var; +} + +@Frozzle({ + @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), + @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), + @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, enable = false, methods = { + "foo", "foo", "foo", "foo", "foo", + "foo", "foo", "foo", "foo", "foo", + "foo", "foo", "foo", "foo", "foo", + }), + @Mirror( + in = edu.oswego.cs.dl.util.concurrent.F.class, + enable = false, + methods = {"foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo"}), + @Mirror(in = edu.oswego.cs.dl.util.concurrent.F.class, methods = "foo"), +}) +class C {} +---------- @Foo @Bar @Baz diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20128760-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20128760-cr.case new file mode 100644 index 000000000..70ecc8f74 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128760-cr.case @@ -0,0 +1 @@ +---------- class B20128760 { void f() { x = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); XxxxxxxxxXxx.xxxxxxx() .xxx(XxxxxxxxxXxxXxxx.Xxxxx.XXXXX, "Xxxxx xxxxxxxxx xxxxx") .xxx( XxxxxxxxxXxxXxxx.Xxxxx.XXXXXxXXXXX, XxxxXxxxxxxxxx.xxxXxxxxxxxxXxxxxXxxxxXxXxxxxx(Xxxxxxxxxx.xxxXxxxXxxxx(x))) .xxxxx(); xxxxxxXxxx( xxx .xxxXxXxxxxxxx( new XxxxxxxxxXxxxxxxx.Xxxxxxx() .xxxxXxxxXxx( Xxxxx.xxxXxxxxXxxx( new XxxxXx( xxxxxxxxx1.xxxXxxxXx().xxxXxxxx() + xxxxxxxxx2.xxxXxxxXx().xxxXxxxx()))) .xxxxx()) .xxxXxxxxxx()) .xxxxxxxxXxxxxxx(); XXxxxx xxxxxxxxxXxxXxxXxXxxxxxxxXx = XX .xxxxXxxXxxx2( "XxxxXxxxxxxxXxxxXxxxXxxxxxxxXxxxXxxXxxxxxxXxxxxxxxx", xxxxxxxxXxxxXxXxxxxxxxXx, xxxxxxxxXxxxXxxxxXxxxXxXxxxxxxxXx) .xxxxxxxxXx( "XxxxxxxxXxxxxxxxxXxx", xxxxxxxxXxxxxxxxxXxxXx, XX.xxxxxXx(XX.xxxxx(), XX.xxxxxx(XxxxxxxXxxxxxxxxxxXxxxxxxxx.xxxxx))); xxXxxxxxxxXxxxXxxx = (XxxxXxxx) xxxxxxxxXxxxxxxxxx.xxx() .xxxxxXxxxxxx .xxxXxxxxxxx(xxxxxxxxXxxxxxxxxx.xxx().xxxxXxxxx.xxxXxxxxxxXxxx() - 1) .xxxXxxx() .xxxxXxxxXxXx(X.xx.xxxxxxxxxxxxxxxxxxxxxxxxxxx); xxxxxxXxxx( xxxxxxxxxx .xxxXxxxXxxxxXxxxxxxxxxxXxxxXxxxXxxxxXxxx(XXXxXXXXxXX, XXXXXXxXXXxXXXXxXX, XXXXXxXX) .xxxxxxxxxxxXxxxXxxxXxxxxx()) .xxxxxxxxXxxxxxx( xxxxXxxxxxxxxxxXxxxXxxxXxxxx(xxxx1Xxxx, Xxxxx.XXxXXX), xxxxXxxxxxxxxxxXxxxXxxxXxxxx(xxxx2Xxxx, Xxxxx.XXxXXX)); xxxx( xxxx( xxxx( xxxx( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)))); assertThat( main .format("--offset", "0", "--length", String.valueOf(input.length()), path.toString())) .isEqualTo(0); } private static class GenerateDashboardRowFn extends XX.XxXx< Xxxx< Xxxx, Xxxxx2.XxxXxxxXxxxxxxxxxx>>, Xxxx> {} public class XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx extends XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx< XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx, XxxxXxxxxxxXxxxxxxxx>> {} public class Foo extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} public class Foo extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} public class Foo extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxx, Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} { Stream itemIdsStream = stream(members) .flatMap(m -> m.getFieldValues() .entrySet() .stream() .filter(fv -> itemLinkFieldIds.contains(fv.getKey())) .flatMap(fv -> FieldDTO.deserializeStringToListOfStrings(fv.getValue()) .stream() .map(id -> new ItemKey(fieldsById.get(fv.getKey()).getItemTypeId(), id)))); } } ---------- class B20128760 { void f() { x = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); XxxxxxxxxXxx.xxxxxxx() .xxx(XxxxxxxxxXxxXxxx.Xxxxx.XXXXX, "Xxxxx xxxxxxxxx xxxxx") .xxx( XxxxxxxxxXxxXxxx.Xxxxx.XXXXXxXXXXX, XxxxXxxxxxxxxx.xxxXxxxxxxxxXxxxxXxxxxXxXxxxxx(Xxxxxxxxxx.xxxXxxxXxxxx(x))) .xxxxx(); xxxxxxXxxx(xxx.xxxXxXxxxxxxx(new XxxxxxxxxXxxxxxxx.Xxxxxxx() .xxxxXxxxXxx(Xxxxx.xxxXxxxxXxxx( new XxxxXx(xxxxxxxxx1.xxxXxxxXx().xxxXxxxx() + xxxxxxxxx2.xxxXxxxXx().xxxXxxxx()))) .xxxxx()) .xxxXxxxxxx()) .xxxxxxxxXxxxxxx(); XXxxxx xxxxxxxxxXxxXxxXxXxxxxxxxXx = XX.xxxxXxxXxxx2( "XxxxXxxxxxxxXxxxXxxxXxxxxxxxXxxxXxxXxxxxxxXxxxxxxxx", xxxxxxxxXxxxXxXxxxxxxxXx, xxxxxxxxXxxxXxxxxXxxxXxXxxxxxxxXx) .xxxxxxxxXx( "XxxxxxxxXxxxxxxxxXxx", xxxxxxxxXxxxxxxxxXxxXx, XX.xxxxxXx(XX.xxxxx(), XX.xxxxxx(XxxxxxxXxxxxxxxxxxXxxxxxxxx.xxxxx))); xxXxxxxxxxXxxxXxxx = (XxxxXxxx) xxxxxxxxXxxxxxxxxx .xxx() .xxxxxXxxxxxx .xxxXxxxxxxx(xxxxxxxxXxxxxxxxxx.xxx().xxxxXxxxx.xxxXxxxxxxXxxx() - 1) .xxxXxxx() .xxxxXxxxXxXx(X.xx.xxxxxxxxxxxxxxxxxxxxxxxxxxx); xxxxxxXxxx(xxxxxxxxxx .xxxXxxxXxxxxXxxxxxxxxxxXxxxXxxxXxxxxXxxx(XXXxXXXXxXX, XXXXXXxXXXxXXXXxXX, XXXXXxXX) .xxxxxxxxxxxXxxxXxxxXxxxxx()) .xxxxxxxxXxxxxxx( xxxxXxxxxxxxxxxXxxxXxxxXxxxx(xxxx1Xxxx, Xxxxx.XXxXXX), xxxxXxxxxxxxxxxXxxxXxxxXxxxx(xxxx2Xxxx, Xxxxx.XXxXXX)); xxxx(xxxx(xxxx(xxxx(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)))); assertThat(main.format("--offset", "0", "--length", String.valueOf(input.length()), path.toString())) .isEqualTo(0); } private static class GenerateDashboardRowFn extends XX.XxXx< Xxxx>>, Xxxx> {} public class XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx extends XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx< XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx, XxxxXxxxxxxXxxxxxxxx>> {} public class Foo extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} public class Foo extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} public class Foo extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxx< Xxxxxxxxxxxxxxxxxxxxxxxxxxxxx, Xxxxxxxxxxxxxxxxxxxxxxxxxxxxx, Xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>, Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} { Stream itemIdsStream = stream(members) .flatMap(m -> m.getFieldValues().entrySet().stream() .filter(fv -> itemLinkFieldIds.contains(fv.getKey())) .flatMap(fv -> FieldDTO.deserializeStringToListOfStrings(fv.getValue()).stream() .map(id -> new ItemKey(fieldsById.get(fv.getKey()).getItemTypeId(), id)))); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20128760-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20128760-crlf.case new file mode 100644 index 000000000..fce6014fc --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128760-crlf.case @@ -0,0 +1,189 @@ +---------- +class B20128760 { + void f() { + x = + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + XxxxxxxxxXxx.xxxxxxx() + .xxx(XxxxxxxxxXxxXxxx.Xxxxx.XXXXX, "Xxxxx xxxxxxxxx xxxxx") + .xxx( + XxxxxxxxxXxxXxxx.Xxxxx.XXXXXxXXXXX, + XxxxXxxxxxxxxx.xxxXxxxxxxxxXxxxxXxxxxXxXxxxxx(Xxxxxxxxxx.xxxXxxxXxxxx(x))) + .xxxxx(); + + xxxxxxXxxx( + xxx + .xxxXxXxxxxxxx( + new XxxxxxxxxXxxxxxxx.Xxxxxxx() + .xxxxXxxxXxx( + Xxxxx.xxxXxxxxXxxx( + new XxxxXx( + xxxxxxxxx1.xxxXxxxXx().xxxXxxxx() + + xxxxxxxxx2.xxxXxxxXx().xxxXxxxx()))) + .xxxxx()) + .xxxXxxxxxx()) + .xxxxxxxxXxxxxxx(); + + XXxxxx xxxxxxxxxXxxXxxXxXxxxxxxxXx = + XX + .xxxxXxxXxxx2( + "XxxxXxxxxxxxXxxxXxxxXxxxxxxxXxxxXxxXxxxxxxXxxxxxxxx", + xxxxxxxxXxxxXxXxxxxxxxXx, + xxxxxxxxXxxxXxxxxXxxxXxXxxxxxxxXx) + .xxxxxxxxXx( + "XxxxxxxxXxxxxxxxxXxx", + xxxxxxxxXxxxxxxxxXxxXx, + XX.xxxxxXx(XX.xxxxx(), XX.xxxxxx(XxxxxxxXxxxxxxxxxxXxxxxxxxx.xxxxx))); + + xxXxxxxxxxXxxxXxxx = + (XxxxXxxx) + xxxxxxxxXxxxxxxxxx.xxx() + .xxxxxXxxxxxx + .xxxXxxxxxxx(xxxxxxxxXxxxxxxxxx.xxx().xxxxXxxxx.xxxXxxxxxxXxxx() - 1) + .xxxXxxx() + .xxxxXxxxXxXx(X.xx.xxxxxxxxxxxxxxxxxxxxxxxxxxx); + + xxxxxxXxxx( + xxxxxxxxxx + .xxxXxxxXxxxxXxxxxxxxxxxXxxxXxxxXxxxxXxxx(XXXxXXXXxXX, XXXXXXxXXXxXXXXxXX, XXXXXxXX) + .xxxxxxxxxxxXxxxXxxxXxxxxx()) + .xxxxxxxxXxxxxxx( + xxxxXxxxxxxxxxxXxxxXxxxXxxxx(xxxx1Xxxx, Xxxxx.XXxXXX), + xxxxXxxxxxxxxxxXxxxXxxxXxxxx(xxxx2Xxxx, Xxxxx.XXxXXX)); + + xxxx( + xxxx( + xxxx( + xxxx( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)))); + + assertThat( + main + .format("--offset", "0", "--length", String.valueOf(input.length()), path.toString())) + .isEqualTo(0); + } + + private static class GenerateDashboardRowFn + extends + XX.XxXx< + Xxxx< + Xxxx, + Xxxxx2.XxxXxxxXxxxxxxxxxx>>, + Xxxx> {} + + public class XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx + extends + XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx< + XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx, XxxxXxxxxxxXxxxxxxxx>> {} + + public class Foo + extends + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} + + public class Foo + extends + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + implements + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} + + public class Foo + extends + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + implements + Xxxxxxxxxxxxx, + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} + + { + Stream itemIdsStream = stream(members) + .flatMap(m -> m.getFieldValues() + .entrySet() + .stream() + .filter(fv -> itemLinkFieldIds.contains(fv.getKey())) + .flatMap(fv -> FieldDTO.deserializeStringToListOfStrings(fv.getValue()) + .stream() + .map(id -> new ItemKey(fieldsById.get(fv.getKey()).getItemTypeId(), id)))); + } +} +---------- +class B20128760 { + void f() { + x = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + XxxxxxxxxXxx.xxxxxxx() + .xxx(XxxxxxxxxXxxXxxx.Xxxxx.XXXXX, "Xxxxx xxxxxxxxx xxxxx") + .xxx( + XxxxxxxxxXxxXxxx.Xxxxx.XXXXXxXXXXX, + XxxxXxxxxxxxxx.xxxXxxxxxxxxXxxxxXxxxxXxXxxxxx(Xxxxxxxxxx.xxxXxxxXxxxx(x))) + .xxxxx(); + + xxxxxxXxxx(xxx.xxxXxXxxxxxxx(new XxxxxxxxxXxxxxxxx.Xxxxxxx() + .xxxxXxxxXxx(Xxxxx.xxxXxxxxXxxx( + new XxxxXx(xxxxxxxxx1.xxxXxxxXx().xxxXxxxx() + + xxxxxxxxx2.xxxXxxxXx().xxxXxxxx()))) + .xxxxx()) + .xxxXxxxxxx()) + .xxxxxxxxXxxxxxx(); + + XXxxxx xxxxxxxxxXxxXxxXxXxxxxxxxXx = XX.xxxxXxxXxxx2( + "XxxxXxxxxxxxXxxxXxxxXxxxxxxxXxxxXxxXxxxxxxXxxxxxxxx", + xxxxxxxxXxxxXxXxxxxxxxXx, + xxxxxxxxXxxxXxxxxXxxxXxXxxxxxxxXx) + .xxxxxxxxXx( + "XxxxxxxxXxxxxxxxxXxx", + xxxxxxxxXxxxxxxxxXxxXx, + XX.xxxxxXx(XX.xxxxx(), XX.xxxxxx(XxxxxxxXxxxxxxxxxxXxxxxxxxx.xxxxx))); + + xxXxxxxxxxXxxxXxxx = (XxxxXxxx) xxxxxxxxXxxxxxxxxx + .xxx() + .xxxxxXxxxxxx + .xxxXxxxxxxx(xxxxxxxxXxxxxxxxxx.xxx().xxxxXxxxx.xxxXxxxxxxXxxx() - 1) + .xxxXxxx() + .xxxxXxxxXxXx(X.xx.xxxxxxxxxxxxxxxxxxxxxxxxxxx); + + xxxxxxXxxx(xxxxxxxxxx + .xxxXxxxXxxxxXxxxxxxxxxxXxxxXxxxXxxxxXxxx(XXXxXXXXxXX, XXXXXXxXXXxXXXXxXX, XXXXXxXX) + .xxxxxxxxxxxXxxxXxxxXxxxxx()) + .xxxxxxxxXxxxxxx( + xxxxXxxxxxxxxxxXxxxXxxxXxxxx(xxxx1Xxxx, Xxxxx.XXxXXX), + xxxxXxxxxxxxxxxXxxxXxxxXxxxx(xxxx2Xxxx, Xxxxx.XXxXXX)); + + xxxx(xxxx(xxxx(xxxx(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)))); + + assertThat(main.format("--offset", "0", "--length", String.valueOf(input.length()), path.toString())) + .isEqualTo(0); + } + + private static class GenerateDashboardRowFn + extends XX.XxXx< + Xxxx>>, + Xxxx> {} + + public class XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx + extends XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx< + XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx, XxxxXxxxxxxXxxxxxxxx>> {} + + public class Foo extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} + + public class Foo extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} + + public class Foo extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + implements Xxxxxxxxxxxxx< + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>, + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} + + { + Stream itemIdsStream = stream(members) + .flatMap(m -> m.getFieldValues().entrySet().stream() + .filter(fv -> itemLinkFieldIds.contains(fv.getKey())) + .flatMap(fv -> FieldDTO.deserializeStringToListOfStrings(fv.getValue()).stream() + .map(id -> + new ItemKey(fieldsById.get(fv.getKey()).getItemTypeId(), id)))); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128760.output b/open-java-format/src/test/resources/test-cases/testdata/B20128760-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128760.output rename to open-java-format/src/test/resources/test-cases/testdata/B20128760-lf.case index b19ff68b0..eafcf54a2 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128760.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128760-lf.case @@ -1,3 +1,112 @@ +---------- +class B20128760 { + void f() { + x = + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + XxxxxxxxxXxx.xxxxxxx() + .xxx(XxxxxxxxxXxxXxxx.Xxxxx.XXXXX, "Xxxxx xxxxxxxxx xxxxx") + .xxx( + XxxxxxxxxXxxXxxx.Xxxxx.XXXXXxXXXXX, + XxxxXxxxxxxxxx.xxxXxxxxxxxxXxxxxXxxxxXxXxxxxx(Xxxxxxxxxx.xxxXxxxXxxxx(x))) + .xxxxx(); + + xxxxxxXxxx( + xxx + .xxxXxXxxxxxxx( + new XxxxxxxxxXxxxxxxx.Xxxxxxx() + .xxxxXxxxXxx( + Xxxxx.xxxXxxxxXxxx( + new XxxxXx( + xxxxxxxxx1.xxxXxxxXx().xxxXxxxx() + + xxxxxxxxx2.xxxXxxxXx().xxxXxxxx()))) + .xxxxx()) + .xxxXxxxxxx()) + .xxxxxxxxXxxxxxx(); + + XXxxxx xxxxxxxxxXxxXxxXxXxxxxxxxXx = + XX + .xxxxXxxXxxx2( + "XxxxXxxxxxxxXxxxXxxxXxxxxxxxXxxxXxxXxxxxxxXxxxxxxxx", + xxxxxxxxXxxxXxXxxxxxxxXx, + xxxxxxxxXxxxXxxxxXxxxXxXxxxxxxxXx) + .xxxxxxxxXx( + "XxxxxxxxXxxxxxxxxXxx", + xxxxxxxxXxxxxxxxxXxxXx, + XX.xxxxxXx(XX.xxxxx(), XX.xxxxxx(XxxxxxxXxxxxxxxxxxXxxxxxxxx.xxxxx))); + + xxXxxxxxxxXxxxXxxx = + (XxxxXxxx) + xxxxxxxxXxxxxxxxxx.xxx() + .xxxxxXxxxxxx + .xxxXxxxxxxx(xxxxxxxxXxxxxxxxxx.xxx().xxxxXxxxx.xxxXxxxxxxXxxx() - 1) + .xxxXxxx() + .xxxxXxxxXxXx(X.xx.xxxxxxxxxxxxxxxxxxxxxxxxxxx); + + xxxxxxXxxx( + xxxxxxxxxx + .xxxXxxxXxxxxXxxxxxxxxxxXxxxXxxxXxxxxXxxx(XXXxXXXXxXX, XXXXXXxXXXxXXXXxXX, XXXXXxXX) + .xxxxxxxxxxxXxxxXxxxXxxxxx()) + .xxxxxxxxXxxxxxx( + xxxxXxxxxxxxxxxXxxxXxxxXxxxx(xxxx1Xxxx, Xxxxx.XXxXXX), + xxxxXxxxxxxxxxxXxxxXxxxXxxxx(xxxx2Xxxx, Xxxxx.XXxXXX)); + + xxxx( + xxxx( + xxxx( + xxxx( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)))); + + assertThat( + main + .format("--offset", "0", "--length", String.valueOf(input.length()), path.toString())) + .isEqualTo(0); + } + + private static class GenerateDashboardRowFn + extends + XX.XxXx< + Xxxx< + Xxxx, + Xxxxx2.XxxXxxxXxxxxxxxxxx>>, + Xxxx> {} + + public class XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx + extends + XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx< + XxxxxxxXxxxxxxxXxxxXxxxxXxxxxxx, XxxxXxxxxxxXxxxxxxxx>> {} + + public class Foo + extends + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} + + public class Foo + extends + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + implements + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} + + public class Foo + extends + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + implements + Xxxxxxxxxxxxx, + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} + + { + Stream itemIdsStream = stream(members) + .flatMap(m -> m.getFieldValues() + .entrySet() + .stream() + .filter(fv -> itemLinkFieldIds.contains(fv.getKey())) + .flatMap(fv -> FieldDTO.deserializeStringToListOfStrings(fv.getValue()) + .stream() + .map(id -> new ItemKey(fieldsById.get(fv.getKey()).getItemTypeId(), id)))); + } +} +---------- class B20128760 { void f() { x = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx( diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20128921-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20128921-cr.case new file mode 100644 index 000000000..c527ca93b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128921-cr.case @@ -0,0 +1 @@ +---------- public class B20128921 { void m(Iterable ax) { for (T a : ax) { System.err.println(x); } } } ---------- public class B20128921 { void m(Iterable ax) { for (T a : ax) { System.err.println(x); } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20128921-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20128921-crlf.case new file mode 100644 index 000000000..5ce4589ab --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128921-crlf.case @@ -0,0 +1,22 @@ +---------- +public class B20128921 { + + void m(Iterable ax) { + + for (T a : ax) { + + System.err.println(x); + } + } +} +---------- +public class B20128921 { + + void m(Iterable ax) { + + for (T a : ax) { + + System.err.println(x); + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20128921-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20128921-lf.case new file mode 100644 index 000000000..4193f4608 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128921-lf.case @@ -0,0 +1,22 @@ +---------- +public class B20128921 { + + void m(Iterable ax) { + + for (T a : ax) { + + System.err.println(x); + } + } +} +---------- +public class B20128921 { + + void m(Iterable ax) { + + for (T a : ax) { + + System.err.println(x); + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20341001-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20341001-cr.case new file mode 100644 index 000000000..da121fcb1 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20341001-cr.case @@ -0,0 +1 @@ +---------- public class B20341001 { int[] xs = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; int[] xs = { Foo.CONSTxx, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; int[] xs = { Foo_CONST, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; int[] xs = { "foo", "0123456", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; int[] xs = { "foo", "01234567", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; { return ImmutableList.of( item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13); } } ---------- public class B20341001 { int[] xs = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; int[] xs = { Foo.CONSTxx, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; int[] xs = { Foo_CONST, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; int[] xs = { "foo", "0123456", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; int[] xs = { "foo", "01234567", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; { return ImmutableList.of( item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20341001-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20341001-crlf.case new file mode 100644 index 000000000..ebbec2b0d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20341001-crlf.case @@ -0,0 +1,352 @@ +---------- +public class B20341001 { + int[] xs = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + int[] xs = { + Foo.CONSTxx, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + int[] xs = { + Foo_CONST, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + int[] xs = { + "foo", + "0123456", + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + int[] xs = { + "foo", + "01234567", + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + { + return ImmutableList.of( + item1, + item2, + item3, + item4, + item5, + item6, + item7, + item8, + item9, + item10, + item11, + item12, + item13); + } +} +---------- +public class B20341001 { + int[] xs = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + int[] xs = { + Foo.CONSTxx, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + }; + int[] xs = { + Foo_CONST, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + int[] xs = { + "foo", "0123456", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + int[] xs = { + "foo", + "01234567", + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + }; + + { + return ImmutableList.of( + item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20341001.output b/open-java-format/src/test/resources/test-cases/testdata/B20341001-lf.case similarity index 64% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20341001.output rename to open-java-format/src/test/resources/test-cases/testdata/B20341001-lf.case index 3e7d9bb55..3f48907d9 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20341001.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B20341001-lf.case @@ -1,3 +1,59 @@ +---------- +public class B20341001 { + int[] xs = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + int[] xs = { + Foo.CONSTxx, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + int[] xs = { + Foo_CONST, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + int[] xs = { + "foo", + "0123456", + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + int[] xs = { + "foo", + "01234567", + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + { + return ImmutableList.of( + item1, + item2, + item3, + item4, + item5, + item6, + item7, + item8, + item9, + item10, + item11, + item12, + item13); + } +} +---------- public class B20341001 { int[] xs = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20524742-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20524742-cr.case new file mode 100644 index 000000000..679122952 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20524742-cr.case @@ -0,0 +1 @@ +---------- class Test {{ int x; }} ---------- class Test { { int x; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20524742-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20524742-crlf.case new file mode 100644 index 000000000..9ff884d55 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20524742-crlf.case @@ -0,0 +1,10 @@ +---------- +class Test {{ + int x; +}} +---------- +class Test { + { + int x; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20524742-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20524742-lf.case new file mode 100644 index 000000000..879ac0ed2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20524742-lf.case @@ -0,0 +1,10 @@ +---------- +class Test {{ + int x; +}} +---------- +class Test { + { + int x; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20529113-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20529113-cr.case new file mode 100644 index 000000000..8ae4a34ce --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20529113-cr.case @@ -0,0 +1 @@ +---------- @BugPattern(category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) @BugPattern( name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) @BugPattern( name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, explanation = "If an AsyncFunction always returns immediateFuture() and never throws, it can " + "be replaced with a Function.", category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) class Test { } ---------- @BugPattern(category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) @BugPattern( name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) @BugPattern( name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, explanation = "If an AsyncFunction always returns immediateFuture() and never throws, it can " + "be replaced with a Function.", category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) class Test {} \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20529113-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20529113-crlf.case new file mode 100644 index 000000000..7c094639d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20529113-crlf.case @@ -0,0 +1,30 @@ +---------- +@BugPattern(category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) +@BugPattern( + name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, + category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) +@BugPattern( + name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, + explanation = + "If an AsyncFunction always returns immediateFuture() and never throws, it can " + + "be replaced with a Function.", + category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) +class Test { +} +---------- +@BugPattern(category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) +@BugPattern( + name = "AsyncFunctionReturnsImmediate", + summary = SIMPLIFY, + category = GUAVA, + severity = NOT_A_PROBLEM, + maturity = EXPERIMENTAL) +@BugPattern( + name = "AsyncFunctionReturnsImmediate", + summary = SIMPLIFY, + explanation = "If an AsyncFunction always returns immediateFuture() and never throws, it can " + + "be replaced with a Function.", + category = GUAVA, + severity = NOT_A_PROBLEM, + maturity = EXPERIMENTAL) +class Test {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20529113.output b/open-java-format/src/test/resources/test-cases/testdata/B20529113-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20529113.output rename to open-java-format/src/test/resources/test-cases/testdata/B20529113-lf.case index 24957a2f5..f25a3e356 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20529113.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B20529113-lf.case @@ -1,3 +1,17 @@ +---------- +@BugPattern(category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) +@BugPattern( + name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, + category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) +@BugPattern( + name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, + explanation = + "If an AsyncFunction always returns immediateFuture() and never throws, it can " + + "be replaced with a Function.", + category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) +class Test { +} +---------- @BugPattern(category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) @BugPattern( name = "AsyncFunctionReturnsImmediate", diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20531711-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20531711-cr.case new file mode 100644 index 000000000..964736fdc --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20531711-cr.case @@ -0,0 +1 @@ +---------- class B20531711 { void m() { when(mLoginHelper.getAllAccounts()).thenReturn( new Account[] { new Account("test1", "test1"), new Account("test2", "test2"), }); when(mLoginHelper.getAllAccounts()).thenReturn( new Account[] { new Account("test1", "test1"), new Account("test2", "test2"), // asd }); } } ---------- class B20531711 { void m() { when(mLoginHelper.getAllAccounts()).thenReturn(new Account[] { new Account("test1", "test1"), new Account("test2", "test2"), }); when(mLoginHelper.getAllAccounts()).thenReturn(new Account[] { new Account("test1", "test1"), new Account("test2", "test2"), // asd }); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20531711-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20531711-crlf.case new file mode 100644 index 000000000..976063e4a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20531711-crlf.case @@ -0,0 +1,30 @@ +---------- +class B20531711 { + void m() { + when(mLoginHelper.getAllAccounts()).thenReturn( + new Account[] { + new Account("test1", "test1"), + new Account("test2", "test2"), + }); + + when(mLoginHelper.getAllAccounts()).thenReturn( + new Account[] { + new Account("test1", "test1"), + new Account("test2", "test2"), +// asd + }); + } +} +---------- +class B20531711 { + void m() { + when(mLoginHelper.getAllAccounts()).thenReturn(new Account[] { + new Account("test1", "test1"), new Account("test2", "test2"), + }); + + when(mLoginHelper.getAllAccounts()).thenReturn(new Account[] { + new Account("test1", "test1"), new Account("test2", "test2"), + // asd + }); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20531711-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20531711-lf.case new file mode 100644 index 000000000..388a7993b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20531711-lf.case @@ -0,0 +1,30 @@ +---------- +class B20531711 { + void m() { + when(mLoginHelper.getAllAccounts()).thenReturn( + new Account[] { + new Account("test1", "test1"), + new Account("test2", "test2"), + }); + + when(mLoginHelper.getAllAccounts()).thenReturn( + new Account[] { + new Account("test1", "test1"), + new Account("test2", "test2"), +// asd + }); + } +} +---------- +class B20531711 { + void m() { + when(mLoginHelper.getAllAccounts()).thenReturn(new Account[] { + new Account("test1", "test1"), new Account("test2", "test2"), + }); + + when(mLoginHelper.getAllAccounts()).thenReturn(new Account[] { + new Account("test1", "test1"), new Account("test2", "test2"), + // asd + }); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20535125-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20535125-cr.case new file mode 100644 index 000000000..88de6b8d0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20535125-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; class Test { void m() { if (!metadata.ignoreOutputTransformations() && Producers.isListenableFutureMapKey(outputKey)) { ImmutableList> nodes = createMapNodes((ProducerNode) node); checkCollectionNodesAgainstWhitelist(nodes, whitelist); return nodes; } else if (!metadata.ignoreOutputTransformations() && Producers.isListenableFutureListKey(outputKey)) { ImmutableList> nodes = createListNodes((ProducerNode) node); return nodes; } Set shorts = new HashSet<>(); for (short i = 0; i < 99; ++i) { shorts.add(i); shorts.remove(i - 1); } short i = 0; do { shorts.add(i); shorts.remove(i - 1); i++; } while (i < 99); if (true) { System.err.println("Hi"); } if (true) { System.err.println("Hi"); } else { System.err.println("Hi"); } if (true) { System.err.println("Hi"); } else if (true) { System.err.println("Hi"); } else { System.err.println("Hi"); } try { throw new Exception(); } catch (Exception e) { System.err.println("Hi"); } try { throw new Exception(); } finally { System.err.println("Hi"); } try { throw new Exception(); } catch (Exception e) { System.err.println("Hi"); } finally { System.err.println("Hi"); } try { throw new Exception(); } catch (Exception e) { System.err.println("Hi"); } catch (Exception e) { System.err.println("Hi"); } finally { System.err.println("Hi"); } try (Lock l = lock.lock()) {} try (Lock l = lock.lock()) {} finally {} for (;;) {} while (true) {} do {} while (true); if (true) {} if (true) {} else if (true) {} if (true) {} else if (true) {} else if (true) {} if (true) {} else if (true) {} else {} if (true) {} else if (true) {} else if (true) {} else {} try {} catch (Exception e) {} catch (Exception e) {} finally {} try {} catch (Exception e) {} finally {} try {} catch (Exception e) {} catch (Exception e) {} try {} catch (Exception e) {} } } ---------- package com.google.googlejavaformat.java.test; class Test { void m() { if (!metadata.ignoreOutputTransformations() && Producers.isListenableFutureMapKey(outputKey)) { ImmutableList> nodes = createMapNodes((ProducerNode) node); checkCollectionNodesAgainstWhitelist(nodes, whitelist); return nodes; } else if (!metadata.ignoreOutputTransformations() && Producers.isListenableFutureListKey(outputKey)) { ImmutableList> nodes = createListNodes((ProducerNode) node); return nodes; } Set shorts = new HashSet<>(); for (short i = 0; i < 99; ++i) { shorts.add(i); shorts.remove(i - 1); } short i = 0; do { shorts.add(i); shorts.remove(i - 1); i++; } while (i < 99); if (true) { System.err.println("Hi"); } if (true) { System.err.println("Hi"); } else { System.err.println("Hi"); } if (true) { System.err.println("Hi"); } else if (true) { System.err.println("Hi"); } else { System.err.println("Hi"); } try { throw new Exception(); } catch (Exception e) { System.err.println("Hi"); } try { throw new Exception(); } finally { System.err.println("Hi"); } try { throw new Exception(); } catch (Exception e) { System.err.println("Hi"); } finally { System.err.println("Hi"); } try { throw new Exception(); } catch (Exception e) { System.err.println("Hi"); } catch (Exception e) { System.err.println("Hi"); } finally { System.err.println("Hi"); } try (Lock l = lock.lock()) {} try (Lock l = lock.lock()) { } finally { } for (; ; ) {} while (true) {} do {} while (true); if (true) {} if (true) { } else if (true) { } if (true) { } else if (true) { } else if (true) { } if (true) { } else if (true) { } else { } if (true) { } else if (true) { } else if (true) { } else { } try { } catch (Exception e) { } catch (Exception e) { } finally { } try { } catch (Exception e) { } finally { } try { } catch (Exception e) { } catch (Exception e) { } try { } catch (Exception e) { } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20535125-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20535125-crlf.case new file mode 100644 index 000000000..eed66acca --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20535125-crlf.case @@ -0,0 +1,308 @@ +---------- +package com.google.googlejavaformat.java.test; + +class Test { + void m() { + if (!metadata.ignoreOutputTransformations() + && Producers.isListenableFutureMapKey(outputKey)) { + ImmutableList> nodes = createMapNodes((ProducerNode) node); + checkCollectionNodesAgainstWhitelist(nodes, whitelist); + return nodes; + + } else if (!metadata.ignoreOutputTransformations() + && Producers.isListenableFutureListKey(outputKey)) { + ImmutableList> nodes = createListNodes((ProducerNode) node); + return nodes; + } + + Set shorts = new HashSet<>(); + for (short i = 0; i < 99; ++i) { + + shorts.add(i); + shorts.remove(i - 1); + + } + + short i = 0; + do { + + shorts.add(i); + shorts.remove(i - 1); + i++; + + } while (i < 99); + + if (true) { + + System.err.println("Hi"); + + } + + if (true) { + + System.err.println("Hi"); + + } else { + + System.err.println("Hi"); + + } + + if (true) { + + System.err.println("Hi"); + + } else if (true) { + + System.err.println("Hi"); + + } else { + + System.err.println("Hi"); + + } + + try { + + throw new Exception(); + + } catch (Exception e) { + + System.err.println("Hi"); + + } + + try { + + throw new Exception(); + + } finally { + + System.err.println("Hi"); + + } + + try { + + throw new Exception(); + + } catch (Exception e) { + + System.err.println("Hi"); + + } finally { + + System.err.println("Hi"); + + } + + try { + + throw new Exception(); + + } catch (Exception e) { + + System.err.println("Hi"); + + } catch (Exception e) { + + System.err.println("Hi"); + + } finally { + + System.err.println("Hi"); + + } + + try (Lock l = lock.lock()) {} + + try (Lock l = lock.lock()) {} finally {} + + for (;;) {} + + while (true) {} + + do {} while (true); + + if (true) {} + + if (true) {} else if (true) {} + + if (true) {} else if (true) {} else if (true) {} + + if (true) {} else if (true) {} else {} + + if (true) {} else if (true) {} else if (true) {} else {} + + try {} catch (Exception e) {} catch (Exception e) {} finally {} + + try {} catch (Exception e) {} finally {} + + try {} catch (Exception e) {} catch (Exception e) {} + + try {} catch (Exception e) {} + + } + +} +---------- +package com.google.googlejavaformat.java.test; + +class Test { + void m() { + if (!metadata.ignoreOutputTransformations() && Producers.isListenableFutureMapKey(outputKey)) { + ImmutableList> nodes = createMapNodes((ProducerNode) node); + checkCollectionNodesAgainstWhitelist(nodes, whitelist); + return nodes; + + } else if (!metadata.ignoreOutputTransformations() && Producers.isListenableFutureListKey(outputKey)) { + ImmutableList> nodes = createListNodes((ProducerNode) node); + return nodes; + } + + Set shorts = new HashSet<>(); + for (short i = 0; i < 99; ++i) { + + shorts.add(i); + shorts.remove(i - 1); + } + + short i = 0; + do { + + shorts.add(i); + shorts.remove(i - 1); + i++; + + } while (i < 99); + + if (true) { + + System.err.println("Hi"); + } + + if (true) { + + System.err.println("Hi"); + + } else { + + System.err.println("Hi"); + } + + if (true) { + + System.err.println("Hi"); + + } else if (true) { + + System.err.println("Hi"); + + } else { + + System.err.println("Hi"); + } + + try { + + throw new Exception(); + + } catch (Exception e) { + + System.err.println("Hi"); + } + + try { + + throw new Exception(); + + } finally { + + System.err.println("Hi"); + } + + try { + + throw new Exception(); + + } catch (Exception e) { + + System.err.println("Hi"); + + } finally { + + System.err.println("Hi"); + } + + try { + + throw new Exception(); + + } catch (Exception e) { + + System.err.println("Hi"); + + } catch (Exception e) { + + System.err.println("Hi"); + + } finally { + + System.err.println("Hi"); + } + + try (Lock l = lock.lock()) {} + + try (Lock l = lock.lock()) { + } finally { + } + + for (; ; ) {} + + while (true) {} + + do {} while (true); + + if (true) {} + + if (true) { + } else if (true) { + } + + if (true) { + } else if (true) { + } else if (true) { + } + + if (true) { + } else if (true) { + } else { + } + + if (true) { + } else if (true) { + } else if (true) { + } else { + } + + try { + } catch (Exception e) { + } catch (Exception e) { + } finally { + } + + try { + } catch (Exception e) { + } finally { + } + + try { + } catch (Exception e) { + } catch (Exception e) { + } + + try { + } catch (Exception e) { + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20535125.output b/open-java-format/src/test/resources/test-cases/testdata/B20535125-lf.case similarity index 55% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20535125.output rename to open-java-format/src/test/resources/test-cases/testdata/B20535125-lf.case index 431571cfc..52e513af4 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20535125.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B20535125-lf.case @@ -1,3 +1,151 @@ +---------- +package com.google.googlejavaformat.java.test; + +class Test { + void m() { + if (!metadata.ignoreOutputTransformations() + && Producers.isListenableFutureMapKey(outputKey)) { + ImmutableList> nodes = createMapNodes((ProducerNode) node); + checkCollectionNodesAgainstWhitelist(nodes, whitelist); + return nodes; + + } else if (!metadata.ignoreOutputTransformations() + && Producers.isListenableFutureListKey(outputKey)) { + ImmutableList> nodes = createListNodes((ProducerNode) node); + return nodes; + } + + Set shorts = new HashSet<>(); + for (short i = 0; i < 99; ++i) { + + shorts.add(i); + shorts.remove(i - 1); + + } + + short i = 0; + do { + + shorts.add(i); + shorts.remove(i - 1); + i++; + + } while (i < 99); + + if (true) { + + System.err.println("Hi"); + + } + + if (true) { + + System.err.println("Hi"); + + } else { + + System.err.println("Hi"); + + } + + if (true) { + + System.err.println("Hi"); + + } else if (true) { + + System.err.println("Hi"); + + } else { + + System.err.println("Hi"); + + } + + try { + + throw new Exception(); + + } catch (Exception e) { + + System.err.println("Hi"); + + } + + try { + + throw new Exception(); + + } finally { + + System.err.println("Hi"); + + } + + try { + + throw new Exception(); + + } catch (Exception e) { + + System.err.println("Hi"); + + } finally { + + System.err.println("Hi"); + + } + + try { + + throw new Exception(); + + } catch (Exception e) { + + System.err.println("Hi"); + + } catch (Exception e) { + + System.err.println("Hi"); + + } finally { + + System.err.println("Hi"); + + } + + try (Lock l = lock.lock()) {} + + try (Lock l = lock.lock()) {} finally {} + + for (;;) {} + + while (true) {} + + do {} while (true); + + if (true) {} + + if (true) {} else if (true) {} + + if (true) {} else if (true) {} else if (true) {} + + if (true) {} else if (true) {} else {} + + if (true) {} else if (true) {} else if (true) {} else {} + + try {} catch (Exception e) {} catch (Exception e) {} finally {} + + try {} catch (Exception e) {} finally {} + + try {} catch (Exception e) {} catch (Exception e) {} + + try {} catch (Exception e) {} + + } + +} +---------- package com.google.googlejavaformat.java.test; class Test { diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20567842-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20567842-cr.case new file mode 100644 index 000000000..a31c72c40 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20567842-cr.case @@ -0,0 +1 @@ +---------- public class B20567842 { // don't try to wrap the rhs as '{1, 2, 3}', go to block-like initializer style: int[] xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = {1, 2, 3}; // force block style, but not one-per-line for trailing ',': int[] x = {a.b, true ? 1 : 2, CONST,}; // don't format one-per-line here: int[] x = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; } ---------- public class B20567842 { // don't try to wrap the rhs as '{1, 2, 3}', go to block-like initializer style: int[] xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = {1, 2, 3}; // force block style, but not one-per-line for trailing ',': int[] x = { a.b, true ? 1 : 2, CONST, }; // don't format one-per-line here: int[] x = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20567842-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20567842-crlf.case new file mode 100644 index 000000000..87de91e80 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20567842-crlf.case @@ -0,0 +1,26 @@ +---------- +public class B20567842 { + // don't try to wrap the rhs as '{1, 2, 3}', go to block-like initializer style: + int[] xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = {1, 2, 3}; + + // force block style, but not one-per-line for trailing ',': + int[] x = {a.b, true ? 1 : 2, CONST,}; + + // don't format one-per-line here: + int[] x = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; +} +---------- +public class B20567842 { + // don't try to wrap the rhs as '{1, 2, 3}', go to block-like initializer style: + int[] xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = {1, 2, 3}; + + // force block style, but not one-per-line for trailing ',': + int[] x = { + a.b, true ? 1 : 2, CONST, + }; + + // don't format one-per-line here: + int[] x = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20567842.output b/open-java-format/src/test/resources/test-cases/testdata/B20567842-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20567842.output rename to open-java-format/src/test/resources/test-cases/testdata/B20567842-lf.case index 171e34cd0..2cd2ebc8a 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20567842.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B20567842-lf.case @@ -1,3 +1,15 @@ +---------- +public class B20567842 { + // don't try to wrap the rhs as '{1, 2, 3}', go to block-like initializer style: + int[] xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = {1, 2, 3}; + + // force block style, but not one-per-line for trailing ',': + int[] x = {a.b, true ? 1 : 2, CONST,}; + + // don't format one-per-line here: + int[] x = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; +} +---------- public class B20567842 { // don't try to wrap the rhs as '{1, 2, 3}', go to block-like initializer style: int[] xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = {1, 2, 3}; diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20569245-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20569245-cr.case new file mode 100644 index 000000000..d8fa95742 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20569245-cr.case @@ -0,0 +1 @@ +---------- class B20569245 { void m() { if (true) System.err.println("asd"); if (true) System.err.println("asd"); else if (true) System.err.println("asd"); else System.err.println("asd"); if (true) System.err.println("asd"); else if (true) System.err.println("asd"); if (true) System.err.println("asd"); else System.err.println("asd"); if (true) System.err.println("asd"); if (true) System.err.println("asd"); else if (true) System.err.println("asd"); else System.err.println("asd"); if (true) System.err.println("asd"); else if (true) System.err.println("asd"); if (true) System.err.println("asd"); else System.err.println("asd"); } } ---------- class B20569245 { void m() { if (true) System.err.println("asd"); if (true) System.err.println("asd"); else if (true) System.err.println("asd"); else System.err.println("asd"); if (true) System.err.println("asd"); else if (true) System.err.println("asd"); if (true) System.err.println("asd"); else System.err.println("asd"); if (true) System.err.println("asd"); if (true) System.err.println("asd"); else if (true) System.err.println("asd"); else System.err.println("asd"); if (true) System.err.println("asd"); else if (true) System.err.println("asd"); if (true) System.err.println("asd"); else System.err.println("asd"); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20569245-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20569245-crlf.case new file mode 100644 index 000000000..89790f9a2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20569245-crlf.case @@ -0,0 +1,64 @@ +---------- +class B20569245 { + void m() { + if (true) System.err.println("asd"); + + if (true) System.err.println("asd"); + else if (true) System.err.println("asd"); + else System.err.println("asd"); + + if (true) System.err.println("asd"); + else if (true) System.err.println("asd"); + + if (true) System.err.println("asd"); + else System.err.println("asd"); + + if (true) + System.err.println("asd"); + + if (true) + System.err.println("asd"); + else if (true) + System.err.println("asd"); + else + System.err.println("asd"); + + if (true) + System.err.println("asd"); + else if (true) + System.err.println("asd"); + + if (true) + System.err.println("asd"); + else + System.err.println("asd"); + } +} +---------- +class B20569245 { + void m() { + if (true) System.err.println("asd"); + + if (true) System.err.println("asd"); + else if (true) System.err.println("asd"); + else System.err.println("asd"); + + if (true) System.err.println("asd"); + else if (true) System.err.println("asd"); + + if (true) System.err.println("asd"); + else System.err.println("asd"); + + if (true) System.err.println("asd"); + + if (true) System.err.println("asd"); + else if (true) System.err.println("asd"); + else System.err.println("asd"); + + if (true) System.err.println("asd"); + else if (true) System.err.println("asd"); + + if (true) System.err.println("asd"); + else System.err.println("asd"); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20569245-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20569245-lf.case new file mode 100644 index 000000000..b449039b3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20569245-lf.case @@ -0,0 +1,64 @@ +---------- +class B20569245 { + void m() { + if (true) System.err.println("asd"); + + if (true) System.err.println("asd"); + else if (true) System.err.println("asd"); + else System.err.println("asd"); + + if (true) System.err.println("asd"); + else if (true) System.err.println("asd"); + + if (true) System.err.println("asd"); + else System.err.println("asd"); + + if (true) + System.err.println("asd"); + + if (true) + System.err.println("asd"); + else if (true) + System.err.println("asd"); + else + System.err.println("asd"); + + if (true) + System.err.println("asd"); + else if (true) + System.err.println("asd"); + + if (true) + System.err.println("asd"); + else + System.err.println("asd"); + } +} +---------- +class B20569245 { + void m() { + if (true) System.err.println("asd"); + + if (true) System.err.println("asd"); + else if (true) System.err.println("asd"); + else System.err.println("asd"); + + if (true) System.err.println("asd"); + else if (true) System.err.println("asd"); + + if (true) System.err.println("asd"); + else System.err.println("asd"); + + if (true) System.err.println("asd"); + + if (true) System.err.println("asd"); + else if (true) System.err.println("asd"); + else System.err.println("asd"); + + if (true) System.err.println("asd"); + else if (true) System.err.println("asd"); + + if (true) System.err.println("asd"); + else System.err.println("asd"); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20577626-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20577626-cr.case new file mode 100644 index 000000000..2c6f02108 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20577626-cr.case @@ -0,0 +1 @@ +---------- class B20577626 { private @Mock GsaConfigFlags mGsaConfig; @Foo @Bar private @Mock GsaConfigFlags mGsaConfig; @Foo abstract @Bar void m() {} @Foo @Baz abstract @Bar void m() {} } ---------- class B20577626 { private @Mock GsaConfigFlags mGsaConfig; @Foo @Bar private @Mock GsaConfigFlags mGsaConfig; @Foo abstract @Bar void m() {} @Foo @Baz abstract @Bar void m() {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20577626-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20577626-crlf.case new file mode 100644 index 000000000..d52dbfdb5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20577626-crlf.case @@ -0,0 +1,34 @@ +---------- +class B20577626 { + private @Mock + GsaConfigFlags mGsaConfig; + + @Foo + @Bar + private @Mock + GsaConfigFlags mGsaConfig; + + @Foo + abstract @Bar + void m() {} + + @Foo + @Baz + abstract @Bar + void m() {} +} +---------- +class B20577626 { + private @Mock GsaConfigFlags mGsaConfig; + + @Foo + @Bar + private @Mock GsaConfigFlags mGsaConfig; + + @Foo + abstract @Bar void m() {} + + @Foo + @Baz + abstract @Bar void m() {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20577626-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20577626-lf.case new file mode 100644 index 000000000..8177a5e22 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20577626-lf.case @@ -0,0 +1,34 @@ +---------- +class B20577626 { + private @Mock + GsaConfigFlags mGsaConfig; + + @Foo + @Bar + private @Mock + GsaConfigFlags mGsaConfig; + + @Foo + abstract @Bar + void m() {} + + @Foo + @Baz + abstract @Bar + void m() {} +} +---------- +class B20577626 { + private @Mock GsaConfigFlags mGsaConfig; + + @Foo + @Bar + private @Mock GsaConfigFlags mGsaConfig; + + @Foo + abstract @Bar void m() {} + + @Foo + @Baz + abstract @Bar void m() {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20578077-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20578077-cr.case new file mode 100644 index 000000000..55646d4e3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20578077-cr.case @@ -0,0 +1 @@ +---------- class B20578077 { { new IteratorTester( 4, MODIFIABLE, newArrayList(1, 2), IteratorTester.KnownOrder.KNOWN_ORDER) { @Override protected Iterator newTargetIterator() { Iterator iterator = Lists.newArrayList(1, 2).iterator(); return new IteratorWithSunJavaBug6529795(iterator); } } .test(); } } ---------- class B20578077 { { new IteratorTester(4, MODIFIABLE, newArrayList(1, 2), IteratorTester.KnownOrder.KNOWN_ORDER) { @Override protected Iterator newTargetIterator() { Iterator iterator = Lists.newArrayList(1, 2).iterator(); return new IteratorWithSunJavaBug6529795(iterator); } }.test(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20578077-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20578077-crlf.case new file mode 100644 index 000000000..7cebf018b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20578077-crlf.case @@ -0,0 +1,26 @@ +---------- +class B20578077 { + { + new IteratorTester( + 4, MODIFIABLE, newArrayList(1, 2), IteratorTester.KnownOrder.KNOWN_ORDER) { + @Override + protected Iterator newTargetIterator() { + Iterator iterator = Lists.newArrayList(1, 2).iterator(); + return new IteratorWithSunJavaBug6529795(iterator); + } + } + .test(); + } +} +---------- +class B20578077 { + { + new IteratorTester(4, MODIFIABLE, newArrayList(1, 2), IteratorTester.KnownOrder.KNOWN_ORDER) { + @Override + protected Iterator newTargetIterator() { + Iterator iterator = Lists.newArrayList(1, 2).iterator(); + return new IteratorWithSunJavaBug6529795(iterator); + } + }.test(); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20578077.output b/open-java-format/src/test/resources/test-cases/testdata/B20578077-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20578077.output rename to open-java-format/src/test/resources/test-cases/testdata/B20578077-lf.case index 898534444..73444f55d 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20578077.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B20578077-lf.case @@ -1,3 +1,18 @@ +---------- +class B20578077 { + { + new IteratorTester( + 4, MODIFIABLE, newArrayList(1, 2), IteratorTester.KnownOrder.KNOWN_ORDER) { + @Override + protected Iterator newTargetIterator() { + Iterator iterator = Lists.newArrayList(1, 2).iterator(); + return new IteratorWithSunJavaBug6529795(iterator); + } + } + .test(); + } +} +---------- class B20578077 { { new IteratorTester(4, MODIFIABLE, newArrayList(1, 2), IteratorTester.KnownOrder.KNOWN_ORDER) { diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20580212-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20580212-cr.case new file mode 100644 index 000000000..ae3184c9b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20580212-cr.case @@ -0,0 +1 @@ +---------- class B20580212 { void m() { GroupExpansionReply mockIsgReply = buildRecipientListSubGroupReply( RECIPIENT1, alternatives /* isgExpansions */, alternativesDeltas /* isgExpansionsScoreDeltas */, false /* withRecipient */, 0 /* recipientScoreDelta */); try { } catch (IllegalStateException e) { /* expected */ } } static class ThrowsAtEndException extends RuntimeException { /* nothing */ } } ---------- class B20580212 { void m() { GroupExpansionReply mockIsgReply = buildRecipientListSubGroupReply( RECIPIENT1, alternatives /* isgExpansions */, alternativesDeltas /* isgExpansionsScoreDeltas */, false /* withRecipient */, 0 /* recipientScoreDelta */); try { } catch (IllegalStateException e) { /* expected */ } } static class ThrowsAtEndException extends RuntimeException { /* nothing */ } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20580212-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20580212-crlf.case new file mode 100644 index 000000000..ac5e0c13f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20580212-crlf.case @@ -0,0 +1,37 @@ +---------- +class B20580212 { + void m() { + GroupExpansionReply mockIsgReply = + buildRecipientListSubGroupReply( + RECIPIENT1, + alternatives /* isgExpansions */, + alternativesDeltas /* isgExpansionsScoreDeltas */, + false /* withRecipient */, + 0 /* recipientScoreDelta */); + + try { + } catch (IllegalStateException e) { /* expected */ } + } + + static class ThrowsAtEndException extends RuntimeException { /* nothing */ } +} +---------- +class B20580212 { + void m() { + GroupExpansionReply mockIsgReply = buildRecipientListSubGroupReply( + RECIPIENT1, + alternatives /* isgExpansions */, + alternativesDeltas /* isgExpansionsScoreDeltas */, + false /* withRecipient */, + 0 /* recipientScoreDelta */); + + try { + } catch (IllegalStateException e) { + /* expected */ + } + } + + static class ThrowsAtEndException extends RuntimeException { + /* nothing */ + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20580212.output b/open-java-format/src/test/resources/test-cases/testdata/B20580212-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20580212.output rename to open-java-format/src/test/resources/test-cases/testdata/B20580212-lf.case index 26e921476..3db5f0efd 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20580212.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B20580212-lf.case @@ -1,3 +1,21 @@ +---------- +class B20580212 { + void m() { + GroupExpansionReply mockIsgReply = + buildRecipientListSubGroupReply( + RECIPIENT1, + alternatives /* isgExpansions */, + alternativesDeltas /* isgExpansionsScoreDeltas */, + false /* withRecipient */, + 0 /* recipientScoreDelta */); + + try { + } catch (IllegalStateException e) { /* expected */ } + } + + static class ThrowsAtEndException extends RuntimeException { /* nothing */ } +} +---------- class B20580212 { void m() { GroupExpansionReply mockIsgReply = buildRecipientListSubGroupReply( diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20701054-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20701054-cr.case new file mode 100644 index 000000000..91fe9df3e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20701054-cr.case @@ -0,0 +1 @@ +---------- class B20701054 { void m() { ImmutableList x = ImmutableList.builder().add(1).build(); OptionalBinder.newOptionalBinder(binder(), InputWhitelist.class).setBinding().to( AllInputWhitelist.class); Foo z = Foo.INSTANCE.field; Foo z = Foo.INSTANCE.field.field; Foo z = Foo.INSTANCE.field.field.field; Foo z = Foo.INSTANCE.field.field.field.field; Foo z = Foo.INSTANCE.field.field.field.field.field; ImmutableList x = ImmutableList.INSTANCE.add(1).build(); ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).build(); ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).add(3).build(); ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).add(3).add(4).build(); ImmutableList x = ImmutableList.builder().add(1).build(); ImmutableList x = ImmutableList.builder().add(1).add(2).build(); ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).build(); ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).add(4).build(); ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).add(4).add(5).build(); ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).add(4).add(5).add(6).build(); ImmutableList x = new ImmutableList.Builder<>() .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .build(); ImmutableList x = ImmutableList.new Builder<>() .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .build(); System.err.println( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); Class.my.contrived.example.function( veryLongArgumentxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); PTable> latestResults = FJ.joinOneShot2(accountSummaryProvider.get(), results).parallelDo( "extractPageSpeedUrls", new ExtractPageSpeedUrlsFn(false)); PTable adImpressionsByAccount = impressionExtractor.getImpressionBreakdownByAccountId().parallelDo( "rekeyAdImpressionsByAccountId", new ExtractTotalImpressionsFn()); PTable crawlerErrorsByCode = crawlReportSource.read("readCrawlReportTable").parallelDo( "reKeyErrorsByPropertyCode", new RekeyErrorsByPropertyCodeFn()); if (ImmutableList.builder().add(1).add(2).add(3)) { } if (ImmutableList.builder() .add(1) .add(2) .add(3) .add(4)) {} if (value.fst.name.toString().equals("value")) { } analysis().analyze(compilationUnit, context, configuration, new DescriptionListener() { @Override public void onDescribed(Description description) { listener.onDescribed(description.filterFixes(new Predicate() { @Override public boolean apply(Fix fix) { return compiles(fix, (JCCompilationUnit) compilationUnit, context); } })); } }); (test ? xxx : yyy).zzz(xxx); (test ? xxx : yyy) .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); (test ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); zzzzzzzzzzzzzzzzzzzz.zzzzzzzzzzzzzzzzzzzzzzzzzzz.zzzzzzzzzzzzzzzzzzzzzzzzzzzzz( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); field.field.field.field.field.field.field.field.field.field.field.field.field.field.field.field .field.field.field.field.field.method( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); (test ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) .field.field.field.field.field.field.field.field.field.field.field.field.field.method( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); (test ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) .field.field.field.field.field.field.field.field.field.field.field.field.field.field.field .field.field.field.field.field.field.method( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); field.field.field.field.field.field.method( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); field.field.field.field.field.field.method( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(); edu.oswego.cs.dl.util.concurrent.misc.ImmutableList.builder( zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) .zzzzzzz( zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) .zzzzzzz( zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) .zzzzzzz( zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz); edu.oswego.cs.dl.util.concurrent.misc.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz .ImmutableList.builder( zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) .zzzzzzz( zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) .zzzzzzz( zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) .zzzzzzz( zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz); int u = edu.oswego.cs.dl.util.concurrent.misc.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz .ImmutableList.builder( zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; for (String configured : errorProneOptions().getSeverityMap().keySet()) {} return fffffffffff( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); return fffffffffff( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) .fffffffffffff( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); } } ---------- class B20701054 { void m() { ImmutableList x = ImmutableList.builder().add(1).build(); OptionalBinder.newOptionalBinder(binder(), InputWhitelist.class) .setBinding() .to(AllInputWhitelist.class); Foo z = Foo.INSTANCE.field; Foo z = Foo.INSTANCE.field.field; Foo z = Foo.INSTANCE.field.field.field; Foo z = Foo.INSTANCE.field.field.field.field; Foo z = Foo.INSTANCE.field.field.field.field.field; ImmutableList x = ImmutableList.INSTANCE.add(1).build(); ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).build(); ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).add(3).build(); ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).add(3).add(4).build(); ImmutableList x = ImmutableList.builder().add(1).build(); ImmutableList x = ImmutableList.builder().add(1).add(2).build(); ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).build(); ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).add(4).build(); ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).add(4).add(5).build(); ImmutableList x = ImmutableList.builder() .add(1) .add(2) .add(3) .add(4) .add(5) .add(6) .build(); ImmutableList x = new ImmutableList.Builder<>() .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .build(); ImmutableList x = ImmutableList.new Builder<>() .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .add(xxxxx) .build(); System.err.println(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); Class.my.contrived.example.function( veryLongArgumentxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); PTable> latestResults = FJ.joinOneShot2(accountSummaryProvider.get(), results) .parallelDo("extractPageSpeedUrls", new ExtractPageSpeedUrlsFn(false)); PTable adImpressionsByAccount = impressionExtractor .getImpressionBreakdownByAccountId() .parallelDo("rekeyAdImpressionsByAccountId", new ExtractTotalImpressionsFn()); PTable crawlerErrorsByCode = crawlReportSource .read("readCrawlReportTable") .parallelDo("reKeyErrorsByPropertyCode", new RekeyErrorsByPropertyCodeFn()); if (ImmutableList.builder().add(1).add(2).add(3)) {} if (ImmutableList.builder().add(1).add(2).add(3).add(4)) {} if (value.fst.name.toString().equals("value")) {} analysis().analyze(compilationUnit, context, configuration, new DescriptionListener() { @Override public void onDescribed(Description description) { listener.onDescribed(description.filterFixes(new Predicate() { @Override public boolean apply(Fix fix) { return compiles(fix, (JCCompilationUnit) compilationUnit, context); } })); } }); (test ? xxx : yyy).zzz(xxx); (test ? xxx : yyy) .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); (test ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); zzzzzzzzzzzzzzzzzzzz.zzzzzzzzzzzzzzzzzzzzzzzzzzz.zzzzzzzzzzzzzzzzzzzzzzzzzzzzz( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); field.field.field.field.field.field.field.field.field.field.field.field.field.field.field.field.field.field .field.field.field.method( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); (test ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) .field.field.field.field.field.field.field.field.field.field.field.field.field.method( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); (test ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) .field.field.field.field.field.field.field.field.field.field.field.field.field.field.field.field.field .field.field.field.field.method( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); field.field.field.field.field.field.method( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); field.field .field .field .field .field .method(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(); edu.oswego.cs.dl.util.concurrent.misc.ImmutableList.builder( zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) .zzzzzzz(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) .zzzzzzz(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) .zzzzzzz(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz); edu.oswego.cs.dl.util.concurrent.misc.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.ImmutableList .builder(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) .zzzzzzz(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) .zzzzzzz(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) .zzzzzzz(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz); int u = edu.oswego.cs.dl.util.concurrent.misc.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.ImmutableList .builder(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; for (String configured : errorProneOptions().getSeverityMap().keySet()) {} return fffffffffff( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); return fffffffffff( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) .fffffffffffff( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20701054-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20701054-crlf.case new file mode 100644 index 000000000..e0242809d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20701054-crlf.case @@ -0,0 +1,367 @@ +---------- +class B20701054 { + void m() { + ImmutableList x = ImmutableList.builder().add(1).build(); + OptionalBinder.newOptionalBinder(binder(), InputWhitelist.class).setBinding().to( + AllInputWhitelist.class); + + Foo z = Foo.INSTANCE.field; + Foo z = Foo.INSTANCE.field.field; + Foo z = Foo.INSTANCE.field.field.field; + Foo z = Foo.INSTANCE.field.field.field.field; + Foo z = Foo.INSTANCE.field.field.field.field.field; + + ImmutableList x = ImmutableList.INSTANCE.add(1).build(); + ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).build(); + ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).add(3).build(); + ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).add(3).add(4).build(); + + ImmutableList x = ImmutableList.builder().add(1).build(); + ImmutableList x = ImmutableList.builder().add(1).add(2).build(); + ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).build(); + ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).add(4).build(); + ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).add(4).add(5).build(); + ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).add(4).add(5).add(6).build(); + + ImmutableList x = + new ImmutableList.Builder<>() + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .build(); + + ImmutableList x = + ImmutableList.new Builder<>() + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .build(); + + System.err.println( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + Class.my.contrived.example.function( + veryLongArgumentxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + PTable> latestResults = + FJ.joinOneShot2(accountSummaryProvider.get(), results).parallelDo( + "extractPageSpeedUrls", new ExtractPageSpeedUrlsFn(false)); + + PTable adImpressionsByAccount = + impressionExtractor.getImpressionBreakdownByAccountId().parallelDo( + "rekeyAdImpressionsByAccountId", new ExtractTotalImpressionsFn()); + + PTable crawlerErrorsByCode = + crawlReportSource.read("readCrawlReportTable").parallelDo( + "reKeyErrorsByPropertyCode", new RekeyErrorsByPropertyCodeFn()); + + if (ImmutableList.builder().add(1).add(2).add(3)) { + } + + if (ImmutableList.builder() + .add(1) + .add(2) + .add(3) + .add(4)) {} + + if (value.fst.name.toString().equals("value")) { + } + + analysis().analyze(compilationUnit, context, configuration, new DescriptionListener() { + @Override + public void onDescribed(Description description) { + listener.onDescribed(description.filterFixes(new Predicate() { + @Override + public boolean apply(Fix fix) { + return compiles(fix, (JCCompilationUnit) compilationUnit, context); + } + })); + } + }); + + (test ? xxx : yyy).zzz(xxx); + + (test ? xxx : yyy) + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + (test + ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + zzzzzzzzzzzzzzzzzzzz.zzzzzzzzzzzzzzzzzzzzzzzzzzz.zzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + field.field.field.field.field.field.field.field.field.field.field.field.field.field.field.field + .field.field.field.field.field.method( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + (test + ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) + .field.field.field.field.field.field.field.field.field.field.field.field.field.method( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + (test + ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) + .field.field.field.field.field.field.field.field.field.field.field.field.field.field.field + .field.field.field.field.field.field.method( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + field.field.field.field.field.field.method( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + field.field.field.field.field.field.method( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) + .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy + .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy + .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) + .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(); + + edu.oswego.cs.dl.util.concurrent.misc.ImmutableList.builder( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz); + + edu.oswego.cs.dl.util.concurrent.misc.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz + .ImmutableList.builder( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz); + + int u = + edu.oswego.cs.dl.util.concurrent.misc.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz + .ImmutableList.builder( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; + + for (String configured : errorProneOptions().getSeverityMap().keySet()) {} + + return fffffffffff( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + return fffffffffff( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) + .fffffffffffff( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + } +} +---------- +class B20701054 { + void m() { + ImmutableList x = ImmutableList.builder().add(1).build(); + OptionalBinder.newOptionalBinder(binder(), InputWhitelist.class) + .setBinding() + .to(AllInputWhitelist.class); + + Foo z = Foo.INSTANCE.field; + Foo z = Foo.INSTANCE.field.field; + Foo z = Foo.INSTANCE.field.field.field; + Foo z = Foo.INSTANCE.field.field.field.field; + Foo z = Foo.INSTANCE.field.field.field.field.field; + + ImmutableList x = ImmutableList.INSTANCE.add(1).build(); + ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).build(); + ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).add(3).build(); + ImmutableList x = + ImmutableList.INSTANCE.add(1).add(2).add(3).add(4).build(); + + ImmutableList x = ImmutableList.builder().add(1).build(); + ImmutableList x = ImmutableList.builder().add(1).add(2).build(); + ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).build(); + ImmutableList x = + ImmutableList.builder().add(1).add(2).add(3).add(4).build(); + ImmutableList x = + ImmutableList.builder().add(1).add(2).add(3).add(4).add(5).build(); + ImmutableList x = ImmutableList.builder() + .add(1) + .add(2) + .add(3) + .add(4) + .add(5) + .add(6) + .build(); + + ImmutableList x = new ImmutableList.Builder<>() + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .build(); + + ImmutableList x = ImmutableList.new Builder<>() + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .build(); + + System.err.println(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + Class.my.contrived.example.function( + veryLongArgumentxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + PTable> latestResults = FJ.joinOneShot2(accountSummaryProvider.get(), results) + .parallelDo("extractPageSpeedUrls", new ExtractPageSpeedUrlsFn(false)); + + PTable adImpressionsByAccount = impressionExtractor + .getImpressionBreakdownByAccountId() + .parallelDo("rekeyAdImpressionsByAccountId", new ExtractTotalImpressionsFn()); + + PTable crawlerErrorsByCode = crawlReportSource + .read("readCrawlReportTable") + .parallelDo("reKeyErrorsByPropertyCode", new RekeyErrorsByPropertyCodeFn()); + + if (ImmutableList.builder().add(1).add(2).add(3)) {} + + if (ImmutableList.builder().add(1).add(2).add(3).add(4)) {} + + if (value.fst.name.toString().equals("value")) {} + + analysis().analyze(compilationUnit, context, configuration, new DescriptionListener() { + @Override + public void onDescribed(Description description) { + listener.onDescribed(description.filterFixes(new Predicate() { + @Override + public boolean apply(Fix fix) { + return compiles(fix, (JCCompilationUnit) compilationUnit, context); + } + })); + } + }); + + (test ? xxx : yyy).zzz(xxx); + + (test ? xxx : yyy) + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + (test + ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + zzzzzzzzzzzzzzzzzzzz.zzzzzzzzzzzzzzzzzzzzzzzzzzz.zzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + field.field.field.field.field.field.field.field.field.field.field.field.field.field.field.field.field.field + .field.field.field.method( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + (test + ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) + .field.field.field.field.field.field.field.field.field.field.field.field.field.method( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + (test + ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) + .field.field.field.field.field.field.field.field.field.field.field.field.field.field.field.field.field + .field.field.field.field.method( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + field.field.field.field.field.field.method( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + field.field + .field + .field + .field + .field + .method(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) + .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy + .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy + .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) + .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(); + + edu.oswego.cs.dl.util.concurrent.misc.ImmutableList.builder( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz); + + edu.oswego.cs.dl.util.concurrent.misc.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.ImmutableList + .builder(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz); + + int u = edu.oswego.cs.dl.util.concurrent.misc.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.ImmutableList + .builder(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; + + for (String configured : errorProneOptions().getSeverityMap().keySet()) {} + + return fffffffffff( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + return fffffffffff( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) + .fffffffffffff( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20701054.output b/open-java-format/src/test/resources/test-cases/testdata/B20701054-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20701054.output rename to open-java-format/src/test/resources/test-cases/testdata/B20701054-lf.case index 7693a5fcb..0b41fd7b7 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20701054.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B20701054-lf.case @@ -1,3 +1,190 @@ +---------- +class B20701054 { + void m() { + ImmutableList x = ImmutableList.builder().add(1).build(); + OptionalBinder.newOptionalBinder(binder(), InputWhitelist.class).setBinding().to( + AllInputWhitelist.class); + + Foo z = Foo.INSTANCE.field; + Foo z = Foo.INSTANCE.field.field; + Foo z = Foo.INSTANCE.field.field.field; + Foo z = Foo.INSTANCE.field.field.field.field; + Foo z = Foo.INSTANCE.field.field.field.field.field; + + ImmutableList x = ImmutableList.INSTANCE.add(1).build(); + ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).build(); + ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).add(3).build(); + ImmutableList x = ImmutableList.INSTANCE.add(1).add(2).add(3).add(4).build(); + + ImmutableList x = ImmutableList.builder().add(1).build(); + ImmutableList x = ImmutableList.builder().add(1).add(2).build(); + ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).build(); + ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).add(4).build(); + ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).add(4).add(5).build(); + ImmutableList x = ImmutableList.builder().add(1).add(2).add(3).add(4).add(5).add(6).build(); + + ImmutableList x = + new ImmutableList.Builder<>() + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .build(); + + ImmutableList x = + ImmutableList.new Builder<>() + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .add(xxxxx) + .build(); + + System.err.println( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + Class.my.contrived.example.function( + veryLongArgumentxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + PTable> latestResults = + FJ.joinOneShot2(accountSummaryProvider.get(), results).parallelDo( + "extractPageSpeedUrls", new ExtractPageSpeedUrlsFn(false)); + + PTable adImpressionsByAccount = + impressionExtractor.getImpressionBreakdownByAccountId().parallelDo( + "rekeyAdImpressionsByAccountId", new ExtractTotalImpressionsFn()); + + PTable crawlerErrorsByCode = + crawlReportSource.read("readCrawlReportTable").parallelDo( + "reKeyErrorsByPropertyCode", new RekeyErrorsByPropertyCodeFn()); + + if (ImmutableList.builder().add(1).add(2).add(3)) { + } + + if (ImmutableList.builder() + .add(1) + .add(2) + .add(3) + .add(4)) {} + + if (value.fst.name.toString().equals("value")) { + } + + analysis().analyze(compilationUnit, context, configuration, new DescriptionListener() { + @Override + public void onDescribed(Description description) { + listener.onDescribed(description.filterFixes(new Predicate() { + @Override + public boolean apply(Fix fix) { + return compiles(fix, (JCCompilationUnit) compilationUnit, context); + } + })); + } + }); + + (test ? xxx : yyy).zzz(xxx); + + (test ? xxx : yyy) + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + (test + ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + zzzzzzzzzzzzzzzzzzzz.zzzzzzzzzzzzzzzzzzzzzzzzzzz.zzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + field.field.field.field.field.field.field.field.field.field.field.field.field.field.field.field + .field.field.field.field.field.method( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + (test + ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) + .field.field.field.field.field.field.field.field.field.field.field.field.field.method( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + (test + ? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + : yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy) + .field.field.field.field.field.field.field.field.field.field.field.field.field.field.field + .field.field.field.field.field.field.method( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + field.field.field.field.field.field.method( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + field.field.field.field.field.field.method( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) + .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy + .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy + .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) + .yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(); + + edu.oswego.cs.dl.util.concurrent.misc.ImmutableList.builder( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz); + + edu.oswego.cs.dl.util.concurrent.misc.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz + .ImmutableList.builder( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzz( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz); + + int u = + edu.oswego.cs.dl.util.concurrent.misc.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz + .ImmutableList.builder( + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz + .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; + + for (String configured : errorProneOptions().getSeverityMap().keySet()) {} + + return fffffffffff( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + return fffffffffff( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) + .fffffffffffff( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + } +} +---------- class B20701054 { void m() { ImmutableList x = ImmutableList.builder().add(1).build(); diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20844369-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20844369-cr.case new file mode 100644 index 000000000..f4c1501a9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20844369-cr.case @@ -0,0 +1 @@ +---------- public class B20844369 { private static final String ID_PATTERN = // TODO(daw): add min/max lengths for the numbers here, e.g. android ID "(?:(?\\d+)\\+)?" // optional Android ID + "(?\\d+)" // type + ":" + "(?\\d+)" // timestamp + "(?%" // begin optional subtype + "(?:(?\\d+)#)?" // subtype's optional user ID, followed by a hash + "(?[0-9a-fA-F]{8})" // subtype's category hash + "(?[0-9a-fA-F]{8})" // subtype's token hash + ")?"; // end optional subtype int x = //foo 42 + //bar 1; int x = //foo 42 + //bar 1; int x = /*foo*/ 42 + //bar 1; int x = /*foo*/ 42 + //bar 1; } ---------- public class B20844369 { private static final String ID_PATTERN = // TODO(daw): add min/max lengths for the numbers here, e.g. android ID "(?:(?\\d+)\\+)?" // optional Android ID + "(?\\d+)" // type + ":" + "(?\\d+)" // timestamp + "(?%" // begin optional subtype + "(?:(?\\d+)#)?" // subtype's optional user ID, followed by a hash + "(?[0-9a-fA-F]{8})" // subtype's category hash + "(?[0-9a-fA-F]{8})" // subtype's token hash + ")?"; // end optional subtype int x = // foo 42 + // bar 1; int x = // foo 42 + // bar 1; int x = /*foo*/ 42 + // bar 1; int x = /*foo*/ 42 + // bar 1; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20844369-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20844369-crlf.case new file mode 100644 index 000000000..33dbc6984 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20844369-crlf.case @@ -0,0 +1,65 @@ +---------- +public class B20844369 { + private static final String ID_PATTERN = + // TODO(daw): add min/max lengths for the numbers here, e.g. android ID + "(?:(?\\d+)\\+)?" // optional Android ID + + "(?\\d+)" // type + + ":" + + "(?\\d+)" // timestamp + + "(?%" // begin optional subtype + + "(?:(?\\d+)#)?" // subtype's optional user ID, followed by a hash + + "(?[0-9a-fA-F]{8})" // subtype's category hash + + "(?[0-9a-fA-F]{8})" // subtype's token hash + + ")?"; // end optional subtype + + int x = //foo + 42 + //bar + 1; + + int x = + //foo + 42 + //bar + 1; + + int x = /*foo*/ + 42 + //bar + 1; + + int x = + /*foo*/ + 42 + //bar + 1; +} +---------- +public class B20844369 { + private static final String ID_PATTERN = + // TODO(daw): add min/max lengths for the numbers here, e.g. android ID + "(?:(?\\d+)\\+)?" // optional Android ID + + "(?\\d+)" // type + + ":" + + "(?\\d+)" // timestamp + + "(?%" // begin optional subtype + + "(?:(?\\d+)#)?" // subtype's optional user ID, followed by a hash + + "(?[0-9a-fA-F]{8})" // subtype's category hash + + "(?[0-9a-fA-F]{8})" // subtype's token hash + + ")?"; // end optional subtype + + int x = // foo + 42 + // bar + 1; + + int x = + // foo + 42 + + // bar + 1; + + int x = /*foo*/ 42 + // bar + 1; + + int x = + /*foo*/ + 42 + + // bar + 1; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20844369.output b/open-java-format/src/test/resources/test-cases/testdata/B20844369-lf.case similarity index 56% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20844369.output rename to open-java-format/src/test/resources/test-cases/testdata/B20844369-lf.case index 3bf3973e5..d727d6286 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20844369.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B20844369-lf.case @@ -1,3 +1,36 @@ +---------- +public class B20844369 { + private static final String ID_PATTERN = + // TODO(daw): add min/max lengths for the numbers here, e.g. android ID + "(?:(?\\d+)\\+)?" // optional Android ID + + "(?\\d+)" // type + + ":" + + "(?\\d+)" // timestamp + + "(?%" // begin optional subtype + + "(?:(?\\d+)#)?" // subtype's optional user ID, followed by a hash + + "(?[0-9a-fA-F]{8})" // subtype's category hash + + "(?[0-9a-fA-F]{8})" // subtype's token hash + + ")?"; // end optional subtype + + int x = //foo + 42 + //bar + 1; + + int x = + //foo + 42 + //bar + 1; + + int x = /*foo*/ + 42 + //bar + 1; + + int x = + /*foo*/ + 42 + //bar + 1; +} +---------- public class B20844369 { private static final String ID_PATTERN = // TODO(daw): add min/max lengths for the numbers here, e.g. android ID diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20915776-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B20915776-cr.case new file mode 100644 index 000000000..5aa72e187 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20915776-cr.case @@ -0,0 +1 @@ +---------- class B20915776 { @Inject void ChunkAnalysis( // TODO(user) ... @Parent DatasetSource supporters, @Child DatasetSource children, @Parent Provider parentSupportsDecider, @Child Provider childSupportsDecider) { } } ---------- class B20915776 { @Inject void ChunkAnalysis( // TODO(user) ... @Parent DatasetSource supporters, @Child DatasetSource children, @Parent Provider parentSupportsDecider, @Child Provider childSupportsDecider) {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B20915776-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B20915776-crlf.case new file mode 100644 index 000000000..36dbd7328 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20915776-crlf.case @@ -0,0 +1,21 @@ +---------- +class B20915776 { + @Inject + void ChunkAnalysis( + // TODO(user) ... + @Parent DatasetSource supporters, + @Child DatasetSource children, + @Parent Provider parentSupportsDecider, + @Child Provider childSupportsDecider) { + } +} +---------- +class B20915776 { + @Inject + void ChunkAnalysis( + // TODO(user) ... + @Parent DatasetSource supporters, + @Child DatasetSource children, + @Parent Provider parentSupportsDecider, + @Child Provider childSupportsDecider) {} +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20915776.output b/open-java-format/src/test/resources/test-cases/testdata/B20915776-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20915776.output rename to open-java-format/src/test/resources/test-cases/testdata/B20915776-lf.case index f1cfdc6e1..81b9c00f9 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20915776.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B20915776-lf.case @@ -1,3 +1,15 @@ +---------- +class B20915776 { + @Inject + void ChunkAnalysis( + // TODO(user) ... + @Parent DatasetSource supporters, + @Child DatasetSource children, + @Parent Provider parentSupportsDecider, + @Child Provider childSupportsDecider) { + } +} +---------- class B20915776 { @Inject void ChunkAnalysis( diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21031147-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21031147-cr.case new file mode 100644 index 000000000..df1bd92be --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21031147-cr.case @@ -0,0 +1 @@ +---------- public class B21031147 { { return new StringBuilder(maxLength) .append(seq, 0, truncationLength).append(truncationIndicator).toString(); } } ---------- public class B21031147 { { return new StringBuilder(maxLength) .append(seq, 0, truncationLength) .append(truncationIndicator) .toString(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21031147-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21031147-crlf.case new file mode 100644 index 000000000..e7301c701 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21031147-crlf.case @@ -0,0 +1,16 @@ +---------- +public class B21031147 { + { + return new StringBuilder(maxLength) + .append(seq, 0, truncationLength).append(truncationIndicator).toString(); + } +} +---------- +public class B21031147 { + { + return new StringBuilder(maxLength) + .append(seq, 0, truncationLength) + .append(truncationIndicator) + .toString(); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21031147.output b/open-java-format/src/test/resources/test-cases/testdata/B21031147-lf.case similarity index 53% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21031147.output rename to open-java-format/src/test/resources/test-cases/testdata/B21031147-lf.case index 8d2ff50e4..d5a698a21 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21031147.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B21031147-lf.case @@ -1,3 +1,11 @@ +---------- +public class B21031147 { + { + return new StringBuilder(maxLength) + .append(seq, 0, truncationLength).append(truncationIndicator).toString(); + } +} +---------- public class B21031147 { { return new StringBuilder(maxLength) diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21105569-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21105569-cr.case new file mode 100644 index 000000000..2afe23495 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21105569-cr.case @@ -0,0 +1 @@ +---------- class B21105569 { void f() { // asd } void g() { /* asd */ } void h() { /* asd */ } } ---------- class B21105569 { void f() { // asd } void g() { /* asd */ } void h() { /* asd */ } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21105569-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21105569-crlf.case new file mode 100644 index 000000000..b9e06ee17 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21105569-crlf.case @@ -0,0 +1,24 @@ +---------- +class B21105569 { + void f() { + // asd + } + void g() { + /* asd */ + } + void h() { /* asd */ } +} +---------- +class B21105569 { + void f() { + // asd + } + + void g() { + /* asd */ + } + + void h() { + /* asd */ + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21105569.output b/open-java-format/src/test/resources/test-cases/testdata/B21105569-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21105569.output rename to open-java-format/src/test/resources/test-cases/testdata/B21105569-lf.case index 3a3589f4a..c8f5f0509 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21105569.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B21105569-lf.case @@ -1,3 +1,14 @@ +---------- +class B21105569 { + void f() { + // asd + } + void g() { + /* asd */ + } + void h() { /* asd */ } +} +---------- class B21105569 { void f() { // asd diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21185365-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21185365-cr.case new file mode 100644 index 000000000..422c9f5fd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21185365-cr.case @@ -0,0 +1 @@ +---------- class B21185365 { { for (int i = 0; i < s.length();) {} } } ---------- class B21185365 { { for (int i = 0; i < s.length(); ) {} } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21185365-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21185365-crlf.case new file mode 100644 index 000000000..b3cd6c6ba --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21185365-crlf.case @@ -0,0 +1,12 @@ +---------- +class B21185365 { + { + for (int i = 0; i < s.length();) {} + } +} +---------- +class B21185365 { + { + for (int i = 0; i < s.length(); ) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21185365-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21185365-lf.case new file mode 100644 index 000000000..6ef5987fc --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21185365-lf.case @@ -0,0 +1,12 @@ +---------- +class B21185365 { + { + for (int i = 0; i < s.length();) {} + } +} +---------- +class B21185365 { + { + for (int i = 0; i < s.length(); ) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21192435-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21192435-cr.case new file mode 100644 index 000000000..c24cec979 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21192435-cr.case @@ -0,0 +1 @@ +---------- package testdata.output; public class B21192435 { static class Test extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{} static class Testxxxxxxxxx extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxx{} static class Testxxxxxxxxx extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxx{} static class Test extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} } ---------- package testdata.output; public class B21192435 { static class Test extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} static class Testxxxxxxxxx extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxx {} static class Testxxxxxxxxx extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxx {} static class Test extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21192435-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21192435-crlf.case new file mode 100644 index 000000000..670f0b538 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21192435-crlf.case @@ -0,0 +1,29 @@ +---------- +package testdata.output; + +public class B21192435 { + + static class Test extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{} + + static class Testxxxxxxxxx extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxx{} + + static class Testxxxxxxxxx extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxx{} + + static class Test extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} +} +---------- +package testdata.output; + +public class B21192435 { + + static class Test extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} + + static class Testxxxxxxxxx extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + implements Xxxxx {} + + static class Testxxxxxxxxx extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + implements Xxxxxxxxxxxxxxxx {} + + static class Test + extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21192435.output b/open-java-format/src/test/resources/test-cases/testdata/B21192435-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21192435.output rename to open-java-format/src/test/resources/test-cases/testdata/B21192435-lf.case index d7fd41439..1f4e6b8fa 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21192435.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B21192435-lf.case @@ -1,3 +1,17 @@ +---------- +package testdata.output; + +public class B21192435 { + + static class Test extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{} + + static class Testxxxxxxxxx extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxx{} + + static class Testxxxxxxxxx extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxx{} + + static class Test extends Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} +} +---------- package testdata.output; public class B21192435 { diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21278211-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21278211-cr.case new file mode 100644 index 000000000..89d1eb00c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21278211-cr.case @@ -0,0 +1 @@ +---------- class B21278211 { void m() { return names.isEmpty() || names.size() == 1 && names.get(0).toString().isEmpty(); // use unified breaks for all chained dereferences x.f().g(); x.fzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz() .gzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz(); x.f().g().h(); x .f() .g() .hzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz(); x .f() .g() .h() .i(); } } ---------- class B21278211 { void m() { return names.isEmpty() || names.size() == 1 && names.get(0).toString().isEmpty(); // use unified breaks for all chained dereferences x.f().g(); x.fzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz().gzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz(); x.f().g().h(); x.f().g().hzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz(); x.f().g().h().i(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21278211-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21278211-crlf.case new file mode 100644 index 000000000..904efe8fe --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21278211-crlf.case @@ -0,0 +1,40 @@ +---------- +class B21278211 { + void m() { + return names.isEmpty() || names.size() == 1 && names.get(0).toString().isEmpty(); + + // use unified breaks for all chained dereferences + + x.f().g(); + x.fzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz() + .gzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz(); + + x.f().g().h(); + x + .f() + .g() + .hzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz(); + + x + .f() + .g() + .h() + .i(); + } +} +---------- +class B21278211 { + void m() { + return names.isEmpty() || names.size() == 1 && names.get(0).toString().isEmpty(); + + // use unified breaks for all chained dereferences + + x.f().g(); + x.fzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz().gzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz(); + + x.f().g().h(); + x.f().g().hzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz(); + + x.f().g().h().i(); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21278211.input b/open-java-format/src/test/resources/test-cases/testdata/B21278211-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21278211.input rename to open-java-format/src/test/resources/test-cases/testdata/B21278211-lf.case index 13e1559db..7e27ca946 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21278211.input +++ b/open-java-format/src/test/resources/test-cases/testdata/B21278211-lf.case @@ -1,3 +1,4 @@ +---------- class B21278211 { void m() { return names.isEmpty() || names.size() == 1 && names.get(0).toString().isEmpty(); @@ -21,3 +22,19 @@ class B21278211 { .i(); } } +---------- +class B21278211 { + void m() { + return names.isEmpty() || names.size() == 1 && names.get(0).toString().isEmpty(); + + // use unified breaks for all chained dereferences + + x.f().g(); + x.fzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz().gzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz(); + + x.f().g().h(); + x.f().g().hzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz(); + + x.f().g().h().i(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21283374-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21283374-cr.case new file mode 100644 index 000000000..073e7884f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21283374-cr.case @@ -0,0 +1 @@ +---------- class B21283374 { void f(boolean flagA, boolean flagB, boolean flagC, boolean flagD, boolean flagE, boolean flagF, boolean flagG, boolean flagH, boolean flagI, boolean flagJ, boolean flagK) {} { 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); 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); 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); assertThat__________________________________________________________(/*paramName=*/ false, thingy); assertThat__________________________________________________________( /*paramName=*/ false, thingy); f( arg1, /* which arg is this attached to? */ arg2, arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); f( /* paramName1 */ arg1, /* paramName2 */ arg2, arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); f( arg1, /* paramName1 */ arg2, /* paramName2 */ arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); } } ---------- class B21283374 { void f( boolean flagA, boolean flagB, boolean flagC, boolean flagD, boolean flagE, boolean flagF, boolean flagG, boolean flagH, boolean flagI, boolean flagJ, boolean flagK) {} { 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); 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); 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); assertThat__________________________________________________________(/*paramName=*/ false, thingy); assertThat__________________________________________________________(/*paramName=*/ false, thingy); f( arg1, /* which arg is this attached to? */ arg2, arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); f( /* paramName1 */ arg1, /* paramName2 */ arg2, arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); f( arg1, /* paramName1 */ arg2, /* paramName2 */ arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21283374-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21283374-crlf.case new file mode 100644 index 000000000..6c0a80798 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21283374-crlf.case @@ -0,0 +1,125 @@ +---------- +class B21283374 { + void f(boolean flagA, boolean flagB, boolean flagC, boolean flagD, boolean flagE, boolean flagF, boolean flagG, boolean flagH, boolean flagI, boolean flagJ, boolean flagK) {} + + { + 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); + + 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); + + 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); + + assertThat__________________________________________________________(/*paramName=*/ false, thingy); + assertThat__________________________________________________________( + /*paramName=*/ false, thingy); + + f( + arg1, /* which arg is this attached to? */ + arg2, + arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + + f( + /* paramName1 */ arg1, + /* paramName2 */ arg2, + arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + f( + arg1, /* paramName1 */ + arg2, /* paramName2 */ + arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + } +} +---------- +class B21283374 { + void f( + boolean flagA, + boolean flagB, + boolean flagC, + boolean flagD, + boolean flagE, + boolean flagF, + boolean flagG, + boolean flagH, + boolean flagI, + boolean flagJ, + boolean flagK) {} + + { + 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); + + 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); + + 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); + + assertThat__________________________________________________________(/*paramName=*/ false, thingy); + assertThat__________________________________________________________(/*paramName=*/ false, thingy); + + f( + arg1, /* which arg is this attached to? */ + arg2, + arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + f( + /* paramName1 */ arg1, + /* paramName2 */ arg2, + arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + f( + arg1, /* paramName1 */ + arg2, /* paramName2 */ + arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21283374.output b/open-java-format/src/test/resources/test-cases/testdata/B21283374-lf.case similarity index 54% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21283374.output rename to open-java-format/src/test/resources/test-cases/testdata/B21283374-lf.case index f4e04a92e..18b24c934 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21283374.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B21283374-lf.case @@ -1,3 +1,62 @@ +---------- +class B21283374 { + void f(boolean flagA, boolean flagB, boolean flagC, boolean flagD, boolean flagE, boolean flagF, boolean flagG, boolean flagH, boolean flagI, boolean flagJ, boolean flagK) {} + + { + 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); + + 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); + + 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); + + assertThat__________________________________________________________(/*paramName=*/ false, thingy); + assertThat__________________________________________________________( + /*paramName=*/ false, thingy); + + f( + arg1, /* which arg is this attached to? */ + arg2, + arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + + f( + /* paramName1 */ arg1, + /* paramName2 */ arg2, + arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + + f( + arg1, /* paramName1 */ + arg2, /* paramName2 */ + arg3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + } +} +---------- class B21283374 { void f( boolean flagA, diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21305044-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21305044-cr.case new file mode 100644 index 000000000..5fc282a7c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21305044-cr.case @@ -0,0 +1 @@ +---------- class B21305044 { class T<@Nullable X extends @Nullable Object, @Nullable Y extends @Nullable Object, @Nullable Z extends @Nullable Object> extends Function<@Nullable X, @Nullable Y> implements Predicate<@Nullable Z> { public T(@Nullable T this, List<@Nullable X> xs) { } public T(@Nullable T B21305044.this, List<@Nullable X> xs) { } List<@Nullable ?> a; List<@Nullable ? extends @Nullable Object> b; List<@Nullable ? super @Nullable Object> c; List c; } Function f = com.foo.bar.Baz::func; Function g = new Baz()::func; Function h = Baz::new; Function i = com.foo.bar.VeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongBaz::new; { Function f = () -> moderatelyLongResult; Function f = () -> breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult; Function f = () -> System.err.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); Function f = (someParam) -> System.err.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); } } ---------- class B21305044 { class T< @Nullable X extends @Nullable Object, @Nullable Y extends @Nullable Object, @Nullable Z extends @Nullable Object> extends Function<@Nullable X, @Nullable Y> implements Predicate<@Nullable Z> { public T(@Nullable T this, List<@Nullable X> xs) {} public T(@Nullable T B21305044.this, List<@Nullable X> xs) {} List<@Nullable ?> a; List<@Nullable ? extends @Nullable Object> b; List<@Nullable ? super @Nullable Object> c; List< ? super @Crazy( key = value, other = @Crazier({ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 })) Object> c; } Function f = com.foo.bar.Baz::func; Function g = new Baz()::func; Function h = Baz::new; Function i = com.foo.bar .VeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongBaz ::new; { Function f = () -> moderatelyLongResult; Function f = () -> breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult; Function f = () -> System.err.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); Function f = (someParam) -> System.err.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21305044-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21305044-crlf.case new file mode 100644 index 000000000..94a345b07 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21305044-crlf.case @@ -0,0 +1,83 @@ +---------- +class B21305044 { + + class T<@Nullable X extends @Nullable Object, + @Nullable Y extends @Nullable Object, + @Nullable Z extends @Nullable Object> + extends Function<@Nullable X, @Nullable Y> + implements Predicate<@Nullable Z> { + public T(@Nullable T this, List<@Nullable X> xs) { + } + + public T(@Nullable T B21305044.this, List<@Nullable X> xs) { + } + + List<@Nullable ?> a; + List<@Nullable ? extends @Nullable Object> b; + List<@Nullable ? super @Nullable Object> c; + + List c; + } + + Function f = com.foo.bar.Baz::func; + Function g = new Baz()::func; + Function h = Baz::new; + Function i = com.foo.bar.VeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongBaz::new; + + { + Function f = () -> moderatelyLongResult; + Function f = () -> breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult; + Function f = () -> System.err.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + Function f = (someParam) -> System.err.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + } +} +---------- +class B21305044 { + + class T< + @Nullable X extends @Nullable Object, + @Nullable Y extends @Nullable Object, + @Nullable Z extends @Nullable Object> + extends Function<@Nullable X, @Nullable Y> implements Predicate<@Nullable Z> { + public T(@Nullable T this, List<@Nullable X> xs) {} + + public T(@Nullable T B21305044.this, List<@Nullable X> xs) {} + + List<@Nullable ?> a; + List<@Nullable ? extends @Nullable Object> b; + List<@Nullable ? super @Nullable Object> c; + + List< + ? super + @Crazy( + key = value, + other = @Crazier({ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 + })) + Object> + c; + } + + Function f = com.foo.bar.Baz::func; + Function g = new Baz()::func; + Function h = Baz::new; + Function i = com.foo.bar + .VeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongBaz + ::new; + + { + Function f = () -> moderatelyLongResult; + Function f = () -> breakableResult + + breakableResult + + breakableResult + + breakableResult + + breakableResult + + breakableResult + + breakableResult + + breakableResult + + breakableResult; + Function f = () -> System.err.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + Function f = + (someParam) -> System.err.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21305044.output b/open-java-format/src/test/resources/test-cases/testdata/B21305044-lf.case similarity index 57% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21305044.output rename to open-java-format/src/test/resources/test-cases/testdata/B21305044-lf.case index 16f11eeec..ab833617c 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21305044.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B21305044-lf.case @@ -1,3 +1,37 @@ +---------- +class B21305044 { + + class T<@Nullable X extends @Nullable Object, + @Nullable Y extends @Nullable Object, + @Nullable Z extends @Nullable Object> + extends Function<@Nullable X, @Nullable Y> + implements Predicate<@Nullable Z> { + public T(@Nullable T this, List<@Nullable X> xs) { + } + + public T(@Nullable T B21305044.this, List<@Nullable X> xs) { + } + + List<@Nullable ?> a; + List<@Nullable ? extends @Nullable Object> b; + List<@Nullable ? super @Nullable Object> c; + + List c; + } + + Function f = com.foo.bar.Baz::func; + Function g = new Baz()::func; + Function h = Baz::new; + Function i = com.foo.bar.VeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongBaz::new; + + { + Function f = () -> moderatelyLongResult; + Function f = () -> breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult + breakableResult; + Function f = () -> System.err.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + Function f = (someParam) -> System.err.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + } +} +---------- class B21305044 { class T< diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21327412-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21327412-cr.case new file mode 100644 index 000000000..02f6d70a3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21327412-cr.case @@ -0,0 +1 @@ +---------- class B21327412 { int i = Data._ID; } ---------- class B21327412 { int i = Data._ID; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21327412-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21327412-crlf.case new file mode 100644 index 000000000..492cd4cd5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21327412-crlf.case @@ -0,0 +1,8 @@ +---------- +class B21327412 { + int i = Data._ID; +} +---------- +class B21327412 { + int i = Data._ID; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21327412-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21327412-lf.case new file mode 100644 index 000000000..7cac40295 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21327412-lf.case @@ -0,0 +1,8 @@ +---------- +class B21327412 { + int i = Data._ID; +} +---------- +class B21327412 { + int i = Data._ID; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21329312-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21329312-cr.case new file mode 100644 index 000000000..580b5d456 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21329312-cr.case @@ -0,0 +1 @@ +---------- public class B21329312 { boolean test() { return wasEdited || didContactsChange || medicalInfoManager.getTemporaryProfilePicture() != null || inMemoryAccessMedicalProfileAboveKeyguard != originalAccessMedicalProfileAboveKeyguard; } } ---------- public class B21329312 { boolean test() { return wasEdited || didContactsChange || medicalInfoManager.getTemporaryProfilePicture() != null || inMemoryAccessMedicalProfileAboveKeyguard != originalAccessMedicalProfileAboveKeyguard; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21329312-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21329312-crlf.case new file mode 100644 index 000000000..3ddbf60e8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21329312-crlf.case @@ -0,0 +1,16 @@ +---------- +public class B21329312 { + boolean test() { + return wasEdited || didContactsChange || medicalInfoManager.getTemporaryProfilePicture() != null + || inMemoryAccessMedicalProfileAboveKeyguard != originalAccessMedicalProfileAboveKeyguard; + } +} +---------- +public class B21329312 { + boolean test() { + return wasEdited + || didContactsChange + || medicalInfoManager.getTemporaryProfilePicture() != null + || inMemoryAccessMedicalProfileAboveKeyguard != originalAccessMedicalProfileAboveKeyguard; + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21329312.output b/open-java-format/src/test/resources/test-cases/testdata/B21329312-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21329312.output rename to open-java-format/src/test/resources/test-cases/testdata/B21329312-lf.case index a76d6ec28..997fdd0f7 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21329312.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B21329312-lf.case @@ -1,3 +1,11 @@ +---------- +public class B21329312 { + boolean test() { + return wasEdited || didContactsChange || medicalInfoManager.getTemporaryProfilePicture() != null + || inMemoryAccessMedicalProfileAboveKeyguard != originalAccessMedicalProfileAboveKeyguard; + } +} +---------- public class B21329312 { boolean test() { return wasEdited diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21331232-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21331232-cr.case new file mode 100644 index 000000000..448529ae5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21331232-cr.case @@ -0,0 +1 @@ +---------- class B21331232 { private S instantiate( Class wrapperType, Type t, FailureStrategy fs, SF factory, Iterable data) { } public > IterableSubject, T, C> that(@Nullable Iterable target) { return IterableSubject.create(getFailureStrategy(), target); } boolean mightContain(T object, Funnel funnels, int numHashFunctions, BitArray bits); } ---------- class B21331232 { private S instantiate(Class wrapperType, Type t, FailureStrategy fs, SF factory, Iterable data) {} public > IterableSubject, T, C> that( @Nullable Iterable target) { return IterableSubject.create(getFailureStrategy(), target); } boolean mightContain(T object, Funnel funnels, int numHashFunctions, BitArray bits); } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21331232-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21331232-crlf.case new file mode 100644 index 000000000..0f4c4a200 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21331232-crlf.case @@ -0,0 +1,25 @@ +---------- +class B21331232 { + private + S instantiate( + Class wrapperType, Type t, FailureStrategy fs, SF factory, Iterable data) { + } + + public > + IterableSubject, T, C> that(@Nullable Iterable target) { + return IterableSubject.create(getFailureStrategy(), target); + } + + boolean mightContain(T object, Funnel funnels, int numHashFunctions, BitArray bits); +} +---------- +class B21331232 { + private S instantiate(Class wrapperType, Type t, FailureStrategy fs, SF factory, Iterable data) {} + + public > IterableSubject, T, C> that( + @Nullable Iterable target) { + return IterableSubject.create(getFailureStrategy(), target); + } + + boolean mightContain(T object, Funnel funnels, int numHashFunctions, BitArray bits); +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21331232-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21331232-lf.case new file mode 100644 index 000000000..da5170816 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21331232-lf.case @@ -0,0 +1,25 @@ +---------- +class B21331232 { + private + S instantiate( + Class wrapperType, Type t, FailureStrategy fs, SF factory, Iterable data) { + } + + public > + IterableSubject, T, C> that(@Nullable Iterable target) { + return IterableSubject.create(getFailureStrategy(), target); + } + + boolean mightContain(T object, Funnel funnels, int numHashFunctions, BitArray bits); +} +---------- +class B21331232 { + private S instantiate(Class wrapperType, Type t, FailureStrategy fs, SF factory, Iterable data) {} + + public > IterableSubject, T, C> that( + @Nullable Iterable target) { + return IterableSubject.create(getFailureStrategy(), target); + } + + boolean mightContain(T object, Funnel funnels, int numHashFunctions, BitArray bits); +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21465217-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21465217-cr.case new file mode 100644 index 000000000..e2aa7e36a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21465217-cr.case @@ -0,0 +1 @@ +---------- class B21465217 { void m() { try (JimfsOutputStream out2 = newOutputStream(false); BufferedOutputStream bout = new BufferedOutputStream(out2); OutputStreamWriter writer = new OutputStreamWriter(bout, UTF_8___________________________)) { } try (Writer sourceWriter = env.getFiler().createSourceFile(qualifiedNamezzzzzzzz).openWriter()) { sourceWriter.append(fileContents); } } } ---------- class B21465217 { void m() { try (JimfsOutputStream out2 = newOutputStream(false); BufferedOutputStream bout = new BufferedOutputStream(out2); OutputStreamWriter writer = new OutputStreamWriter(bout, UTF_8___________________________)) {} try (Writer sourceWriter = env.getFiler().createSourceFile(qualifiedNamezzzzzzzz).openWriter()) { sourceWriter.append(fileContents); } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21465217-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21465217-crlf.case new file mode 100644 index 000000000..7b74c6220 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21465217-crlf.case @@ -0,0 +1,26 @@ +---------- +class B21465217 { + void m() { + try (JimfsOutputStream out2 = newOutputStream(false); + BufferedOutputStream bout = new BufferedOutputStream(out2); + OutputStreamWriter writer = new OutputStreamWriter(bout, UTF_8___________________________)) { + } + + try (Writer sourceWriter = env.getFiler().createSourceFile(qualifiedNamezzzzzzzz).openWriter()) { + sourceWriter.append(fileContents); + } + } +} +---------- +class B21465217 { + void m() { + try (JimfsOutputStream out2 = newOutputStream(false); + BufferedOutputStream bout = new BufferedOutputStream(out2); + OutputStreamWriter writer = new OutputStreamWriter(bout, UTF_8___________________________)) {} + + try (Writer sourceWriter = + env.getFiler().createSourceFile(qualifiedNamezzzzzzzz).openWriter()) { + sourceWriter.append(fileContents); + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465217.output b/open-java-format/src/test/resources/test-cases/testdata/B21465217-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465217.output rename to open-java-format/src/test/resources/test-cases/testdata/B21465217-lf.case index debbfecfb..2d5625d90 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465217.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B21465217-lf.case @@ -1,3 +1,17 @@ +---------- +class B21465217 { + void m() { + try (JimfsOutputStream out2 = newOutputStream(false); + BufferedOutputStream bout = new BufferedOutputStream(out2); + OutputStreamWriter writer = new OutputStreamWriter(bout, UTF_8___________________________)) { + } + + try (Writer sourceWriter = env.getFiler().createSourceFile(qualifiedNamezzzzzzzz).openWriter()) { + sourceWriter.append(fileContents); + } + } +} +---------- class B21465217 { void m() { try (JimfsOutputStream out2 = newOutputStream(false); diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21465477-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21465477-cr.case new file mode 100644 index 000000000..5773c18c4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21465477-cr.case @@ -0,0 +1 @@ +---------- class B21465477 { @Nullable private final String simpleFieldName; @Nullable private final String shortFlagName; private final String containerClassName; private final String type; private final String doc; private final DocLevel docLevel; @Nullable private final String altName; } ---------- class B21465477 { @Nullable private final String simpleFieldName; @Nullable private final String shortFlagName; private final String containerClassName; private final String type; private final String doc; private final DocLevel docLevel; @Nullable private final String altName; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21465477-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21465477-crlf.case new file mode 100644 index 000000000..e20af766b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21465477-crlf.case @@ -0,0 +1,28 @@ +---------- +class B21465477 { + + @Nullable private final String simpleFieldName; + @Nullable private final String shortFlagName; + private final String containerClassName; + private final String type; + private final String doc; + private final DocLevel docLevel; + @Nullable private final String altName; +} +---------- +class B21465477 { + + @Nullable + private final String simpleFieldName; + + @Nullable + private final String shortFlagName; + + private final String containerClassName; + private final String type; + private final String doc; + private final DocLevel docLevel; + + @Nullable + private final String altName; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465477.output b/open-java-format/src/test/resources/test-cases/testdata/B21465477-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465477.output rename to open-java-format/src/test/resources/test-cases/testdata/B21465477-lf.case index 97df7e812..4769ac969 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465477.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B21465477-lf.case @@ -1,3 +1,15 @@ +---------- +class B21465477 { + + @Nullable private final String simpleFieldName; + @Nullable private final String shortFlagName; + private final String containerClassName; + private final String type; + private final String doc; + private final DocLevel docLevel; + @Nullable private final String altName; +} +---------- class B21465477 { @Nullable diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21585653-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21585653-cr.case new file mode 100644 index 000000000..128c3ce4e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21585653-cr.case @@ -0,0 +1 @@ +---------- class B21585653 { { try (X x = x;) { } } } ---------- class B21585653 { { try (X x = x; ) {} } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21585653-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21585653-crlf.case new file mode 100644 index 000000000..9af9d6355 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21585653-crlf.case @@ -0,0 +1,13 @@ +---------- +class B21585653 { + { + try (X x = x;) { + } + } +} +---------- +class B21585653 { + { + try (X x = x; ) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21585653-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21585653-lf.case new file mode 100644 index 000000000..036f38d74 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21585653-lf.case @@ -0,0 +1,13 @@ +---------- +class B21585653 { + { + try (X x = x;) { + } + } +} +---------- +class B21585653 { + { + try (X x = x; ) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21954779-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21954779-cr.case new file mode 100644 index 000000000..5726485c7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21954779-cr.case @@ -0,0 +1 @@ +---------- class B21954779 { { when(computeApi.findOrCreateVm( VM_METADATA, Optional.absent(), AssignReservedIp.YES, AttachDataDisk.YES)) .thenReturn(OPERATION); fail(String.format( " Experiment name %s is used multiple times in %s", expName, envName, zzzzzzzzzzzz, zzzzzzzzzzzz)); new Handler(Looper.getMainLooper()) .post( new Runnable() { @Override public void run() { utils.showShortToast( application.getString( R.string.working_on_project_format, Utils.getProjectDisplayName(selectedProject))); } }); (new Handler()) .post( new Runnable() { @Override public void run() { showErrorAndSetDone(error); } }); getContext() .getErrorReporter() .log(new RuntimeException("Called layout with a non-zero segment index: " + segmentIndex)); bind( new Key>() {}); // this isn't a feature; we'd prefer to keep `new Key...` as one unit bind( new Key>() {}).then(); } } ---------- class B21954779 { { when(computeApi.findOrCreateVm( VM_METADATA, Optional.absent(), AssignReservedIp.YES, AttachDataDisk.YES)) .thenReturn(OPERATION); fail(String.format( " Experiment name %s is used multiple times in %s", expName, envName, zzzzzzzzzzzz, zzzzzzzzzzzz)); new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { utils.showShortToast(application.getString( R.string.working_on_project_format, Utils.getProjectDisplayName(selectedProject))); } }); (new Handler()).post(new Runnable() { @Override public void run() { showErrorAndSetDone(error); } }); getContext() .getErrorReporter() .log(new RuntimeException("Called layout with a non-zero segment index: " + segmentIndex)); bind(new Key>() {}); // this isn't a feature; we'd prefer to keep `new Key...` as one unit bind(new Key>() {}) .then(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21954779-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21954779-crlf.case new file mode 100644 index 000000000..2b03d3939 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21954779-crlf.case @@ -0,0 +1,84 @@ +---------- +class B21954779 { + { + when(computeApi.findOrCreateVm( + VM_METADATA, + Optional.absent(), + AssignReservedIp.YES, + AttachDataDisk.YES)) + .thenReturn(OPERATION); + + fail(String.format( + " Experiment name %s is used multiple times in %s", + expName, envName, zzzzzzzzzzzz, zzzzzzzzzzzz)); + + new Handler(Looper.getMainLooper()) + .post( + new Runnable() { + @Override + public void run() { + utils.showShortToast( + application.getString( + R.string.working_on_project_format, + Utils.getProjectDisplayName(selectedProject))); + } + }); + + (new Handler()) + .post( + new Runnable() { + @Override + public void run() { + showErrorAndSetDone(error); + } + }); + + getContext() + .getErrorReporter() + .log(new RuntimeException("Called layout with a non-zero segment index: " + segmentIndex)); + + bind( + new Key>() {}); + + // this isn't a feature; we'd prefer to keep `new Key...` as one unit + bind( + new Key>() {}).then(); + } +} +---------- +class B21954779 { + { + when(computeApi.findOrCreateVm( + VM_METADATA, Optional.absent(), AssignReservedIp.YES, AttachDataDisk.YES)) + .thenReturn(OPERATION); + + fail(String.format( + " Experiment name %s is used multiple times in %s", + expName, envName, zzzzzzzzzzzz, zzzzzzzzzzzz)); + + new Handler(Looper.getMainLooper()).post(new Runnable() { + @Override + public void run() { + utils.showShortToast(application.getString( + R.string.working_on_project_format, Utils.getProjectDisplayName(selectedProject))); + } + }); + + (new Handler()).post(new Runnable() { + @Override + public void run() { + showErrorAndSetDone(error); + } + }); + + getContext() + .getErrorReporter() + .log(new RuntimeException("Called layout with a non-zero segment index: " + segmentIndex)); + + bind(new Key>() {}); + + // this isn't a feature; we'd prefer to keep `new Key...` as one unit + bind(new Key>() {}) + .then(); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21954779.input b/open-java-format/src/test/resources/test-cases/testdata/B21954779-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21954779.input rename to open-java-format/src/test/resources/test-cases/testdata/B21954779-lf.case index 804eb98ae..9d71d5e66 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21954779.input +++ b/open-java-format/src/test/resources/test-cases/testdata/B21954779-lf.case @@ -1,3 +1,4 @@ +---------- class B21954779 { { when(computeApi.findOrCreateVm( @@ -44,3 +45,40 @@ class B21954779 { new Key>() {}).then(); } } +---------- +class B21954779 { + { + when(computeApi.findOrCreateVm( + VM_METADATA, Optional.absent(), AssignReservedIp.YES, AttachDataDisk.YES)) + .thenReturn(OPERATION); + + fail(String.format( + " Experiment name %s is used multiple times in %s", + expName, envName, zzzzzzzzzzzz, zzzzzzzzzzzz)); + + new Handler(Looper.getMainLooper()).post(new Runnable() { + @Override + public void run() { + utils.showShortToast(application.getString( + R.string.working_on_project_format, Utils.getProjectDisplayName(selectedProject))); + } + }); + + (new Handler()).post(new Runnable() { + @Override + public void run() { + showErrorAndSetDone(error); + } + }); + + getContext() + .getErrorReporter() + .log(new RuntimeException("Called layout with a non-zero segment index: " + segmentIndex)); + + bind(new Key>() {}); + + // this isn't a feature; we'd prefer to keep `new Key...` as one unit + bind(new Key>() {}) + .then(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22169269-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B22169269-cr.case new file mode 100644 index 000000000..70a539020 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22169269-cr.case @@ -0,0 +1 @@ +---------- class B22169269 { { try { } catch ( ClassNotFoundException | NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { } try { } catch (ClassNotFoundException | NoSuchMethodException e) { } } } ---------- class B22169269 { { try { } catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { } try { } catch (ClassNotFoundException | NoSuchMethodException e) { } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22169269-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B22169269-crlf.case new file mode 100644 index 000000000..893a5a8bb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22169269-crlf.case @@ -0,0 +1,29 @@ +---------- +class B22169269 { + { + try { + } catch ( + ClassNotFoundException + | NoSuchMethodException + | InvocationTargetException + | IllegalAccessException e) { + } + try { + } catch (ClassNotFoundException | NoSuchMethodException e) { + } + } +} +---------- +class B22169269 { + { + try { + } catch (ClassNotFoundException + | NoSuchMethodException + | InvocationTargetException + | IllegalAccessException e) { + } + try { + } catch (ClassNotFoundException | NoSuchMethodException e) { + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22169269.output b/open-java-format/src/test/resources/test-cases/testdata/B22169269-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22169269.output rename to open-java-format/src/test/resources/test-cases/testdata/B22169269-lf.case index 768155ecd..74f9c27f7 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22169269.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B22169269-lf.case @@ -1,3 +1,19 @@ +---------- +class B22169269 { + { + try { + } catch ( + ClassNotFoundException + | NoSuchMethodException + | InvocationTargetException + | IllegalAccessException e) { + } + try { + } catch (ClassNotFoundException | NoSuchMethodException e) { + } + } +} +---------- class B22169269 { { try { diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22424362-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B22424362-cr.case new file mode 100644 index 000000000..45a5fee50 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22424362-cr.case @@ -0,0 +1 @@ +---------- class Test { { int x = 1 + 2; } } ---------- class Test { { int x = 1 + 2; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22424362-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B22424362-crlf.case new file mode 100644 index 000000000..38f4e95e6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22424362-crlf.case @@ -0,0 +1,15 @@ +---------- +class Test { + { + int x = + 1 + + + 2; + } +} +---------- +class Test { + { + int x = 1 + 2; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22424362-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B22424362-lf.case new file mode 100644 index 000000000..ef05817eb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22424362-lf.case @@ -0,0 +1,15 @@ +---------- +class Test { + { + int x = + 1 + + + 2; + } +} +---------- +class Test { + { + int x = 1 + 2; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22469536-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B22469536-cr.case new file mode 100644 index 000000000..9c379ccdd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22469536-cr.case @@ -0,0 +1 @@ +---------- public class Test { public static void foo() { long x = -9223372036854775808L; int y = -2147483648; } } ---------- public class Test { public static void foo() { long x = -9223372036854775808L; int y = -2147483648; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22469536-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B22469536-crlf.case new file mode 100644 index 000000000..0d27c045a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22469536-crlf.case @@ -0,0 +1,14 @@ +---------- +public class Test { + public static void foo() { + long x = -9223372036854775808L; + int y = -2147483648; + } +} +---------- +public class Test { + public static void foo() { + long x = -9223372036854775808L; + int y = -2147483648; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22469536-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B22469536-lf.case new file mode 100644 index 000000000..17766dfc2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22469536-lf.case @@ -0,0 +1,14 @@ +---------- +public class Test { + public static void foo() { + long x = -9223372036854775808L; + int y = -2147483648; + } +} +---------- +public class Test { + public static void foo() { + long x = -9223372036854775808L; + int y = -2147483648; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22488373-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B22488373-cr.case new file mode 100644 index 000000000..2a3a1c081 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22488373-cr.case @@ -0,0 +1 @@ +---------- class B22488373 { { if (enumBindingKeys.contains(bindingKey) && (bindingKey .key() .type() .getKind() .equals(DECLARED) && !((DeclaredType) bindingKey.key().type()).getTypeArguments().isEmpty())) {} } } ---------- class B22488373 { { if (enumBindingKeys.contains(bindingKey) && (bindingKey.key().type().getKind().equals(DECLARED) && !((DeclaredType) bindingKey.key().type()) .getTypeArguments() .isEmpty())) {} } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22488373-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B22488373-crlf.case new file mode 100644 index 000000000..69042cfa8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22488373-crlf.case @@ -0,0 +1,22 @@ +---------- +class B22488373 { + { + if (enumBindingKeys.contains(bindingKey) + && (bindingKey + .key() + .type() + .getKind() + .equals(DECLARED) + && !((DeclaredType) bindingKey.key().type()).getTypeArguments().isEmpty())) {} + } +} +---------- +class B22488373 { + { + if (enumBindingKeys.contains(bindingKey) + && (bindingKey.key().type().getKind().equals(DECLARED) + && !((DeclaredType) bindingKey.key().type()) + .getTypeArguments() + .isEmpty())) {} + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22488373.output b/open-java-format/src/test/resources/test-cases/testdata/B22488373-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22488373.output rename to open-java-format/src/test/resources/test-cases/testdata/B22488373-lf.case index e957f5112..50ba83ab1 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22488373.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B22488373-lf.case @@ -1,3 +1,16 @@ +---------- +class B22488373 { + { + if (enumBindingKeys.contains(bindingKey) + && (bindingKey + .key() + .type() + .getKind() + .equals(DECLARED) + && !((DeclaredType) bindingKey.key().type()).getTypeArguments().isEmpty())) {} + } +} +---------- class B22488373 { { if (enumBindingKeys.contains(bindingKey) diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22610221-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B22610221-cr.case new file mode 100644 index 000000000..3834eee09 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22610221-cr.case @@ -0,0 +1 @@ +---------- class B22610221 { { for (Map.Entry, Object> entry : FOO .bar() .bazs() .thing(someThing) .entrySet()) { output.put(entry.getKey(), entry.getValue()); } } } ---------- class B22610221 { { for (Map.Entry, Object> entry : FOO.bar().bazs().thing(someThing).entrySet()) { output.put(entry.getKey(), entry.getValue()); } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22610221-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B22610221-crlf.case new file mode 100644 index 000000000..15c496d73 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22610221-crlf.case @@ -0,0 +1,22 @@ +---------- +class B22610221 { + { + for (Map.Entry, Object> entry : + FOO + .bar() + .bazs() + .thing(someThing) + .entrySet()) { + output.put(entry.getKey(), entry.getValue()); + } + } +} +---------- +class B22610221 { + { + for (Map.Entry, Object> entry : + FOO.bar().bazs().thing(someThing).entrySet()) { + output.put(entry.getKey(), entry.getValue()); + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22610221.input b/open-java-format/src/test/resources/test-cases/testdata/B22610221-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22610221.input rename to open-java-format/src/test/resources/test-cases/testdata/B22610221-lf.case index eb05cfde0..6c33995fd 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22610221.input +++ b/open-java-format/src/test/resources/test-cases/testdata/B22610221-lf.case @@ -1,3 +1,4 @@ +---------- class B22610221 { { for (Map.Entry, Object> entry : @@ -10,3 +11,12 @@ class B22610221 { } } } +---------- +class B22610221 { + { + for (Map.Entry, Object> entry : + FOO.bar().bazs().thing(someThing).entrySet()) { + output.put(entry.getKey(), entry.getValue()); + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22815364-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B22815364-cr.case new file mode 100644 index 000000000..ea0c3d4f5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22815364-cr.case @@ -0,0 +1 @@ +---------- class B22815364 { @Xxx({ "=0|=0", "Xxx xxxx xx xxxxxxxx xx xxxxxxxxxxxxx.", "=0|xxx", "Xxx xxxx x xxxxxxxxxxxx.", "xxx|=0", "Xxx xxxx x xxxxxxx.", "xxx|xxx", "Xxx xxxx xxx xxxxxxx xxx xxx xxxxxxxxxxxx.", "xxxxx|xxx", "Xxx xxxx {0} xxxxxxxx xxx xxx xxxxxxxxxxxx.", "xxx|xxxxx", "Xxx xxxx xxx xxxxxxx xxx {1} xxxxxxxxxxxxx." }) int x; @Xxx({ "a", "b", "c", "d", // }) int y; int[] xs = { 1, 2, 3, 1, 2, 3, 1, 2, 3, }; int[] xs = { 1, 2, 3, 1, 2, 3, 1, 2, }; int[] xs = { 1, 2, 1, }; int[][] xs = { {0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111}, {0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111}, {0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111}, {0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111}, }; } ---------- class B22815364 { @Xxx({ "=0|=0", "Xxx xxxx xx xxxxxxxx xx xxxxxxxxxxxxx.", "=0|xxx", "Xxx xxxx x xxxxxxxxxxxx.", "xxx|=0", "Xxx xxxx x xxxxxxx.", "xxx|xxx", "Xxx xxxx xxx xxxxxxx xxx xxx xxxxxxxxxxxx.", "xxxxx|xxx", "Xxx xxxx {0} xxxxxxxx xxx xxx xxxxxxxxxxxx.", "xxx|xxxxx", "Xxx xxxx xxx xxxxxxx xxx {1} xxxxxxxxxxxxx." }) int x; @Xxx({ "a", "b", "c", "d", // }) int y; int[] xs = { 1, 2, 3, 1, 2, 3, 1, 2, 3, }; int[] xs = { 1, 2, 3, 1, 2, 3, 1, 2, }; int[] xs = { 1, 2, 1, }; int[][] xs = { { 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111 }, { 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111 }, { 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111 }, { 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111 }, }; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22815364-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B22815364-crlf.case new file mode 100644 index 000000000..ba4864c05 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22815364-crlf.case @@ -0,0 +1,121 @@ +---------- +class B22815364 { + @Xxx({ + "=0|=0", "Xxx xxxx xx xxxxxxxx xx xxxxxxxxxxxxx.", + "=0|xxx", "Xxx xxxx x xxxxxxxxxxxx.", + "xxx|=0", "Xxx xxxx x xxxxxxx.", + "xxx|xxx", "Xxx xxxx xxx xxxxxxx xxx xxx xxxxxxxxxxxx.", + "xxxxx|xxx", "Xxx xxxx {0} xxxxxxxx xxx xxx xxxxxxxxxxxx.", + "xxx|xxxxx", "Xxx xxxx xxx xxxxxxx xxx {1} xxxxxxxxxxxxx." + }) + int x; + + @Xxx({ + "a", "b", + "c", "d", + // + }) + int y; + + int[] xs = { + 1, 2, 3, + 1, 2, 3, + 1, 2, 3, + }; + + int[] xs = { + 1, 2, 3, + 1, 2, 3, + 1, 2, + }; + + int[] xs = { + 1, 2, + 1, + }; + + int[][] xs = { + {0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, + 0b111111111111111111, 0b111111111111111111, 0b111111111111111111}, {0b111111111111111111, + 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, + 0b111111111111111111, 0b111111111111111111}, + {0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, + 0b111111111111111111, 0b111111111111111111, 0b111111111111111111}, {0b111111111111111111, + 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, + 0b111111111111111111, 0b111111111111111111}, + }; +} +---------- +class B22815364 { + @Xxx({ + "=0|=0", "Xxx xxxx xx xxxxxxxx xx xxxxxxxxxxxxx.", + "=0|xxx", "Xxx xxxx x xxxxxxxxxxxx.", + "xxx|=0", "Xxx xxxx x xxxxxxx.", + "xxx|xxx", "Xxx xxxx xxx xxxxxxx xxx xxx xxxxxxxxxxxx.", + "xxxxx|xxx", "Xxx xxxx {0} xxxxxxxx xxx xxx xxxxxxxxxxxx.", + "xxx|xxxxx", "Xxx xxxx xxx xxxxxxx xxx {1} xxxxxxxxxxxxx." + }) + int x; + + @Xxx({ + "a", "b", + "c", "d", + // + }) + int y; + + int[] xs = { + 1, 2, 3, + 1, 2, 3, + 1, 2, 3, + }; + + int[] xs = { + 1, 2, 3, + 1, 2, 3, + 1, 2, + }; + + int[] xs = { + 1, 2, 1, + }; + + int[][] xs = { + { + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111 + }, + { + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111 + }, + { + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111 + }, + { + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111, + 0b111111111111111111 + }, + }; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22815364.output b/open-java-format/src/test/resources/test-cases/testdata/B22815364-lf.case similarity index 56% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22815364.output rename to open-java-format/src/test/resources/test-cases/testdata/B22815364-lf.case index fd46a9946..4bd9004d5 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22815364.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B22815364-lf.case @@ -1,3 +1,51 @@ +---------- +class B22815364 { + @Xxx({ + "=0|=0", "Xxx xxxx xx xxxxxxxx xx xxxxxxxxxxxxx.", + "=0|xxx", "Xxx xxxx x xxxxxxxxxxxx.", + "xxx|=0", "Xxx xxxx x xxxxxxx.", + "xxx|xxx", "Xxx xxxx xxx xxxxxxx xxx xxx xxxxxxxxxxxx.", + "xxxxx|xxx", "Xxx xxxx {0} xxxxxxxx xxx xxx xxxxxxxxxxxx.", + "xxx|xxxxx", "Xxx xxxx xxx xxxxxxx xxx {1} xxxxxxxxxxxxx." + }) + int x; + + @Xxx({ + "a", "b", + "c", "d", + // + }) + int y; + + int[] xs = { + 1, 2, 3, + 1, 2, 3, + 1, 2, 3, + }; + + int[] xs = { + 1, 2, 3, + 1, 2, 3, + 1, 2, + }; + + int[] xs = { + 1, 2, + 1, + }; + + int[][] xs = { + {0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, + 0b111111111111111111, 0b111111111111111111, 0b111111111111111111}, {0b111111111111111111, + 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, + 0b111111111111111111, 0b111111111111111111}, + {0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, + 0b111111111111111111, 0b111111111111111111, 0b111111111111111111}, {0b111111111111111111, + 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, 0b111111111111111111, + 0b111111111111111111, 0b111111111111111111}, + }; +} +---------- class B22815364 { @Xxx({ "=0|=0", "Xxx xxxx xx xxxxxxxx xx xxxxxxxxxxxxx.", diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22848286-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B22848286-cr.case new file mode 100644 index 000000000..02596bee7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22848286-cr.case @@ -0,0 +1 @@ +---------- class B22848286 { @FxxxSxxx(xxxx = "xxxxxx_xxxxxxx_xxxxxxxxx_xxxx", xxxx = "Xxxxx xxxx xx xxxxxx xxxxxxx xxxxxxxxx.") int x; @FxxxGxxxxxxxx(xxxx = "Xxx xxxxxx xxxxxxxxy xxx xxx xxxxxxxxx, x.x. xxx xxxxxx xxxxxxxx xxxxxxxxy") int y; } ---------- class B22848286 { @FxxxSxxx(xxxx = "xxxxxx_xxxxxxx_xxxxxxxxx_xxxx", xxxx = "Xxxxx xxxx xx xxxxxx xxxxxxx xxxxxxxxx.") int x; @FxxxGxxxxxxxx(xxxx = "Xxx xxxxxx xxxxxxxxy xxx xxx xxxxxxxxx, x.x. xxx xxxxxx xxxxxxxx xxxxxxxxy") int y; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22848286-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B22848286-crlf.case new file mode 100644 index 000000000..9e2238887 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22848286-crlf.case @@ -0,0 +1,18 @@ +---------- +class B22848286 { + + @FxxxSxxx(xxxx = "xxxxxx_xxxxxxx_xxxxxxxxx_xxxx", xxxx = "Xxxxx xxxx xx xxxxxx xxxxxxx xxxxxxxxx.") + int x; + + @FxxxGxxxxxxxx(xxxx = "Xxx xxxxxx xxxxxxxxy xxx xxx xxxxxxxxx, x.x. xxx xxxxxx xxxxxxxx xxxxxxxxy") + int y; +} +---------- +class B22848286 { + + @FxxxSxxx(xxxx = "xxxxxx_xxxxxxx_xxxxxxxxx_xxxx", xxxx = "Xxxxx xxxx xx xxxxxx xxxxxxx xxxxxxxxx.") + int x; + + @FxxxGxxxxxxxx(xxxx = "Xxx xxxxxx xxxxxxxxy xxx xxx xxxxxxxxx, x.x. xxx xxxxxx xxxxxxxx xxxxxxxxy") + int y; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22848286-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B22848286-lf.case new file mode 100644 index 000000000..2d2f81cae --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22848286-lf.case @@ -0,0 +1,18 @@ +---------- +class B22848286 { + + @FxxxSxxx(xxxx = "xxxxxx_xxxxxxx_xxxxxxxxx_xxxx", xxxx = "Xxxxx xxxx xx xxxxxx xxxxxxx xxxxxxxxx.") + int x; + + @FxxxGxxxxxxxx(xxxx = "Xxx xxxxxx xxxxxxxxy xxx xxx xxxxxxxxx, x.x. xxx xxxxxx xxxxxxxx xxxxxxxxy") + int y; +} +---------- +class B22848286 { + + @FxxxSxxx(xxxx = "xxxxxx_xxxxxxx_xxxxxxxxx_xxxx", xxxx = "Xxxxx xxxx xx xxxxxx xxxxxxx xxxxxxxxx.") + int x; + + @FxxxGxxxxxxxx(xxxx = "Xxx xxxxxx xxxxxxxxy xxx xxx xxxxxxxxx, x.x. xxx xxxxxx xxxxxxxx xxxxxxxxy") + int y; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22873322-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B22873322-cr.case new file mode 100644 index 000000000..98c737655 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22873322-cr.case @@ -0,0 +1 @@ +---------- class B22873322 { { f(param -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); f((param1, param2) -> veryLooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param1, param2)); f((int param) -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); f((param1, param2) -> { return expr(param1, param2); }); f((param1, param2) -> { Object foo = expr(param1, param2); return foo; }); } } ---------- class B22873322 { { f(param -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); f((param1, param2) -> veryLooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param1, param2)); f((int param) -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); f((param1, param2) -> { return expr(param1, param2); }); f((param1, param2) -> { Object foo = expr(param1, param2); return foo; }); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22873322-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B22873322-crlf.case new file mode 100644 index 000000000..7d768f0f5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22873322-crlf.case @@ -0,0 +1,30 @@ +---------- +class B22873322 { + { + f(param -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); + f((param1, param2) -> veryLooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param1, param2)); + f((int param) -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); + f((param1, param2) -> { + return expr(param1, param2); + }); + f((param1, param2) -> { + Object foo = expr(param1, param2); + return foo; + }); + } +} +---------- +class B22873322 { + { + f(param -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); + f((param1, param2) -> veryLooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param1, param2)); + f((int param) -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); + f((param1, param2) -> { + return expr(param1, param2); + }); + f((param1, param2) -> { + Object foo = expr(param1, param2); + return foo; + }); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22873322.output b/open-java-format/src/test/resources/test-cases/testdata/B22873322-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22873322.output rename to open-java-format/src/test/resources/test-cases/testdata/B22873322-lf.case index e285177b2..5caf398f0 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22873322.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B22873322-lf.case @@ -1,3 +1,19 @@ +---------- +class B22873322 { + { + f(param -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); + f((param1, param2) -> veryLooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param1, param2)); + f((int param) -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); + f((param1, param2) -> { + return expr(param1, param2); + }); + f((param1, param2) -> { + Object foo = expr(param1, param2); + return foo; + }); + } +} +---------- class B22873322 { { f(param -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22913048-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B22913048-cr.case new file mode 100644 index 000000000..9880a3877 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22913048-cr.case @@ -0,0 +1 @@ +---------- private class Yellow extends Red.Orange { Yellow(Red red) { red.super(); } Class getClassB() { return new TypeToken(getClass()) {}.getRawType(); } } ---------- private class Yellow extends Red.Orange { Yellow(Red red) { red.super(); } Class getClassB() { return new TypeToken(getClass()) {}.getRawType(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22913048-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B22913048-crlf.case new file mode 100644 index 000000000..9e24103fe --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22913048-crlf.case @@ -0,0 +1,20 @@ +---------- +private class Yellow extends Red.Orange { + Yellow(Red red) { + red.super(); + } + + Class getClassB() { + return new TypeToken(getClass()) {}.getRawType(); + } +} +---------- +private class Yellow extends Red.Orange { + Yellow(Red red) { + red.super(); + } + + Class getClassB() { + return new TypeToken(getClass()) {}.getRawType(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22913048-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B22913048-lf.case new file mode 100644 index 000000000..91b053691 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22913048-lf.case @@ -0,0 +1,20 @@ +---------- +private class Yellow extends Red.Orange { + Yellow(Red red) { + red.super(); + } + + Class getClassB() { + return new TypeToken(getClass()) {}.getRawType(); + } +} +---------- +private class Yellow extends Red.Orange { + Yellow(Red red) { + red.super(); + } + + Class getClassB() { + return new TypeToken(getClass()) {}.getRawType(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B23349153-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B23349153-cr.case new file mode 100644 index 000000000..b3d19f1b0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23349153-cr.case @@ -0,0 +1 @@ +---------- class B23349153 { enum Foo { A, B,; } { System.err.println("Hello");; } } private enum UnsafeAtomicHelperFactory { REALLY_TRY_TO_CREATE { @Override AtomicHelper tryCreateUnsafeAtomicHelper() { return new UnsafeAtomicHelper(); } }, DONT_EVEN_TRY_TO_CREATE { @Override AtomicHelper tryCreateUnsafeAtomicHelper() { return null; } }, ; abstract AtomicHelper tryCreateUnsafeAtomicHelper(); } ---------- class B23349153 { enum Foo { A, B, ; } { System.err.println("Hello"); ; } } private enum UnsafeAtomicHelperFactory { REALLY_TRY_TO_CREATE { @Override AtomicHelper tryCreateUnsafeAtomicHelper() { return new UnsafeAtomicHelper(); } }, DONT_EVEN_TRY_TO_CREATE { @Override AtomicHelper tryCreateUnsafeAtomicHelper() { return null; } }, ; abstract AtomicHelper tryCreateUnsafeAtomicHelper(); } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B23349153-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B23349153-crlf.case new file mode 100644 index 000000000..59db1448c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23349153-crlf.case @@ -0,0 +1,61 @@ +---------- +class B23349153 { + enum Foo { + A, B,; + } + { + System.err.println("Hello");; + } +} + +private enum UnsafeAtomicHelperFactory { + REALLY_TRY_TO_CREATE { + @Override + AtomicHelper tryCreateUnsafeAtomicHelper() { + return new UnsafeAtomicHelper(); + } + }, + + DONT_EVEN_TRY_TO_CREATE { + @Override + AtomicHelper tryCreateUnsafeAtomicHelper() { + return null; + } + }, + + ; + + abstract AtomicHelper tryCreateUnsafeAtomicHelper(); +} +---------- +class B23349153 { + enum Foo { + A, + B, + ; + } + + { + System.err.println("Hello"); + ; + } +} + +private enum UnsafeAtomicHelperFactory { + REALLY_TRY_TO_CREATE { + @Override + AtomicHelper tryCreateUnsafeAtomicHelper() { + return new UnsafeAtomicHelper(); + } + }, + + DONT_EVEN_TRY_TO_CREATE { + @Override + AtomicHelper tryCreateUnsafeAtomicHelper() { + return null; + } + }, + ; + + abstract AtomicHelper tryCreateUnsafeAtomicHelper(); +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23349153.output b/open-java-format/src/test/resources/test-cases/testdata/B23349153-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23349153.output rename to open-java-format/src/test/resources/test-cases/testdata/B23349153-lf.case index 5c87ebff5..77ccea4e0 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23349153.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B23349153-lf.case @@ -1,3 +1,33 @@ +---------- +class B23349153 { + enum Foo { + A, B,; + } + { + System.err.println("Hello");; + } +} + +private enum UnsafeAtomicHelperFactory { + REALLY_TRY_TO_CREATE { + @Override + AtomicHelper tryCreateUnsafeAtomicHelper() { + return new UnsafeAtomicHelper(); + } + }, + + DONT_EVEN_TRY_TO_CREATE { + @Override + AtomicHelper tryCreateUnsafeAtomicHelper() { + return null; + } + }, + + ; + + abstract AtomicHelper tryCreateUnsafeAtomicHelper(); +} +---------- class B23349153 { enum Foo { A, diff --git a/open-java-format/src/test/resources/test-cases/testdata/B23514513-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B23514513-cr.case new file mode 100644 index 000000000..edc0b6ce8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23514513-cr.case @@ -0,0 +1 @@ +---------- class Test { { f( rrr.kkkkk.uuuuuuuu, rrr.iiiiii.ggggggggggggggggg, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); } } ---------- class Test { { f(rrr.kkkkk.uuuuuuuu, rrr.iiiiii.ggggggggggggggggg, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B23514513-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B23514513-crlf.case new file mode 100644 index 000000000..870f76198 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23514513-crlf.case @@ -0,0 +1,14 @@ +---------- +class Test { + { + f( + rrr.kkkkk.uuuuuuuu, rrr.iiiiii.ggggggggggggggggg, + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + } +} +---------- +class Test { + { + f(rrr.kkkkk.uuuuuuuu, rrr.iiiiii.ggggggggggggggggg, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B23514513-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B23514513-lf.case new file mode 100644 index 000000000..5d4d9118d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23514513-lf.case @@ -0,0 +1,14 @@ +---------- +class Test { + { + f( + rrr.kkkkk.uuuuuuuu, rrr.iiiiii.ggggggggggggggggg, + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + } +} +---------- +class Test { + { + f(rrr.kkkkk.uuuuuuuu, rrr.iiiiii.ggggggggggggggggg, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B23626035-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B23626035-cr.case new file mode 100644 index 000000000..ed25517e0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23626035-cr.case @@ -0,0 +1 @@ +---------- class Test2 { void f(Test2... xs) {} } ---------- class Test2 { void f(Test2... xs) {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B23626035-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B23626035-crlf.case new file mode 100644 index 000000000..daadb8a1e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23626035-crlf.case @@ -0,0 +1,6 @@ +---------- +class Test2 { void f(Test2... xs) {} } +---------- +class Test2 { + void f(Test2... xs) {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B23626035-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B23626035-lf.case new file mode 100644 index 000000000..dce20f4d8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23626035-lf.case @@ -0,0 +1,6 @@ +---------- +class Test2 { void f(Test2... xs) {} } +---------- +class Test2 { + void f(Test2... xs) {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B23708487-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B23708487-cr.case new file mode 100644 index 000000000..92d06f195 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23708487-cr.case @@ -0,0 +1 @@ +---------- class B23708487 { static { TASK_AS_OWNER = com.google.security.acl.proto2api.ACL.Entry.newBuilder() .setRole(com.google.security.acl.proto2api.ACL.Entry.ROLE.OWNER.getNumber()) .setScope(com.google.security.acl.proto2api.ACL.Scope.newBuilder() .setMdbUser(BorgTaskInfo.getMdbUser().getMdbUserName())) .build(); } } ---------- class B23708487 { static { TASK_AS_OWNER = com.google.security.acl.proto2api.ACL.Entry.newBuilder() .setRole(com.google.security.acl.proto2api.ACL.Entry.ROLE.OWNER.getNumber()) .setScope(com.google.security.acl.proto2api.ACL.Scope.newBuilder() .setMdbUser(BorgTaskInfo.getMdbUser().getMdbUserName())) .build(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B23708487-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B23708487-crlf.case new file mode 100644 index 000000000..3e27a2bb0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23708487-crlf.case @@ -0,0 +1,21 @@ +---------- +class B23708487 { + static { + TASK_AS_OWNER = + com.google.security.acl.proto2api.ACL.Entry.newBuilder() + .setRole(com.google.security.acl.proto2api.ACL.Entry.ROLE.OWNER.getNumber()) + .setScope(com.google.security.acl.proto2api.ACL.Scope.newBuilder() + .setMdbUser(BorgTaskInfo.getMdbUser().getMdbUserName())) + .build(); + } +} +---------- +class B23708487 { + static { + TASK_AS_OWNER = com.google.security.acl.proto2api.ACL.Entry.newBuilder() + .setRole(com.google.security.acl.proto2api.ACL.Entry.ROLE.OWNER.getNumber()) + .setScope(com.google.security.acl.proto2api.ACL.Scope.newBuilder() + .setMdbUser(BorgTaskInfo.getMdbUser().getMdbUserName())) + .build(); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23708487.output b/open-java-format/src/test/resources/test-cases/testdata/B23708487-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23708487.output rename to open-java-format/src/test/resources/test-cases/testdata/B23708487-lf.case index 9a9be3737..a34bab5ae 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23708487.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B23708487-lf.case @@ -1,3 +1,15 @@ +---------- +class B23708487 { + static { + TASK_AS_OWNER = + com.google.security.acl.proto2api.ACL.Entry.newBuilder() + .setRole(com.google.security.acl.proto2api.ACL.Entry.ROLE.OWNER.getNumber()) + .setScope(com.google.security.acl.proto2api.ACL.Scope.newBuilder() + .setMdbUser(BorgTaskInfo.getMdbUser().getMdbUserName())) + .build(); + } +} +---------- class B23708487 { static { TASK_AS_OWNER = com.google.security.acl.proto2api.ACL.Entry.newBuilder() diff --git a/open-java-format/src/test/resources/test-cases/testdata/B23749160-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B23749160-cr.case new file mode 100644 index 000000000..6c0b4c509 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23749160-cr.case @@ -0,0 +1 @@ +---------- class B23749160 { { mockDailySummaryModuleListFiller .buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( anyInt(), anyInt(), anyInt()); mockDailySummaryModuleListFiller . buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( anyInt(), anyInt(), anyInt()); foo . buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( anyInt(), anyInt(), anyInt()) .bar(); // `.build`... and `anotherThing`... are technically at different syntactic // levels, but the indentation required to express that starts to get out // of hand MockDailySummaryModuleListFiller .buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( anyInt(), anyInt(), anyInt()) .anotherThing(); when( mockDailySummaryModuleListFiller .buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDay( anyInt(), anyInt(), anyInt())) .then(); final List XXXXXXXX = ImmutableList.of( XXXXXXX, // XXXXXXX, // XXXXXXX, // XXXXXXX, // XXXXXXX // ); } } ---------- class B23749160 { { mockDailySummaryModuleListFiller.buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( anyInt(), anyInt(), anyInt()); mockDailySummaryModuleListFiller . buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( anyInt(), anyInt(), anyInt()); foo. buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( anyInt(), anyInt(), anyInt()) .bar(); // `.build`... and `anotherThing`... are technically at different syntactic // levels, but the indentation required to express that starts to get out // of hand MockDailySummaryModuleListFiller.buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( anyInt(), anyInt(), anyInt()) .anotherThing(); when(mockDailySummaryModuleListFiller.buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDay( anyInt(), anyInt(), anyInt())) .then(); final List XXXXXXXX = ImmutableList.of( XXXXXXX, // XXXXXXX, // XXXXXXX, // XXXXXXX, // XXXXXXX // ); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B23749160-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B23749160-crlf.case new file mode 100644 index 000000000..4d2cf8a60 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23749160-crlf.case @@ -0,0 +1,80 @@ +---------- +class B23749160 { + { + mockDailySummaryModuleListFiller + .buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( + anyInt(), anyInt(), anyInt()); + + mockDailySummaryModuleListFiller + . + buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( + anyInt(), anyInt(), anyInt()); + + foo + . + buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( + anyInt(), anyInt(), anyInt()) + .bar(); + + // `.build`... and `anotherThing`... are technically at different syntactic + // levels, but the indentation required to express that starts to get out + // of hand + MockDailySummaryModuleListFiller + .buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( + anyInt(), anyInt(), anyInt()) + .anotherThing(); + + when( + mockDailySummaryModuleListFiller + .buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDay( + anyInt(), anyInt(), anyInt())) + .then(); + + final List XXXXXXXX = + ImmutableList.of( + XXXXXXX, // + XXXXXXX, // + XXXXXXX, // + XXXXXXX, // + XXXXXXX // + ); + } +} +---------- +class B23749160 { + { + mockDailySummaryModuleListFiller.buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( + anyInt(), anyInt(), anyInt()); + + mockDailySummaryModuleListFiller + . + buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( + anyInt(), anyInt(), anyInt()); + + foo. + buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( + anyInt(), anyInt(), anyInt()) + .bar(); + + // `.build`... and `anotherThing`... are technically at different syntactic + // levels, but the indentation required to express that starts to get out + // of hand + MockDailySummaryModuleListFiller.buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( + anyInt(), anyInt(), anyInt()) + .anotherThing(); + + when(mockDailySummaryModuleListFiller.buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDay( + anyInt(), anyInt(), anyInt())) + .then(); + + final List XXXXXXXX = ImmutableList.of( + XXXXXXX, // + XXXXXXX, // + XXXXXXX, // + XXXXXXX, // + XXXXXXX // + ); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23749160.output b/open-java-format/src/test/resources/test-cases/testdata/B23749160-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23749160.output rename to open-java-format/src/test/resources/test-cases/testdata/B23749160-lf.case index b08be17af..5f02f9068 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23749160.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B23749160-lf.case @@ -1,3 +1,48 @@ +---------- +class B23749160 { + { + mockDailySummaryModuleListFiller + .buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( + anyInt(), anyInt(), anyInt()); + + mockDailySummaryModuleListFiller + . + buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( + anyInt(), anyInt(), anyInt()); + + foo + . + buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( + anyInt(), anyInt(), anyInt()) + .bar(); + + // `.build`... and `anotherThing`... are technically at different syntactic + // levels, but the indentation required to express that starts to get out + // of hand + MockDailySummaryModuleListFiller + .buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( + anyInt(), anyInt(), anyInt()) + .anotherThing(); + + when( + mockDailySummaryModuleListFiller + .buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDay( + anyInt(), anyInt(), anyInt())) + .then(); + + final List XXXXXXXX = + ImmutableList.of( + XXXXXXX, // + XXXXXXX, // + XXXXXXX, // + XXXXXXX, // + XXXXXXX // + ); + } +} +---------- class B23749160 { { mockDailySummaryModuleListFiller.buildDailySummaryModulesWithHeadersOnlyAndOneExpandedDayxxxxxxxxxxx( diff --git a/open-java-format/src/test/resources/test-cases/testdata/B23804934-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B23804934-cr.case new file mode 100644 index 000000000..a11110e9e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23804934-cr.case @@ -0,0 +1 @@ +---------- class B23804934{ @Zzzzzz B23804934( ZzzzzzzzZzzzzzZzzzzZzzzzzzz zzzzzzzzZzzzzzZzzzzZzzzzzzz, ZzzzzzzZzzzzzzz zzzzzzZzzzZzzzZzzzzzzz, @ZzzzZzzzzZzzzzzz Zzzzzz zzzzzZzzzzzz, @ZzzzzzzzzzzZzzzzzz(Zz.ZZZZZZZ_ZZZZZ_ZZZZ_ZZZZZZ_ZZZZ_ZZZZZZZZZZ) Zzzzzzzz zzzzzZzzzZzzzzzZzzzZzzzzzzzzz) { zzzz.zzzzzzzzZzzzzzZzzzzZzzzzzzz = zzzzzzzzZzzzzzZzzzzZzzzzzzz; zzzz.zzzzzzZzzzZzzzZzzzzzzz = zzzzzzZzzzZzzzZzzzzzzz; zzzz.zzzzzZzzzzzz = zzzzzZzzzzzz; zzzz.zzzzzZzzzZzzzzzZzzzZzzzzzzzzz = zzzzzZzzzZzzzzzZzzzZzzzzzzzzz; } zzzz z( zzz z, @Zzzzzzzz @Zzzzzzzzzz ZzzzzzzzzZzzz zzzzZzzzZzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) {} @ZzzZzzzZzzzzzzzzzz @Zzzzzzzz(zzzzzzzzz = Zzzzzzzzz.ZZ) ZzzzzzzzzzZzzzzz zzzzzzzZzzzzzzzzzz( @Zzz @Zzz zzzz zzzzZzzzZz, @Zzz @ZzzzzzzzzzZzzzz(zzzz = ZzzzzZzzzzzZzzzz.ZZZZZZ_ZZZ_ZZZ_ZZZZZZZ) zzzzzzz zzzzzzZzzZzzZzzzzzz, @Zzzzz @ZzzzzzzzzzZzzzz(zzzz = ZzzzzZzzzzzZzzzz.ZZZZZ_ZZZ_ZZZZZZZZZZZ) zzzzzzz zzzzzZzzZzzzzzzzzzz, @Zzzzz ZzzzzZzzz zzzzzZzzz) {} void fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff( final zzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) {} } ---------- class B23804934 { @Zzzzzz B23804934( ZzzzzzzzZzzzzzZzzzzZzzzzzzz zzzzzzzzZzzzzzZzzzzZzzzzzzz, ZzzzzzzZzzzzzzz zzzzzzZzzzZzzzZzzzzzzz, @ZzzzZzzzzZzzzzzz Zzzzzz zzzzzZzzzzzz, @ZzzzzzzzzzzZzzzzzz(Zz.ZZZZZZZ_ZZZZZ_ZZZZ_ZZZZZZ_ZZZZ_ZZZZZZZZZZ) Zzzzzzzz zzzzzZzzzZzzzzzZzzzZzzzzzzzzz) { zzzz.zzzzzzzzZzzzzzZzzzzZzzzzzzz = zzzzzzzzZzzzzzZzzzzZzzzzzzz; zzzz.zzzzzzZzzzZzzzZzzzzzzz = zzzzzzZzzzZzzzZzzzzzzz; zzzz.zzzzzZzzzzzz = zzzzzZzzzzzz; zzzz.zzzzzZzzzZzzzzzZzzzZzzzzzzzzz = zzzzzZzzzZzzzzzZzzzZzzzzzzzzz; } zzzz z( zzz z, @Zzzzzzzz @Zzzzzzzzzz ZzzzzzzzzZzzz zzzzZzzzZzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) {} @ZzzZzzzZzzzzzzzzzz @Zzzzzzzz(zzzzzzzzz = Zzzzzzzzz.ZZ) ZzzzzzzzzzZzzzzz zzzzzzzZzzzzzzzzzz( @Zzz @Zzz zzzz zzzzZzzzZz, @Zzz @ZzzzzzzzzzZzzzz(zzzz = ZzzzzZzzzzzZzzzz.ZZZZZZ_ZZZ_ZZZ_ZZZZZZZ) zzzzzzz zzzzzzZzzZzzZzzzzzz, @Zzzzz @ZzzzzzzzzzZzzzz(zzzz = ZzzzzZzzzzzZzzzz.ZZZZZ_ZZZ_ZZZZZZZZZZZ) zzzzzzz zzzzzZzzZzzzzzzzzzz, @Zzzzz ZzzzzZzzz zzzzzZzzz) {} void fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff( final zzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B23804934-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B23804934-crlf.case new file mode 100644 index 000000000..4ae11b24e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23804934-crlf.case @@ -0,0 +1,67 @@ +---------- +class B23804934{ + + @Zzzzzz + B23804934( + ZzzzzzzzZzzzzzZzzzzZzzzzzzz zzzzzzzzZzzzzzZzzzzZzzzzzzz, + ZzzzzzzZzzzzzzz zzzzzzZzzzZzzzZzzzzzzz, + @ZzzzZzzzzZzzzzzz Zzzzzz zzzzzZzzzzzz, + @ZzzzzzzzzzzZzzzzzz(Zz.ZZZZZZZ_ZZZZZ_ZZZZ_ZZZZZZ_ZZZZ_ZZZZZZZZZZ) + Zzzzzzzz zzzzzZzzzZzzzzzZzzzZzzzzzzzzz) { + zzzz.zzzzzzzzZzzzzzZzzzzZzzzzzzz = zzzzzzzzZzzzzzZzzzzZzzzzzzz; + zzzz.zzzzzzZzzzZzzzZzzzzzzz = zzzzzzZzzzZzzzZzzzzzzz; + zzzz.zzzzzZzzzzzz = zzzzzZzzzzzz; + zzzz.zzzzzZzzzZzzzzzZzzzZzzzzzzzzz = zzzzzZzzzZzzzzzZzzzZzzzzzzzzz; + } + + zzzz z( + zzz z, + @Zzzzzzzz @Zzzzzzzzzz + ZzzzzzzzzZzzz + zzzzZzzzZzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) {} + + @ZzzZzzzZzzzzzzzzzz + @Zzzzzzzz(zzzzzzzzz = Zzzzzzzzz.ZZ) + ZzzzzzzzzzZzzzzz zzzzzzzZzzzzzzzzzz( + @Zzz @Zzz zzzz zzzzZzzzZz, + @Zzz @ZzzzzzzzzzZzzzz(zzzz = ZzzzzZzzzzzZzzzz.ZZZZZZ_ZZZ_ZZZ_ZZZZZZZ) + zzzzzzz zzzzzzZzzZzzZzzzzzz, + @Zzzzz @ZzzzzzzzzzZzzzz(zzzz = ZzzzzZzzzzzZzzzz.ZZZZZ_ZZZ_ZZZZZZZZZZZ) + zzzzzzz zzzzzZzzZzzzzzzzzzz, + @Zzzzz ZzzzzZzzz zzzzzZzzz) {} + + void fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff( + final zzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) {} +} +---------- +class B23804934 { + + @Zzzzzz + B23804934( + ZzzzzzzzZzzzzzZzzzzZzzzzzzz zzzzzzzzZzzzzzZzzzzZzzzzzzz, + ZzzzzzzZzzzzzzz zzzzzzZzzzZzzzZzzzzzzz, + @ZzzzZzzzzZzzzzzz Zzzzzz zzzzzZzzzzzz, + @ZzzzzzzzzzzZzzzzzz(Zz.ZZZZZZZ_ZZZZZ_ZZZZ_ZZZZZZ_ZZZZ_ZZZZZZZZZZ) + Zzzzzzzz zzzzzZzzzZzzzzzZzzzZzzzzzzzzz) { + zzzz.zzzzzzzzZzzzzzZzzzzZzzzzzzz = zzzzzzzzZzzzzzZzzzzZzzzzzzz; + zzzz.zzzzzzZzzzZzzzZzzzzzzz = zzzzzzZzzzZzzzZzzzzzzz; + zzzz.zzzzzZzzzzzz = zzzzzZzzzzzz; + zzzz.zzzzzZzzzZzzzzzZzzzZzzzzzzzzz = zzzzzZzzzZzzzzzZzzzZzzzzzzzzz; + } + + zzzz z( + zzz z, + @Zzzzzzzz @Zzzzzzzzzz + ZzzzzzzzzZzzz zzzzZzzzZzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) {} + + @ZzzZzzzZzzzzzzzzzz + @Zzzzzzzz(zzzzzzzzz = Zzzzzzzzz.ZZ) + ZzzzzzzzzzZzzzzz zzzzzzzZzzzzzzzzzz( + @Zzz @Zzz zzzz zzzzZzzzZz, + @Zzz @ZzzzzzzzzzZzzzz(zzzz = ZzzzzZzzzzzZzzzz.ZZZZZZ_ZZZ_ZZZ_ZZZZZZZ) zzzzzzz zzzzzzZzzZzzZzzzzzz, + @Zzzzz @ZzzzzzzzzzZzzzz(zzzz = ZzzzzZzzzzzZzzzz.ZZZZZ_ZZZ_ZZZZZZZZZZZ) zzzzzzz zzzzzZzzZzzzzzzzzzz, + @Zzzzz ZzzzzZzzz zzzzzZzzz) {} + + void fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff( + final zzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) {} +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23804934.output b/open-java-format/src/test/resources/test-cases/testdata/B23804934-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23804934.output rename to open-java-format/src/test/resources/test-cases/testdata/B23804934-lf.case index e4361b21e..81a7cb912 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23804934.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B23804934-lf.case @@ -1,3 +1,39 @@ +---------- +class B23804934{ + + @Zzzzzz + B23804934( + ZzzzzzzzZzzzzzZzzzzZzzzzzzz zzzzzzzzZzzzzzZzzzzZzzzzzzz, + ZzzzzzzZzzzzzzz zzzzzzZzzzZzzzZzzzzzzz, + @ZzzzZzzzzZzzzzzz Zzzzzz zzzzzZzzzzzz, + @ZzzzzzzzzzzZzzzzzz(Zz.ZZZZZZZ_ZZZZZ_ZZZZ_ZZZZZZ_ZZZZ_ZZZZZZZZZZ) + Zzzzzzzz zzzzzZzzzZzzzzzZzzzZzzzzzzzzz) { + zzzz.zzzzzzzzZzzzzzZzzzzZzzzzzzz = zzzzzzzzZzzzzzZzzzzZzzzzzzz; + zzzz.zzzzzzZzzzZzzzZzzzzzzz = zzzzzzZzzzZzzzZzzzzzzz; + zzzz.zzzzzZzzzzzz = zzzzzZzzzzzz; + zzzz.zzzzzZzzzZzzzzzZzzzZzzzzzzzzz = zzzzzZzzzZzzzzzZzzzZzzzzzzzzz; + } + + zzzz z( + zzz z, + @Zzzzzzzz @Zzzzzzzzzz + ZzzzzzzzzZzzz + zzzzZzzzZzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) {} + + @ZzzZzzzZzzzzzzzzzz + @Zzzzzzzz(zzzzzzzzz = Zzzzzzzzz.ZZ) + ZzzzzzzzzzZzzzzz zzzzzzzZzzzzzzzzzz( + @Zzz @Zzz zzzz zzzzZzzzZz, + @Zzz @ZzzzzzzzzzZzzzz(zzzz = ZzzzzZzzzzzZzzzz.ZZZZZZ_ZZZ_ZZZ_ZZZZZZZ) + zzzzzzz zzzzzzZzzZzzZzzzzzz, + @Zzzzz @ZzzzzzzzzzZzzzz(zzzz = ZzzzzZzzzzzZzzzz.ZZZZZ_ZZZ_ZZZZZZZZZZZ) + zzzzzzz zzzzzZzzZzzzzzzzzzz, + @Zzzzz ZzzzzZzzz zzzzzZzzz) {} + + void fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff( + final zzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) {} +} +---------- class B23804934 { @Zzzzzz diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24202287-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B24202287-cr.case new file mode 100644 index 000000000..edc0770bb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24202287-cr.case @@ -0,0 +1 @@ +---------- class B24202287 { { this.overflowContactCompositeSupportedRenderers = this.getSharePanelResponse.contents.unifiedSharePanelRenderer.contents[0] .connectionSection .connectionsOverflowMenu .connectionsOverflowMenuRenderer .contents[ 0] .overflowConnectionSectionRenderer .contacts[ 0]; int y = ((int[]) null)[0]; } IntentSource getSource() { return mIntent.isPresent() && mIntent.get().hasExtra(INTENT_SOURCE_KEY) ? IntentSource.values()[ mIntent.get().getIntExtra(INTENT_SOURCE_KEY, IntentSource.OTHER.ordinal())] : IntentSource.OTHER; } { mTabUiParts[mRenderedTabIndex] .setData( tabs[mRenderedTabIndex], true /* isSelected */, mIsLoadingState, mErrorMessageType, mOnDailySummaryHeaderClickListener, mShowSpacerForSnackbar, mResetScrollAndAnimationAndReplaceDoodle); } } ---------- class B24202287 { { this.overflowContactCompositeSupportedRenderers = this.getSharePanelResponse .contents .unifiedSharePanelRenderer .contents[0] .connectionSection .connectionsOverflowMenu .connectionsOverflowMenuRenderer .contents[0] .overflowConnectionSectionRenderer .contacts[0]; int y = ((int[]) null)[0]; } IntentSource getSource() { return mIntent.isPresent() && mIntent.get().hasExtra(INTENT_SOURCE_KEY) ? IntentSource.values()[mIntent.get().getIntExtra(INTENT_SOURCE_KEY, IntentSource.OTHER.ordinal())] : IntentSource.OTHER; } { mTabUiParts[mRenderedTabIndex].setData( tabs[mRenderedTabIndex], true /* isSelected */, mIsLoadingState, mErrorMessageType, mOnDailySummaryHeaderClickListener, mShowSpacerForSnackbar, mResetScrollAndAnimationAndReplaceDoodle); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24202287-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B24202287-crlf.case new file mode 100644 index 000000000..11f2002b3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24202287-crlf.case @@ -0,0 +1,70 @@ +---------- +class B24202287 { + { + this.overflowContactCompositeSupportedRenderers = + this.getSharePanelResponse.contents.unifiedSharePanelRenderer.contents[0] + .connectionSection + .connectionsOverflowMenu + .connectionsOverflowMenuRenderer + .contents[ + 0] + .overflowConnectionSectionRenderer + .contacts[ + 0]; + + int y = ((int[]) null)[0]; + } + + IntentSource getSource() { + return mIntent.isPresent() && mIntent.get().hasExtra(INTENT_SOURCE_KEY) + ? IntentSource.values()[ + mIntent.get().getIntExtra(INTENT_SOURCE_KEY, IntentSource.OTHER.ordinal())] + : IntentSource.OTHER; + } + + { + mTabUiParts[mRenderedTabIndex] + .setData( + tabs[mRenderedTabIndex], + true /* isSelected */, + mIsLoadingState, + mErrorMessageType, + mOnDailySummaryHeaderClickListener, + mShowSpacerForSnackbar, + mResetScrollAndAnimationAndReplaceDoodle); + } +} +---------- +class B24202287 { + { + this.overflowContactCompositeSupportedRenderers = this.getSharePanelResponse + .contents + .unifiedSharePanelRenderer + .contents[0] + .connectionSection + .connectionsOverflowMenu + .connectionsOverflowMenuRenderer + .contents[0] + .overflowConnectionSectionRenderer + .contacts[0]; + + int y = ((int[]) null)[0]; + } + + IntentSource getSource() { + return mIntent.isPresent() && mIntent.get().hasExtra(INTENT_SOURCE_KEY) + ? IntentSource.values()[mIntent.get().getIntExtra(INTENT_SOURCE_KEY, IntentSource.OTHER.ordinal())] + : IntentSource.OTHER; + } + + { + mTabUiParts[mRenderedTabIndex].setData( + tabs[mRenderedTabIndex], + true /* isSelected */, + mIsLoadingState, + mErrorMessageType, + mOnDailySummaryHeaderClickListener, + mShowSpacerForSnackbar, + mResetScrollAndAnimationAndReplaceDoodle); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24202287.output b/open-java-format/src/test/resources/test-cases/testdata/B24202287-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24202287.output rename to open-java-format/src/test/resources/test-cases/testdata/B24202287-lf.case index eeb004535..4fac8b93a 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24202287.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B24202287-lf.case @@ -1,3 +1,40 @@ +---------- +class B24202287 { + { + this.overflowContactCompositeSupportedRenderers = + this.getSharePanelResponse.contents.unifiedSharePanelRenderer.contents[0] + .connectionSection + .connectionsOverflowMenu + .connectionsOverflowMenuRenderer + .contents[ + 0] + .overflowConnectionSectionRenderer + .contacts[ + 0]; + + int y = ((int[]) null)[0]; + } + + IntentSource getSource() { + return mIntent.isPresent() && mIntent.get().hasExtra(INTENT_SOURCE_KEY) + ? IntentSource.values()[ + mIntent.get().getIntExtra(INTENT_SOURCE_KEY, IntentSource.OTHER.ordinal())] + : IntentSource.OTHER; + } + + { + mTabUiParts[mRenderedTabIndex] + .setData( + tabs[mRenderedTabIndex], + true /* isSelected */, + mIsLoadingState, + mErrorMessageType, + mOnDailySummaryHeaderClickListener, + mShowSpacerForSnackbar, + mResetScrollAndAnimationAndReplaceDoodle); + } +} +---------- class B24202287 { { this.overflowContactCompositeSupportedRenderers = this.getSharePanelResponse diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24494875-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B24494875-cr.case new file mode 100644 index 000000000..482f3af14 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24494875-cr.case @@ -0,0 +1 @@ +---------- public enum B24494875 { ; public static final String ONE = "ONE"; } ---------- public enum B24494875 { ; public static final String ONE = "ONE"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24494875-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B24494875-crlf.case new file mode 100644 index 000000000..922225664 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24494875-crlf.case @@ -0,0 +1,10 @@ +---------- +public enum B24494875 { + ; + public static final String ONE = "ONE"; +} +---------- +public enum B24494875 { + ; + public static final String ONE = "ONE"; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24494875-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B24494875-lf.case new file mode 100644 index 000000000..5f1f65282 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24494875-lf.case @@ -0,0 +1,10 @@ +---------- +public enum B24494875 { + ; + public static final String ONE = "ONE"; +} +---------- +public enum B24494875 { + ; + public static final String ONE = "ONE"; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24543625-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B24543625-cr.case new file mode 100644 index 000000000..8ee43b7db --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24543625-cr.case @@ -0,0 +1 @@ +---------- /** * This
    * is
    * a
    * train. */ class TheTrain { /* ______ .-"""".._'. _,## _..__ |.-"""-.| | _,##'`-._ (_____)||_____|| |_,##'`-._,##'` _| |.;-""-. | |#'`-._,##'` _.;_ `--' `\ \ |.'`\._,##'` /.-.\ `\ |.-";.`_, |##'` |\__/ | _..;__ |'-' / '.____.'_.-`)\--' /'-'` //||\\(_.-'_,'-'` (`-...-')_,##'` jgs _,##`-..,-;##` _,##'`-._,##'` _,##'`-._,##'` `-._,##'` */ public static final Object THE_TRAIN = null; /* BLOCK COMMENT */ int x; /* . BLOCK COMMENT . */ int y; /* . BLOCK COMMENT . */ int z; /* . BLOCK COMMENT . */ int z; /* * This is almost javadoc. * */ int z; /** * This is (was) malformed javadoc. *
      System.err.println
      * 
    */ int z; private Object f; /*-{ System.err.println("asd"); }-*/ private native Object f() /*-{ System.err.println("asd"); }-*/; private native Object f() /*-{ System.err.println("asd"); }-*/; } ---------- /** * This
    * is
    * a
    * train. */ class TheTrain { /* ______ .-"""".._'. _,## _..__ |.-"""-.| | _,##'`-._ (_____)||_____|| |_,##'`-._,##'` _| |.;-""-. | |#'`-._,##'` _.;_ `--' `\ \ |.'`\._,##'` /.-.\ `\ |.-";.`_, |##'` |\__/ | _..;__ |'-' / '.____.'_.-`)\--' /'-'` //||\\(_.-'_,'-'` (`-...-')_,##'` jgs _,##`-..,-;##` _,##'`-._,##'` _,##'`-._,##'` `-._,##'` */ public static final Object THE_TRAIN = null; /* BLOCK COMMENT */ int x; /* . BLOCK COMMENT . */ int y; /* . BLOCK COMMENT . */ int z; /* . BLOCK COMMENT . */ int z; /* * This is almost javadoc. * */ int z; /** * This is (was) malformed javadoc. *
         * System.err.println
         * 
    */ int z; private Object f; /*-{ System.err.println("asd"); }-*/ private native Object f() /*-{ System.err.println("asd"); }-*/; private native Object f() /*-{ System.err.println("asd"); }-*/; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24543625-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B24543625-crlf.case new file mode 100644 index 000000000..d41f89dac --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24543625-crlf.case @@ -0,0 +1,154 @@ +---------- +/** +* This
    +* is
    +* a
    +* train. +*/ +class TheTrain { +/* + ______ + .-"""".._'. _,## + _..__ |.-"""-.| | _,##'`-._ + (_____)||_____|| |_,##'`-._,##'` + _| |.;-""-. | |#'`-._,##'` + _.;_ `--' `\ \ |.'`\._,##'` + /.-.\ `\ |.-";.`_, |##'` + |\__/ | _..;__ |'-' / + '.____.'_.-`)\--' /'-'` + //||\\(_.-'_,'-'` + (`-...-')_,##'` + jgs _,##`-..,-;##` + _,##'`-._,##'` + _,##'`-._,##'` + `-._,##'` +*/ + public static final Object THE_TRAIN = null; + +/* +BLOCK COMMENT + +*/ + int x; + + /* . + BLOCK COMMENT . + + */ + int y; + + /* . + BLOCK COMMENT . + + */ + int z; + + /* . + BLOCK COMMENT . + + */ + int z; + + /* + * This is almost javadoc. + * + */ + int z; + + /** + * This is (was) malformed javadoc. + *
    +  System.err.println
    +  * 
    + */ + int z; + + private Object f; /*-{ + System.err.println("asd"); + }-*/ + + private native Object f() /*-{ + System.err.println("asd"); + }-*/; + + private native Object f() /*-{ +System.err.println("asd"); +}-*/; +} +---------- +/** + * This
    + * is
    + * a
    + * train. + */ +class TheTrain { + /* + ______ + .-"""".._'. _,## + _..__ |.-"""-.| | _,##'`-._ + (_____)||_____|| |_,##'`-._,##'` + _| |.;-""-. | |#'`-._,##'` + _.;_ `--' `\ \ |.'`\._,##'` + /.-.\ `\ |.-";.`_, |##'` + |\__/ | _..;__ |'-' / + '.____.'_.-`)\--' /'-'` + //||\\(_.-'_,'-'` + (`-...-')_,##'` + jgs _,##`-..,-;##` + _,##'`-._,##'` + _,##'`-._,##'` + `-._,##'` + */ + public static final Object THE_TRAIN = null; + + /* + BLOCK COMMENT + + */ + int x; + + /* . + BLOCK COMMENT . + + */ + int y; + + /* . + BLOCK COMMENT . + + */ + int z; + + /* . + BLOCK COMMENT . + + */ + int z; + + /* + * This is almost javadoc. + * + */ + int z; + + /** + * This is (was) malformed javadoc. + *
    +     * System.err.println
    +     * 
    + */ + int z; + + private Object f; /*-{ + System.err.println("asd"); + }-*/ + + private native Object f() /*-{ + System.err.println("asd"); + }-*/; + + private native Object f() /*-{ +System.err.println("asd"); +}-*/; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24543625.input b/open-java-format/src/test/resources/test-cases/testdata/B24543625-lf.case similarity index 53% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24543625.input rename to open-java-format/src/test/resources/test-cases/testdata/B24543625-lf.case index 4c8dfb5a2..7a9cdb31b 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24543625.input +++ b/open-java-format/src/test/resources/test-cases/testdata/B24543625-lf.case @@ -1,3 +1,4 @@ +---------- /** * This
    * is
    @@ -74,3 +75,80 @@ BLOCK COMMENT System.err.println("asd"); }-*/; } +---------- +/** + * This
    + * is
    + * a
    + * train. + */ +class TheTrain { + /* + ______ + .-"""".._'. _,## + _..__ |.-"""-.| | _,##'`-._ + (_____)||_____|| |_,##'`-._,##'` + _| |.;-""-. | |#'`-._,##'` + _.;_ `--' `\ \ |.'`\._,##'` + /.-.\ `\ |.-";.`_, |##'` + |\__/ | _..;__ |'-' / + '.____.'_.-`)\--' /'-'` + //||\\(_.-'_,'-'` + (`-...-')_,##'` + jgs _,##`-..,-;##` + _,##'`-._,##'` + _,##'`-._,##'` + `-._,##'` + */ + public static final Object THE_TRAIN = null; + + /* + BLOCK COMMENT + + */ + int x; + + /* . + BLOCK COMMENT . + + */ + int y; + + /* . + BLOCK COMMENT . + + */ + int z; + + /* . + BLOCK COMMENT . + + */ + int z; + + /* + * This is almost javadoc. + * + */ + int z; + + /** + * This is (was) malformed javadoc. + *
    +     * System.err.println
    +     * 
    + */ + int z; + + private Object f; /*-{ + System.err.println("asd"); + }-*/ + + private native Object f() /*-{ + System.err.println("asd"); + }-*/; + + private native Object f() /*-{ +System.err.println("asd"); +}-*/; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24702438-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B24702438-cr.case new file mode 100644 index 000000000..aa9907dfe --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24702438-cr.case @@ -0,0 +1 @@ +---------- class B24702438 { @Inject int x; @Inject int y; @Inject int z; @Inject int x; @Inject int y; @Inject int z; // this is a comment // another comment int x; // another comment int y; { switch (x) { case 1: break; case 1: break; default: break; } // this is a comment // another comment System.err.println("asd"); } void f( int a, @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, int c) {} void g( @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, @Nullable @Deprecated ImmutableList veryVeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooong) {} } ---------- class B24702438 { @Inject int x; @Inject int y; @Inject int z; @Inject int x; @Inject int y; @Inject int z; // this is a comment // another comment int x; // another comment int y; { switch (x) { case 1: break; case 1: break; default: break; } // this is a comment // another comment System.err.println("asd"); } void f( int a, @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, int c) {} void g( @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, @Nullable @Deprecated ImmutableList veryVeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooong) {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24702438-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B24702438-crlf.case new file mode 100644 index 000000000..28b6ab60a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24702438-crlf.case @@ -0,0 +1,119 @@ +---------- +class B24702438 { + + @Inject int x; + + @Inject int y; + + @Inject int z; + + @Inject int x; + @Inject int y; + @Inject int z; + + // this is a comment + + // another comment + int x; + + // another comment + + int y; + + { + switch (x) { + + case 1: + + break; + + case 1: + + break; + + default: + + break; + + } + + // this is a comment + + // another comment + System.err.println("asd"); + } + + void f( + int a, + @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, + @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, + @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, + int c) {} + void g( + @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, + @Nullable @Deprecated ImmutableList veryVeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooong) {} +} +---------- +class B24702438 { + + @Inject + int x; + + @Inject + int y; + + @Inject + int z; + + @Inject + int x; + + @Inject + int y; + + @Inject + int z; + + // this is a comment + + // another comment + int x; + + // another comment + + int y; + + { + switch (x) { + case 1: + break; + + case 1: + break; + + default: + break; + } + + // this is a comment + + // another comment + System.err.println("asd"); + } + + void f( + int a, + @Nullable @Deprecated + ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, + @Nullable @Deprecated + ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, + @Nullable @Deprecated + ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, + int c) {} + + void g( + @Nullable @Deprecated + ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, + @Nullable @Deprecated + ImmutableList veryVeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooong) {} +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24702438.output b/open-java-format/src/test/resources/test-cases/testdata/B24702438-lf.case similarity index 54% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24702438.output rename to open-java-format/src/test/resources/test-cases/testdata/B24702438-lf.case index 99c2fa517..09d9caae3 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24702438.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B24702438-lf.case @@ -1,3 +1,59 @@ +---------- +class B24702438 { + + @Inject int x; + + @Inject int y; + + @Inject int z; + + @Inject int x; + @Inject int y; + @Inject int z; + + // this is a comment + + // another comment + int x; + + // another comment + + int y; + + { + switch (x) { + + case 1: + + break; + + case 1: + + break; + + default: + + break; + + } + + // this is a comment + + // another comment + System.err.println("asd"); + } + + void f( + int a, + @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, + @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, + @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, + int c) {} + void g( + @Nullable @Deprecated ImmutableList veryVeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, + @Nullable @Deprecated ImmutableList veryVeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooong) {} +} +---------- class B24702438 { @Inject diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24862959-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B24862959-cr.case new file mode 100644 index 000000000..094a263cd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24862959-cr.case @@ -0,0 +1 @@ +---------- public enum XxxxxxxXxxx implements XxxxxxXxxxxxxXxxx { XXXXXXXXX_XXXX_XXX_XXXXXXXX( " ", Xxxxxx.XXXXXXX, XxxxXxxxxxxXxxxxxxx.XXXXX), // // // } ---------- public enum XxxxxxxXxxx implements XxxxxxXxxxxxxXxxx { XXXXXXXXX_XXXX_XXX_XXXXXXXX(" ", Xxxxxx.XXXXXXX, XxxxXxxxxxxXxxxxxxx.XXXXX), // // // } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24862959-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B24862959-crlf.case new file mode 100644 index 000000000..39840de14 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24862959-crlf.case @@ -0,0 +1,16 @@ +---------- +public enum XxxxxxxXxxx implements XxxxxxXxxxxxxXxxx { + XXXXXXXXX_XXXX_XXX_XXXXXXXX( + " ", Xxxxxx.XXXXXXX, XxxxXxxxxxxXxxxxxxx.XXXXX), + // + // + // +} + +---------- +public enum XxxxxxxXxxx implements XxxxxxXxxxxxxXxxx { + XXXXXXXXX_XXXX_XXX_XXXXXXXX(" ", Xxxxxx.XXXXXXX, XxxxXxxxxxxXxxxxxxx.XXXXX), + // + // + // +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24862959-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B24862959-lf.case new file mode 100644 index 000000000..992a79e1c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24862959-lf.case @@ -0,0 +1,16 @@ +---------- +public enum XxxxxxxXxxx implements XxxxxxXxxxxxxXxxx { + XXXXXXXXX_XXXX_XXX_XXXXXXXX( + " ", Xxxxxx.XXXXXXX, XxxxXxxxxxxXxxxxxxx.XXXXX), + // + // + // +} + +---------- +public enum XxxxxxxXxxx implements XxxxxxXxxxxxxXxxx { + XXXXXXXXX_XXXX_XXX_XXXXXXXX(" ", Xxxxxx.XXXXXXX, XxxxXxxxxxxXxxxxxxx.XXXXX), + // + // + // +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24909927-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B24909927-cr.case new file mode 100644 index 000000000..cd7550ded --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24909927-cr.case @@ -0,0 +1 @@ +---------- class Xxx { public xxxx xxx() { XxxxxxXxxx xxxxxxxxXxxx = XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx(XxxxxxXxxx.XXXXXXX) .xxxXxxxxxXxxx(" ") .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx( XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(-42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx( XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(-42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx(XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(-42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx( XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(-42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx( XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(-42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx(XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(-42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx( XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(-42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx( XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(-42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(-42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(-42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx(); } } ---------- class Xxx { public xxxx xxx() { XxxxxxXxxx xxxxxxxxXxxx = XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx(XxxxxxXxxx.XXXXXXX) .xxxXxxxxxXxxx(" ") .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx( XxxxxxXxxx .XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx( XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx( XxxxxxxxXxxxXxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx( XxxxXxxxxxxx .xxxXxxxxxx() .xxxXxxxx( -42) .xxxXxxx( XxxxXxxx .XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx( XxxxxxXxxx .XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx( XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx( XxxxxxxxXxxxXxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx( XxxxXxxxxxxx .xxxXxxxxxx() .xxxXxxxx( -42) .xxxXxxx( XxxxXxxx .XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(-42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx( XxxxxxXxxx .XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx( XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx( XxxxxxxxXxxxXxxxxxx .xxxXxxxxxx() .xxxXxxx( XxxxxxxxXxxxXxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx( XxxxXxxxxxxx .xxxXxxxxxx() .xxxXxxxx( -42) .xxxXxxx( XxxxXxxx .XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx( XxxxxxXxxx .XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx( XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx( XxxxxxxxXxxxXxxxxxx .xxxXxxxxxx() .xxxXxxx( XxxxxxxxXxxxXxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx( XxxxXxxxxxxx .xxxXxxxxxx() .xxxXxxxx( -42) .xxxXxxx( XxxxXxxx .XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(-42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx( XxxxxxXxxx .XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx( XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx( XxxxxxxxXxxxXxxxxxx .xxxXxxxxxx() .xxxXxxx( XxxxxxxxXxxxXxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx( XxxxXxxxxxxx .xxxXxxxxxx() .xxxXxxxx( -42) .xxxXxxx( XxxxXxxx .XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx( XxxxXxxxxxxx .xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx( XxxxXxxx .XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( XxxxxxxxxxXxxXxxxXxxxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx( XxxxxxXxxx .XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx( XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx( XxxxxxxxXxxxXxxxxxx .xxxXxxxxxx() .xxxXxxx( XxxxxxxxXxxxXxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx( XxxxXxxxxxxx .xxxXxxxxxx() .xxxXxxxx( -42) .xxxXxxx( XxxxXxxx .XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx( XxxxXxxxxxxx .xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx( XxxxXxxx .XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( XxxxxxxxxxXxxXxxxXxxxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx( XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx( XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx( XxxxxxxxXxxxXxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx( XxxxXxxxxxxx .xxxXxxxxxx() .xxxXxxxx(-42) .xxxXxxx( XxxxXxxx .XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxxx(Xxxxxxxx.XXXX) .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() .xxxXxxxxxXxxx( XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxXxxxxxx( XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() .xxxXxxx( XxxxxxxxXxxxXxxxxxx .xxxXxxxxxx() .xxxXxxxxxxxXxxxxxxxx( XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) .xxxxx()) .xxxXxxxxx( XxxxXxxxxxxx .xxxXxxxxxx() .xxxXxxxx(-42) .xxxXxxx( XxxxXxxx .XXX) .xxxxx()) .xxxxx()) .xxxxx()) .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() .xxxXxxxx(42) .xxxXxxx(XxxxXxxx.XXX) .xxxxx()) .xxxxx()) .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() .xxxXxxxxxxxxxXxxxXx(42) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx()) .xxxxx(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24909927-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B24909927-crlf.case new file mode 100644 index 000000000..376020c74 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24909927-crlf.case @@ -0,0 +1,800 @@ +---------- +class Xxx { + + public xxxx xxx() { + XxxxxxXxxx xxxxxxxxXxxx = XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx(XxxxxxXxxx.XXXXXXX) + .xxxXxxxxxXxxx(" ") + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx(XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx(XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx(); + } +} +---------- +class Xxx { + + public xxxx xxx() { + XxxxxxXxxx xxxxxxxxXxxx = XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx(XxxxxxXxxx.XXXXXXX) + .xxxXxxxxxXxxx(" ") + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx + .XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx( + XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx( + XxxxxxxxXxxxXxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx( + XxxxXxxxxxxx + .xxxXxxxxxx() + .xxxXxxxx( + -42) + .xxxXxxx( + XxxxXxxx + .XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( + XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx + .XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx( + XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx( + XxxxxxxxXxxxXxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx( + XxxxXxxxxxxx + .xxxXxxxxxx() + .xxxXxxxx( + -42) + .xxxXxxx( + XxxxXxxx + .XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( + XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx + .XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx( + XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx( + XxxxxxxxXxxxXxxxxxx + .xxxXxxxxxx() + .xxxXxxx( + XxxxxxxxXxxxXxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx( + XxxxXxxxxxxx + .xxxXxxxxxx() + .xxxXxxxx( + -42) + .xxxXxxx( + XxxxXxxx + .XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( + XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx + .XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx( + XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx( + XxxxxxxxXxxxXxxxxxx + .xxxXxxxxxx() + .xxxXxxx( + XxxxxxxxXxxxXxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx( + XxxxXxxxxxxx + .xxxXxxxxxx() + .xxxXxxxx( + -42) + .xxxXxxx( + XxxxXxxx + .XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( + XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx + .XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx( + XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx( + XxxxxxxxXxxxXxxxxxx + .xxxXxxxxxx() + .xxxXxxx( + XxxxxxxxXxxxXxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx( + XxxxXxxxxxxx + .xxxXxxxxxx() + .xxxXxxxx( + -42) + .xxxXxxx( + XxxxXxxx + .XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx( + XxxxXxxxxxxx + .xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx( + XxxxXxxx + .XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( + XxxxxxxxxxXxxXxxxXxxxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx + .XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx( + XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx( + XxxxxxxxXxxxXxxxxxx + .xxxXxxxxxx() + .xxxXxxx( + XxxxxxxxXxxxXxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx( + XxxxXxxxxxxx + .xxxXxxxxxx() + .xxxXxxxx( + -42) + .xxxXxxx( + XxxxXxxx + .XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx( + XxxxXxxxxxxx + .xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx( + XxxxXxxx + .XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( + XxxxxxxxxxXxxXxxxXxxxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx( + XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx( + XxxxxxxxXxxxXxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx( + XxxxXxxxxxxx + .xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx( + XxxxXxxx + .XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( + XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx( + XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx( + XxxxxxxxXxxxXxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx( + XxxxXxxxxxxx + .xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx( + XxxxXxxx + .XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx( + XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx(); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24909927.output b/open-java-format/src/test/resources/test-cases/testdata/B24909927-lf.case similarity index 67% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24909927.output rename to open-java-format/src/test/resources/test-cases/testdata/B24909927-lf.case index ec8d742f4..417af336e 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24909927.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B24909927-lf.case @@ -1,3 +1,358 @@ +---------- +class Xxx { + + public xxxx xxx() { + XxxxxxXxxx xxxxxxxxXxxx = XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx(XxxxxxXxxx.XXXXXXX) + .xxxXxxxxxXxxx(" ") + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx(XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx(XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XX_XXXXX) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx( + XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx + .xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxx(XxxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxxx(Xxxxxxxx.XXXX) + .xxxXxxxxxXxxx(XxxxxxXxxx.xxxXxxxxxx() + .xxxXxxxxxXxxx(XxxxxxXxxx.XXX_XXXXXXXXXXXXXXX_XXXX_XXXXXXX_XXXXX_XXXXX) + .xxxXxxxXxxxxx(XxxxXxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxXxxxx(XxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxx(XxxxxxxxXxxxXxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxXxxxxxxxx( + XxxxxxxxXxxxXxxxxxxXxxxxxxxXxxxxxxxx + .XXXX_XXXXXX_XXXX_XXXXX_XX_XXX) + .xxxxx()) + .xxxXxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(-42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxx(XxxxXxxxxxxx.xxxXxxxxxx() + .xxxXxxxx(42) + .xxxXxxx(XxxxXxxx.XXX) + .xxxxx()) + .xxxxx()) + .xxxXxxxxxxxxxXxxXxxxXxxxxxxxx(XxxxxxxxxxXxxXxxxXxxxxxxxx.xxxXxxxxxx() + .xxxXxxxxxxxxxXxxxXx(42) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx()) + .xxxxx(); + } +} +---------- class Xxx { public xxxx xxx() { diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24988078-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B24988078-cr.case new file mode 100644 index 000000000..85edf3ffd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24988078-cr.case @@ -0,0 +1 @@ +---------- class B24988078 { public static Optional fromNullable(@Nullable T nullableReference) {} public static Optional fromNullable(@Nullable T nullableReference) {} Table< /*@Nullable*/ Object, /*@Nullable*/ Object, /*@Nullable*/ Object > foo; } ---------- class B24988078 { public static Optional fromNullable(@Nullable T nullableReference) {} public static Optional fromNullable(@Nullable T nullableReference) {} Table foo; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24988078-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B24988078-crlf.case new file mode 100644 index 000000000..19603831d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24988078-crlf.case @@ -0,0 +1,16 @@ +---------- +class B24988078 { + public static Optional fromNullable(@Nullable T nullableReference) {} + + public static Optional fromNullable(@Nullable T nullableReference) {} + + Table< /*@Nullable*/ Object, /*@Nullable*/ Object, /*@Nullable*/ Object > foo; +} +---------- +class B24988078 { + public static Optional fromNullable(@Nullable T nullableReference) {} + + public static Optional fromNullable(@Nullable T nullableReference) {} + + Table foo; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B24988078-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B24988078-lf.case new file mode 100644 index 000000000..b4897c903 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24988078-lf.case @@ -0,0 +1,16 @@ +---------- +class B24988078 { + public static Optional fromNullable(@Nullable T nullableReference) {} + + public static Optional fromNullable(@Nullable T nullableReference) {} + + Table< /*@Nullable*/ Object, /*@Nullable*/ Object, /*@Nullable*/ Object > foo; +} +---------- +class B24988078 { + public static Optional fromNullable(@Nullable T nullableReference) {} + + public static Optional fromNullable(@Nullable T nullableReference) {} + + Table foo; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B25372815-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B25372815-cr.case new file mode 100644 index 000000000..9f87ad5ca --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B25372815-cr.case @@ -0,0 +1 @@ +---------- class Test { { // For "All goals" view, show only advertiser goals tab. return newPageTypeSet( false /* advertisers */, false /* userManagement */, false /* campaigns */, false /* adGroups */, false /* ads */, false /* keywords */, false /* negativeKeywords */, false /* advertiserBidStrategies */, false /* bidStrategies */, false /* bidStrategyRecommendations */, false /* bidKeywords */, false /* engineBidStrategies */, false /* conversionTrackers */, false /* labels */, false /* labelKeywords */, false /* evergreen labels */, false /* searchQueries */, false /* engineSearchQueries */, false /* remarketingTarget */, false /* sitelinks */, false /* feedSitelinks */, false /* locationExtensions */, false /* callExtensions */, false /* calloutExtensions */, false /* appExtensions */, false /* events */); } } ---------- class Test { { // For "All goals" view, show only advertiser goals tab. return newPageTypeSet( false /* advertisers */, false /* userManagement */, false /* campaigns */, false /* adGroups */, false /* ads */, false /* keywords */, false /* negativeKeywords */, false /* advertiserBidStrategies */, false /* bidStrategies */, false /* bidStrategyRecommendations */, false /* bidKeywords */, false /* engineBidStrategies */, false /* conversionTrackers */, false /* labels */, false /* labelKeywords */, false /* evergreen labels */, false /* searchQueries */, false /* engineSearchQueries */, false /* remarketingTarget */, false /* sitelinks */, false /* feedSitelinks */, false /* locationExtensions */, false /* callExtensions */, false /* calloutExtensions */, false /* appExtensions */, false /* events */); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B25372815-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B25372815-crlf.case new file mode 100644 index 000000000..515385f0b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B25372815-crlf.case @@ -0,0 +1,66 @@ +---------- +class Test { + { + // For "All goals" view, show only advertiser goals tab. + return newPageTypeSet( + false /* advertisers */, + false /* userManagement */, + false /* campaigns */, + false /* adGroups */, + false /* ads */, + false /* keywords */, + false /* negativeKeywords */, + false /* advertiserBidStrategies */, + false /* bidStrategies */, + false /* bidStrategyRecommendations */, + false /* bidKeywords */, + false /* engineBidStrategies */, + false /* conversionTrackers */, + false /* labels */, + false /* labelKeywords */, + false /* evergreen labels */, + false /* searchQueries */, + false /* engineSearchQueries */, + false /* remarketingTarget */, + false /* sitelinks */, + false /* feedSitelinks */, + false /* locationExtensions */, + false /* callExtensions */, + false /* calloutExtensions */, + false /* appExtensions */, + false /* events */); + } +} +---------- +class Test { + { + // For "All goals" view, show only advertiser goals tab. + return newPageTypeSet( + false /* advertisers */, + false /* userManagement */, + false /* campaigns */, + false /* adGroups */, + false /* ads */, + false /* keywords */, + false /* negativeKeywords */, + false /* advertiserBidStrategies */, + false /* bidStrategies */, + false /* bidStrategyRecommendations */, + false /* bidKeywords */, + false /* engineBidStrategies */, + false /* conversionTrackers */, + false /* labels */, + false /* labelKeywords */, + false /* evergreen labels */, + false /* searchQueries */, + false /* engineSearchQueries */, + false /* remarketingTarget */, + false /* sitelinks */, + false /* feedSitelinks */, + false /* locationExtensions */, + false /* callExtensions */, + false /* calloutExtensions */, + false /* appExtensions */, + false /* events */); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25372815.output b/open-java-format/src/test/resources/test-cases/testdata/B25372815-lf.case similarity index 54% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25372815.output rename to open-java-format/src/test/resources/test-cases/testdata/B25372815-lf.case index 23fb27764..ab0a9a4d2 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25372815.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B25372815-lf.case @@ -1,3 +1,37 @@ +---------- +class Test { + { + // For "All goals" view, show only advertiser goals tab. + return newPageTypeSet( + false /* advertisers */, + false /* userManagement */, + false /* campaigns */, + false /* adGroups */, + false /* ads */, + false /* keywords */, + false /* negativeKeywords */, + false /* advertiserBidStrategies */, + false /* bidStrategies */, + false /* bidStrategyRecommendations */, + false /* bidKeywords */, + false /* engineBidStrategies */, + false /* conversionTrackers */, + false /* labels */, + false /* labelKeywords */, + false /* evergreen labels */, + false /* searchQueries */, + false /* engineSearchQueries */, + false /* remarketingTarget */, + false /* sitelinks */, + false /* feedSitelinks */, + false /* locationExtensions */, + false /* callExtensions */, + false /* calloutExtensions */, + false /* appExtensions */, + false /* events */); + } +} +---------- class Test { { // For "All goals" view, show only advertiser goals tab. diff --git a/open-java-format/src/test/resources/test-cases/testdata/B25749989-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B25749989-cr.case new file mode 100644 index 000000000..486618b82 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B25749989-cr.case @@ -0,0 +1 @@ +---------- class Dummy { /** */private static void method(){MISSING();} } ---------- class Dummy { /** */ private static void method() { MISSING(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B25749989-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B25749989-crlf.case new file mode 100644 index 000000000..723b7c156 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B25749989-crlf.case @@ -0,0 +1,13 @@ +---------- +class Dummy { + /** + */private static void method(){MISSING();} +} +---------- +class Dummy { + /** + */ + private static void method() { + MISSING(); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25749989.output b/open-java-format/src/test/resources/test-cases/testdata/B25749989-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25749989.output rename to open-java-format/src/test/resources/test-cases/testdata/B25749989-lf.case index 6b34e4739..62ea0fff5 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25749989.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B25749989-lf.case @@ -1,3 +1,9 @@ +---------- +class Dummy { + /** + */private static void method(){MISSING();} +} +---------- class Dummy { /** */ diff --git a/open-java-format/src/test/resources/test-cases/testdata/B25787055-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B25787055-cr.case new file mode 100644 index 000000000..867378735 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B25787055-cr.case @@ -0,0 +1 @@ +---------- class B25787055 { { logger .atInfo() .log( "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", deletedPersistentNames.size(), deletedPersistentNames); logger.atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo() .log( "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", deletedPersistentNames.size(), deletedPersistentNames); logger // interior .atInfo() // comments .log( // are best comments "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", deletedPersistentNames.size(), deletedPersistentNames); logger .log( "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", deletedPersistentNames.size(), deletedPersistentNames) .log( "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", deletedPersistentNames.size(), deletedPersistentNames); } } ---------- class B25787055 { { logger.atInfo().log( "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", deletedPersistentNames.size(), deletedPersistentNames); logger.atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().log( "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", deletedPersistentNames.size(), deletedPersistentNames); logger // interior .atInfo() // comments .log( // are best comments "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", deletedPersistentNames.size(), deletedPersistentNames); logger .log( "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", deletedPersistentNames.size(), deletedPersistentNames) .log( "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", deletedPersistentNames.size(), deletedPersistentNames); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B25787055-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B25787055-crlf.case new file mode 100644 index 000000000..c2eb94854 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B25787055-crlf.case @@ -0,0 +1,54 @@ +---------- +class B25787055 { + { + logger + .atInfo() + .log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), + deletedPersistentNames); + logger.atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo() + .log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), + deletedPersistentNames); + logger // interior + .atInfo() // comments + .log( // are best comments + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), + deletedPersistentNames); + logger + .log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), + deletedPersistentNames) + .log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), + deletedPersistentNames); + } +} +---------- +class B25787055 { + { + logger.atInfo().log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), deletedPersistentNames); + logger.atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), deletedPersistentNames); + logger // interior + .atInfo() // comments + .log( // are best comments + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), deletedPersistentNames); + logger + .log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), deletedPersistentNames) + .log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), deletedPersistentNames); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25787055.output b/open-java-format/src/test/resources/test-cases/testdata/B25787055-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25787055.output rename to open-java-format/src/test/resources/test-cases/testdata/B25787055-lf.case index 00e0a3600..ede3878c5 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25787055.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B25787055-lf.case @@ -1,3 +1,35 @@ +---------- +class B25787055 { + { + logger + .atInfo() + .log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), + deletedPersistentNames); + logger.atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo() + .log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), + deletedPersistentNames); + logger // interior + .atInfo() // comments + .log( // are best comments + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), + deletedPersistentNames); + logger + .log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), + deletedPersistentNames) + .log( + "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", + deletedPersistentNames.size(), + deletedPersistentNames); + } +} +---------- class B25787055 { { logger.atInfo().log( diff --git a/open-java-format/src/test/resources/test-cases/testdata/B25811323-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B25811323-cr.case new file mode 100644 index 000000000..668318cef --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B25811323-cr.case @@ -0,0 +1 @@ +---------- class B25811323 { void f() { class Inner {}; } } ---------- class B25811323 { void f() { class Inner {} ; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B25811323-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B25811323-crlf.case new file mode 100644 index 000000000..0c02a27f5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B25811323-crlf.case @@ -0,0 +1,13 @@ +---------- +class B25811323 { + void f() { + class Inner {}; + } +} +---------- +class B25811323 { + void f() { + class Inner {} + ; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B25811323-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B25811323-lf.case new file mode 100644 index 000000000..e6249831f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B25811323-lf.case @@ -0,0 +1,13 @@ +---------- +class B25811323 { + void f() { + class Inner {}; + } +} +---------- +class B25811323 { + void f() { + class Inner {} + ; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26159561-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B26159561-cr.case new file mode 100644 index 000000000..8193dd779 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26159561-cr.case @@ -0,0 +1 @@ +---------- class B26159561 { { try (A a = a(); B b = b()) {} try (A a = a();) {} } } ---------- class B26159561 { { try (A a = a(); B b = b()) {} try (A a = a(); ) {} } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26159561-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B26159561-crlf.case new file mode 100644 index 000000000..179f7c479 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26159561-crlf.case @@ -0,0 +1,15 @@ +---------- +class B26159561 { + { + try (A a = a(); B b = b()) {} + try (A a = a();) {} + } +} +---------- +class B26159561 { + { + try (A a = a(); + B b = b()) {} + try (A a = a(); ) {} + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26159561.output b/open-java-format/src/test/resources/test-cases/testdata/B26159561-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26159561.output rename to open-java-format/src/test/resources/test-cases/testdata/B26159561-lf.case index 274feff20..461eca986 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26159561.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B26159561-lf.case @@ -1,3 +1,11 @@ +---------- +class B26159561 { + { + try (A a = a(); B b = b()) {} + try (A a = a();) {} + } +} +---------- class B26159561 { { try (A a = a(); diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26207047-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B26207047-cr.case new file mode 100644 index 000000000..16b020455 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26207047-cr.case @@ -0,0 +1 @@ +---------- class B26207047 { { String.format( "%s ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); String.format( "%s ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); String.format( "{0} ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); String.format( "%s " + " ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); String.format( "%s ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); String.format( "%s ", xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx); String.format( "%s ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "); Set ZONES = ImmutableSet.of( TimeZone.getTimeZone("EST"), // TODO: TimeZone.getTimeZone("GMT"), TimeZone.getTimeZone("HST"), TimeZone.getTimeZone("MST")); String.format( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + "%s", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); String.format( " ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); } } ---------- class B26207047 { { String.format("%s ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); String.format( "%s ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); String.format( "{0} ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); String.format( "%s " + " ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); String.format( "%s ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); String.format( "%s ", xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx); String.format( "%s ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "); Set ZONES = ImmutableSet.of( TimeZone.getTimeZone("EST"), // TODO: TimeZone.getTimeZone("GMT"), TimeZone.getTimeZone("HST"), TimeZone.getTimeZone("MST")); String.format( xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + "%s", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); String.format( " ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26207047-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B26207047-crlf.case new file mode 100644 index 000000000..b833aef8f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26207047-crlf.case @@ -0,0 +1,100 @@ +---------- +class B26207047 { + { + String.format( + "%s ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); + String.format( + "%s ", + xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); + String.format( + "{0} ", + xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); + String.format( + "%s " + + " ", + xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); + String.format( + "%s ", + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx); + String.format( + "%s ", + xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, + xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, + xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx); + String.format( + "%s ", " ", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " ", " ", " ", " "); + Set ZONES = + ImmutableSet.of( + TimeZone.getTimeZone("EST"), + // TODO: + TimeZone.getTimeZone("GMT"), + TimeZone.getTimeZone("HST"), + TimeZone.getTimeZone("MST")); + String.format( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + "%s", + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx); + String.format( + " ", + xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); + } +} +---------- +class B26207047 { + { + String.format("%s ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); + String.format( + "%s ", + xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); + String.format( + "{0} ", + xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); + String.format( + "%s " + + " ", + xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); + String.format( + "%s ", + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx); + String.format( + "%s ", + xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, + xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, + xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx); + String.format( + "%s ", + " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " "); + Set ZONES = ImmutableSet.of( + TimeZone.getTimeZone("EST"), + // TODO: + TimeZone.getTimeZone("GMT"), + TimeZone.getTimeZone("HST"), + TimeZone.getTimeZone("MST")); + String.format( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + "%s", + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx); + String.format( + " ", + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26207047.output b/open-java-format/src/test/resources/test-cases/testdata/B26207047-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26207047.output rename to open-java-format/src/test/resources/test-cases/testdata/B26207047-lf.case index bda87fbc7..51fdd39ac 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26207047.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B26207047-lf.case @@ -1,3 +1,54 @@ +---------- +class B26207047 { + { + String.format( + "%s ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); + String.format( + "%s ", + xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); + String.format( + "{0} ", + xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); + String.format( + "%s " + + " ", + xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); + String.format( + "%s ", + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx); + String.format( + "%s ", + xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, + xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, + xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx, xxxxxx); + String.format( + "%s ", " ", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " ", " ", " ", " "); + Set ZONES = + ImmutableSet.of( + TimeZone.getTimeZone("EST"), + // TODO: + TimeZone.getTimeZone("GMT"), + TimeZone.getTimeZone("HST"), + TimeZone.getTimeZone("MST")); + String.format( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + "%s", + xxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxx); + String.format( + " ", + xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); + } +} +---------- class B26207047 { { String.format("%s ", xxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxx); diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26275739-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B26275739-cr.case new file mode 100644 index 000000000..381ec2b66 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26275739-cr.case @@ -0,0 +1 @@ +---------- public class B26275739 { { f( /* x */ 1, /* xx */ 2, /* x */ 3, /* xx */ 4); f( 1, 2, 3, 4); f( /* asd */ 1, 2, 3, 4); } } ---------- public class B26275739 { { f(/* x */ 1, /* xx */ 2, /* x */ 3, /* xx */ 4); f( 1, 2, 3, 4); f( /* asd */ 1, 2, 3, 4); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26275739-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B26275739-crlf.case new file mode 100644 index 000000000..ee9ef303c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26275739-crlf.case @@ -0,0 +1,32 @@ +---------- +public class B26275739 { + { + f( + /* x */ 1, + /* xx */ 2, + /* x */ 3, + /* xx */ 4); + f( + 1, + 2, + 3, + 4); + f( + /* asd */ + 1, 2, + 3, 4); + } +} +---------- +public class B26275739 { + { + f(/* x */ 1, /* xx */ 2, /* x */ 3, /* xx */ 4); + f( + 1, 2, + 3, 4); + f( + /* asd */ + 1, 2, + 3, 4); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26275739-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B26275739-lf.case new file mode 100644 index 000000000..c5f88774f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26275739-lf.case @@ -0,0 +1,32 @@ +---------- +public class B26275739 { + { + f( + /* x */ 1, + /* xx */ 2, + /* x */ 3, + /* xx */ 4); + f( + 1, + 2, + 3, + 4); + f( + /* asd */ + 1, 2, + 3, 4); + } +} +---------- +public class B26275739 { + { + f(/* x */ 1, /* xx */ 2, /* x */ 3, /* xx */ 4); + f( + 1, 2, + 3, 4); + f( + /* asd */ + 1, 2, + 3, 4); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26293162-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B26293162-cr.case new file mode 100644 index 000000000..d32ac8fbb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26293162-cr.case @@ -0,0 +1 @@ +---------- class Xxxx { public static final class XxxxXxxxxxxxXxxxxxxxxXxxxxxXxxxxxxx< X, X, X extends XxxxxxxxxXxxxxxxxxXxxxxxxx> { int x; } public static final class XxxxXxxxxxxxXxxxxxxxxXxxxxxXxxxxxxx< X, X, X extends XxxxxxxxxXxxxxxxxxXxxxxxxx> extends Xxxxx { int x; } class XxxxxxxxXxxxxxxxxXxxxXxxx< X extends XxxxxxxxxXxxxxxx, X extends XxxxxxxxxXxxxxx, X extends Xxxxxxxxxxxxx, X> extends XxxxXxxx { int x; } @Xxx class XxxxxxxxxxxXxxxxxXx< X extends XxxxxxXxxxxxxxxxxXxxxxxXxxxxx, X extends Xxxxxxx, XX extends Xxxxxxxxx> extends XxxxxxxxXx { int x; } static class XxxxxXxxxxXxxx< XXXXX extends XxxxxxxxXxxxxxx, XXX extends XxxxxxxxXxxxxxx> { int x; } @Xxx class XxxxxxxxxxxXxxxxxXx< X extends XxxxxxXxxxxxxxxxxXxxxxxXxxxxx, X extends Xxxxxxx, X extends Xxxxxxx, XX extends Xxxxxxxxx> extends XxxxxxxxXx { int x; } } ---------- class Xxxx { public static final class XxxxXxxxxxxxXxxxxxxxxXxxxxxXxxxxxxx> { int x; } public static final class XxxxXxxxxxxxXxxxxxxxxXxxxxxXxxxxxxx> extends Xxxxx { int x; } class XxxxxxxxXxxxxxxxxXxxxXxxx extends XxxxXxxx { int x; } @Xxx class XxxxxxxxxxxXxxxxxXx> extends XxxxxxxxXx { int x; } static class XxxxxXxxxxXxxx, XXX extends XxxxxxxxXxxxxxx> { int x; } @Xxx class XxxxxxxxxxxXxxxxxXx< X extends XxxxxxXxxxxxxxxxxXxxxxxXxxxxx, X extends Xxxxxxx, X extends Xxxxxxx, XX extends Xxxxxxxxx> extends XxxxxxxxXx { int x; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26293162-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B26293162-crlf.case new file mode 100644 index 000000000..57a40c2f3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26293162-crlf.case @@ -0,0 +1,87 @@ +---------- +class Xxxx { + + public static final class XxxxXxxxxxxxXxxxxxxxxXxxxxxXxxxxxxx< + X, X, X extends XxxxxxxxxXxxxxxxxxXxxxxxxx> { + + int x; + } + + public static final class XxxxXxxxxxxxXxxxxxxxxXxxxxxXxxxxxxx< + X, X, X extends XxxxxxxxxXxxxxxxxxXxxxxxxx> extends Xxxxx { + + int x; + } + + class XxxxxxxxXxxxxxxxxXxxxXxxx< + X extends XxxxxxxxxXxxxxxx, X extends XxxxxxxxxXxxxxx, X extends Xxxxxxxxxxxxx, X> + extends XxxxXxxx { + + int x; + } + + @Xxx + class XxxxxxxxxxxXxxxxxXx< + X extends XxxxxxXxxxxxxxxxxXxxxxxXxxxxx, X extends Xxxxxxx, XX extends Xxxxxxxxx> + extends XxxxxxxxXx { + + int x; + } + + static class XxxxxXxxxxXxxx< + XXXXX extends XxxxxxxxXxxxxxx, XXX extends XxxxxxxxXxxxxxx> { + + int x; + } + + @Xxx + class XxxxxxxxxxxXxxxxxXx< + X extends XxxxxxXxxxxxxxxxxXxxxxxXxxxxx, X extends Xxxxxxx, X extends Xxxxxxx, + XX extends Xxxxxxxxx> extends XxxxxxxxXx { + + int x; + } +} +---------- +class Xxxx { + + public static final class XxxxXxxxxxxxXxxxxxxxxXxxxxxXxxxxxxx> { + + int x; + } + + public static final class XxxxXxxxxxxxXxxxxxxxxXxxxxxXxxxxxxx> + extends Xxxxx { + + int x; + } + + class XxxxxxxxXxxxxxxxxXxxxXxxx + extends XxxxXxxx { + + int x; + } + + @Xxx + class XxxxxxxxxxxXxxxxxXx> + extends XxxxxxxxXx { + + int x; + } + + static class XxxxxXxxxxXxxx, XXX extends XxxxxxxxXxxxxxx> { + + int x; + } + + @Xxx + class XxxxxxxxxxxXxxxxxXx< + X extends XxxxxxXxxxxxxxxxxXxxxxxXxxxxx, + X extends Xxxxxxx, + X extends Xxxxxxx, + XX extends Xxxxxxxxx> + extends XxxxxxxxXx { + + int x; + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26293162.output b/open-java-format/src/test/resources/test-cases/testdata/B26293162-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26293162.output rename to open-java-format/src/test/resources/test-cases/testdata/B26293162-lf.case index 2fb9282b5..29ece1e1f 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26293162.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B26293162-lf.case @@ -1,3 +1,48 @@ +---------- +class Xxxx { + + public static final class XxxxXxxxxxxxXxxxxxxxxXxxxxxXxxxxxxx< + X, X, X extends XxxxxxxxxXxxxxxxxxXxxxxxxx> { + + int x; + } + + public static final class XxxxXxxxxxxxXxxxxxxxxXxxxxxXxxxxxxx< + X, X, X extends XxxxxxxxxXxxxxxxxxXxxxxxxx> extends Xxxxx { + + int x; + } + + class XxxxxxxxXxxxxxxxxXxxxXxxx< + X extends XxxxxxxxxXxxxxxx, X extends XxxxxxxxxXxxxxx, X extends Xxxxxxxxxxxxx, X> + extends XxxxXxxx { + + int x; + } + + @Xxx + class XxxxxxxxxxxXxxxxxXx< + X extends XxxxxxXxxxxxxxxxxXxxxxxXxxxxx, X extends Xxxxxxx, XX extends Xxxxxxxxx> + extends XxxxxxxxXx { + + int x; + } + + static class XxxxxXxxxxXxxx< + XXXXX extends XxxxxxxxXxxxxxx, XXX extends XxxxxxxxXxxxxxx> { + + int x; + } + + @Xxx + class XxxxxxxxxxxXxxxxxXx< + X extends XxxxxxXxxxxxxxxxxXxxxxxXxxxxx, X extends Xxxxxxx, X extends Xxxxxxx, + XX extends Xxxxxxxxx> extends XxxxxxxxXx { + + int x; + } +} +---------- class Xxxx { public static final class XxxxXxxxxxxxXxxxxxxxxXxxxxxXxxxxxxx> { diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26694550-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B26694550-cr.case new file mode 100644 index 000000000..709d60532 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26694550-cr.case @@ -0,0 +1 @@ +---------- class B26694550 { { /* === not a param comment */ fffffffffffffffffffffffffffffff( ImmutableList.copyOf(keys), /*&=*//*keepGoing=*/ false, ggggggggggggggggggggggggggggggggggggggggggg); fffffffffffffffffffffffffffffff( ImmutableList.copyOf(keys), /*keepGoing=*/ false, ggggggggggggggggggggggggggggggggggggggggggg); fffffffffffffffffffffffffffffff( ImmutableList.copyOf(keys), /*foo_bar=*/ false, /*foo-bar=*/ false, ggggggggggggggggggggggggggggggggggggggggggg); } } ---------- class B26694550 { { /* === not a param comment */ fffffffffffffffffffffffffffffff( ImmutableList.copyOf(keys), /*&=*/ /*keepGoing=*/ false, ggggggggggggggggggggggggggggggggggggggggggg); fffffffffffffffffffffffffffffff( ImmutableList.copyOf(keys), /*keepGoing=*/ false, ggggggggggggggggggggggggggggggggggggggggggg); fffffffffffffffffffffffffffffff( ImmutableList.copyOf(keys), /*foo_bar=*/ false, /*foo-bar=*/ false, ggggggggggggggggggggggggggggggggggggggggggg); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26694550-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B26694550-crlf.case new file mode 100644 index 000000000..9c02a821b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26694550-crlf.case @@ -0,0 +1,37 @@ +---------- +class B26694550 { + { + /* === not a param comment */ + fffffffffffffffffffffffffffffff( + ImmutableList.copyOf(keys), /*&=*//*keepGoing=*/ + false, + ggggggggggggggggggggggggggggggggggggggggggg); + fffffffffffffffffffffffffffffff( + ImmutableList.copyOf(keys), + /*keepGoing=*/ + false, + ggggggggggggggggggggggggggggggggggggggggggg); + fffffffffffffffffffffffffffffff( + ImmutableList.copyOf(keys), + /*foo_bar=*/ + false, + /*foo-bar=*/ + false, + ggggggggggggggggggggggggggggggggggggggggggg); + } +} +---------- +class B26694550 { + { + /* === not a param comment */ + fffffffffffffffffffffffffffffff( + ImmutableList.copyOf(keys), /*&=*/ /*keepGoing=*/ false, ggggggggggggggggggggggggggggggggggggggggggg); + fffffffffffffffffffffffffffffff( + ImmutableList.copyOf(keys), /*keepGoing=*/ false, ggggggggggggggggggggggggggggggggggggggggggg); + fffffffffffffffffffffffffffffff( + ImmutableList.copyOf(keys), + /*foo_bar=*/ false, + /*foo-bar=*/ false, + ggggggggggggggggggggggggggggggggggggggggggg); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26694550-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B26694550-lf.case new file mode 100644 index 000000000..cee5a86bd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26694550-lf.case @@ -0,0 +1,37 @@ +---------- +class B26694550 { + { + /* === not a param comment */ + fffffffffffffffffffffffffffffff( + ImmutableList.copyOf(keys), /*&=*//*keepGoing=*/ + false, + ggggggggggggggggggggggggggggggggggggggggggg); + fffffffffffffffffffffffffffffff( + ImmutableList.copyOf(keys), + /*keepGoing=*/ + false, + ggggggggggggggggggggggggggggggggggggggggggg); + fffffffffffffffffffffffffffffff( + ImmutableList.copyOf(keys), + /*foo_bar=*/ + false, + /*foo-bar=*/ + false, + ggggggggggggggggggggggggggggggggggggggggggg); + } +} +---------- +class B26694550 { + { + /* === not a param comment */ + fffffffffffffffffffffffffffffff( + ImmutableList.copyOf(keys), /*&=*/ /*keepGoing=*/ false, ggggggggggggggggggggggggggggggggggggggggggg); + fffffffffffffffffffffffffffffff( + ImmutableList.copyOf(keys), /*keepGoing=*/ false, ggggggggggggggggggggggggggggggggggggggggggg); + fffffffffffffffffffffffffffffff( + ImmutableList.copyOf(keys), + /*foo_bar=*/ false, + /*foo-bar=*/ false, + ggggggggggggggggggggggggggggggggggggggggggg); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26884608-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B26884608-cr.case new file mode 100644 index 000000000..d3d170f45 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26884608-cr.case @@ -0,0 +1 @@ +---------- class X26884608 { { this .xxxxxxxxxXxxxxxXxxxxxxXxxxxx( XXXXXXXXX_XXXXXXXXX); this .xxxXxxxxXxxxxxx( XxxxxXxxx.xxxxxXxxxx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); Xxxxx.this .xxxxxxxxxXxxxxxXxxxxxxXxxxxx( XXXXXXXXX_XXXXXXXXX); Xxxxx.this .xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); xxx.xxxxxx.Xxxxx.this .xxxxxxxxxXxxxxxXxxxxxxXxxxxx( XXXXXXXXX_XXXXXXXXX); xxx.xxxxxx.Xxxxx.this .xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx( XXXXXXXXX_XXXXXXXXX); super.xxxXxxxxXxxx( XxxxxXxxxx.xxxxxXxxxx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); Xxxxx.super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx( XXXXXXXXX_XXXXXXXXX); Xxxxx.super.xxxXxxxxXxxx( XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); xxx.xxxxxx.Xxxxx.super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); xxx.xxxxxx.Xxxxx.super.xxxXxxxxXxxx( XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); } } ---------- class X26884608 { { this.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); this.xxxXxxxxXxxxxxx(XxxxxXxxx.xxxxxXxxxx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); Xxxxx.this.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); Xxxxx.this.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); xxx.xxxxxx.Xxxxx.this.xxxxxxxxxXxxxxxXxxxxxxXxxxxx( XXXXXXXXX_XXXXXXXXX); xxx.xxxxxx.Xxxxx.this.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); super.xxxXxxxxXxxx(XxxxxXxxxx.xxxxxXxxxx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); Xxxxx.super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); Xxxxx.super.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); xxx.xxxxxx.Xxxxx.super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx( XXXXXXXXX_XXXXXXXXX); xxx.xxxxxx.Xxxxx.super.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26884608-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B26884608-crlf.case new file mode 100644 index 000000000..3ec37188f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26884608-crlf.case @@ -0,0 +1,55 @@ +---------- +class X26884608 { + { + this + .xxxxxxxxxXxxxxxXxxxxxxXxxxxx( + XXXXXXXXX_XXXXXXXXX); + this + .xxxXxxxxXxxxxxx( + XxxxxXxxx.xxxxxXxxxx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + Xxxxx.this + .xxxxxxxxxXxxxxxXxxxxxxXxxxxx( + XXXXXXXXX_XXXXXXXXX); + Xxxxx.this + .xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + xxx.xxxxxx.Xxxxx.this + .xxxxxxxxxXxxxxxXxxxxxxXxxxxx( + XXXXXXXXX_XXXXXXXXX); + xxx.xxxxxx.Xxxxx.this + .xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + + super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx( + XXXXXXXXX_XXXXXXXXX); + super.xxxXxxxxXxxx( + XxxxxXxxxx.xxxxxXxxxx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + Xxxxx.super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx( + XXXXXXXXX_XXXXXXXXX); + Xxxxx.super.xxxXxxxxXxxx( + XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + xxx.xxxxxx.Xxxxx.super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); + xxx.xxxxxx.Xxxxx.super.xxxXxxxxXxxx( + XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + } +} + +---------- +class X26884608 { + { + this.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); + this.xxxXxxxxXxxxxxx(XxxxxXxxx.xxxxxXxxxx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + Xxxxx.this.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); + Xxxxx.this.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + xxx.xxxxxx.Xxxxx.this.xxxxxxxxxXxxxxxXxxxxxxXxxxxx( + XXXXXXXXX_XXXXXXXXX); + xxx.xxxxxx.Xxxxx.this.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + + super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); + super.xxxXxxxxXxxx(XxxxxXxxxx.xxxxxXxxxx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + Xxxxx.super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); + Xxxxx.super.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + xxx.xxxxxx.Xxxxx.super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx( + XXXXXXXXX_XXXXXXXXX); + xxx.xxxxxx.Xxxxx.super.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26884608.input b/open-java-format/src/test/resources/test-cases/testdata/B26884608-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26884608.input rename to open-java-format/src/test/resources/test-cases/testdata/B26884608-lf.case index 52764b003..734d22e75 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26884608.input +++ b/open-java-format/src/test/resources/test-cases/testdata/B26884608-lf.case @@ -1,3 +1,4 @@ +---------- class X26884608 { { this @@ -32,3 +33,23 @@ class X26884608 { } } +---------- +class X26884608 { + { + this.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); + this.xxxXxxxxXxxxxxx(XxxxxXxxx.xxxxxXxxxx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + Xxxxx.this.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); + Xxxxx.this.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + xxx.xxxxxx.Xxxxx.this.xxxxxxxxxXxxxxxXxxxxxxXxxxxx( + XXXXXXXXX_XXXXXXXXX); + xxx.xxxxxx.Xxxxx.this.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + + super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); + super.xxxXxxxxXxxx(XxxxxXxxxx.xxxxxXxxxx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + Xxxxx.super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx(XXXXXXXXX_XXXXXXXXX); + Xxxxx.super.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + xxx.xxxxxx.Xxxxx.super.xxxxxxxxxXxxxxxXxxxxxxXxxxxx( + XXXXXXXXX_XXXXXXXXX); + xxx.xxxxxx.Xxxxx.super.xxxXxxxxXxxx(XxxxxXxxx.xxxxxXx(xxxxxx.xxxxxxxXxxxxxXxxxx(xxxxxx), xxxxxx.xxXxxxxxx())); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26952926-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B26952926-cr.case new file mode 100644 index 000000000..c79fa1667 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26952926-cr.case @@ -0,0 +1 @@ +---------- class T { { this( x, // line comment x // line comment ); super( x, // line comment x // line comment ); new t( x, // line comment x // line comment ); f( x, // line comment x // line comment ); fffff.fffff( x, // line comment x // line comment ); fffff .fffff( x, // line comment x // line comment ) .fffff( x, // line comment x // line comment ); } { this(x // line comment ); super(x // line comment ); new t(x // line comment ); f(x // line comment ); fffff.fffff(x // line comment ); fffff .fffff(x // line comment ) .fffff(x // line comment ); } } ---------- class T { { this( x, // line comment x // line comment ); super( x, // line comment x // line comment ); new t( x, // line comment x // line comment ); f( x, // line comment x // line comment ); fffff.fffff( x, // line comment x // line comment ); fffff.fffff( x, // line comment x // line comment ) .fffff( x, // line comment x // line comment ); } { this( x // line comment ); super( x // line comment ); new t( x // line comment ); f( x // line comment ); fffff.fffff( x // line comment ); fffff.fffff( x // line comment ) .fffff( x // line comment ); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26952926-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B26952926-crlf.case new file mode 100644 index 000000000..85cbcbd3e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26952926-crlf.case @@ -0,0 +1,109 @@ +---------- +class T { + { + this( + x, // line comment + x // line comment + ); + super( + x, // line comment + x // line comment + ); + new t( + x, // line comment + x // line comment + ); + f( + x, // line comment + x // line comment + ); + fffff.fffff( + x, // line comment + x // line comment + ); + fffff + .fffff( + x, // line comment + x // line comment + ) + .fffff( + x, // line comment + x // line comment + ); + } + + { + this(x // line comment + ); + super(x // line comment + ); + new t(x // line comment + ); + f(x // line comment + ); + fffff.fffff(x // line comment + ); + fffff + .fffff(x // line comment + ) + .fffff(x // line comment + ); + } +} +---------- +class T { + { + this( + x, // line comment + x // line comment + ); + super( + x, // line comment + x // line comment + ); + new t( + x, // line comment + x // line comment + ); + f( + x, // line comment + x // line comment + ); + fffff.fffff( + x, // line comment + x // line comment + ); + fffff.fffff( + x, // line comment + x // line comment + ) + .fffff( + x, // line comment + x // line comment + ); + } + + { + this( + x // line comment + ); + super( + x // line comment + ); + new t( + x // line comment + ); + f( + x // line comment + ); + fffff.fffff( + x // line comment + ); + fffff.fffff( + x // line comment + ) + .fffff( + x // line comment + ); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26952926.output b/open-java-format/src/test/resources/test-cases/testdata/B26952926-lf.case similarity index 60% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26952926.output rename to open-java-format/src/test/resources/test-cases/testdata/B26952926-lf.case index 3ac396626..340ed17c8 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26952926.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B26952926-lf.case @@ -1,3 +1,56 @@ +---------- +class T { + { + this( + x, // line comment + x // line comment + ); + super( + x, // line comment + x // line comment + ); + new t( + x, // line comment + x // line comment + ); + f( + x, // line comment + x // line comment + ); + fffff.fffff( + x, // line comment + x // line comment + ); + fffff + .fffff( + x, // line comment + x // line comment + ) + .fffff( + x, // line comment + x // line comment + ); + } + + { + this(x // line comment + ); + super(x // line comment + ); + new t(x // line comment + ); + f(x // line comment + ); + fffff.fffff(x // line comment + ); + fffff + .fffff(x // line comment + ) + .fffff(x // line comment + ); + } +} +---------- class T { { this( diff --git a/open-java-format/src/test/resources/test-cases/testdata/B27078833-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B27078833-cr.case new file mode 100644 index 000000000..a95b8dc06 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B27078833-cr.case @@ -0,0 +1 @@ +---------- enum OpKind { POST_INCR(Precedence.POSTFIX), POST_DECR(Precedence.POSTFIX), PRE_INCR(Precedence.UNARY), PRE_DECR(Precedence.UNARY), PLUS(Precedence.UNARY), NEG(Precedence.UNARY), COMP(Precedence.UNARY), NOT(Precedence.UNARY), MULT(Precedence.MULTIPLICATIVE), DIVIDE(Precedence.MULTIPLICATIVE), MODULO(Precedence.MULTIPLICATIVE), ; // ... } ---------- enum OpKind { POST_INCR(Precedence.POSTFIX), POST_DECR(Precedence.POSTFIX), PRE_INCR(Precedence.UNARY), PRE_DECR(Precedence.UNARY), PLUS(Precedence.UNARY), NEG(Precedence.UNARY), COMP(Precedence.UNARY), NOT(Precedence.UNARY), MULT(Precedence.MULTIPLICATIVE), DIVIDE(Precedence.MULTIPLICATIVE), MODULO(Precedence.MULTIPLICATIVE), ; // ... } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B27078833-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B27078833-crlf.case new file mode 100644 index 000000000..73114f2c8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B27078833-crlf.case @@ -0,0 +1,39 @@ +---------- +enum OpKind { + + POST_INCR(Precedence.POSTFIX), + POST_DECR(Precedence.POSTFIX), + + PRE_INCR(Precedence.UNARY), + PRE_DECR(Precedence.UNARY), + PLUS(Precedence.UNARY), + NEG(Precedence.UNARY), + COMP(Precedence.UNARY), + NOT(Precedence.UNARY), + + MULT(Precedence.MULTIPLICATIVE), + DIVIDE(Precedence.MULTIPLICATIVE), + MODULO(Precedence.MULTIPLICATIVE), + ; + + // ... +} +---------- +enum OpKind { + POST_INCR(Precedence.POSTFIX), + POST_DECR(Precedence.POSTFIX), + + PRE_INCR(Precedence.UNARY), + PRE_DECR(Precedence.UNARY), + PLUS(Precedence.UNARY), + NEG(Precedence.UNARY), + COMP(Precedence.UNARY), + NOT(Precedence.UNARY), + + MULT(Precedence.MULTIPLICATIVE), + DIVIDE(Precedence.MULTIPLICATIVE), + MODULO(Precedence.MULTIPLICATIVE), + ; + + // ... +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27078833.output b/open-java-format/src/test/resources/test-cases/testdata/B27078833-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27078833.output rename to open-java-format/src/test/resources/test-cases/testdata/B27078833-lf.case index c529e1cee..abb3f0075 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27078833.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B27078833-lf.case @@ -1,3 +1,24 @@ +---------- +enum OpKind { + + POST_INCR(Precedence.POSTFIX), + POST_DECR(Precedence.POSTFIX), + + PRE_INCR(Precedence.UNARY), + PRE_DECR(Precedence.UNARY), + PLUS(Precedence.UNARY), + NEG(Precedence.UNARY), + COMP(Precedence.UNARY), + NOT(Precedence.UNARY), + + MULT(Precedence.MULTIPLICATIVE), + DIVIDE(Precedence.MULTIPLICATIVE), + MODULO(Precedence.MULTIPLICATIVE), + ; + + // ... +} +---------- enum OpKind { POST_INCR(Precedence.POSTFIX), POST_DECR(Precedence.POSTFIX), diff --git a/open-java-format/src/test/resources/test-cases/testdata/B27246427-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B27246427-cr.case new file mode 100644 index 000000000..6b9c00239 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B27246427-cr.case @@ -0,0 +1 @@ +---------- enum TrailingComment { /** foo */ FOO, /** bar */ BAR; /** a */ Object a; /** b */ Object b; } ---------- enum TrailingComment { /** foo */ FOO, /** bar */ BAR; /** a */ Object a; /** b */ Object b; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B27246427-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B27246427-crlf.case new file mode 100644 index 000000000..62dbb536a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B27246427-crlf.case @@ -0,0 +1,20 @@ +---------- +enum TrailingComment { + /** foo */ FOO, /** bar */ + BAR; + + /** a */ Object a; /** b */ + Object b; +} +---------- +enum TrailingComment { + /** foo */ + FOO, + /** bar */ + BAR; + + /** a */ + Object a; + /** b */ + Object b; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27246427.output b/open-java-format/src/test/resources/test-cases/testdata/B27246427-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27246427.output rename to open-java-format/src/test/resources/test-cases/testdata/B27246427-lf.case index bd0446a67..fd9ee16b8 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27246427.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B27246427-lf.case @@ -1,3 +1,12 @@ +---------- +enum TrailingComment { + /** foo */ FOO, /** bar */ + BAR; + + /** a */ Object a; /** b */ + Object b; +} +---------- enum TrailingComment { /** foo */ FOO, diff --git a/open-java-format/src/test/resources/test-cases/testdata/B27602933-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B27602933-cr.case new file mode 100644 index 000000000..30d1ff83a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B27602933-cr.case @@ -0,0 +1 @@ +---------- class B27602933 { { try { } catch (final A | B x) { } try { } catch (@SuppressWarnings("unused") IllegalArgumentException | RuntimeException e) { } } } ---------- class B27602933 { { try { } catch (final A | B x) { } try { } catch (@SuppressWarnings("unused") IllegalArgumentException | RuntimeException e) { } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B27602933-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B27602933-crlf.case new file mode 100644 index 000000000..2e18f7a47 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B27602933-crlf.case @@ -0,0 +1,24 @@ +---------- +class B27602933 { + { + try { + } catch (final A | B x) { + } + + try { + } catch (@SuppressWarnings("unused") IllegalArgumentException | RuntimeException e) { + } + } +} +---------- +class B27602933 { + { + try { + } catch (final A | B x) { + } + + try { + } catch (@SuppressWarnings("unused") IllegalArgumentException | RuntimeException e) { + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27602933.output b/open-java-format/src/test/resources/test-cases/testdata/B27602933-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27602933.output rename to open-java-format/src/test/resources/test-cases/testdata/B27602933-lf.case index 008c945c8..8e367cab3 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27602933.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B27602933-lf.case @@ -1,3 +1,16 @@ +---------- +class B27602933 { + { + try { + } catch (final A | B x) { + } + + try { + } catch (@SuppressWarnings("unused") IllegalArgumentException | RuntimeException e) { + } + } +} +---------- class B27602933 { { try { diff --git a/open-java-format/src/test/resources/test-cases/testdata/B28774859-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B28774859-cr.case new file mode 100644 index 000000000..4ecdab7dc --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B28774859-cr.case @@ -0,0 +1 @@ +---------- class B28774859 { java.util. /*comment*/ Map. /*comment*/ Entry e; } ---------- class B28774859 { java.util./*comment*/ Map./*comment*/ Entry e; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B28774859-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B28774859-crlf.case new file mode 100644 index 000000000..d58737217 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B28774859-crlf.case @@ -0,0 +1,8 @@ +---------- +class B28774859 { + java.util. /*comment*/ Map. /*comment*/ Entry e; +} +---------- +class B28774859 { + java.util./*comment*/ Map./*comment*/ Entry e; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B28774859-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B28774859-lf.case new file mode 100644 index 000000000..9d11460bd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B28774859-lf.case @@ -0,0 +1,8 @@ +---------- +class B28774859 { + java.util. /*comment*/ Map. /*comment*/ Entry e; +} +---------- +class B28774859 { + java.util./*comment*/ Map./*comment*/ Entry e; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B28786284-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B28786284-cr.case new file mode 100644 index 000000000..dd740f82c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B28786284-cr.case @@ -0,0 +1 @@ +---------- enum E { ONE, TWO; ; } ---------- enum E { ONE, TWO; ; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B28786284-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B28786284-crlf.case new file mode 100644 index 000000000..4cb87e392 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B28786284-crlf.case @@ -0,0 +1,12 @@ +---------- +enum E { + ONE, + TWO; + ; +} +---------- +enum E { + ONE, + TWO; + ; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B28786284-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B28786284-lf.case new file mode 100644 index 000000000..623845ffe --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B28786284-lf.case @@ -0,0 +1,12 @@ +---------- +enum E { + ONE, + TWO; + ; +} +---------- +enum E { + ONE, + TWO; + ; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B29368546-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B29368546-cr.case new file mode 100644 index 000000000..b55ead598 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B29368546-cr.case @@ -0,0 +1 @@ +---------- public class B29368546 { /** * Example: * *
    {@code
       *     class T {
       *     }
       * }
    */ int x; /** * Example: * *
        {@code
       *   class T {
       *   }
       * }
    */ int x; /** * Example: * *
    {@code
       *   class T {
       *   }}
    */ int x; /** * Example: * *
    {@code
       * foo bar
       * }
       *
       * more stuff
       * 
    * *
    {@code
       * foo bar
       * }
       *
       * more stuff that ends with {}
       * 
    */ int x; /** * Example: * *
    {@code
       * class T {}
       * 
    // oops, we forgot the close brace * * more stuff that ends with {} */ int x; } ---------- public class B29368546 { /** * Example: * *
    {@code
         *     class T {
         *     }
         * }
    */ int x; /** * Example: * *
        {@code
         *   class T {
         *   }
         * }
    */ int x; /** * Example: * *
    {@code
         *   class T {
         *   }}
    */ int x; /** * Example: * *
    {@code
         * foo bar
         * }
         *
         * more stuff
         * 
    * *
    {@code
         * foo bar
         * }
         *
         * more stuff that ends with {}
         * 
    */ int x; /** * Example: * *
    {@code
         * class T {}
         * 
    // oops, we forgot the close brace * * more stuff that ends with {} */ int x; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B29368546-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B29368546-crlf.case new file mode 100644 index 000000000..52514165c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B29368546-crlf.case @@ -0,0 +1,122 @@ +---------- +public class B29368546 { + /** + * Example: + * + *
    {@code
    +   *     class T {
    +   *     }
    +   * }
    + */ + int x; + + /** + * Example: + * + *
        {@code
    +   *   class T {
    +   *   }
    +   * }
    + */ + int x; + + /** + * Example: + * + *
    {@code
    +   *   class T {
    +   *   }}
    + */ + int x; + + /** + * Example: + * + *
    {@code
    +   * foo bar
    +   * }
    +   *
    +   * more stuff
    +   * 
    + * + *
    {@code
    +   * foo bar
    +   * }
    +   *
    +   * more stuff that ends with {}
    +   * 
    + */ + int x; + + /** + * Example: + * + *
    {@code
    +   * class T {}
    +   * 
    // oops, we forgot the close brace + * + * more stuff that ends with {} + */ + int x; +} +---------- +public class B29368546 { + /** + * Example: + * + *
    {@code
    +     *     class T {
    +     *     }
    +     * }
    + */ + int x; + + /** + * Example: + * + *
        {@code
    +     *   class T {
    +     *   }
    +     * }
    + */ + int x; + + /** + * Example: + * + *
    {@code
    +     *   class T {
    +     *   }}
    + */ + int x; + + /** + * Example: + * + *
    {@code
    +     * foo bar
    +     * }
    +     *
    +     * more stuff
    +     * 
    + * + *
    {@code
    +     * foo bar
    +     * }
    +     *
    +     * more stuff that ends with {}
    +     * 
    + */ + int x; + + /** + * Example: + * + *
    {@code
    +     * class T {}
    +     * 
    // oops, we forgot the close brace + * + * more stuff that ends with {} + */ + int x; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29368546.output b/open-java-format/src/test/resources/test-cases/testdata/B29368546-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29368546.output rename to open-java-format/src/test/resources/test-cases/testdata/B29368546-lf.case index cf89a475e..f8dd52e00 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29368546.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B29368546-lf.case @@ -1,3 +1,65 @@ +---------- +public class B29368546 { + /** + * Example: + * + *
    {@code
    +   *     class T {
    +   *     }
    +   * }
    + */ + int x; + + /** + * Example: + * + *
        {@code
    +   *   class T {
    +   *   }
    +   * }
    + */ + int x; + + /** + * Example: + * + *
    {@code
    +   *   class T {
    +   *   }}
    + */ + int x; + + /** + * Example: + * + *
    {@code
    +   * foo bar
    +   * }
    +   *
    +   * more stuff
    +   * 
    + * + *
    {@code
    +   * foo bar
    +   * }
    +   *
    +   * more stuff that ends with {}
    +   * 
    + */ + int x; + + /** + * Example: + * + *
    {@code
    +   * class T {}
    +   * 
    // oops, we forgot the close brace + * + * more stuff that ends with {} + */ + int x; +} +---------- public class B29368546 { /** * Example: diff --git a/open-java-format/src/test/resources/test-cases/testdata/B29618429-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B29618429-cr.case new file mode 100644 index 000000000..2473b7c72 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B29618429-cr.case @@ -0,0 +1 @@ +---------- class B29618429 { /** * Hello * *

    World *

       * @LooksLikeATag(
       *   foo = "bar"
       * )
       * 
    */ int x; } ---------- class B29618429 { /** * Hello * *

    World *

         * @LooksLikeATag(
         *   foo = "bar"
         * )
         * 
    */ int x; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B29618429-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B29618429-crlf.case new file mode 100644 index 000000000..284193a57 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B29618429-crlf.case @@ -0,0 +1,28 @@ +---------- +class B29618429 { + /** + * Hello + * + *

    World + *

    +   * @LooksLikeATag(
    +   *   foo = "bar"
    +   * )
    +   * 
    + */ + int x; +} +---------- +class B29618429 { + /** + * Hello + * + *

    World + *

    +     * @LooksLikeATag(
    +     *   foo = "bar"
    +     * )
    +     * 
    + */ + int x; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29618429.output b/open-java-format/src/test/resources/test-cases/testdata/B29618429-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29618429.output rename to open-java-format/src/test/resources/test-cases/testdata/B29618429-lf.case index efe20c21b..f303ccbdd 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29618429.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B29618429-lf.case @@ -1,3 +1,18 @@ +---------- +class B29618429 { + /** + * Hello + * + *

    World + *

    +   * @LooksLikeATag(
    +   *   foo = "bar"
    +   * )
    +   * 
    + */ + int x; +} +---------- class B29618429 { /** * Hello diff --git a/open-java-format/src/test/resources/test-cases/testdata/B29705613-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B29705613-cr.case new file mode 100644 index 000000000..0b66c5bfc --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B29705613-cr.case @@ -0,0 +1 @@ +---------- class B29705613 { /** * This tag isn't closed: {@link Foo * *

    A paragraph */ int x; } ---------- class B29705613 { /** * This tag isn't closed: {@link Foo * *

    A paragraph */ int x; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B29705613-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B29705613-crlf.case new file mode 100644 index 000000000..93d78d80f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B29705613-crlf.case @@ -0,0 +1,18 @@ +---------- +class B29705613 { + /** + * This tag isn't closed: {@link Foo + * + *

    A paragraph + */ + int x; +} +---------- +class B29705613 { + /** + * This tag isn't closed: {@link Foo + * + *

    A paragraph + */ + int x; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B29705613-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B29705613-lf.case new file mode 100644 index 000000000..3b4de6774 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B29705613-lf.case @@ -0,0 +1,18 @@ +---------- +class B29705613 { + /** + * This tag isn't closed: {@link Foo + * + *

    A paragraph + */ + int x; +} +---------- +class B29705613 { + /** + * This tag isn't closed: {@link Foo + * + *

    A paragraph + */ + int x; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B30153869-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B30153869-cr.case new file mode 100644 index 000000000..f33fc4fb0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B30153869-cr.case @@ -0,0 +1 @@ +---------- /** * one * *

      *
    1. two *
    * *

    *

  • four */ class T { /** * One * *
      *
    • a *
        *
      • b *
      • c *
      *
    • e *
    */ int x; } ---------- /** * one * *
      *
    1. two *
    * *

    *

  • four */ class T { /** * One * *
      *
    • a *
        *
      • b *
      • c *
      *
    • e *
    */ int x; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B30153869-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B30153869-crlf.case new file mode 100644 index 000000000..638078da5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B30153869-crlf.case @@ -0,0 +1,54 @@ +---------- +/** + * one + * + *
      + *
    1. two + *
    + * + *

    + *

  • four + */ +class T { + + /** + * One + * + *
      + *
    • a + *
        + *
      • b + *
      • c + *
      + *
    • e + *
    + */ + int x; +} +---------- +/** + * one + * + *
      + *
    1. two + *
    + * + *

    + *

  • four + */ +class T { + + /** + * One + * + *
      + *
    • a + *
        + *
      • b + *
      • c + *
      + *
    • e + *
    + */ + int x; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30153869.output b/open-java-format/src/test/resources/test-cases/testdata/B30153869-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30153869.output rename to open-java-format/src/test/resources/test-cases/testdata/B30153869-lf.case index d0db2afd0..59ce25c10 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30153869.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B30153869-lf.case @@ -1,3 +1,31 @@ +---------- +/** + * one + * + *
      + *
    1. two + *
    + * + *

    + *

  • four + */ +class T { + + /** + * One + * + *
      + *
    • a + *
        + *
      • b + *
      • c + *
      + *
    • e + *
    + */ + int x; +} +---------- /** * one * diff --git a/open-java-format/src/test/resources/test-cases/testdata/B30789352-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B30789352-cr.case new file mode 100644 index 000000000..5c8c52806 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B30789352-cr.case @@ -0,0 +1 @@ +---------- /** * Body. * * @param

    the protobuf type */ class B30789352

    {} ---------- /** * Body. * * @param

    the protobuf type */ class B30789352

    {} \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B30789352-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B30789352-crlf.case new file mode 100644 index 000000000..3cdc85c9d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B30789352-crlf.case @@ -0,0 +1,14 @@ +---------- +/** + * Body. + * + * @param

    the protobuf type + */ +class B30789352

    {} +---------- +/** + * Body. + * + * @param

    the protobuf type + */ +class B30789352

    {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B30789352-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B30789352-lf.case new file mode 100644 index 000000000..1e39a8ecb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B30789352-lf.case @@ -0,0 +1,14 @@ +---------- +/** + * Body. + * + * @param

    the protobuf type + */ +class B30789352

    {} +---------- +/** + * Body. + * + * @param

    the protobuf type + */ +class B30789352

    {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B308157568-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B308157568-cr.case new file mode 100644 index 000000000..d7ca8278f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B308157568-cr.case @@ -0,0 +1 @@ +---------- 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> a = @A(0x45) ArrayList::new; Supplier> 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> c = ArrayList<@A(0x4A) String>::new; Supplier> d = ImmutableList::<@A(0x4B) String>of; return 0; } } ---------- 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> a = @A(0x45) ArrayList::new; Supplier> 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> c = ArrayList<@A(0x4A) String>::new; Supplier> d = ImmutableList::<@A(0x4B) String>of; return 0; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B308157568-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B308157568-crlf.case new file mode 100644 index 000000000..9f2892224 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B308157568-crlf.case @@ -0,0 +1,48 @@ +---------- +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> a = @A(0x45) ArrayList::new; + Supplier> 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> c = ArrayList<@A(0x4A) String>::new; + Supplier> d = ImmutableList::<@A(0x4B) String>of; + return 0; + } +} +---------- +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> a = @A(0x45) ArrayList::new; + Supplier> 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> c = ArrayList<@A(0x4A) String>::new; + Supplier> d = ImmutableList::<@A(0x4B) String>of; + return 0; + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B308157568.output b/open-java-format/src/test/resources/test-cases/testdata/B308157568-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B308157568.output rename to open-java-format/src/test/resources/test-cases/testdata/B308157568-lf.case index 31eb4bdc2..ceeabc700 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B308157568.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B308157568-lf.case @@ -1,3 +1,28 @@ +---------- +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> a = @A(0x45) ArrayList::new; + Supplier> 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> c = ArrayList<@A(0x4A) String>::new; + Supplier> d = ImmutableList::<@A(0x4B) String>of; + return 0; + } +} +---------- class C { @A(0x14) int f(Object o) { diff --git a/open-java-format/src/test/resources/test-cases/testdata/B32114928-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B32114928-cr.case new file mode 100644 index 000000000..b65400de9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B32114928-cr.case @@ -0,0 +1 @@ +---------- class B32114928 { { Class tClass = (Class) verifyNotNull((ParameterizedType) getClass().getGenericSuperclass()) .getActualTypeArguments()[ 0]; } } ---------- class B32114928 { { Class tClass = (Class) verifyNotNull((ParameterizedType) getClass().getGenericSuperclass()) .getActualTypeArguments()[0]; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B32114928-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B32114928-crlf.case new file mode 100644 index 000000000..31af48329 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B32114928-crlf.case @@ -0,0 +1,18 @@ +---------- +class B32114928 { + { + Class tClass = + (Class) + verifyNotNull((ParameterizedType) getClass().getGenericSuperclass()) + .getActualTypeArguments()[ + 0]; + } +} +---------- +class B32114928 { + { + Class tClass = + (Class) verifyNotNull((ParameterizedType) getClass().getGenericSuperclass()) + .getActualTypeArguments()[0]; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B32114928-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B32114928-lf.case new file mode 100644 index 000000000..6a5f4d2ba --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B32114928-lf.case @@ -0,0 +1,18 @@ +---------- +class B32114928 { + { + Class tClass = + (Class) + verifyNotNull((ParameterizedType) getClass().getGenericSuperclass()) + .getActualTypeArguments()[ + 0]; + } +} +---------- +class B32114928 { + { + Class tClass = + (Class) verifyNotNull((ParameterizedType) getClass().getGenericSuperclass()) + .getActualTypeArguments()[0]; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B32284705-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B32284705-cr.case new file mode 100644 index 000000000..10692969c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B32284705-cr.case @@ -0,0 +1 @@ +---------- /** * Foo *

     * bar
     * 
    * */ class B32284705 {} ---------- /** * Foo *
     * bar
     * 
    *
    */ class B32284705 {} \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B32284705-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B32284705-crlf.case new file mode 100644 index 000000000..bd2e2be30 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B32284705-crlf.case @@ -0,0 +1,18 @@ +---------- +/** + * Foo + *
    + * bar
    + * 
    + *
    + */ +class B32284705 {} +---------- +/** + * Foo + *
    + * bar
    + * 
    + *
    + */ +class B32284705 {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B32284705-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B32284705-lf.case new file mode 100644 index 000000000..5dfd553ec --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B32284705-lf.case @@ -0,0 +1,18 @@ +---------- +/** + * Foo + *
    + * bar
    + * 
    + *
    + */ +class B32284705 {} +---------- +/** + * Foo + *
    + * bar
    + * 
    + *
    + */ +class B32284705 {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B32729600-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B32729600-cr.case new file mode 100644 index 000000000..dcc424f0c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B32729600-cr.case @@ -0,0 +1 @@ +---------- class B32729600 { { f(() -> {}); } } ---------- class B32729600 { { f(() -> {}); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B32729600-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B32729600-crlf.case new file mode 100644 index 000000000..4b24bbaba --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B32729600-crlf.case @@ -0,0 +1,12 @@ +---------- +class B32729600 { + { + f(() -> {}); + } +} +---------- +class B32729600 { + { + f(() -> {}); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B32729600-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B32729600-lf.case new file mode 100644 index 000000000..20b8624a9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B32729600-lf.case @@ -0,0 +1,12 @@ +---------- +class B32729600 { + { + f(() -> {}); + } +} +---------- +class B32729600 { + { + f(() -> {}); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B33358723-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B33358723-cr.case new file mode 100644 index 000000000..185841a40 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B33358723-cr.case @@ -0,0 +1 @@ +---------- class B33358723 { { f( // x -> System.err.println( // "hello")); f( // ( // x) -> System.err.println( // "hello")); f( // (int // x) -> System.err.println( // "hello")); } } ---------- class B33358723 { { f( // x -> System.err.println( // "hello")); f( // ( // x) -> System.err.println( // "hello")); f( // (int // x) -> System.err.println( // "hello")); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B33358723-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B33358723-crlf.case new file mode 100644 index 000000000..f963030a2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B33358723-crlf.case @@ -0,0 +1,47 @@ +---------- +class B33358723 { + { + f( + // + x -> + System.err.println( + // + "hello")); + f( + // + ( // + x) -> + System.err.println( + // + "hello")); + f( + // + (int // + x) -> + System.err.println( + // + "hello")); + } +} +---------- +class B33358723 { + { + f( + // + x -> System.err.println( + // + "hello")); + f( + // + ( // + x) -> System.err.println( + // + "hello")); + f( + // + (int // + x) -> System.err.println( + // + "hello")); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B33358723.output b/open-java-format/src/test/resources/test-cases/testdata/B33358723-lf.case similarity index 59% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B33358723.output rename to open-java-format/src/test/resources/test-cases/testdata/B33358723-lf.case index 0e64eadbe..a4397d3a4 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B33358723.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B33358723-lf.case @@ -1,3 +1,29 @@ +---------- +class B33358723 { + { + f( + // + x -> + System.err.println( + // + "hello")); + f( + // + ( // + x) -> + System.err.println( + // + "hello")); + f( + // + (int // + x) -> + System.err.println( + // + "hello")); + } +} +---------- class B33358723 { { f( diff --git a/open-java-format/src/test/resources/test-cases/testdata/B35644813-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B35644813-cr.case new file mode 100644 index 000000000..bdb58f33c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B35644813-cr.case @@ -0,0 +1 @@ +---------- class B35644813 { { return foo____________ .bar__________() .baz____________() .stream() .map(Baz::getId) .collect(toList()); } private static final ImmutableSet SCANDINAVIA = ImmutableSet.of( DENMARK____________________________________________________, NORWAY_____________________________________________________, SWEDEN_____________________________________________________) .stream() .map(x -> String.format("country: %s", x.toLowerCase())) .collect(toImmutableSet()); } ---------- class B35644813 { { return foo____________.bar__________().baz____________().stream() .map(Baz::getId) .collect(toList()); } private static final ImmutableSet SCANDINAVIA = ImmutableSet.of( DENMARK____________________________________________________, NORWAY_____________________________________________________, SWEDEN_____________________________________________________) .stream() .map(x -> String.format("country: %s", x.toLowerCase())) .collect(toImmutableSet()); } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B35644813-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B35644813-crlf.case new file mode 100644 index 000000000..9596cade0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B35644813-crlf.case @@ -0,0 +1,36 @@ +---------- +class B35644813 { + { + return foo____________ + .bar__________() + .baz____________() + .stream() + .map(Baz::getId) + .collect(toList()); + } + + private static final ImmutableSet SCANDINAVIA = + ImmutableSet.of( + DENMARK____________________________________________________, + NORWAY_____________________________________________________, + SWEDEN_____________________________________________________) + .stream() + .map(x -> String.format("country: %s", x.toLowerCase())) + .collect(toImmutableSet()); +} +---------- +class B35644813 { + { + return foo____________.bar__________().baz____________().stream() + .map(Baz::getId) + .collect(toList()); + } + + private static final ImmutableSet SCANDINAVIA = ImmutableSet.of( + DENMARK____________________________________________________, + NORWAY_____________________________________________________, + SWEDEN_____________________________________________________) + .stream() + .map(x -> String.format("country: %s", x.toLowerCase())) + .collect(toImmutableSet()); +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B35644813-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B35644813-lf.case new file mode 100644 index 000000000..c7b784ec2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B35644813-lf.case @@ -0,0 +1,36 @@ +---------- +class B35644813 { + { + return foo____________ + .bar__________() + .baz____________() + .stream() + .map(Baz::getId) + .collect(toList()); + } + + private static final ImmutableSet SCANDINAVIA = + ImmutableSet.of( + DENMARK____________________________________________________, + NORWAY_____________________________________________________, + SWEDEN_____________________________________________________) + .stream() + .map(x -> String.format("country: %s", x.toLowerCase())) + .collect(toImmutableSet()); +} +---------- +class B35644813 { + { + return foo____________.bar__________().baz____________().stream() + .map(Baz::getId) + .collect(toList()); + } + + private static final ImmutableSet SCANDINAVIA = ImmutableSet.of( + DENMARK____________________________________________________, + NORWAY_____________________________________________________, + SWEDEN_____________________________________________________) + .stream() + .map(x -> String.format("country: %s", x.toLowerCase())) + .collect(toImmutableSet()); +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B35797074-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B35797074-cr.case new file mode 100644 index 000000000..070673b37 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B35797074-cr.case @@ -0,0 +1 @@ +---------- class B35797074 { /** javadoc */ /* package */ final int x; } ---------- class B35797074 { /** javadoc */ /* package */ final int x; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B35797074-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B35797074-crlf.case new file mode 100644 index 000000000..cbbecab71 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B35797074-crlf.case @@ -0,0 +1,10 @@ +---------- +class B35797074 { + /** javadoc */ + /* package */ final int x; +} +---------- +class B35797074 { + /** javadoc */ + /* package */ final int x; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B35797074-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B35797074-lf.case new file mode 100644 index 000000000..08b424e21 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B35797074-lf.case @@ -0,0 +1,10 @@ +---------- +class B35797074 { + /** javadoc */ + /* package */ final int x; +} +---------- +class B35797074 { + /** javadoc */ + /* package */ final int x; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B36194204-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B36194204-cr.case new file mode 100644 index 000000000..61cb0455d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B36194204-cr.case @@ -0,0 +1 @@ +---------- class B36194204 { { Function f = (String... s) -> s[0]; } } ---------- class B36194204 { { Function f = (String... s) -> s[0]; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B36194204-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B36194204-crlf.case new file mode 100644 index 000000000..33dd46b79 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B36194204-crlf.case @@ -0,0 +1,12 @@ +---------- +class B36194204 { + { + Function f = (String... s) -> s[0]; + } +} +---------- +class B36194204 { + { + Function f = (String... s) -> s[0]; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B36194204-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B36194204-lf.case new file mode 100644 index 000000000..127cc9b89 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B36194204-lf.case @@ -0,0 +1,12 @@ +---------- +class B36194204 { + { + Function f = (String... s) -> s[0]; + } +} +---------- +class B36194204 { + { + Function f = (String... s) -> s[0]; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B37629610-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B37629610-cr.case new file mode 100644 index 000000000..3ff0e028b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B37629610-cr.case @@ -0,0 +1 @@ +---------- class B37629610 { private static ImmutableList toInputOutputPairs(Options options) { for (Iterator inputIt = options.inputJars.iterator(), outputIt = options.outputJars.iterator(); inputIt.hasNext(); ) {} for (Iterator inputIt = options.inputJars.iterator(), outputIt = options.outputJars.iterator(); ; inputIt.next()) {} for (inputIt = options.inputJars.iterator(), // outputIt = options.outputJars.iterator(); ; inputIt.next()) {} } } ---------- class B37629610 { private static ImmutableList toInputOutputPairs(Options options) { for (Iterator inputIt = options.inputJars.iterator(), outputIt = options.outputJars.iterator(); inputIt.hasNext(); ) {} for (Iterator inputIt = options.inputJars.iterator(), outputIt = options.outputJars.iterator(); ; inputIt.next()) {} for (inputIt = options.inputJars.iterator(), // outputIt = options.outputJars.iterator(); ; inputIt.next()) {} } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B37629610-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B37629610-crlf.case new file mode 100644 index 000000000..87d2d2bd9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B37629610-crlf.case @@ -0,0 +1,31 @@ +---------- +class B37629610 { + private static ImmutableList toInputOutputPairs(Options options) { + for (Iterator inputIt = options.inputJars.iterator(), + outputIt = options.outputJars.iterator(); + inputIt.hasNext(); + ) {} + for (Iterator inputIt = options.inputJars.iterator(), + outputIt = options.outputJars.iterator(); + ; + inputIt.next()) {} + for (inputIt = options.inputJars.iterator(), // + outputIt = options.outputJars.iterator(); + ; + inputIt.next()) {} + } +} +---------- +class B37629610 { + private static ImmutableList toInputOutputPairs(Options options) { + for (Iterator inputIt = options.inputJars.iterator(), outputIt = options.outputJars.iterator(); + inputIt.hasNext(); ) {} + for (Iterator inputIt = options.inputJars.iterator(), outputIt = options.outputJars.iterator(); + ; + inputIt.next()) {} + for (inputIt = options.inputJars.iterator(), // + outputIt = options.outputJars.iterator(); + ; + inputIt.next()) {} + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37629610.output b/open-java-format/src/test/resources/test-cases/testdata/B37629610-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37629610.output rename to open-java-format/src/test/resources/test-cases/testdata/B37629610-lf.case index 737a69bfa..07b24de63 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37629610.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B37629610-lf.case @@ -1,3 +1,21 @@ +---------- +class B37629610 { + private static ImmutableList toInputOutputPairs(Options options) { + for (Iterator inputIt = options.inputJars.iterator(), + outputIt = options.outputJars.iterator(); + inputIt.hasNext(); + ) {} + for (Iterator inputIt = options.inputJars.iterator(), + outputIt = options.outputJars.iterator(); + ; + inputIt.next()) {} + for (inputIt = options.inputJars.iterator(), // + outputIt = options.outputJars.iterator(); + ; + inputIt.next()) {} + } +} +---------- class B37629610 { private static ImmutableList toInputOutputPairs(Options options) { for (Iterator inputIt = options.inputJars.iterator(), outputIt = options.outputJars.iterator(); diff --git a/open-java-format/src/test/resources/test-cases/testdata/B377585941-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B377585941-cr.case new file mode 100644 index 000000000..ae335095b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B377585941-cr.case @@ -0,0 +1 @@ +---------- class T { { f( /* foo */ """ hello """); } } ---------- class T { { f(/* foo */ """ hello """); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B377585941-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B377585941-crlf.case new file mode 100644 index 000000000..729b36094 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B377585941-crlf.case @@ -0,0 +1,17 @@ +---------- +class T { + { + f( + /* foo */ """ + hello + """); + } +} +---------- +class T { + { + f(/* foo */ """ + hello + """); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B377585941-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B377585941-lf.case new file mode 100644 index 000000000..988fcd297 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B377585941-lf.case @@ -0,0 +1,17 @@ +---------- +class T { + { + f( + /* foo */ """ + hello + """); + } +} +---------- +class T { + { + f(/* foo */ """ + hello + """); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B37895033-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B37895033-cr.case new file mode 100644 index 000000000..91bac6de0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B37895033-cr.case @@ -0,0 +1 @@ +---------- class B37895033 { String[][] xs = new String[][] { {"B3", "C3", "D3"}, {"B4", "C4", "D4"}, {"B5", "C5", "D5"} }; String[] ys = new String[] { "B3", "B4", "B5", }; String[][] zs = new String[][] { {"B3"}, {"B4"}, {"B5"}, }; } ---------- class B37895033 { String[][] xs = new String[][] { {"B3", "C3", "D3"}, {"B4", "C4", "D4"}, {"B5", "C5", "D5"} }; String[] ys = new String[] { "B3", "B4", "B5", }; String[][] zs = new String[][] { {"B3"}, {"B4"}, {"B5"}, }; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B37895033-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B37895033-crlf.case new file mode 100644 index 000000000..84c3cd635 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B37895033-crlf.case @@ -0,0 +1,35 @@ +---------- +class B37895033 { + String[][] xs = + new String[][] { + {"B3", "C3", "D3"}, + {"B4", "C4", "D4"}, + {"B5", "C5", "D5"} + }; + String[] ys = + new String[] { + "B3", + "B4", + "B5", + }; + String[][] zs = + new String[][] { + {"B3"}, + {"B4"}, + {"B5"}, + }; +} +---------- +class B37895033 { + String[][] xs = new String[][] { + {"B3", "C3", "D3"}, + {"B4", "C4", "D4"}, + {"B5", "C5", "D5"} + }; + String[] ys = new String[] { + "B3", "B4", "B5", + }; + String[][] zs = new String[][] { + {"B3"}, {"B4"}, {"B5"}, + }; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37895033.input b/open-java-format/src/test/resources/test-cases/testdata/B37895033-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37895033.input rename to open-java-format/src/test/resources/test-cases/testdata/B37895033-lf.case index 9ec5e463a..6ffcee90d 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37895033.input +++ b/open-java-format/src/test/resources/test-cases/testdata/B37895033-lf.case @@ -1,3 +1,4 @@ +---------- class B37895033 { String[][] xs = new String[][] { @@ -18,3 +19,17 @@ class B37895033 { {"B5"}, }; } +---------- +class B37895033 { + String[][] xs = new String[][] { + {"B3", "C3", "D3"}, + {"B4", "C4", "D4"}, + {"B5", "C5", "D5"} + }; + String[] ys = new String[] { + "B3", "B4", "B5", + }; + String[][] zs = new String[][] { + {"B3"}, {"B4"}, {"B5"}, + }; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B380299722-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B380299722-cr.case new file mode 100644 index 000000000..8fb682055 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B380299722-cr.case @@ -0,0 +1 @@ +---------- package com.helloworld; class Foo { void foo() { var bar = """ bar\ bar\ """; } } ---------- package com.helloworld; class Foo { void foo() { var bar = """ bar\ bar\ """; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B380299722-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B380299722-crlf.case new file mode 100644 index 000000000..ebdacaefa --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B380299722-crlf.case @@ -0,0 +1,22 @@ +---------- +package com.helloworld; + +class Foo { + void foo() { + var bar = """ + bar\ + bar\ + """; + } +} +---------- +package com.helloworld; + +class Foo { + void foo() { + var bar = """ + bar\ + bar\ + """; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B380299722-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B380299722-lf.case new file mode 100644 index 000000000..0132681f7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B380299722-lf.case @@ -0,0 +1,22 @@ +---------- +package com.helloworld; + +class Foo { + void foo() { + var bar = """ + bar\ + bar\ + """; + } +} +---------- +package com.helloworld; + +class Foo { + void foo() { + var bar = """ + bar\ + bar\ + """; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B38203081-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B38203081-cr.case new file mode 100644 index 000000000..6eaa8823e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B38203081-cr.case @@ -0,0 +1 @@ +---------- class B38203081 { void f(int @A []... xs) {} void g(int @A [] @B... xs) {} } ---------- class B38203081 { void f(int @A []... xs) {} void g(int @A [] @B ... xs) {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B38203081-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B38203081-crlf.case new file mode 100644 index 000000000..5126ed91d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B38203081-crlf.case @@ -0,0 +1,12 @@ +---------- +class B38203081 { + void f(int @A []... xs) {} + + void g(int @A [] @B... xs) {} +} +---------- +class B38203081 { + void f(int @A []... xs) {} + + void g(int @A [] @B ... xs) {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B38203081-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B38203081-lf.case new file mode 100644 index 000000000..3ec4c0083 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B38203081-lf.case @@ -0,0 +1,12 @@ +---------- +class B38203081 { + void f(int @A []... xs) {} + + void g(int @A [] @B... xs) {} +} +---------- +class B38203081 { + void f(int @A []... xs) {} + + void g(int @A [] @B ... xs) {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B38352414-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B38352414-cr.case new file mode 100644 index 000000000..92e6b7ff3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B38352414-cr.case @@ -0,0 +1 @@ +---------- @Redacted(Redacted.REDACTED + "/redacted", redacted = Redacted.class) class B38352414 {} ---------- @Redacted(Redacted.REDACTED + "/redacted", redacted = Redacted.class) class B38352414 {} \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B38352414-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B38352414-crlf.case new file mode 100644 index 000000000..66ca9ed47 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B38352414-crlf.case @@ -0,0 +1,6 @@ +---------- +@Redacted(Redacted.REDACTED + "/redacted", redacted = Redacted.class) +class B38352414 {} +---------- +@Redacted(Redacted.REDACTED + "/redacted", redacted = Redacted.class) +class B38352414 {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B38352414-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B38352414-lf.case new file mode 100644 index 000000000..b69055ac2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B38352414-lf.case @@ -0,0 +1,6 @@ +---------- +@Redacted(Redacted.REDACTED + "/redacted", redacted = Redacted.class) +class B38352414 {} +---------- +@Redacted(Redacted.REDACTED + "/redacted", redacted = Redacted.class) +class B38352414 {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B64493529-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B64493529-cr.case new file mode 100644 index 000000000..6ccef5595 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B64493529-cr.case @@ -0,0 +1 @@ +---------- /** Copies from {@link Foo} to {@link Bar}. */ // XXXX.XxXxxxxx() class B64493529 { // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) } // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) ---------- /** Copies from {@link Foo} to {@link Bar}. */ // XXXX.XxXxxxxx() class B64493529 { // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) } // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B64493529-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B64493529-crlf.case new file mode 100644 index 000000000..9fd042634 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B64493529-crlf.case @@ -0,0 +1,22 @@ +---------- +/** Copies from {@link Foo} to {@link Bar}. */ +// XXXX.XxXxxxxx() +class B64493529 { + // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ + // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) + // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ + // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) +} +// XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ +// XxxxxxXxxxxxXXxxxxxxXxxxxx.java) +---------- +/** Copies from {@link Foo} to {@link Bar}. */ +// XXXX.XxXxxxxx() +class B64493529 { + // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ + // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) + // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ + // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) +} +// XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ +// XxxxxxXxxxxxXXxxxxxxXxxxxx.java) diff --git a/open-java-format/src/test/resources/test-cases/testdata/B64493529-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B64493529-lf.case new file mode 100644 index 000000000..9f4dbf27c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B64493529-lf.case @@ -0,0 +1,22 @@ +---------- +/** Copies from {@link Foo} to {@link Bar}. */ +// XXXX.XxXxxxxx() +class B64493529 { + // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ + // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) + // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ + // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) +} +// XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ +// XxxxxxXxxxxxXXxxxxxxXxxxxx.java) +---------- +/** Copies from {@link Foo} to {@link Bar}. */ +// XXXX.XxXxxxxx() +class B64493529 { + // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ + // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) + // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ + // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) +} +// XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ +// XxxxxxXxxxxxXXxxxxxxXxxxxx.java) diff --git a/open-java-format/src/test/resources/test-cases/testdata/B65214682-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B65214682-cr.case new file mode 100644 index 000000000..caa03c848 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B65214682-cr.case @@ -0,0 +1 @@ +---------- @BugPattern( name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL ) @BugPattern( name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, explanation = "If an AsyncFunction always returns immediateFuture() and never throws, it can " + "be replaced with a Function.", category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) class Test {} ---------- @BugPattern( name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) @BugPattern( name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, explanation = "If an AsyncFunction always returns immediateFuture() and never throws, it can " + "be replaced with a Function.", category = GUAVA, severity = NOT_A_PROBLEM, maturity = EXPERIMENTAL) class Test {} \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B65214682-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B65214682-crlf.case new file mode 100644 index 000000000..8cb6a95f1 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B65214682-crlf.case @@ -0,0 +1,34 @@ +---------- +@BugPattern( + name = "AsyncFunctionReturnsImmediate", + summary = SIMPLIFY, + category = GUAVA, + severity = NOT_A_PROBLEM, + maturity = EXPERIMENTAL +) +@BugPattern( + name = "AsyncFunctionReturnsImmediate", + summary = SIMPLIFY, + explanation = + "If an AsyncFunction always returns immediateFuture() and never throws, it can " + + "be replaced with a Function.", + category = GUAVA, + severity = NOT_A_PROBLEM, + maturity = EXPERIMENTAL) +class Test {} +---------- +@BugPattern( + name = "AsyncFunctionReturnsImmediate", + summary = SIMPLIFY, + category = GUAVA, + severity = NOT_A_PROBLEM, + maturity = EXPERIMENTAL) +@BugPattern( + name = "AsyncFunctionReturnsImmediate", + summary = SIMPLIFY, + explanation = "If an AsyncFunction always returns immediateFuture() and never throws, it can " + + "be replaced with a Function.", + category = GUAVA, + severity = NOT_A_PROBLEM, + maturity = EXPERIMENTAL) +class Test {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B65214682.output b/open-java-format/src/test/resources/test-cases/testdata/B65214682-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B65214682.output rename to open-java-format/src/test/resources/test-cases/testdata/B65214682-lf.case index 3b192617f..ff9f207ab 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B65214682.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B65214682-lf.case @@ -1,3 +1,22 @@ +---------- +@BugPattern( + name = "AsyncFunctionReturnsImmediate", + summary = SIMPLIFY, + category = GUAVA, + severity = NOT_A_PROBLEM, + maturity = EXPERIMENTAL +) +@BugPattern( + name = "AsyncFunctionReturnsImmediate", + summary = SIMPLIFY, + explanation = + "If an AsyncFunction always returns immediateFuture() and never throws, it can " + + "be replaced with a Function.", + category = GUAVA, + severity = NOT_A_PROBLEM, + maturity = EXPERIMENTAL) +class Test {} +---------- @BugPattern( name = "AsyncFunctionReturnsImmediate", summary = SIMPLIFY, diff --git a/open-java-format/src/test/resources/test-cases/testdata/B72507902-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B72507902-cr.case new file mode 100644 index 000000000..9e37ae20a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B72507902-cr.case @@ -0,0 +1 @@ +---------- class B72507902 { private static class Xxxxxxxxxxxxxxxxxxxx extends Xxxxxxxxxxx< Pair>, Xxxxxxxxxxxxxxxxxxxx, List> {} } ---------- class B72507902 { private static class Xxxxxxxxxxxxxxxxxxxx extends Xxxxxxxxxxx< Pair>, Xxxxxxxxxxxxxxxxxxxx, List> {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B72507902-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B72507902-crlf.case new file mode 100644 index 000000000..11402c3f2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B72507902-crlf.case @@ -0,0 +1,13 @@ +---------- +class B72507902 { + private static class Xxxxxxxxxxxxxxxxxxxx + extends Xxxxxxxxxxx< + Pair>, Xxxxxxxxxxxxxxxxxxxx, + List> {} +} +---------- +class B72507902 { + private static class Xxxxxxxxxxxxxxxxxxxx + extends Xxxxxxxxxxx< + Pair>, Xxxxxxxxxxxxxxxxxxxx, List> {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B72507902-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B72507902-lf.case new file mode 100644 index 000000000..1bb4cdcf1 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B72507902-lf.case @@ -0,0 +1,13 @@ +---------- +class B72507902 { + private static class Xxxxxxxxxxxxxxxxxxxx + extends Xxxxxxxxxxx< + Pair>, Xxxxxxxxxxxxxxxxxxxx, + List> {} +} +---------- +class B72507902 { + private static class Xxxxxxxxxxxxxxxxxxxx + extends Xxxxxxxxxxx< + Pair>, Xxxxxxxxxxxxxxxxxxxx, List> {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/C-cr.case b/open-java-format/src/test/resources/test-cases/testdata/C-cr.case new file mode 100644 index 000000000..8314556ec --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/C-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** * Tests for CastExpressions, CatchClauses, CharacterLiterals, ClassInstanceCreations, * CommentHelper, ConditionalExpressions, ConstructorInvocations, ContinueStatements, and * CreationReferences. */ class C { // TODO(jdd): Test higher-language-level constructs. C() { this( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31); } C(int... x) {} void f() { try { } catch (RuntimeException e) { Object x = (Pair< Pair< Pair, Pair>, Pair, Pair>>, Pair< Pair, Pair>, Pair, Pair>>>) null; C c = new C( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31); int i = 0; int j = i == 0 ? 0 : i == 1 ? 1 : i == 2 ? 2 : i == 3 ? 3 : i == 4 ? 4 : i == 5 ? 5 : i == 6 ? 6 : i == 7 ? 7 : i; LABEL: while (true != false) { if (false == true) continue; if (false == false) continue LABEL; // Comment indented +2 // Comment indented +2 } } } } ---------- package com.google.googlejavaformat.java.test; /** * Tests for CastExpressions, CatchClauses, CharacterLiterals, ClassInstanceCreations, * CommentHelper, ConditionalExpressions, ConstructorInvocations, ContinueStatements, and * CreationReferences. */ class C { // TODO(jdd): Test higher-language-level constructs. C() { this( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31); } C(int... x) {} void f() { try { } catch (RuntimeException e) { Object x = (Pair< Pair< Pair, Pair>, Pair, Pair>>, Pair< Pair, Pair>, Pair, Pair>>>) null; C c = new C( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31); int i = 0; int j = i == 0 ? 0 : i == 1 ? 1 : i == 2 ? 2 : i == 3 ? 3 : i == 4 ? 4 : i == 5 ? 5 : i == 6 ? 6 : i == 7 ? 7 : i; LABEL: while (true != false) { if (false == true) continue; if (false == false) continue LABEL; // Comment indented +2 // Comment indented +2 } } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/C-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/C-crlf.case new file mode 100644 index 000000000..2bdbdecee --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/C-crlf.case @@ -0,0 +1,157 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for CastExpressions, CatchClauses, CharacterLiterals, ClassInstanceCreations, + * CommentHelper, ConditionalExpressions, ConstructorInvocations, ContinueStatements, and + * CreationReferences. + */ +class C { + // TODO(jdd): Test higher-language-level constructs. + + C() { + this( + 0, 1, + 2, 3, + 4, 5, + 6, 7, + 8, 9, + 10, 11, + 12, 13, + 14, 15, + 16, 17, + 18, 19, + 20, 21, + 22, 23, + 24, 25, + 26, 27, + 28, 29, + 30, 31); + } + + C(int... x) {} + + void f() { + try { + } catch (RuntimeException e) { + Object x = + (Pair< + Pair< + Pair, Pair>, + Pair, Pair>>, + Pair< + Pair, Pair>, + Pair, Pair>>>) + null; + C c = + new C( + 0, 1, + 2, 3, + 4, 5, + 6, 7, + 8, 9, + 10, 11, + 12, 13, + 14, 15, + 16, 17, + 18, 19, + 20, 21, + 22, 23, + 24, 25, + 26, 27, + 28, 29, + 30, 31); + int i = 0; + int j = + i == 0 + ? 0 + : i == 1 + ? 1 + : i == 2 ? 2 : i == 3 ? 3 : i == 4 ? 4 : i == 5 ? 5 : i == 6 ? 6 : i == 7 ? 7 : i; + LABEL: + while (true != false) { + if (false == true) + continue; + if (false == false) + continue LABEL; + // Comment indented +2 + // Comment indented +2 + } + } + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for CastExpressions, CatchClauses, CharacterLiterals, ClassInstanceCreations, + * CommentHelper, ConditionalExpressions, ConstructorInvocations, ContinueStatements, and + * CreationReferences. + */ +class C { + // TODO(jdd): Test higher-language-level constructs. + + C() { + this( + 0, 1, + 2, 3, + 4, 5, + 6, 7, + 8, 9, + 10, 11, + 12, 13, + 14, 15, + 16, 17, + 18, 19, + 20, 21, + 22, 23, + 24, 25, + 26, 27, + 28, 29, + 30, 31); + } + + C(int... x) {} + + void f() { + try { + } catch (RuntimeException e) { + Object x = (Pair< + Pair< + Pair, Pair>, + Pair, Pair>>, + Pair< + Pair, Pair>, + Pair, Pair>>>) + null; + C c = new C( + 0, 1, + 2, 3, + 4, 5, + 6, 7, + 8, 9, + 10, 11, + 12, 13, + 14, 15, + 16, 17, + 18, 19, + 20, 21, + 22, 23, + 24, 25, + 26, 27, + 28, 29, + 30, 31); + int i = 0; + int j = i == 0 + ? 0 + : i == 1 ? 1 : i == 2 ? 2 : i == 3 ? 3 : i == 4 ? 4 : i == 5 ? 5 : i == 6 ? 6 : i == 7 ? 7 : i; + LABEL: + while (true != false) { + if (false == true) continue; + if (false == false) continue LABEL; + // Comment indented +2 + // Comment indented +2 + } + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/C.output b/open-java-format/src/test/resources/test-cases/testdata/C-lf.case similarity index 53% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/C.output rename to open-java-format/src/test/resources/test-cases/testdata/C-lf.case index f593f2dc7..c605ba4ef 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/C.output +++ b/open-java-format/src/test/resources/test-cases/testdata/C-lf.case @@ -1,3 +1,86 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for CastExpressions, CatchClauses, CharacterLiterals, ClassInstanceCreations, + * CommentHelper, ConditionalExpressions, ConstructorInvocations, ContinueStatements, and + * CreationReferences. + */ +class C { + // TODO(jdd): Test higher-language-level constructs. + + C() { + this( + 0, 1, + 2, 3, + 4, 5, + 6, 7, + 8, 9, + 10, 11, + 12, 13, + 14, 15, + 16, 17, + 18, 19, + 20, 21, + 22, 23, + 24, 25, + 26, 27, + 28, 29, + 30, 31); + } + + C(int... x) {} + + void f() { + try { + } catch (RuntimeException e) { + Object x = + (Pair< + Pair< + Pair, Pair>, + Pair, Pair>>, + Pair< + Pair, Pair>, + Pair, Pair>>>) + null; + C c = + new C( + 0, 1, + 2, 3, + 4, 5, + 6, 7, + 8, 9, + 10, 11, + 12, 13, + 14, 15, + 16, 17, + 18, 19, + 20, 21, + 22, 23, + 24, 25, + 26, 27, + 28, 29, + 30, 31); + int i = 0; + int j = + i == 0 + ? 0 + : i == 1 + ? 1 + : i == 2 ? 2 : i == 3 ? 3 : i == 4 ? 4 : i == 5 ? 5 : i == 6 ? 6 : i == 7 ? 7 : i; + LABEL: + while (true != false) { + if (false == true) + continue; + if (false == false) + continue LABEL; + // Comment indented +2 + // Comment indented +2 + } + } + } +} +---------- package com.google.googlejavaformat.java.test; /** diff --git a/open-java-format/src/test/resources/test-cases/testdata/CompactSource-cr.case b/open-java-format/src/test/resources/test-cases/testdata/CompactSource-cr.case new file mode 100644 index 000000000..abb17dec6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/CompactSource-cr.case @@ -0,0 +1 @@ +---------- import java.util.List; /// A field with a markdown doc comment. String greeting = "hello"; record Pair(String first, String second) {} /** Javadoc on a top-level member of a compact source file. */ List names() { return List.of(greeting, new Pair(greeting, greeting).second()); } void main() { System.out.println(names()); } ---------- import java.util.List; /// A field with a markdown doc comment. String greeting = "hello"; record Pair(String first, String second) {} /** Javadoc on a top-level member of a compact source file. */ List names() { return List.of(greeting, new Pair(greeting, greeting).second()); } void main() { System.out.println(names()); } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/CompactSource-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/CompactSource-crlf.case new file mode 100644 index 000000000..7dfbda9c7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/CompactSource-crlf.case @@ -0,0 +1,32 @@ +---------- +import java.util.List; + +/// A field with a markdown doc comment. +String greeting = "hello"; + +record Pair(String first, String second) {} + +/** Javadoc on a top-level member of a compact source file. */ +List names() { + return List.of(greeting, new Pair(greeting, greeting).second()); +} + +void main() { + System.out.println(names()); +} +---------- +import java.util.List; + +/// A field with a markdown doc comment. +String greeting = "hello"; + +record Pair(String first, String second) {} + +/** Javadoc on a top-level member of a compact source file. */ +List names() { + return List.of(greeting, new Pair(greeting, greeting).second()); +} + +void main() { + System.out.println(names()); +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/CompactSource-lf.case b/open-java-format/src/test/resources/test-cases/testdata/CompactSource-lf.case new file mode 100644 index 000000000..7f9080d3f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/CompactSource-lf.case @@ -0,0 +1,32 @@ +---------- +import java.util.List; + +/// A field with a markdown doc comment. +String greeting = "hello"; + +record Pair(String first, String second) {} + +/** Javadoc on a top-level member of a compact source file. */ +List names() { + return List.of(greeting, new Pair(greeting, greeting).second()); +} + +void main() { + System.out.println(names()); +} +---------- +import java.util.List; + +/// A field with a markdown doc comment. +String greeting = "hello"; + +record Pair(String first, String second) {} + +/** Javadoc on a top-level member of a compact source file. */ +List names() { + return List.of(greeting, new Pair(greeting, greeting).second()); +} + +void main() { + System.out.println(names()); +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/D-cr.case b/open-java-format/src/test/resources/test-cases/testdata/D-cr.case new file mode 100644 index 000000000..af44b1fea --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/D-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** Tests for Dimensions and DoStatements. */ class D { // TODO(jdd): Test higher-language-level features. int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][] [][][][] array[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][] [][][][][][][]; void f() { do { assert false; } while (1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1); } } ---------- package com.google.googlejavaformat.java.test; /** Tests for Dimensions and DoStatements. */ class D { // TODO(jdd): Test higher-language-level features. int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][] array[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]; void f() { do { assert false; } while (1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/D-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/D-crlf.case new file mode 100644 index 000000000..690a8f597 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/D-crlf.case @@ -0,0 +1,40 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for Dimensions and DoStatements. */ +class D { + // TODO(jdd): Test higher-language-level features. + + int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][] + [][][][] + array[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][] + [][][][][][][]; + + void f() { + do { + assert false; + } while (1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1); + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for Dimensions and DoStatements. */ +class D { + // TODO(jdd): Test higher-language-level features. + + int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][] + array[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]; + + void f() { + do { + assert false; + } while (1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/D.output b/open-java-format/src/test/resources/test-cases/testdata/D-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/D.output rename to open-java-format/src/test/resources/test-cases/testdata/D-lf.case index a92d6cd34..16a7f2311 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/D.output +++ b/open-java-format/src/test/resources/test-cases/testdata/D-lf.case @@ -1,3 +1,25 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for Dimensions and DoStatements. */ +class D { + // TODO(jdd): Test higher-language-level features. + + int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][] + [][][][] + array[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][] + [][][][][][][]; + + void f() { + do { + assert false; + } while (1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1); + } +} +---------- package com.google.googlejavaformat.java.test; /** Tests for Dimensions and DoStatements. */ diff --git a/open-java-format/src/test/resources/test-cases/testdata/E-cr.case b/open-java-format/src/test/resources/test-cases/testdata/E-cr.case new file mode 100644 index 000000000..097595f90 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/E-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; /** * Tests for EmptyStatements, EnhancedForStatements, EnumConstantDeclarations, EnumDeclarations, * ExpressionMethodReferences, ExpressionStatements, Expressions, and ExtendedModifiers. */ @MarkerAnnotation class E { // TODO(jdd): Test higher language-level features. enum Enum1 { A, B, C, D; Enum1() {} } @MarkerAnnotation public enum Enum2 { A, B, C, D, ; Enum2() {} } enum Enum3 { A( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0), B( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1), C( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2), D( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3); Enum3(int x) {} } enum Enum4 { A( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0), B( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1), C( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2), D( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3), ; Enum4(int x) {} } int f(int value) { ; ; ; ; ; for (Integer x : ImmutableList.of( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) {} for (Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> x : Lists ., Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>>> newArrayList()) {} f(10); return f(20); } } ---------- package com.google.googlejavaformat.java.test; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; /** * Tests for EmptyStatements, EnhancedForStatements, EnumConstantDeclarations, EnumDeclarations, * ExpressionMethodReferences, ExpressionStatements, Expressions, and ExtendedModifiers. */ @MarkerAnnotation class E { // TODO(jdd): Test higher language-level features. enum Enum1 { A, B, C, D; Enum1() {} } @MarkerAnnotation public enum Enum2 { A, B, C, D, ; Enum2() {} } enum Enum3 { A(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0), B(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1), C(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2), D(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3); Enum3(int x) {} } enum Enum4 { A(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0), B(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1), C(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2), D(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3), ; Enum4(int x) {} } int f(int value) { ; ; ; ; ; for (Integer x : ImmutableList.of(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) {} for (Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> x : Lists ., Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>>> newArrayList()) {} f(10); return f(20); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/E-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/E-crlf.case new file mode 100644 index 000000000..0d90a65d5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/E-crlf.case @@ -0,0 +1,169 @@ +---------- +package com.google.googlejavaformat.java.test; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; + +/** + * Tests for EmptyStatements, EnhancedForStatements, EnumConstantDeclarations, EnumDeclarations, + * ExpressionMethodReferences, ExpressionStatements, Expressions, and ExtendedModifiers. + */ +@MarkerAnnotation +class E { + // TODO(jdd): Test higher language-level features. + + enum Enum1 { + A, B, C, D; + + Enum1() {} + } + + @MarkerAnnotation + public enum Enum2 { + A, + B, + C, + D, + ; + + Enum2() {} + } + + enum Enum3 { + A( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0), + B( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1), + C( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2), + D( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3); + + Enum3(int x) {} + } + + enum Enum4 { + A( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0), + B( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1), + C( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2), + D( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3), + ; + + Enum4(int x) {} + } + + int f(int value) { + ; + ; + ; + ; + ; + for (Integer x : + ImmutableList.of( + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) {} + for (Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + x : + Lists + ., Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>>> + newArrayList()) {} + f(10); + return f(20); + } +} +---------- +package com.google.googlejavaformat.java.test; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; + +/** + * Tests for EmptyStatements, EnhancedForStatements, EnumConstantDeclarations, EnumDeclarations, + * ExpressionMethodReferences, ExpressionStatements, Expressions, and ExtendedModifiers. + */ +@MarkerAnnotation +class E { + // TODO(jdd): Test higher language-level features. + + enum Enum1 { + A, + B, + C, + D; + + Enum1() {} + } + + @MarkerAnnotation + public enum Enum2 { + A, + B, + C, + D, + ; + + Enum2() {} + } + + enum Enum3 { + A(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0), + B(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 1), + C(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 2), + D(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 3); + + Enum3(int x) {} + } + + enum Enum4 { + A(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0), + B(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 1), + C(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 2), + D(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 3), + ; + + Enum4(int x) {} + } + + int f(int value) { + ; + ; + ; + ; + ; + for (Integer x : + ImmutableList.of(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) {} + for (Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + x : Lists + ., Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>>> + newArrayList()) {} + f(10); + return f(20); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/E.output b/open-java-format/src/test/resources/test-cases/testdata/E-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/E.output rename to open-java-format/src/test/resources/test-cases/testdata/E-lf.case index 7c43245b9..65a889214 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/E.output +++ b/open-java-format/src/test/resources/test-cases/testdata/E-lf.case @@ -1,3 +1,92 @@ +---------- +package com.google.googlejavaformat.java.test; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; + +/** + * Tests for EmptyStatements, EnhancedForStatements, EnumConstantDeclarations, EnumDeclarations, + * ExpressionMethodReferences, ExpressionStatements, Expressions, and ExtendedModifiers. + */ +@MarkerAnnotation +class E { + // TODO(jdd): Test higher language-level features. + + enum Enum1 { + A, B, C, D; + + Enum1() {} + } + + @MarkerAnnotation + public enum Enum2 { + A, + B, + C, + D, + ; + + Enum2() {} + } + + enum Enum3 { + A( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0), + B( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1), + C( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2), + D( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3); + + Enum3(int x) {} + } + + enum Enum4 { + A( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0), + B( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1), + C( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2), + D( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3), + ; + + Enum4(int x) {} + } + + int f(int value) { + ; + ; + ; + ; + ; + for (Integer x : + ImmutableList.of( + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) {} + for (Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + x : + Lists + ., Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>>> + newArrayList()) {} + f(10); + return f(20); + } +} +---------- package com.google.googlejavaformat.java.test; import com.google.common.collect.ImmutableList; diff --git a/open-java-format/src/test/resources/test-cases/testdata/EnumAnnotation-cr.case b/open-java-format/src/test/resources/test-cases/testdata/EnumAnnotation-cr.case new file mode 100644 index 000000000..88e768817 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/EnumAnnotation-cr.case @@ -0,0 +1 @@ +---------- enum E { @A ONE, TWO, @B @C THREE; } ---------- enum E { @A ONE, TWO, @B @C THREE; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/EnumAnnotation-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/EnumAnnotation-crlf.case new file mode 100644 index 000000000..32653b9a8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/EnumAnnotation-crlf.case @@ -0,0 +1,15 @@ +---------- +enum E { + @A ONE, + TWO, + @B @C THREE; +} +---------- +enum E { + @A + ONE, + TWO, + @B + @C + THREE; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/EnumAnnotation-lf.case b/open-java-format/src/test/resources/test-cases/testdata/EnumAnnotation-lf.case new file mode 100644 index 000000000..dca65e43e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/EnumAnnotation-lf.case @@ -0,0 +1,15 @@ +---------- +enum E { + @A ONE, + TWO, + @B @C THREE; +} +---------- +enum E { + @A + ONE, + TWO, + @B + @C + THREE; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/ExpressionSwitch-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ExpressionSwitch-cr.case new file mode 100644 index 000000000..b2f6b867f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ExpressionSwitch-cr.case @@ -0,0 +1 @@ +---------- class ExpressionSwitch { boolean odd(int x) { return switch (x) { case 0 -> true; case 1 -> false; default -> { int y = x - 1; return odd(y); } }; } int yield(int i) { return switch (i) { case 0: yield 0; default: yield n/i; }; } int assignment(int j) { boolean val = switch (j) { case 0 -> true; case 1 -> false; default -> false; }; return val; } static final int FIELD = switch (KIND) { case 0 -> 1; case 1 -> 2; default -> throw new IllegalStateException(); }; int wrapping(Wrapping w) { switch (w) { case THIS_IS_A_VERY_LONG_ENUM_VALUE_ONE, THIS_IS_A_VERY_LONG_ENUM_VALUE_TWO, THIS_IS_A_VERY_LONG_ENUM_VALUE_THREE -> {} } switch (w) { case CASE_A, CASE_B, CASE_C -> {} } } Supplier lambda(int k) { return () -> switch (k) { case 0 -> true; default -> false; }; } public void test1(int y) { int x = switch (y) { case 1 -> 1; case 2 -> throw new IllegalArgumentException(); default -> throw new IllegalStateException(); }; } public void test2(int y) { int x; x = switch (y) { case 1 -> 1; case 2 -> throw new IllegalArgumentException(); default -> throw new IllegalStateException();}; } public void testWithComments(int y) { int x; x = switch (y) { case 1 -> 1; // after case 1 case 2 -> throw new IllegalArgumentException(); // after case 2 default -> throw new IllegalStateException(); // after default case }; } } ---------- class ExpressionSwitch { boolean odd(int x) { return switch (x) { case 0 -> true; case 1 -> false; default -> { int y = x - 1; return odd(y); } }; } int yield(int i) { return switch (i) { case 0: yield 0; default: yield n / i; }; } int assignment(int j) { boolean val = switch (j) { case 0 -> true; case 1 -> false; default -> false; }; return val; } static final int FIELD = switch (KIND) { case 0 -> 1; case 1 -> 2; default -> throw new IllegalStateException(); }; int wrapping(Wrapping w) { switch (w) { case THIS_IS_A_VERY_LONG_ENUM_VALUE_ONE, THIS_IS_A_VERY_LONG_ENUM_VALUE_TWO, THIS_IS_A_VERY_LONG_ENUM_VALUE_THREE -> {} } switch (w) { case CASE_A, CASE_B, CASE_C -> {} } } Supplier lambda(int k) { return () -> switch (k) { case 0 -> true; default -> false; }; } public void test1(int y) { int x = switch (y) { case 1 -> 1; case 2 -> throw new IllegalArgumentException(); default -> throw new IllegalStateException(); }; } public void test2(int y) { int x; x = switch (y) { case 1 -> 1; case 2 -> throw new IllegalArgumentException(); default -> throw new IllegalStateException(); }; } public void testWithComments(int y) { int x; x = switch (y) { case 1 -> 1; // after case 1 case 2 -> throw new IllegalArgumentException(); // after case 2 default -> throw new IllegalStateException(); // after default case }; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ExpressionSwitch-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ExpressionSwitch-crlf.case new file mode 100644 index 000000000..f580dbc39 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ExpressionSwitch-crlf.case @@ -0,0 +1,170 @@ +---------- +class ExpressionSwitch { + boolean odd(int x) { + return switch (x) { + case 0 -> true; + case 1 -> false; + default -> { int y = x - 1; return odd(y); } + }; + } + + int yield(int i) { + return switch (i) { + case 0: yield 0; + default: yield n/i; + }; + } + + int assignment(int j) { + boolean val = switch (j) { + case 0 -> true; + case 1 -> false; + default -> false; + }; + return val; + } + + static final int FIELD = + switch (KIND) { + case 0 -> 1; + case 1 -> 2; + default -> throw new IllegalStateException(); + }; + + int wrapping(Wrapping w) { + switch (w) { + case THIS_IS_A_VERY_LONG_ENUM_VALUE_ONE, + THIS_IS_A_VERY_LONG_ENUM_VALUE_TWO, + THIS_IS_A_VERY_LONG_ENUM_VALUE_THREE -> {} + } + + switch (w) { + case CASE_A, CASE_B, CASE_C -> {} + } + } + + Supplier lambda(int k) { + return () -> switch (k) { + case 0 -> true; + default -> false; + }; + } + + public void test1(int y) { + int x = + switch (y) { + case 1 -> 1; + case 2 -> throw new IllegalArgumentException(); + default -> throw new IllegalStateException(); + }; + } + + public void test2(int y) { + int x; + x = switch (y) { + case 1 -> 1; + case 2 -> throw new IllegalArgumentException(); + default -> throw new IllegalStateException();}; + } + + + public void testWithComments(int y) { + int x; + x = switch (y) { + case 1 -> +1; +// after case 1 + case 2 -> +throw new IllegalArgumentException(); +// after case 2 + default -> +throw new IllegalStateException(); +// after default case +}; + } +} +---------- +class ExpressionSwitch { + boolean odd(int x) { + return switch (x) { + case 0 -> true; + case 1 -> false; + default -> { + int y = x - 1; + return odd(y); + } + }; + } + + int yield(int i) { + return switch (i) { + case 0: + yield 0; + default: + yield n / i; + }; + } + + int assignment(int j) { + boolean val = switch (j) { + case 0 -> true; + case 1 -> false; + default -> false; + }; + return val; + } + + static final int FIELD = switch (KIND) { + case 0 -> 1; + case 1 -> 2; + default -> throw new IllegalStateException(); + }; + + int wrapping(Wrapping w) { + switch (w) { + case THIS_IS_A_VERY_LONG_ENUM_VALUE_ONE, + THIS_IS_A_VERY_LONG_ENUM_VALUE_TWO, + THIS_IS_A_VERY_LONG_ENUM_VALUE_THREE -> {} + } + + switch (w) { + case CASE_A, CASE_B, CASE_C -> {} + } + } + + Supplier lambda(int k) { + return () -> switch (k) { + case 0 -> true; + default -> false; + }; + } + + public void test1(int y) { + int x = switch (y) { + case 1 -> 1; + case 2 -> throw new IllegalArgumentException(); + default -> throw new IllegalStateException(); + }; + } + + public void test2(int y) { + int x; + x = switch (y) { + case 1 -> 1; + case 2 -> throw new IllegalArgumentException(); + default -> throw new IllegalStateException(); + }; + } + + public void testWithComments(int y) { + int x; + x = switch (y) { + case 1 -> 1; + // after case 1 + case 2 -> throw new IllegalArgumentException(); + // after case 2 + default -> throw new IllegalStateException(); + // after default case + }; + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ExpressionSwitch.output b/open-java-format/src/test/resources/test-cases/testdata/ExpressionSwitch-lf.case similarity index 53% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ExpressionSwitch.output rename to open-java-format/src/test/resources/test-cases/testdata/ExpressionSwitch-lf.case index 5ef1ffadd..1c7530e0d 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ExpressionSwitch.output +++ b/open-java-format/src/test/resources/test-cases/testdata/ExpressionSwitch-lf.case @@ -1,3 +1,89 @@ +---------- +class ExpressionSwitch { + boolean odd(int x) { + return switch (x) { + case 0 -> true; + case 1 -> false; + default -> { int y = x - 1; return odd(y); } + }; + } + + int yield(int i) { + return switch (i) { + case 0: yield 0; + default: yield n/i; + }; + } + + int assignment(int j) { + boolean val = switch (j) { + case 0 -> true; + case 1 -> false; + default -> false; + }; + return val; + } + + static final int FIELD = + switch (KIND) { + case 0 -> 1; + case 1 -> 2; + default -> throw new IllegalStateException(); + }; + + int wrapping(Wrapping w) { + switch (w) { + case THIS_IS_A_VERY_LONG_ENUM_VALUE_ONE, + THIS_IS_A_VERY_LONG_ENUM_VALUE_TWO, + THIS_IS_A_VERY_LONG_ENUM_VALUE_THREE -> {} + } + + switch (w) { + case CASE_A, CASE_B, CASE_C -> {} + } + } + + Supplier lambda(int k) { + return () -> switch (k) { + case 0 -> true; + default -> false; + }; + } + + public void test1(int y) { + int x = + switch (y) { + case 1 -> 1; + case 2 -> throw new IllegalArgumentException(); + default -> throw new IllegalStateException(); + }; + } + + public void test2(int y) { + int x; + x = switch (y) { + case 1 -> 1; + case 2 -> throw new IllegalArgumentException(); + default -> throw new IllegalStateException();}; + } + + + public void testWithComments(int y) { + int x; + x = switch (y) { + case 1 -> +1; +// after case 1 + case 2 -> +throw new IllegalArgumentException(); +// after case 2 + default -> +throw new IllegalStateException(); +// after default case +}; + } +} +---------- class ExpressionSwitch { boolean odd(int x) { return switch (x) { diff --git a/open-java-format/src/test/resources/test-cases/testdata/F-cr.case b/open-java-format/src/test/resources/test-cases/testdata/F-cr.case new file mode 100644 index 000000000..77aa3841c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/F-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** Tests for FieldAccesses, FieldDeclarations, and ForStatements. */ class F { int x; int x1 = 0; int y, z; int y1 = 0, z1 = 0; F f = null; Object field0 = true ? true ? true ? null : null : true ? null : null : true ? true ? null : null : true ? null : null; Pair< Pair, Pair>, Pair, Pair>> field1 = null; Pair< Pair, Pair>, Pair, Pair>> field2 = true ? true ? true ? null : null : true ? null : null : true ? true ? null : null : true ? null : null; @MarkerAnnotation Pair< Pair, Pair>, Pair, Pair>> field3 = true ? true ? true ? null : null : true ? null : null : true ? true ? null : null : true ? null : null; void f() { for (int i = 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0; i < 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 10; i++) { f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.Ff = null; } for (int i = 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0; i < 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 10; i++) { f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.Ff = null; } } } ---------- package com.google.googlejavaformat.java.test; /** Tests for FieldAccesses, FieldDeclarations, and ForStatements. */ class F { int x; int x1 = 0; int y, z; int y1 = 0, z1 = 0; F f = null; Object field0 = true ? true ? true ? null : null : true ? null : null : true ? true ? null : null : true ? null : null; Pair, Pair>, Pair, Pair>> field1 = null; Pair, Pair>, Pair, Pair>> field2 = true ? true ? true ? null : null : true ? null : null : true ? true ? null : null : true ? null : null; @MarkerAnnotation Pair, Pair>, Pair, Pair>> field3 = true ? true ? true ? null : null : true ? null : null : true ? true ? null : null : true ? null : null; void f() { for (int i = 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0; i < 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 10; i++) { f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.Ff = null; } for (int i = 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0; i < 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 10; i++) { f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.Ff = null; } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/F-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/F-crlf.case new file mode 100644 index 000000000..b93536ad2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/F-crlf.case @@ -0,0 +1,111 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for FieldAccesses, FieldDeclarations, and ForStatements. */ +class F { + int x; + int x1 = 0; + int y, z; + int y1 = 0, z1 = 0; + F f = null; + Object field0 = + true + ? true ? true ? null : null : true ? null : null + : true ? true ? null : null : true ? null : null; + + Pair< + Pair, Pair>, + Pair, Pair>> + field1 = null; + Pair< + Pair, Pair>, + Pair, Pair>> + field2 = + true + ? true ? true ? null : null : true ? null : null + : true ? true ? null : null : true ? null : null; + + @MarkerAnnotation + Pair< + Pair, Pair>, + Pair, Pair>> + field3 = + true + ? true ? true ? null : null : true ? null : null + : true ? true ? null : null : true ? null : null; + + void f() { + for (int i = + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0; + i + < 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 10; + i++) { + f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.Ff = null; + } + for (int i = + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0; + i + < 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 10; + i++) { + f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.Ff = + null; + } + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for FieldAccesses, FieldDeclarations, and ForStatements. */ +class F { + int x; + int x1 = 0; + int y, z; + int y1 = 0, z1 = 0; + F f = null; + Object field0 = + true ? true ? true ? null : null : true ? null : null : true ? true ? null : null : true ? null : null; + + Pair, Pair>, Pair, Pair>> + field1 = null; + Pair, Pair>, Pair, Pair>> + field2 = true + ? true ? true ? null : null : true ? null : null + : true ? true ? null : null : true ? null : null; + + @MarkerAnnotation + Pair, Pair>, Pair, Pair>> + field3 = true + ? true ? true ? null : null : true ? null : null + : true ? true ? null : null : true ? null : null; + + void f() { + for (int i = 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0; + i + < 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 10; + i++) { + f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.Ff = null; + } + for (int i = 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0; + i + < 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 10; + i++) { + f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.Ff = null; + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/F.output b/open-java-format/src/test/resources/test-cases/testdata/F-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/F.output rename to open-java-format/src/test/resources/test-cases/testdata/F-lf.case index a6a38cd04..0db8d4820 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/F.output +++ b/open-java-format/src/test/resources/test-cases/testdata/F-lf.case @@ -1,3 +1,66 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for FieldAccesses, FieldDeclarations, and ForStatements. */ +class F { + int x; + int x1 = 0; + int y, z; + int y1 = 0, z1 = 0; + F f = null; + Object field0 = + true + ? true ? true ? null : null : true ? null : null + : true ? true ? null : null : true ? null : null; + + Pair< + Pair, Pair>, + Pair, Pair>> + field1 = null; + Pair< + Pair, Pair>, + Pair, Pair>> + field2 = + true + ? true ? true ? null : null : true ? null : null + : true ? true ? null : null : true ? null : null; + + @MarkerAnnotation + Pair< + Pair, Pair>, + Pair, Pair>> + field3 = + true + ? true ? true ? null : null : true ? null : null + : true ? true ? null : null : true ? null : null; + + void f() { + for (int i = + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0; + i + < 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 10; + i++) { + f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.Ff = null; + } + for (int i = + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0; + i + < 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 10; + i++) { + f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.Ff = + null; + } + } +} +---------- package com.google.googlejavaformat.java.test; /** Tests for FieldAccesses, FieldDeclarations, and ForStatements. */ diff --git a/open-java-format/src/test/resources/test-cases/testdata/Fields-cr.case b/open-java-format/src/test/resources/test-cases/testdata/Fields-cr.case new file mode 100644 index 000000000..34e1cf8fd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Fields-cr.case @@ -0,0 +1 @@ +---------- class Fields { int x = 1; int y = 1; } ---------- class Fields { int x = 1; int y = 1; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/Fields-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/Fields-crlf.case new file mode 100644 index 000000000..3b20e73fb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Fields-crlf.case @@ -0,0 +1,15 @@ +---------- +class Fields { + + int x = 1; + + int y = 1; + +} +---------- +class Fields { + + int x = 1; + + int y = 1; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/Fields-lf.case b/open-java-format/src/test/resources/test-cases/testdata/Fields-lf.case new file mode 100644 index 000000000..ec810cbdf --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Fields-lf.case @@ -0,0 +1,15 @@ +---------- +class Fields { + + int x = 1; + + int y = 1; + +} +---------- +class Fields { + + int x = 1; + + int y = 1; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/FlexibleConstructor-cr.case b/open-java-format/src/test/resources/test-cases/testdata/FlexibleConstructor-cr.case new file mode 100644 index 000000000..6ad19f132 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/FlexibleConstructor-cr.case @@ -0,0 +1 @@ +---------- class FlexibleConstructor { private final int value; FlexibleConstructor(int raw) { if (raw < 0) { throw new IllegalArgumentException("negative"); } var normalized = Math.max(raw, 1); super(); this.value = normalized; } } ---------- class FlexibleConstructor { private final int value; FlexibleConstructor(int raw) { if (raw < 0) { throw new IllegalArgumentException("negative"); } var normalized = Math.max(raw, 1); super(); this.value = normalized; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/FlexibleConstructor-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/FlexibleConstructor-crlf.case new file mode 100644 index 000000000..a12cfad4b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/FlexibleConstructor-crlf.case @@ -0,0 +1,26 @@ +---------- +class FlexibleConstructor { + private final int value; + + FlexibleConstructor(int raw) { + if (raw < 0) { + throw new IllegalArgumentException("negative"); + } + var normalized = Math.max(raw, 1); + super(); + this.value = normalized; + } +} +---------- +class FlexibleConstructor { + private final int value; + + FlexibleConstructor(int raw) { + if (raw < 0) { + throw new IllegalArgumentException("negative"); + } + var normalized = Math.max(raw, 1); + super(); + this.value = normalized; + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/FlexibleConstructor.output b/open-java-format/src/test/resources/test-cases/testdata/FlexibleConstructor-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/FlexibleConstructor.output rename to open-java-format/src/test/resources/test-cases/testdata/FlexibleConstructor-lf.case index 798bb786c..d4f49fe43 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/FlexibleConstructor.output +++ b/open-java-format/src/test/resources/test-cases/testdata/FlexibleConstructor-lf.case @@ -1,3 +1,17 @@ +---------- +class FlexibleConstructor { + private final int value; + + FlexibleConstructor(int raw) { + if (raw < 0) { + throw new IllegalArgumentException("negative"); + } + var normalized = Math.max(raw, 1); + super(); + this.value = normalized; + } +} +---------- class FlexibleConstructor { private final int value; diff --git a/open-java-format/src/test/resources/test-cases/testdata/ForMany-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ForMany-cr.case new file mode 100644 index 000000000..f16ecf68b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ForMany-cr.case @@ -0,0 +1 @@ +---------- class ForMany { { A a; for (b = B; c != C; d = D) {} } } ---------- class ForMany { { A a; for (b = B; c != C; d = D) {} } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ForMany-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ForMany-crlf.case new file mode 100644 index 000000000..a3fd94d2e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ForMany-crlf.case @@ -0,0 +1,14 @@ +---------- +class ForMany { + { + A a; + for (b = B; c != C; d = D) {} + } +} +---------- +class ForMany { + { + A a; + for (b = B; c != C; d = D) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/ForMany-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ForMany-lf.case new file mode 100644 index 000000000..04d863e3a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ForMany-lf.case @@ -0,0 +1,14 @@ +---------- +class ForMany { + { + A a; + for (b = B; c != C; d = D) {} + } +} +---------- +class ForMany { + { + A a; + for (b = B; c != C; d = D) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I-cr.case new file mode 100644 index 000000000..c0596567d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; import java.util.List; /** * Tests for IfStatements, ImportDeclarations, InfixExpressions, Initializers, * InstanceofExpressions, and IntersectionTypes. */ class I { interface I0 {} interface I1 {} interface I2 {} interface I3 {} interface I4 {} interface I5 {} interface I6 {} interface I7 {} interface I8 {} interface I9 {} interface I10 {} interface I11 {} interface I12 {} interface I13 {} interface I14 {} interface I15 {} interface I16 {} interface I17 {} interface I18 {} interface I19 {} class II< T extends I0 & I1 & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9 & I10 & I11 & I12 & I13 & I14 & I15 & I16 & I17 & I18 & I19> {} static class CC { static { int i = 0; } } int x = 0 >>> 0 + 0 / 0 * 0 - 0 & 0 << 0 * 0 / 0 >> 0 - 0 ^ 0 * 0 / 0 >>> 0 << 0 * 0 - 0 / 0 | 0 * 0 >> 0 + 0 / 0 * 0 - 0 << 0 & 0 * 0 / 0 >>> 0 - 0 * 0 >> 0 / 0 << 0 * 0 + 0 - 0 / 0 * 0 | 0 - 0 * 0 >>> 0 << 0 / 0 * 0 >> 0 - 0 ^ 0 * 0 / 0 & 0 << 0 + 0; void f() { if (0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 == 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) { } else if (null instanceof List) { } else { } if (true) {} } } ---------- package com.google.googlejavaformat.java.test; import java.util.List; /** * Tests for IfStatements, ImportDeclarations, InfixExpressions, Initializers, * InstanceofExpressions, and IntersectionTypes. */ class I { interface I0 {} interface I1 {} interface I2 {} interface I3 {} interface I4 {} interface I5 {} interface I6 {} interface I7 {} interface I8 {} interface I9 {} interface I10 {} interface I11 {} interface I12 {} interface I13 {} interface I14 {} interface I15 {} interface I16 {} interface I17 {} interface I18 {} interface I19 {} class II< T extends I0 & I1 & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9 & I10 & I11 & I12 & I13 & I14 & I15 & I16 & I17 & I18 & I19> {} static class CC { static { int i = 0; } } int x = 0 >>> 0 + 0 / 0 * 0 - 0 & 0 << 0 * 0 / 0 >> 0 - 0 ^ 0 * 0 / 0 >>> 0 << 0 * 0 - 0 / 0 | 0 * 0 >> 0 + 0 / 0 * 0 - 0 << 0 & 0 * 0 / 0 >>> 0 - 0 * 0 >> 0 / 0 << 0 * 0 + 0 - 0 / 0 * 0 | 0 - 0 * 0 >>> 0 << 0 / 0 * 0 >> 0 - 0 ^ 0 * 0 / 0 & 0 << 0 + 0; void f() { if (0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 == 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) { } else if (null instanceof List) { } else { } if (true) {} } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I-crlf.case new file mode 100644 index 000000000..4b81e31bd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I-crlf.case @@ -0,0 +1,154 @@ +---------- +package com.google.googlejavaformat.java.test; + +import java.util.List; + +/** + * Tests for IfStatements, ImportDeclarations, InfixExpressions, Initializers, + * InstanceofExpressions, and IntersectionTypes. + */ +class I { + interface I0 {} + + interface I1 {} + + interface I2 {} + + interface I3 {} + + interface I4 {} + + interface I5 {} + + interface I6 {} + + interface I7 {} + + interface I8 {} + + interface I9 {} + + interface I10 {} + + interface I11 {} + + interface I12 {} + + interface I13 {} + + interface I14 {} + + interface I15 {} + + interface I16 {} + + interface I17 {} + + interface I18 {} + + interface I19 {} + + class II< + T extends + I0 & I1 & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9 & I10 & I11 & I12 & I13 & I14 & I15 & I16 + & I17 & I18 & I19> {} + + static class CC { + static { + int i = 0; + } + } + + int x = + 0 >>> 0 + 0 / 0 * 0 - 0 & 0 << 0 * 0 / 0 >> 0 - 0 ^ 0 * 0 / 0 >>> 0 << 0 * 0 - 0 / 0 + | 0 * 0 >> 0 + 0 / 0 * 0 - 0 << 0 + & 0 * 0 / 0 >>> 0 - 0 * 0 >> 0 / 0 << 0 * 0 + 0 - 0 / 0 * 0 + | 0 - 0 * 0 >>> 0 << 0 / 0 * 0 >> 0 - 0 ^ 0 * 0 / 0 & 0 << 0 + 0; + + void f() { + if (0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + == 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) { + } else if (null instanceof List) { + } else { + } + if (true) {} + } +} +---------- +package com.google.googlejavaformat.java.test; + +import java.util.List; + +/** + * Tests for IfStatements, ImportDeclarations, InfixExpressions, Initializers, + * InstanceofExpressions, and IntersectionTypes. + */ +class I { + interface I0 {} + + interface I1 {} + + interface I2 {} + + interface I3 {} + + interface I4 {} + + interface I5 {} + + interface I6 {} + + interface I7 {} + + interface I8 {} + + interface I9 {} + + interface I10 {} + + interface I11 {} + + interface I12 {} + + interface I13 {} + + interface I14 {} + + interface I15 {} + + interface I16 {} + + interface I17 {} + + interface I18 {} + + interface I19 {} + + class II< + T extends + I0 & I1 & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9 & I10 & I11 & I12 & I13 & I14 & I15 & I16 & I17 + & I18 & I19> {} + + static class CC { + static { + int i = 0; + } + } + + int x = 0 >>> 0 + 0 / 0 * 0 - 0 & 0 << 0 * 0 / 0 >> 0 - 0 ^ 0 * 0 / 0 >>> 0 << 0 * 0 - 0 / 0 + | 0 * 0 >> 0 + 0 / 0 * 0 - 0 << 0 & 0 * 0 / 0 >>> 0 - 0 * 0 >> 0 / 0 << 0 * 0 + 0 - 0 / 0 * 0 + | 0 - 0 * 0 >>> 0 << 0 / 0 * 0 >> 0 - 0 ^ 0 * 0 / 0 & 0 << 0 + 0; + + void f() { + if (0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + == 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0) { + } else if (null instanceof List) { + } else { + } + if (true) {} + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I.output b/open-java-format/src/test/resources/test-cases/testdata/I-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I.output rename to open-java-format/src/test/resources/test-cases/testdata/I-lf.case index 6482db012..5d5419d69 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I.output +++ b/open-java-format/src/test/resources/test-cases/testdata/I-lf.case @@ -1,3 +1,82 @@ +---------- +package com.google.googlejavaformat.java.test; + +import java.util.List; + +/** + * Tests for IfStatements, ImportDeclarations, InfixExpressions, Initializers, + * InstanceofExpressions, and IntersectionTypes. + */ +class I { + interface I0 {} + + interface I1 {} + + interface I2 {} + + interface I3 {} + + interface I4 {} + + interface I5 {} + + interface I6 {} + + interface I7 {} + + interface I8 {} + + interface I9 {} + + interface I10 {} + + interface I11 {} + + interface I12 {} + + interface I13 {} + + interface I14 {} + + interface I15 {} + + interface I16 {} + + interface I17 {} + + interface I18 {} + + interface I19 {} + + class II< + T extends + I0 & I1 & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9 & I10 & I11 & I12 & I13 & I14 & I15 & I16 + & I17 & I18 & I19> {} + + static class CC { + static { + int i = 0; + } + } + + int x = + 0 >>> 0 + 0 / 0 * 0 - 0 & 0 << 0 * 0 / 0 >> 0 - 0 ^ 0 * 0 / 0 >>> 0 << 0 * 0 - 0 / 0 + | 0 * 0 >> 0 + 0 / 0 * 0 - 0 << 0 + & 0 * 0 / 0 >>> 0 - 0 * 0 >> 0 / 0 << 0 * 0 + 0 - 0 / 0 * 0 + | 0 - 0 * 0 >>> 0 << 0 / 0 * 0 >> 0 - 0 ^ 0 * 0 / 0 & 0 << 0 + 0; + + void f() { + if (0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + == 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) { + } else if (null instanceof List) { + } else { + } + if (true) {} + } +} +---------- package com.google.googlejavaformat.java.test; import java.util.List; diff --git a/open-java-format/src/test/resources/test-cases/testdata/I1-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I1-cr.case new file mode 100644 index 000000000..92ef6041a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1-cr.case @@ -0,0 +1 @@ +---------- class Test { final CreationMechanism creationMechanism; final @Nullable String creationUserAgent; final ClientId clientId; final @Nullable String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; final Token externalId; { final CreationMechanism creationMechanism; final @Nullable String creationUserAgent; final ClientId clientId; final @Nullable String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; final Token externalId; } } class Test { final CreationMechanism creationMechanism; @Nullable final String creationUserAgent; final ClientId clientId; @Nullable final String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; final Token externalId; { final CreationMechanism creationMechanism; @Nullable final String creationUserAgent; final ClientId clientId; @Nullable final String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; final Token externalId; } } class Test { @Nullable final String creationUserAgent; { @Nullable final String creationUserAgent; } { @Nullable final String creationUserAgent; } } ---------- class Test { final CreationMechanism creationMechanism; final @Nullable String creationUserAgent; final ClientId clientId; final @Nullable String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; final Token externalId; { final CreationMechanism creationMechanism; final @Nullable String creationUserAgent; final ClientId clientId; final @Nullable String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; final Token externalId; } } class Test { final CreationMechanism creationMechanism; @Nullable final String creationUserAgent; final ClientId clientId; @Nullable final String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; final Token externalId; { final CreationMechanism creationMechanism; @Nullable final String creationUserAgent; final ClientId clientId; @Nullable final String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; final Token externalId; } } class Test { @Nullable final String creationUserAgent; { @Nullable final String creationUserAgent; } { @Nullable final String creationUserAgent; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I1-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I1-crlf.case new file mode 100644 index 000000000..45d674e64 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1-crlf.case @@ -0,0 +1,102 @@ +---------- +class Test { + final CreationMechanism creationMechanism; + final @Nullable String creationUserAgent; + final ClientId clientId; + final @Nullable String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; + final Token externalId; + + { + final CreationMechanism creationMechanism; + final @Nullable String creationUserAgent; + final ClientId clientId; + final @Nullable String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; + final Token externalId; + } +} + +class Test { + final CreationMechanism creationMechanism; + @Nullable final String creationUserAgent; + final ClientId clientId; + @Nullable final String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; + final Token externalId; + + { + final CreationMechanism creationMechanism; + @Nullable final String creationUserAgent; + final ClientId clientId; + @Nullable final String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; + final Token externalId; + } +} + +class Test { + + @Nullable + final String creationUserAgent; + + { + @Nullable + final String creationUserAgent; + } + + { + + @Nullable + final String creationUserAgent; + + } +} +---------- +class Test { + final CreationMechanism creationMechanism; + final @Nullable String creationUserAgent; + final ClientId clientId; + final @Nullable String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; + final Token externalId; + + { + final CreationMechanism creationMechanism; + final @Nullable String creationUserAgent; + final ClientId clientId; + final @Nullable String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; + final Token externalId; + } +} + +class Test { + final CreationMechanism creationMechanism; + + @Nullable + final String creationUserAgent; + + final ClientId clientId; + + @Nullable + final String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; + + final Token externalId; + + { + final CreationMechanism creationMechanism; + @Nullable final String creationUserAgent; + final ClientId clientId; + @Nullable final String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; + final Token externalId; + } +} + +class Test { + + @Nullable + final String creationUserAgent; + + { + @Nullable final String creationUserAgent; + } + + { + @Nullable final String creationUserAgent; + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1.output b/open-java-format/src/test/resources/test-cases/testdata/I1-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1.output rename to open-java-format/src/test/resources/test-cases/testdata/I1-lf.case index 4e5ea999b..67cd98550 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1.output +++ b/open-java-format/src/test/resources/test-cases/testdata/I1-lf.case @@ -1,3 +1,54 @@ +---------- +class Test { + final CreationMechanism creationMechanism; + final @Nullable String creationUserAgent; + final ClientId clientId; + final @Nullable String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; + final Token externalId; + + { + final CreationMechanism creationMechanism; + final @Nullable String creationUserAgent; + final ClientId clientId; + final @Nullable String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; + final Token externalId; + } +} + +class Test { + final CreationMechanism creationMechanism; + @Nullable final String creationUserAgent; + final ClientId clientId; + @Nullable final String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; + final Token externalId; + + { + final CreationMechanism creationMechanism; + @Nullable final String creationUserAgent; + final ClientId clientId; + @Nullable final String creationUserAgentXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; + final Token externalId; + } +} + +class Test { + + @Nullable + final String creationUserAgent; + + { + @Nullable + final String creationUserAgent; + } + + { + + @Nullable + final String creationUserAgent; + + } +} +---------- class Test { final CreationMechanism creationMechanism; final @Nullable String creationUserAgent; diff --git a/open-java-format/src/test/resources/test-cases/testdata/I12-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I12-cr.case new file mode 100644 index 000000000..b39f78f85 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I12-cr.case @@ -0,0 +1 @@ +---------- public class Test { } public class Test { } public class Test { } public class Test { } public class Test {} ---------- public class Test {} public class Test {} public class Test {} public class Test {} public class Test {} \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I12-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I12-crlf.case new file mode 100644 index 000000000..d75585a0b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I12-crlf.case @@ -0,0 +1,30 @@ +---------- +public class Test { + + + +} + +public class Test { + + +} + +public class Test { + +} + +public class Test { +} + +public class Test {} +---------- +public class Test {} + +public class Test {} + +public class Test {} + +public class Test {} + +public class Test {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I12-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I12-lf.case new file mode 100644 index 000000000..34240e090 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I12-lf.case @@ -0,0 +1,30 @@ +---------- +public class Test { + + + +} + +public class Test { + + +} + +public class Test { + +} + +public class Test { +} + +public class Test {} +---------- +public class Test {} + +public class Test {} + +public class Test {} + +public class Test {} + +public class Test {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I1205-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I1205-cr.case new file mode 100644 index 000000000..3ba69f9e6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1205-cr.case @@ -0,0 +1 @@ +---------- public interface Foo { private static String foo = """ foo\ bar """; } ---------- public interface Foo { private static String foo = """ foo\ bar\ """; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I1205-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I1205-crlf.case new file mode 100644 index 000000000..db058820b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1205-crlf.case @@ -0,0 +1,16 @@ +---------- +public interface Foo { + + private static String foo = + """ + foo\ + bar """; +} +---------- +public interface Foo { + + private static String foo = """ + foo\ + bar\ + """; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I1205-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I1205-lf.case new file mode 100644 index 000000000..d252a188d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1205-lf.case @@ -0,0 +1,16 @@ +---------- +public interface Foo { + + private static String foo = + """ + foo\ + bar """; +} +---------- +public interface Foo { + + private static String foo = """ + foo\ + bar\ + """; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I1260-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I1260-cr.case new file mode 100644 index 000000000..32de631a8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1260-cr.case @@ -0,0 +1 @@ +---------- class I1260 { void block() { { /* trailing on open brace */ int x = 1; } } void switchCase() { switch (0) { case 1: { /* Break so we don't hit fall-through warning: */ break;/* ignore STRING */ } } } void lambda() { Runnable r = () -> { /* trailing on lambda brace */ block(); }; } int[] array = { /* trailing on array brace */ 1, 2 }; } ---------- class I1260 { void block() { { /* trailing on open brace */ int x = 1; } } void switchCase() { switch (0) { case 1: { /* Break so we don't hit fall-through warning: */ break; /* ignore STRING */ } } } void lambda() { Runnable r = () -> { /* trailing on lambda brace */ block(); }; } int[] array = { /* trailing on array brace */ 1, 2 }; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I1260-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I1260-crlf.case new file mode 100644 index 000000000..a529d0568 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1260-crlf.case @@ -0,0 +1,49 @@ +---------- +class I1260 { + void block() { + { /* trailing on open brace */ int x = 1; } + } + + void switchCase() { + switch (0) { + case 1: { /* Break so we don't hit fall-through warning: */ break;/* ignore STRING */ + } + } + } + + void lambda() { + Runnable r = () -> { /* trailing on lambda brace */ block(); }; + } + + int[] array = { /* trailing on array brace */ 1, 2 }; +} +---------- +class I1260 { + void block() { + { + /* trailing on open brace */ + int x = 1; + } + } + + void switchCase() { + switch (0) { + case 1: { + /* Break so we don't hit fall-through warning: */ + break; /* ignore STRING */ + } + } + } + + void lambda() { + Runnable r = () -> { + /* trailing on lambda brace */ + block(); + }; + } + + int[] array = { + /* trailing on array brace */ + 1, 2 + }; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260.output b/open-java-format/src/test/resources/test-cases/testdata/I1260-lf.case similarity index 57% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260.output rename to open-java-format/src/test/resources/test-cases/testdata/I1260-lf.case index 85257e8d0..59bda850b 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260.output +++ b/open-java-format/src/test/resources/test-cases/testdata/I1260-lf.case @@ -1,3 +1,23 @@ +---------- +class I1260 { + void block() { + { /* trailing on open brace */ int x = 1; } + } + + void switchCase() { + switch (0) { + case 1: { /* Break so we don't hit fall-through warning: */ break;/* ignore STRING */ + } + } + } + + void lambda() { + Runnable r = () -> { /* trailing on lambda brace */ block(); }; + } + + int[] array = { /* trailing on array brace */ 1, 2 }; +} +---------- class I1260 { void block() { { diff --git a/open-java-format/src/test/resources/test-cases/testdata/I1260EmptyBlocks-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I1260EmptyBlocks-cr.case new file mode 100644 index 000000000..ce2b30588 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1260EmptyBlocks-cr.case @@ -0,0 +1 @@ +---------- class I1260EmptyBlocks { void f() { { /* c */ } try { /* t */ } catch (Exception e) { /* c */ } try { /* t */ } finally { /* f */ } if (true) { /* i */ } while (true) { /* w */ } switch (0) { case 1: { /* s */ } } int[] a = { /* a */ }; } void g() { /* body */ } void h() { /* body */ int x; } } ---------- class I1260EmptyBlocks { void f() { { /* c */ } try { /* t */ } catch (Exception e) { /* c */ } try { /* t */ } finally { /* f */ } if (true) { /* i */ } while (true) { /* w */ } switch (0) { case 1: { /* s */ } } int[] a = { /* a */ }; } void g() { /* body */ } void h() { /* body */ int x; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I1260EmptyBlocks-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I1260EmptyBlocks-crlf.case new file mode 100644 index 000000000..2143af3f3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1260EmptyBlocks-crlf.case @@ -0,0 +1,55 @@ +---------- +class I1260EmptyBlocks { + void f() { + { /* c */ } + try { /* t */ } catch (Exception e) { /* c */ } + try { /* t */ } finally { /* f */ } + if (true) { /* i */ } + while (true) { /* w */ } + switch (0) { case 1: { /* s */ } } + int[] a = { /* a */ }; + } + void g() { /* body */ } + void h() { /* body */ int x; } +} +---------- +class I1260EmptyBlocks { + void f() { + { + /* c */ + } + try { + /* t */ + } catch (Exception e) { + /* c */ + } + try { + /* t */ + } finally { + /* f */ + } + if (true) { + /* i */ + } + while (true) { + /* w */ + } + switch (0) { + case 1: { + /* s */ + } + } + int[] a = { + /* a */ + }; + } + + void g() { + /* body */ + } + + void h() { + /* body */ + int x; + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260EmptyBlocks.output b/open-java-format/src/test/resources/test-cases/testdata/I1260EmptyBlocks-lf.case similarity index 63% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260EmptyBlocks.output rename to open-java-format/src/test/resources/test-cases/testdata/I1260EmptyBlocks-lf.case index e58e60f23..67888fb4a 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260EmptyBlocks.output +++ b/open-java-format/src/test/resources/test-cases/testdata/I1260EmptyBlocks-lf.case @@ -1,3 +1,18 @@ +---------- +class I1260EmptyBlocks { + void f() { + { /* c */ } + try { /* t */ } catch (Exception e) { /* c */ } + try { /* t */ } finally { /* f */ } + if (true) { /* i */ } + while (true) { /* w */ } + switch (0) { case 1: { /* s */ } } + int[] a = { /* a */ }; + } + void g() { /* body */ } + void h() { /* body */ int x; } +} +---------- class I1260EmptyBlocks { void f() { { diff --git a/open-java-format/src/test/resources/test-cases/testdata/I13-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I13-cr.case new file mode 100644 index 000000000..a23ff57fe --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I13-cr.case @@ -0,0 +1 @@ +---------- class I13 { @Nullable public int f; @Override public void m() {} } ---------- class I13 { @Nullable public int f; @Override public void m() {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I13-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I13-crlf.case new file mode 100644 index 000000000..bedd45f5d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I13-crlf.case @@ -0,0 +1,20 @@ +---------- +class I13 { + + @Nullable + + public int f; + + @Override + + public void m() {} +} +---------- +class I13 { + + @Nullable + public int f; + + @Override + public void m() {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I13-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I13-lf.case new file mode 100644 index 000000000..b9296c336 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I13-lf.case @@ -0,0 +1,20 @@ +---------- +class I13 { + + @Nullable + + public int f; + + @Override + + public void m() {} +} +---------- +class I13 { + + @Nullable + public int f; + + @Override + public void m() {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I1309-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I1309-cr.case new file mode 100644 index 000000000..a0d76359c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1309-cr.case @@ -0,0 +1 @@ +---------- public class I1309 { void x(Object o) { if (o instanceof Record(Nested(var i), var j)) {} switch (o) { case Record(Nested(var i), var j, int k, char l, java.lang.String m, var n, var o, var p, var q, var r, var s, var t, var u, var v, var w, var x, var y, var z): default: } } } ---------- public class I1309 { void x(Object o) { if (o instanceof Record(Nested(var i), var j)) {} switch (o) { case Record( Nested(var i), var j, int k, char l, java.lang.String m, var n, var o, var p, var q, var r, var s, var t, var u, var v, var w, var x, var y, var z): default: } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I1309-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I1309-crlf.case new file mode 100644 index 000000000..3fdfbe2ca --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1309-crlf.case @@ -0,0 +1,38 @@ +---------- +public class I1309 { + void x(Object o) { + if (o instanceof Record(Nested(var i), var j)) {} + switch (o) { + case Record(Nested(var i), var j, int k, char l, java.lang.String m, var n, var o, var p, var q, var r, var s, var t, var u, var v, var w, var x, var y, var z): + default: + } + } +} +---------- +public class I1309 { + void x(Object o) { + if (o instanceof Record(Nested(var i), var j)) {} + switch (o) { + case Record( + Nested(var i), + var j, + int k, + char l, + java.lang.String m, + var n, + var o, + var p, + var q, + var r, + var s, + var t, + var u, + var v, + var w, + var x, + var y, + var z): + default: + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1309.output b/open-java-format/src/test/resources/test-cases/testdata/I1309-lf.case similarity index 67% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1309.output rename to open-java-format/src/test/resources/test-cases/testdata/I1309-lf.case index a95fa156b..32a46d240 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1309.output +++ b/open-java-format/src/test/resources/test-cases/testdata/I1309-lf.case @@ -1,3 +1,14 @@ +---------- +public class I1309 { + void x(Object o) { + if (o instanceof Record(Nested(var i), var j)) {} + switch (o) { + case Record(Nested(var i), var j, int k, char l, java.lang.String m, var n, var o, var p, var q, var r, var s, var t, var u, var v, var w, var x, var y, var z): + default: + } + } +} +---------- public class I1309 { void x(Object o) { if (o instanceof Record(Nested(var i), var j)) {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I202-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I202-cr.case new file mode 100644 index 000000000..9ea7ed2ad --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I202-cr.case @@ -0,0 +1 @@ +---------- class I202 { { //noinspection CheckResult methodWhoseResultShouldBeChecked(); } } ---------- class I202 { { //noinspection CheckResult methodWhoseResultShouldBeChecked(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I202-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I202-crlf.case new file mode 100644 index 000000000..df68fba23 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I202-crlf.case @@ -0,0 +1,14 @@ +---------- +class I202 { + { + //noinspection CheckResult + methodWhoseResultShouldBeChecked(); + } +} +---------- +class I202 { + { + //noinspection CheckResult + methodWhoseResultShouldBeChecked(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I202-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I202-lf.case new file mode 100644 index 000000000..17949cf06 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I202-lf.case @@ -0,0 +1,14 @@ +---------- +class I202 { + { + //noinspection CheckResult + methodWhoseResultShouldBeChecked(); + } +} +---------- +class I202 { + { + //noinspection CheckResult + methodWhoseResultShouldBeChecked(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I365-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I365-cr.case new file mode 100644 index 000000000..f03dc35d8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I365-cr.case @@ -0,0 +1 @@ +---------- class I365 { { return foo____________ .bar__________() .baz____________() .parallelStream() .map(Baz::getId) .collect(toList()); } } ---------- class I365 { { return foo____________.bar__________().baz____________().parallelStream() .map(Baz::getId) .collect(toList()); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I365-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I365-crlf.case new file mode 100644 index 000000000..732ea03fd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I365-crlf.case @@ -0,0 +1,19 @@ +---------- +class I365 { + { + return foo____________ + .bar__________() + .baz____________() + .parallelStream() + .map(Baz::getId) + .collect(toList()); + } +} +---------- +class I365 { + { + return foo____________.bar__________().baz____________().parallelStream() + .map(Baz::getId) + .collect(toList()); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I365-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I365-lf.case new file mode 100644 index 000000000..e8129a713 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I365-lf.case @@ -0,0 +1,19 @@ +---------- +class I365 { + { + return foo____________ + .bar__________() + .baz____________() + .parallelStream() + .map(Baz::getId) + .collect(toList()); + } +} +---------- +class I365 { + { + return foo____________.bar__________().baz____________().parallelStream() + .map(Baz::getId) + .collect(toList()); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I374-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I374-cr.case new file mode 100644 index 000000000..fb05c49bd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I374-cr.case @@ -0,0 +1 @@ +---------- import java.lang.annotation.ElementType; import java.lang.annotation.Target; @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface MyTypeAnno {} public class GjfFailure { void m(int a @MyTypeAnno []) {} } ---------- import java.lang.annotation.ElementType; import java.lang.annotation.Target; @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface MyTypeAnno {} public class GjfFailure { void m(int a @MyTypeAnno []) {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I374-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I374-crlf.case new file mode 100644 index 000000000..bd8005405 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I374-crlf.case @@ -0,0 +1,20 @@ +---------- +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) +@interface MyTypeAnno {} + +public class GjfFailure { + void m(int a @MyTypeAnno []) {} +} +---------- +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) +@interface MyTypeAnno {} + +public class GjfFailure { + void m(int a @MyTypeAnno []) {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I374-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I374-lf.case new file mode 100644 index 000000000..dd17d2283 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I374-lf.case @@ -0,0 +1,20 @@ +---------- +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) +@interface MyTypeAnno {} + +public class GjfFailure { + void m(int a @MyTypeAnno []) {} +} +---------- +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) +@interface MyTypeAnno {} + +public class GjfFailure { + void m(int a @MyTypeAnno []) {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I594-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I594-cr.case new file mode 100644 index 000000000..0bba5f82a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I594-cr.case @@ -0,0 +1 @@ +---------- public class I594 { public void thisIsNotFormattedCorrectly(Object something){ if(something instanceof String somethingAsString){ return; } } } ---------- public class I594 { public void thisIsNotFormattedCorrectly(Object something) { if (something instanceof String somethingAsString) { return; } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I594-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I594-crlf.case new file mode 100644 index 000000000..bba2effd4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I594-crlf.case @@ -0,0 +1,16 @@ +---------- +public class I594 { + public void thisIsNotFormattedCorrectly(Object something){ + if(something instanceof String somethingAsString){ + return; + } + } +} +---------- +public class I594 { + public void thisIsNotFormattedCorrectly(Object something) { + if (something instanceof String somethingAsString) { + return; + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I594-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I594-lf.case new file mode 100644 index 000000000..60af9fd3c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I594-lf.case @@ -0,0 +1,16 @@ +---------- +public class I594 { + public void thisIsNotFormattedCorrectly(Object something){ + if(something instanceof String somethingAsString){ + return; + } + } +} +---------- +public class I594 { + public void thisIsNotFormattedCorrectly(Object something) { + if (something instanceof String somethingAsString) { + return; + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I603-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I603-cr.case new file mode 100644 index 000000000..1f37905c3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I603-cr.case @@ -0,0 +1 @@ +---------- class I603 { sealed abstract class T1 {} sealed class T2 extends X implements Y permits Z {} sealed class T3 permits Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} sealed class T4 implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx permits Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, Yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy {} } ---------- class I603 { abstract sealed class T1 {} sealed class T2 extends X implements Y permits Z {} sealed class T3 permits Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} sealed class T4 implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx permits Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, Yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I603-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I603-crlf.case new file mode 100644 index 000000000..1c8a76db0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I603-crlf.case @@ -0,0 +1,29 @@ +---------- +class I603 { + sealed abstract class T1 {} + + sealed class T2 extends X implements Y permits Z {} + + sealed class T3 + permits + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} + + sealed class T4 + implements + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + permits + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + Yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy {} +} +---------- +class I603 { + abstract sealed class T1 {} + + sealed class T2 extends X implements Y permits Z {} + + sealed class T3 permits Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} + + sealed class T4 implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + permits Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + Yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I603-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I603-lf.case new file mode 100644 index 000000000..71f2f4c4b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I603-lf.case @@ -0,0 +1,29 @@ +---------- +class I603 { + sealed abstract class T1 {} + + sealed class T2 extends X implements Y permits Z {} + + sealed class T3 + permits + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} + + sealed class T4 + implements + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + permits + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + Yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy {} +} +---------- +class I603 { + abstract sealed class T1 {} + + sealed class T2 extends X implements Y permits Z {} + + sealed class T3 permits Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {} + + sealed class T4 implements Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + permits Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + Yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I643-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I643-cr.case new file mode 100644 index 000000000..852d0f7c4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I643-cr.case @@ -0,0 +1 @@ +---------- public class Foo { static final int VERBOSE_WORDY_AND_LENGTHY_ONE = 1; static final int VERBOSE_WORDY_AND_LENGTHY_TWO = 2; static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 4; static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 5; public static int fn(int x) { switch (x) { case VERBOSE_WORDY_AND_LENGTHY_ONE | VERBOSE_WORDY_AND_LENGTHY_TWO | VERBOSE_WORDY_AND_LENGTHY_FOUR | VERBOSE_WORDY_AND_LENGTHY_FIVE: return 0; default: return 1; } } } ---------- public class Foo { static final int VERBOSE_WORDY_AND_LENGTHY_ONE = 1; static final int VERBOSE_WORDY_AND_LENGTHY_TWO = 2; static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 4; static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 5; public static int fn(int x) { switch (x) { case VERBOSE_WORDY_AND_LENGTHY_ONE | VERBOSE_WORDY_AND_LENGTHY_TWO | VERBOSE_WORDY_AND_LENGTHY_FOUR | VERBOSE_WORDY_AND_LENGTHY_FIVE: return 0; default: return 1; } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I643-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I643-crlf.case new file mode 100644 index 000000000..1ed4fdf7c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I643-crlf.case @@ -0,0 +1,35 @@ +---------- +public class Foo { + static final int VERBOSE_WORDY_AND_LENGTHY_ONE = 1; + static final int VERBOSE_WORDY_AND_LENGTHY_TWO = 2; + static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 4; + static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 5; + + public static int fn(int x) { + switch (x) { + case VERBOSE_WORDY_AND_LENGTHY_ONE | VERBOSE_WORDY_AND_LENGTHY_TWO | VERBOSE_WORDY_AND_LENGTHY_FOUR | VERBOSE_WORDY_AND_LENGTHY_FIVE: + return 0; + default: + return 1; + } + } +} +---------- +public class Foo { + static final int VERBOSE_WORDY_AND_LENGTHY_ONE = 1; + static final int VERBOSE_WORDY_AND_LENGTHY_TWO = 2; + static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 4; + static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 5; + + public static int fn(int x) { + switch (x) { + case VERBOSE_WORDY_AND_LENGTHY_ONE + | VERBOSE_WORDY_AND_LENGTHY_TWO + | VERBOSE_WORDY_AND_LENGTHY_FOUR + | VERBOSE_WORDY_AND_LENGTHY_FIVE: + return 0; + default: + return 1; + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I643.output b/open-java-format/src/test/resources/test-cases/testdata/I643-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I643.output rename to open-java-format/src/test/resources/test-cases/testdata/I643-lf.case index 283720369..47502f7ad 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I643.output +++ b/open-java-format/src/test/resources/test-cases/testdata/I643-lf.case @@ -1,3 +1,20 @@ +---------- +public class Foo { + static final int VERBOSE_WORDY_AND_LENGTHY_ONE = 1; + static final int VERBOSE_WORDY_AND_LENGTHY_TWO = 2; + static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 4; + static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 5; + + public static int fn(int x) { + switch (x) { + case VERBOSE_WORDY_AND_LENGTHY_ONE | VERBOSE_WORDY_AND_LENGTHY_TWO | VERBOSE_WORDY_AND_LENGTHY_FOUR | VERBOSE_WORDY_AND_LENGTHY_FIVE: + return 0; + default: + return 1; + } + } +} +---------- public class Foo { static final int VERBOSE_WORDY_AND_LENGTHY_ONE = 1; static final int VERBOSE_WORDY_AND_LENGTHY_TWO = 2; diff --git a/open-java-format/src/test/resources/test-cases/testdata/I683-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I683-cr.case new file mode 100644 index 000000000..1cae86f97 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I683-cr.case @@ -0,0 +1 @@ +---------- interface Test { static class Test1 implements Test{} static class Test2 implements Test{} public static void main(String[] args) { Test test = new Test1(); switch (test) { case Test1 test1 -> {} case Test2 test2 -> {} default -> throw new IllegalStateException("Unexpected value: " + test); } } } ---------- interface Test { static class Test1 implements Test {} static class Test2 implements Test {} public static void main(String[] args) { Test test = new Test1(); switch (test) { case Test1 test1 -> {} case Test2 test2 -> {} default -> throw new IllegalStateException("Unexpected value: " + test); } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I683-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I683-crlf.case new file mode 100644 index 000000000..7007e800d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I683-crlf.case @@ -0,0 +1,31 @@ +---------- +interface Test { + + static class Test1 implements Test{} + static class Test2 implements Test{} + + public static void main(String[] args) { + Test test = new Test1(); + switch (test) { + case Test1 test1 -> {} + case Test2 test2 -> {} + default -> throw new IllegalStateException("Unexpected value: " + test); + } + } +} +---------- +interface Test { + + static class Test1 implements Test {} + + static class Test2 implements Test {} + + public static void main(String[] args) { + Test test = new Test1(); + switch (test) { + case Test1 test1 -> {} + case Test2 test2 -> {} + default -> throw new IllegalStateException("Unexpected value: " + test); + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I683.output b/open-java-format/src/test/resources/test-cases/testdata/I683-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I683.output rename to open-java-format/src/test/resources/test-cases/testdata/I683-lf.case index eadb3b8e8..90740a11d 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I683.output +++ b/open-java-format/src/test/resources/test-cases/testdata/I683-lf.case @@ -1,3 +1,19 @@ +---------- +interface Test { + + static class Test1 implements Test{} + static class Test2 implements Test{} + + public static void main(String[] args) { + Test test = new Test1(); + switch (test) { + case Test1 test1 -> {} + case Test2 test2 -> {} + default -> throw new IllegalStateException("Unexpected value: " + test); + } + } +} +---------- interface Test { static class Test1 implements Test {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I684-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I684-cr.case new file mode 100644 index 000000000..f03c02216 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I684-cr.case @@ -0,0 +1 @@ +---------- package example; import example.model.SealedInterface; import example.model.TypeA; import example.model.TypeB; public class Main { public void apply(SealedInterface sealedInterface) { switch(sealedInterface) { case TypeA a -> System.out.println("A!"); case TypeB b -> System.out.println("B!"); } } } ---------- package example; import example.model.SealedInterface; import example.model.TypeA; import example.model.TypeB; public class Main { public void apply(SealedInterface sealedInterface) { switch (sealedInterface) { case TypeA a -> System.out.println("A!"); case TypeB b -> System.out.println("B!"); } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I684-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I684-crlf.case new file mode 100644 index 000000000..3d920daf4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I684-crlf.case @@ -0,0 +1,30 @@ +---------- +package example; + +import example.model.SealedInterface; +import example.model.TypeA; +import example.model.TypeB; + +public class Main { + public void apply(SealedInterface sealedInterface) { + switch(sealedInterface) { + case TypeA a -> System.out.println("A!"); + case TypeB b -> System.out.println("B!"); + } + } +} +---------- +package example; + +import example.model.SealedInterface; +import example.model.TypeA; +import example.model.TypeB; + +public class Main { + public void apply(SealedInterface sealedInterface) { + switch (sealedInterface) { + case TypeA a -> System.out.println("A!"); + case TypeB b -> System.out.println("B!"); + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I684.output b/open-java-format/src/test/resources/test-cases/testdata/I684-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I684.output rename to open-java-format/src/test/resources/test-cases/testdata/I684-lf.case index a94d5d818..a388fa68f 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I684.output +++ b/open-java-format/src/test/resources/test-cases/testdata/I684-lf.case @@ -1,3 +1,19 @@ +---------- +package example; + +import example.model.SealedInterface; +import example.model.TypeA; +import example.model.TypeB; + +public class Main { + public void apply(SealedInterface sealedInterface) { + switch(sealedInterface) { + case TypeA a -> System.out.println("A!"); + case TypeB b -> System.out.println("B!"); + } + } +} +---------- package example; import example.model.SealedInterface; diff --git a/open-java-format/src/test/resources/test-cases/testdata/I696-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I696-cr.case new file mode 100644 index 000000000..c994f9b33 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I696-cr.case @@ -0,0 +1 @@ +---------- public abstract non-sealed class A extends SealedClass { } non-sealed class B extends SealedClass { } non-sealed @A class B extends SealedClass { } @A non-sealed class B extends SealedClass { } ---------- public abstract non-sealed class A extends SealedClass {} non-sealed class B extends SealedClass {} non-sealed @A class B extends SealedClass {} @A non-sealed class B extends SealedClass {} \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I696-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I696-crlf.case new file mode 100644 index 000000000..e3da566f7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I696-crlf.case @@ -0,0 +1,21 @@ +---------- +public abstract non-sealed class A extends SealedClass { +} + +non-sealed class B extends SealedClass { +} + +non-sealed @A class B extends SealedClass { +} + +@A non-sealed class B extends SealedClass { +} +---------- +public abstract non-sealed class A extends SealedClass {} + +non-sealed class B extends SealedClass {} + +non-sealed @A class B extends SealedClass {} + +@A +non-sealed class B extends SealedClass {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I696-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I696-lf.case new file mode 100644 index 000000000..a544757d3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I696-lf.case @@ -0,0 +1,21 @@ +---------- +public abstract non-sealed class A extends SealedClass { +} + +non-sealed class B extends SealedClass { +} + +non-sealed @A class B extends SealedClass { +} + +@A non-sealed class B extends SealedClass { +} +---------- +public abstract non-sealed class A extends SealedClass {} + +non-sealed class B extends SealedClass {} + +non-sealed @A class B extends SealedClass {} + +@A +non-sealed class B extends SealedClass {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I959-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I959-cr.case new file mode 100644 index 000000000..37c2ab00c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I959-cr.case @@ -0,0 +1 @@ +---------- class I959 { public void test() { new File(".").listFiles((final var dir, final var name) -> true); } } ---------- class I959 { public void test() { new File(".").listFiles((final var dir, final var name) -> true); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I959-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I959-crlf.case new file mode 100644 index 000000000..6a42f8457 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I959-crlf.case @@ -0,0 +1,12 @@ +---------- +class I959 { + public void test() { + new File(".").listFiles((final var dir, final var name) -> true); + } +} +---------- +class I959 { + public void test() { + new File(".").listFiles((final var dir, final var name) -> true); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I959-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I959-lf.case new file mode 100644 index 000000000..31fdfdd4b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I959-lf.case @@ -0,0 +1,12 @@ +---------- +class I959 { + public void test() { + new File(".").listFiles((final var dir, final var name) -> true); + } +} +---------- +class I959 { + public void test() { + new File(".").listFiles((final var dir, final var name) -> true); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithMultipleLines-cr.case b/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithMultipleLines-cr.case new file mode 100644 index 000000000..111a85e60 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithMultipleLines-cr.case @@ -0,0 +1 @@ +---------- class MyClass { private void myFile() {} } ---------- class MyClass { private void myFile() {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithMultipleLines-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithMultipleLines-crlf.case new file mode 100644 index 000000000..c87e7c001 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithMultipleLines-crlf.case @@ -0,0 +1,12 @@ +---------- +class MyClass { + private void myFile() {} +} + + + + +---------- +class MyClass { + private void myFile() {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithMultipleLines-lf.case b/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithMultipleLines-lf.case new file mode 100644 index 000000000..01cbcc34a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithMultipleLines-lf.case @@ -0,0 +1,12 @@ +---------- +class MyClass { + private void myFile() {} +} + + + + +---------- +class MyClass { + private void myFile() {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/L-cr.case b/open-java-format/src/test/resources/test-cases/testdata/L-cr.case new file mode 100644 index 000000000..dc3eb534c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/L-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** Tests for LabeledStatements and LambdaExpressions. */ class L { // TODO(jdd): Include high language-level tests. void f() { LABEL: for (int i = 0; i < 10; i++) {} } } ---------- package com.google.googlejavaformat.java.test; /** Tests for LabeledStatements and LambdaExpressions. */ class L { // TODO(jdd): Include high language-level tests. void f() { LABEL: for (int i = 0; i < 10; i++) {} } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/L-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/L-crlf.case new file mode 100644 index 000000000..5d6983d1a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/L-crlf.case @@ -0,0 +1,24 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for LabeledStatements and LambdaExpressions. */ +class L { + // TODO(jdd): Include high language-level tests. + + void f() { + LABEL: + for (int i = 0; i < 10; i++) {} + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for LabeledStatements and LambdaExpressions. */ +class L { + // TODO(jdd): Include high language-level tests. + + void f() { + LABEL: + for (int i = 0; i < 10; i++) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/L-lf.case b/open-java-format/src/test/resources/test-cases/testdata/L-lf.case new file mode 100644 index 000000000..83ce038a0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/L-lf.case @@ -0,0 +1,24 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for LabeledStatements and LambdaExpressions. */ +class L { + // TODO(jdd): Include high language-level tests. + + void f() { + LABEL: + for (int i = 0; i < 10; i++) {} + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for LabeledStatements and LambdaExpressions. */ +class L { + // TODO(jdd): Include high language-level tests. + + void f() { + LABEL: + for (int i = 0; i < 10; i++) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/LocalAnnotations-cr.case b/open-java-format/src/test/resources/test-cases/testdata/LocalAnnotations-cr.case new file mode 100644 index 000000000..41c02a670 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/LocalAnnotations-cr.case @@ -0,0 +1 @@ +---------- class LocalAnnotations { { @Foo final Object x; @Foo(1) final Object y; @Foo(x=1) final Object y; } } ---------- class LocalAnnotations { { @Foo final Object x; @Foo(1) final Object y; @Foo(x = 1) final Object y; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/LocalAnnotations-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/LocalAnnotations-crlf.case new file mode 100644 index 000000000..c5a3b1a70 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/LocalAnnotations-crlf.case @@ -0,0 +1,18 @@ +---------- +class LocalAnnotations { + { + @Foo final Object x; + @Foo(1) final Object y; + @Foo(x=1) final Object y; + } +} +---------- +class LocalAnnotations { + { + @Foo final Object x; + @Foo(1) + final Object y; + @Foo(x = 1) + final Object y; + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/LocalAnnotations.output b/open-java-format/src/test/resources/test-cases/testdata/LocalAnnotations-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/LocalAnnotations.output rename to open-java-format/src/test/resources/test-cases/testdata/LocalAnnotations-lf.case index d89d9ce66..54ffdb729 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/LocalAnnotations.output +++ b/open-java-format/src/test/resources/test-cases/testdata/LocalAnnotations-lf.case @@ -1,3 +1,12 @@ +---------- +class LocalAnnotations { + { + @Foo final Object x; + @Foo(1) final Object y; + @Foo(x=1) final Object y; + } +} +---------- class LocalAnnotations { { @Foo final Object x; diff --git a/open-java-format/src/test/resources/test-cases/testdata/M1-cr.case b/open-java-format/src/test/resources/test-cases/testdata/M1-cr.case new file mode 100644 index 000000000..47e925e07 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/M1-cr.case @@ -0,0 +1 @@ +---------- import a.A; import a.B; import com.google.Foo; @A @B module com.google.m { requires com.google.r1; requires transitive com.google.r2; requires static com.google.r3; exports com.google.e1; exports com.google.e1 to com.google.e2; exports com.google.e1 to com.google.e2, com.google.e3; exports com.google.e1 to com.google.e2, com.google.e3, com.google.e4; opens com.google.o1; opens com.google.o1 to com.google.o2; opens com.google.o1 to com.google.o2, com.google.o3; opens com.google.o1 to com.google.o2, com.google.o3, com.googleoe4; uses Foo; uses com.google.Bar; provides com.google.Baz with Foo; provides com.google.Baz with Foo, com.google.Bar; } ---------- import a.A; import a.B; import com.google.Foo; @A @B module com.google.m { requires com.google.r1; requires transitive com.google.r2; requires static com.google.r3; exports com.google.e1; exports com.google.e1 to com.google.e2; exports com.google.e1 to com.google.e2, com.google.e3; exports com.google.e1 to com.google.e2, com.google.e3, com.google.e4; opens com.google.o1; opens com.google.o1 to com.google.o2; opens com.google.o1 to com.google.o2, com.google.o3; opens com.google.o1 to com.google.o2, com.google.o3, com.googleoe4; uses Foo; uses com.google.Bar; provides com.google.Baz with Foo; provides com.google.Baz with Foo, com.google.Bar; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/M1-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/M1-crlf.case new file mode 100644 index 000000000..d838b8468 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/M1-crlf.case @@ -0,0 +1,66 @@ +---------- +import a.A; +import a.B; +import com.google.Foo; + +@A @B +module com.google.m { +requires com.google.r1; +requires transitive com.google.r2; +requires static com.google.r3; +exports com.google.e1; +exports com.google.e1 to com.google.e2; +exports com.google.e1 to com.google.e2, com.google.e3; +exports com.google.e1 to com.google.e2, com.google.e3, com.google.e4; +opens com.google.o1; +opens com.google.o1 to com.google.o2; +opens com.google.o1 to com.google.o2, com.google.o3; +opens com.google.o1 to com.google.o2, com.google.o3, com.googleoe4; +uses Foo; +uses com.google.Bar; +provides com.google.Baz with Foo; +provides com.google.Baz with Foo, com.google.Bar; +} +---------- +import a.A; +import a.B; +import com.google.Foo; + +@A +@B +module com.google.m { + requires com.google.r1; + requires transitive com.google.r2; + requires static com.google.r3; + + exports com.google.e1; + exports com.google.e1 to + com.google.e2; + exports com.google.e1 to + com.google.e2, + com.google.e3; + exports com.google.e1 to + com.google.e2, + com.google.e3, + com.google.e4; + + opens com.google.o1; + opens com.google.o1 to + com.google.o2; + opens com.google.o1 to + com.google.o2, + com.google.o3; + opens com.google.o1 to + com.google.o2, + com.google.o3, + com.googleoe4; + + uses Foo; + uses com.google.Bar; + + provides com.google.Baz with + Foo; + provides com.google.Baz with + Foo, + com.google.Bar; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M1.output b/open-java-format/src/test/resources/test-cases/testdata/M1-lf.case similarity index 57% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M1.output rename to open-java-format/src/test/resources/test-cases/testdata/M1-lf.case index 39bebebdf..f9a67fe98 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M1.output +++ b/open-java-format/src/test/resources/test-cases/testdata/M1-lf.case @@ -1,3 +1,27 @@ +---------- +import a.A; +import a.B; +import com.google.Foo; + +@A @B +module com.google.m { +requires com.google.r1; +requires transitive com.google.r2; +requires static com.google.r3; +exports com.google.e1; +exports com.google.e1 to com.google.e2; +exports com.google.e1 to com.google.e2, com.google.e3; +exports com.google.e1 to com.google.e2, com.google.e3, com.google.e4; +opens com.google.o1; +opens com.google.o1 to com.google.o2; +opens com.google.o1 to com.google.o2, com.google.o3; +opens com.google.o1 to com.google.o2, com.google.o3, com.googleoe4; +uses Foo; +uses com.google.Bar; +provides com.google.Baz with Foo; +provides com.google.Baz with Foo, com.google.Bar; +} +---------- import a.A; import a.B; import com.google.Foo; diff --git a/open-java-format/src/test/resources/test-cases/testdata/M2-cr.case b/open-java-format/src/test/resources/test-cases/testdata/M2-cr.case new file mode 100644 index 000000000..507a7285d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/M2-cr.case @@ -0,0 +1 @@ +---------- open module com.google.m { } ---------- open module com.google.m {} \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/M2-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/M2-crlf.case new file mode 100644 index 000000000..6cdb9f804 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/M2-crlf.case @@ -0,0 +1,5 @@ +---------- +open module com.google.m { +} +---------- +open module com.google.m {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/M2-lf.case b/open-java-format/src/test/resources/test-cases/testdata/M2-lf.case new file mode 100644 index 000000000..c3f5a1b03 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/M2-lf.case @@ -0,0 +1,5 @@ +---------- +open module com.google.m { +} +---------- +open module com.google.m {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/MarkdownDoc-cr.case b/open-java-format/src/test/resources/test-cases/testdata/MarkdownDoc-cr.case new file mode 100644 index 000000000..60f0189b4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/MarkdownDoc-cr.case @@ -0,0 +1 @@ +---------- /// A greeter. /// /// Says hello. See [String]. class MarkdownDoc { /// Returns the greeting. /// @return the text String greeting() { return "hi"; } } ---------- /// A greeter. /// /// Says hello. See [String]. class MarkdownDoc { /// Returns the greeting. /// @return the text String greeting() { return "hi"; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/MarkdownDoc-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/MarkdownDoc-crlf.case new file mode 100644 index 000000000..ab750f8bf --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/MarkdownDoc-crlf.case @@ -0,0 +1,22 @@ +---------- +/// A greeter. +/// +/// Says hello. See [String]. +class MarkdownDoc { + /// Returns the greeting. + /// @return the text + String greeting() { + return "hi"; + } +} +---------- +/// A greeter. +/// +/// Says hello. See [String]. +class MarkdownDoc { + /// Returns the greeting. + /// @return the text + String greeting() { + return "hi"; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/MarkdownDoc-lf.case b/open-java-format/src/test/resources/test-cases/testdata/MarkdownDoc-lf.case new file mode 100644 index 000000000..3815142d6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/MarkdownDoc-lf.case @@ -0,0 +1,22 @@ +---------- +/// A greeter. +/// +/// Says hello. See [String]. +class MarkdownDoc { + /// Returns the greeting. + /// @return the text + String greeting() { + return "hi"; + } +} +---------- +/// A greeter. +/// +/// Says hello. See [String]. +class MarkdownDoc { + /// Returns the greeting. + /// @return the text + String greeting() { + return "hi"; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/MarkerAnnotation-cr.case b/open-java-format/src/test/resources/test-cases/testdata/MarkerAnnotation-cr.case new file mode 100644 index 000000000..a12e3e652 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/MarkerAnnotation-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** JavaDoc comment. */ public @interface MarkerAnnotation {} ---------- package com.google.googlejavaformat.java.test; /** JavaDoc comment. */ public @interface MarkerAnnotation {} \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/MarkerAnnotation-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/MarkerAnnotation-crlf.case new file mode 100644 index 000000000..62a945ab9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/MarkerAnnotation-crlf.case @@ -0,0 +1,10 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** JavaDoc comment. */ +public @interface MarkerAnnotation {} +---------- +package com.google.googlejavaformat.java.test; + +/** JavaDoc comment. */ +public @interface MarkerAnnotation {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/MarkerAnnotation-lf.case b/open-java-format/src/test/resources/test-cases/testdata/MarkerAnnotation-lf.case new file mode 100644 index 000000000..233f34bd7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/MarkerAnnotation-lf.case @@ -0,0 +1,10 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** JavaDoc comment. */ +public @interface MarkerAnnotation {} +---------- +package com.google.googlejavaformat.java.test; + +/** JavaDoc comment. */ +public @interface MarkerAnnotation {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/Multivariables-cr.case b/open-java-format/src/test/resources/test-cases/testdata/Multivariables-cr.case new file mode 100644 index 000000000..abbcdfdc8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Multivariables-cr.case @@ -0,0 +1 @@ +---------- class Multivariables { int xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; // Horizontal and veritcal paddings used for most cells in the standings table. private final int hpad, vpad; { { for (c = cx.iterator(), m = mx.iterator(); c.hasNext() && m.hasNext(); ) { f(c, m); } } } } ---------- class Multivariables { int xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; // Horizontal and veritcal paddings used for most cells in the standings table. private final int hpad, vpad; { { for (c = cx.iterator(), m = mx.iterator(); c.hasNext() && m.hasNext(); ) { f(c, m); } } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/Multivariables-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/Multivariables-crlf.case new file mode 100644 index 000000000..3bb5f2c91 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Multivariables-crlf.case @@ -0,0 +1,35 @@ +---------- +class Multivariables { + int xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy, + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; + + // Horizontal and veritcal paddings used for most cells in the standings table. + private final int hpad, vpad; + + { + { + for (c = cx.iterator(), m = mx.iterator(); + c.hasNext() && m.hasNext(); ) { + f(c, m); + } + } + } +} +---------- +class Multivariables { + int xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy, + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; + + // Horizontal and veritcal paddings used for most cells in the standings table. + private final int hpad, vpad; + + { + { + for (c = cx.iterator(), m = mx.iterator(); c.hasNext() && m.hasNext(); ) { + f(c, m); + } + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Multivariables.output b/open-java-format/src/test/resources/test-cases/testdata/Multivariables-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Multivariables.output rename to open-java-format/src/test/resources/test-cases/testdata/Multivariables-lf.case index cc7f4c91b..b99aeaf39 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Multivariables.output +++ b/open-java-format/src/test/resources/test-cases/testdata/Multivariables-lf.case @@ -1,3 +1,22 @@ +---------- +class Multivariables { + int xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy, + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; + + // Horizontal and veritcal paddings used for most cells in the standings table. + private final int hpad, vpad; + + { + { + for (c = cx.iterator(), m = mx.iterator(); + c.hasNext() && m.hasNext(); ) { + f(c, m); + } + } + } +} +---------- class Multivariables { int xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy, diff --git a/open-java-format/src/test/resources/test-cases/testdata/N-cr.case b/open-java-format/src/test/resources/test-cases/testdata/N-cr.case new file mode 100644 index 000000000..e935cd6ca --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/N-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** Tests for NameQualifiedTypes, Names, NormalAnnotations, NullLiterals, and NumberLiterals. */ class N { @NormalAnnotation( a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7, h = 8, i = 9, j = 10, k = 11, l = 12, m = 13, n = 14, o = 15, p = 16, q = 17, r = 18, s = 19, t = 20, u = 21, v = 22, w = 23, x = 24, y = 25, z = 26) void f() { assert 00 == 0 && 0x0 == 0 && 1.0e0f == 1.00e0f && 0.2D == .2D; java.lang. /* @MarkerAnnotation */String s = null; } } ---------- package com.google.googlejavaformat.java.test; /** Tests for NameQualifiedTypes, Names, NormalAnnotations, NullLiterals, and NumberLiterals. */ class N { @NormalAnnotation( a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7, h = 8, i = 9, j = 10, k = 11, l = 12, m = 13, n = 14, o = 15, p = 16, q = 17, r = 18, s = 19, t = 20, u = 21, v = 22, w = 23, x = 24, y = 25, z = 26) void f() { assert 00 == 0 && 0x0 == 0 && 1.0e0f == 1.00e0f && 0.2D == .2D; java.lang./* @MarkerAnnotation */ String s = null; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/N-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/N-crlf.case new file mode 100644 index 000000000..531ab5e9b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/N-crlf.case @@ -0,0 +1,51 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for NameQualifiedTypes, Names, NormalAnnotations, NullLiterals, and NumberLiterals. */ +class N { + @NormalAnnotation( + a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7, h = 8, i = 9, j = 10, k = 11, l = 12, m = 13, + n = 14, o = 15, p = 16, q = 17, r = 18, s = 19, t = 20, u = 21, v = 22, w = 23, x = 24, + y = 25, z = 26) + void f() { + assert 00 == 0 && 0x0 == 0 && 1.0e0f == 1.00e0f && 0.2D == .2D; + java.lang. /* @MarkerAnnotation */String s = null; + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for NameQualifiedTypes, Names, NormalAnnotations, NullLiterals, and NumberLiterals. */ +class N { + @NormalAnnotation( + a = 1, + b = 2, + c = 3, + d = 4, + e = 5, + f = 6, + g = 7, + h = 8, + i = 9, + j = 10, + k = 11, + l = 12, + m = 13, + n = 14, + o = 15, + p = 16, + q = 17, + r = 18, + s = 19, + t = 20, + u = 21, + v = 22, + w = 23, + x = 24, + y = 25, + z = 26) + void f() { + assert 00 == 0 && 0x0 == 0 && 1.0e0f == 1.00e0f && 0.2D == .2D; + java.lang./* @MarkerAnnotation */ String s = null; + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/N.output b/open-java-format/src/test/resources/test-cases/testdata/N-lf.case similarity index 60% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/N.output rename to open-java-format/src/test/resources/test-cases/testdata/N-lf.case index ad6b0bec7..088dbb0bc 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/N.output +++ b/open-java-format/src/test/resources/test-cases/testdata/N-lf.case @@ -1,3 +1,18 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for NameQualifiedTypes, Names, NormalAnnotations, NullLiterals, and NumberLiterals. */ +class N { + @NormalAnnotation( + a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7, h = 8, i = 9, j = 10, k = 11, l = 12, m = 13, + n = 14, o = 15, p = 16, q = 17, r = 18, s = 19, t = 20, u = 21, v = 22, w = 23, x = 24, + y = 25, z = 26) + void f() { + assert 00 == 0 && 0x0 == 0 && 1.0e0f == 1.00e0f && 0.2D == .2D; + java.lang. /* @MarkerAnnotation */String s = null; + } +} +---------- package com.google.googlejavaformat.java.test; /** Tests for NameQualifiedTypes, Names, NormalAnnotations, NullLiterals, and NumberLiterals. */ diff --git a/open-java-format/src/test/resources/test-cases/testdata/NON-NLS-cr.case b/open-java-format/src/test/resources/test-cases/testdata/NON-NLS-cr.case new file mode 100644 index 000000000..aff2870f9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/NON-NLS-cr.case @@ -0,0 +1 @@ +---------- package test; class MultilineStringConstant { // NON-NLS comments are required for i18n, it's important they are kept with their strings. private static final String MULTIPLE_LINE_NON_NLS = "field_0," + //$NON-NLS-1$ "field_1," + //$NON-NLS-1$ "field_2," + //$NON-NLS-1$ "field_3," + //$NON-NLS-1$ "field_4"; //$NON-NLS-1$ private static final String MULTIPLE_LINE_NO_COMMENT = "field_0," + "field_1," + "field_2," + "field_3," + "field_4"; } ---------- package test; class MultilineStringConstant { // NON-NLS comments are required for i18n, it's important they are kept with their strings. private static final String MULTIPLE_LINE_NON_NLS = "field_0," //$NON-NLS-1$ + "field_1," //$NON-NLS-1$ + "field_2," //$NON-NLS-1$ + "field_3," //$NON-NLS-1$ + "field_4"; //$NON-NLS-1$ private static final String MULTIPLE_LINE_NO_COMMENT = "field_0," + "field_1," + "field_2," + "field_3," + "field_4"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/NON-NLS-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/NON-NLS-crlf.case new file mode 100644 index 000000000..49a4c8d1d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/NON-NLS-crlf.case @@ -0,0 +1,36 @@ +---------- +package test; + +class MultilineStringConstant { + + // NON-NLS comments are required for i18n, it's important they are kept with their strings. + private static final String MULTIPLE_LINE_NON_NLS = + "field_0," + //$NON-NLS-1$ + "field_1," + //$NON-NLS-1$ + "field_2," + //$NON-NLS-1$ + "field_3," + //$NON-NLS-1$ + "field_4"; //$NON-NLS-1$ + + private static final String MULTIPLE_LINE_NO_COMMENT = + "field_0," + + "field_1," + + "field_2," + + "field_3," + + "field_4"; + +} +---------- +package test; + +class MultilineStringConstant { + + // NON-NLS comments are required for i18n, it's important they are kept with their strings. + private static final String MULTIPLE_LINE_NON_NLS = "field_0," //$NON-NLS-1$ + + "field_1," //$NON-NLS-1$ + + "field_2," //$NON-NLS-1$ + + "field_3," //$NON-NLS-1$ + + "field_4"; //$NON-NLS-1$ + + private static final String MULTIPLE_LINE_NO_COMMENT = + "field_0," + "field_1," + "field_2," + "field_3," + "field_4"; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NON-NLS.input b/open-java-format/src/test/resources/test-cases/testdata/NON-NLS-lf.case similarity index 54% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NON-NLS.input rename to open-java-format/src/test/resources/test-cases/testdata/NON-NLS-lf.case index ace31c646..f759c8ab5 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NON-NLS.input +++ b/open-java-format/src/test/resources/test-cases/testdata/NON-NLS-lf.case @@ -1,3 +1,4 @@ +---------- package test; class MultilineStringConstant { @@ -18,3 +19,18 @@ class MultilineStringConstant { "field_4"; } +---------- +package test; + +class MultilineStringConstant { + + // NON-NLS comments are required for i18n, it's important they are kept with their strings. + private static final String MULTIPLE_LINE_NON_NLS = "field_0," //$NON-NLS-1$ + + "field_1," //$NON-NLS-1$ + + "field_2," //$NON-NLS-1$ + + "field_3," //$NON-NLS-1$ + + "field_4"; //$NON-NLS-1$ + + private static final String MULTIPLE_LINE_NO_COMMENT = + "field_0," + "field_1," + "field_2," + "field_3," + "field_4"; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/NormalAnnotation-cr.case b/open-java-format/src/test/resources/test-cases/testdata/NormalAnnotation-cr.case new file mode 100644 index 000000000..00ef88609 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/NormalAnnotation-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** JavaDoc comment. */ public @interface NormalAnnotation { int a(); int b(); int c(); int d(); int e(); int f(); int g(); int h(); int i(); int j(); int k(); int l(); int m(); int n(); int o(); int p(); int q(); int r(); int s(); int t(); int u(); int v(); int w(); int x(); int y(); int z(); } ---------- package com.google.googlejavaformat.java.test; /** JavaDoc comment. */ public @interface NormalAnnotation { int a(); int b(); int c(); int d(); int e(); int f(); int g(); int h(); int i(); int j(); int k(); int l(); int m(); int n(); int o(); int p(); int q(); int r(); int s(); int t(); int u(); int v(); int w(); int x(); int y(); int z(); } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/NormalAnnotation-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/NormalAnnotation-crlf.case new file mode 100644 index 000000000..0b7c8a195 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/NormalAnnotation-crlf.case @@ -0,0 +1,114 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** JavaDoc comment. */ +public @interface NormalAnnotation { + int a(); + + int b(); + + int c(); + + int d(); + + int e(); + + int f(); + + int g(); + + int h(); + + int i(); + + int j(); + + int k(); + + int l(); + + int m(); + + int n(); + + int o(); + + int p(); + + int q(); + + int r(); + + int s(); + + int t(); + + int u(); + + int v(); + + int w(); + + int x(); + + int y(); + + int z(); +} +---------- +package com.google.googlejavaformat.java.test; + +/** JavaDoc comment. */ +public @interface NormalAnnotation { + int a(); + + int b(); + + int c(); + + int d(); + + int e(); + + int f(); + + int g(); + + int h(); + + int i(); + + int j(); + + int k(); + + int l(); + + int m(); + + int n(); + + int o(); + + int p(); + + int q(); + + int r(); + + int s(); + + int t(); + + int u(); + + int v(); + + int w(); + + int x(); + + int y(); + + int z(); +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NormalAnnotation.output b/open-java-format/src/test/resources/test-cases/testdata/NormalAnnotation-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NormalAnnotation.output rename to open-java-format/src/test/resources/test-cases/testdata/NormalAnnotation-lf.case index cad348bee..d97a63627 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NormalAnnotation.output +++ b/open-java-format/src/test/resources/test-cases/testdata/NormalAnnotation-lf.case @@ -1,3 +1,61 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** JavaDoc comment. */ +public @interface NormalAnnotation { + int a(); + + int b(); + + int c(); + + int d(); + + int e(); + + int f(); + + int g(); + + int h(); + + int i(); + + int j(); + + int k(); + + int l(); + + int m(); + + int n(); + + int o(); + + int p(); + + int q(); + + int r(); + + int s(); + + int t(); + + int u(); + + int v(); + + int w(); + + int x(); + + int y(); + + int z(); +} +---------- package com.google.googlejavaformat.java.test; /** JavaDoc comment. */ diff --git a/open-java-format/src/test/resources/test-cases/testdata/P-cr.case b/open-java-format/src/test/resources/test-cases/testdata/P-cr.case new file mode 100644 index 000000000..318470384 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/P-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** * Tests for PackageDeclarations, ParameterizedTypes, ParenthesizedExpressions, PostfixExpressions, * PrefixExpressions, and PrimitiveTypes. */ class P< T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> { void f() { int x = (1 + 2) * 3; ++x; x++; int j = + + +x; int k = + + ++x; int jj = - - -x; int kk = - - --x; boolean b = false; boolean bb = !!b; } } ---------- package com.google.googlejavaformat.java.test; /** * Tests for PackageDeclarations, ParameterizedTypes, ParenthesizedExpressions, PostfixExpressions, * PrefixExpressions, and PrimitiveTypes. */ class P { void f() { int x = (1 + 2) * 3; ++x; x++; int j = + + +x; int k = + + ++x; int jj = - - -x; int kk = - - --x; boolean b = false; boolean bb = !!b; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/P-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/P-crlf.case new file mode 100644 index 000000000..725158144 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/P-crlf.case @@ -0,0 +1,42 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for PackageDeclarations, ParameterizedTypes, ParenthesizedExpressions, PostfixExpressions, + * PrefixExpressions, and PrimitiveTypes. + */ +class P< + T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, + T22, T23, T24> { + void f() { + int x = (1 + 2) * 3; + ++x; + x++; + int j = + + +x; + int k = + + ++x; + int jj = - - -x; + int kk = - - --x; + boolean b = false; + boolean bb = !!b; + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for PackageDeclarations, ParameterizedTypes, ParenthesizedExpressions, PostfixExpressions, + * PrefixExpressions, and PrimitiveTypes. + */ +class P { + void f() { + int x = (1 + 2) * 3; + ++x; + x++; + int j = + + +x; + int k = + + ++x; + int jj = - - -x; + int kk = - - --x; + boolean b = false; + boolean bb = !!b; + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/P.output b/open-java-format/src/test/resources/test-cases/testdata/P-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/P.output rename to open-java-format/src/test/resources/test-cases/testdata/P-lf.case index d84f154b5..cb4fb7364 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/P.output +++ b/open-java-format/src/test/resources/test-cases/testdata/P-lf.case @@ -1,3 +1,26 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for PackageDeclarations, ParameterizedTypes, ParenthesizedExpressions, PostfixExpressions, + * PrefixExpressions, and PrimitiveTypes. + */ +class P< + T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, + T22, T23, T24> { + void f() { + int x = (1 + 2) * 3; + ++x; + x++; + int j = + + +x; + int k = + + ++x; + int jj = - - -x; + int kk = - - --x; + boolean b = false; + boolean bb = !!b; + } +} +---------- package com.google.googlejavaformat.java.test; /** diff --git a/open-java-format/src/test/resources/test-cases/testdata/Pair-cr.case b/open-java-format/src/test/resources/test-cases/testdata/Pair-cr.case new file mode 100644 index 000000000..cd03bab03 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Pair-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** JavaDoc comment. */ public class Pair { public final T1 x; public final T2 y; Pair(T1 x, T2 y) { this.x = x; this.y = y; } } ---------- package com.google.googlejavaformat.java.test; /** JavaDoc comment. */ public class Pair { public final T1 x; public final T2 y; Pair(T1 x, T2 y) { this.x = x; this.y = y; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/Pair-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/Pair-crlf.case new file mode 100644 index 000000000..e3db9c124 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Pair-crlf.case @@ -0,0 +1,26 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** JavaDoc comment. */ +public class Pair { + public final T1 x; + public final T2 y; + + Pair(T1 x, T2 y) { + this.x = x; + this.y = y; + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** JavaDoc comment. */ +public class Pair { + public final T1 x; + public final T2 y; + + Pair(T1 x, T2 y) { + this.x = x; + this.y = y; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/Pair-lf.case b/open-java-format/src/test/resources/test-cases/testdata/Pair-lf.case new file mode 100644 index 000000000..fd91afc0a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Pair-lf.case @@ -0,0 +1,26 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** JavaDoc comment. */ +public class Pair { + public final T1 x; + public final T2 y; + + Pair(T1 x, T2 y) { + this.x = x; + this.y = y; + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** JavaDoc comment. */ +public class Pair { + public final T1 x; + public final T2 y; + + Pair(T1 x, T2 y) { + this.x = x; + this.y = y; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/PairedArguments-cr.case b/open-java-format/src/test/resources/test-cases/testdata/PairedArguments-cr.case new file mode 100644 index 000000000..ec1a2572e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/PairedArguments-cr.case @@ -0,0 +1 @@ +---------- class T { { f( xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); f( xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); f( xxxxxxxxxxxxxxxxxxxxxxx(), xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); f( xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); f( xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); f( xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); f( xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); } } ---------- class T { { f( xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); f( xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); f( xxxxxxxxxxxxxxxxxxxxxxx(), xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); f( xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); f( xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); f( xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); f( xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/PairedArguments-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/PairedArguments-crlf.case new file mode 100644 index 000000000..8b3952b1c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/PairedArguments-crlf.case @@ -0,0 +1,97 @@ +---------- +class T { + { + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxx(), xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + } +} +---------- +class T { + { + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxx(), + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxx(), + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxx(), + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/PairedArguments.output b/open-java-format/src/test/resources/test-cases/testdata/PairedArguments-lf.case similarity index 55% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/PairedArguments.output rename to open-java-format/src/test/resources/test-cases/testdata/PairedArguments-lf.case index f59905b2a..43d75f8ed 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/PairedArguments.output +++ b/open-java-format/src/test/resources/test-cases/testdata/PairedArguments-lf.case @@ -1,3 +1,45 @@ +---------- +class T { + { + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxx(), xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx(), + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + f( + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, + xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxxxx); + } +} +---------- class T { { f( diff --git a/open-java-format/src/test/resources/test-cases/testdata/Q-cr.case b/open-java-format/src/test/resources/test-cases/testdata/Q-cr.case new file mode 100644 index 000000000..c0b1ae1b0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Q-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** Tests for QualifiedNames and QualifiedTypes. */ class Q { static final int zero = 0; class T {} static void f() { Q. /* @MarkerAnnotation */T t; int zero = Q.zero; java.lang. /* @MarkerAnnotation */String s = null; Q.f(); } } ---------- package com.google.googlejavaformat.java.test; /** Tests for QualifiedNames and QualifiedTypes. */ class Q { static final int zero = 0; class T {} static void f() { Q./* @MarkerAnnotation */ T t; int zero = Q.zero; java.lang./* @MarkerAnnotation */ String s = null; Q.f(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/Q-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/Q-crlf.case new file mode 100644 index 000000000..e66a7768d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Q-crlf.case @@ -0,0 +1,32 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for QualifiedNames and QualifiedTypes. */ +class Q { + static final int zero = 0; + + class T {} + + static void f() { + Q. /* @MarkerAnnotation */T t; + int zero = Q.zero; + java.lang. /* @MarkerAnnotation */String s = null; + Q.f(); + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for QualifiedNames and QualifiedTypes. */ +class Q { + static final int zero = 0; + + class T {} + + static void f() { + Q./* @MarkerAnnotation */ T t; + int zero = Q.zero; + java.lang./* @MarkerAnnotation */ String s = null; + Q.f(); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Q.output b/open-java-format/src/test/resources/test-cases/testdata/Q-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Q.output rename to open-java-format/src/test/resources/test-cases/testdata/Q-lf.case index 000f766fd..e444e84dc 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Q.output +++ b/open-java-format/src/test/resources/test-cases/testdata/Q-lf.case @@ -1,3 +1,20 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for QualifiedNames and QualifiedTypes. */ +class Q { + static final int zero = 0; + + class T {} + + static void f() { + Q. /* @MarkerAnnotation */T t; + int zero = Q.zero; + java.lang. /* @MarkerAnnotation */String s = null; + Q.f(); + } +} +---------- package com.google.googlejavaformat.java.test; /** Tests for QualifiedNames and QualifiedTypes. */ diff --git a/open-java-format/src/test/resources/test-cases/testdata/R-cr.case b/open-java-format/src/test/resources/test-cases/testdata/R-cr.case new file mode 100644 index 000000000..d32fc86de --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/R-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** Tests for ReturnStatements. */ class R { void f() { return; } int f(int x) { return x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x; } } ---------- package com.google.googlejavaformat.java.test; /** Tests for ReturnStatements. */ class R { void f() { return; } int f(int x) { return x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/R-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/R-crlf.case new file mode 100644 index 000000000..e4169bd21 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/R-crlf.case @@ -0,0 +1,28 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for ReturnStatements. */ +class R { + void f() { + return; + } + + int f(int x) { + return x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + + x + x + x + x + x + x + x + x + x; + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for ReturnStatements. */ +class R { + void f() { + return; + } + + int f(int x) { + return x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + + x + x + x + x + x; + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/R.output b/open-java-format/src/test/resources/test-cases/testdata/R-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/R.output rename to open-java-format/src/test/resources/test-cases/testdata/R-lf.case index 10b49a8d3..325b1ff33 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/R.output +++ b/open-java-format/src/test/resources/test-cases/testdata/R-lf.case @@ -1,3 +1,18 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for ReturnStatements. */ +class R { + void f() { + return; + } + + int f(int x) { + return x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + + x + x + x + x + x + x + x + x + x; + } +} +---------- package com.google.googlejavaformat.java.test; /** Tests for ReturnStatements. */ diff --git a/open-java-format/src/test/resources/test-cases/testdata/S-cr.case b/open-java-format/src/test/resources/test-cases/testdata/S-cr.case new file mode 100644 index 000000000..03205700e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/S-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** * Tests for SimpleNames, SimpleTypes, SingleMemberAnnotations, SingleVariableDeclarations, * Statements, StringLiterals, SuperConstructorInvocations, SuperFieldAccesses, * SuperMethodInvocations, SuperMethodReferences, SwitchCases, SwitchStatements, and * SynchronizedStatements. */ class S { // TODO(jdd): Add tests for higher language levels. int x = 0; @SingleMemberAnnotation( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) S() { super(); } class SS extends S { SS() { super(); super.x = 0; super.foo(); } } void foo() { Object[] object = null; synchronized ( object[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]) { switch ("abc") { case "one": break; case "two": break; case "three": default: break; } } } } ---------- package com.google.googlejavaformat.java.test; /** * Tests for SimpleNames, SimpleTypes, SingleMemberAnnotations, SingleVariableDeclarations, * Statements, StringLiterals, SuperConstructorInvocations, SuperFieldAccesses, * SuperMethodInvocations, SuperMethodReferences, SwitchCases, SwitchStatements, and * SynchronizedStatements. */ class S { // TODO(jdd): Add tests for higher language levels. int x = 0; @SingleMemberAnnotation(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) S() { super(); } class SS extends S { SS() { super(); super.x = 0; super.foo(); } } void foo() { Object[] object = null; synchronized ( object[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]) { switch ("abc") { case "one": break; case "two": break; case "three": default: break; } } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/S-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/S-crlf.case new file mode 100644 index 000000000..157a5119a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/S-crlf.case @@ -0,0 +1,93 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for SimpleNames, SimpleTypes, SingleMemberAnnotations, SingleVariableDeclarations, + * Statements, StringLiterals, SuperConstructorInvocations, SuperFieldAccesses, + * SuperMethodInvocations, SuperMethodReferences, SwitchCases, SwitchStatements, and + * SynchronizedStatements. + */ +class S { + // TODO(jdd): Add tests for higher language levels. + + int x = 0; + + @SingleMemberAnnotation( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) + S() { + super(); + } + + class SS extends S { + SS() { + super(); + super.x = 0; + super.foo(); + } + } + + void foo() { + Object[] object = null; + synchronized ( + object[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]) { + switch ("abc") { + case "one": + break; + case "two": + break; + case "three": + default: + break; + } + } + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for SimpleNames, SimpleTypes, SingleMemberAnnotations, SingleVariableDeclarations, + * Statements, StringLiterals, SuperConstructorInvocations, SuperFieldAccesses, + * SuperMethodInvocations, SuperMethodReferences, SwitchCases, SwitchStatements, and + * SynchronizedStatements. + */ +class S { + // TODO(jdd): Add tests for higher language levels. + + int x = 0; + + @SingleMemberAnnotation(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) + S() { + super(); + } + + class SS extends S { + SS() { + super(); + super.x = 0; + super.foo(); + } + } + + void foo() { + Object[] object = null; + synchronized ( + object[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]) { + switch ("abc") { + case "one": + break; + case "two": + break; + case "three": + default: + break; + } + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/S.output b/open-java-format/src/test/resources/test-cases/testdata/S-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/S.output rename to open-java-format/src/test/resources/test-cases/testdata/S-lf.case index 5814f56f2..f032856a2 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/S.output +++ b/open-java-format/src/test/resources/test-cases/testdata/S-lf.case @@ -1,3 +1,51 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for SimpleNames, SimpleTypes, SingleMemberAnnotations, SingleVariableDeclarations, + * Statements, StringLiterals, SuperConstructorInvocations, SuperFieldAccesses, + * SuperMethodInvocations, SuperMethodReferences, SwitchCases, SwitchStatements, and + * SynchronizedStatements. + */ +class S { + // TODO(jdd): Add tests for higher language levels. + + int x = 0; + + @SingleMemberAnnotation( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) + S() { + super(); + } + + class SS extends S { + SS() { + super(); + super.x = 0; + super.foo(); + } + } + + void foo() { + Object[] object = null; + synchronized ( + object[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]) { + switch ("abc") { + case "one": + break; + case "two": + break; + case "three": + default: + break; + } + } + } +} +---------- package com.google.googlejavaformat.java.test; /** diff --git a/open-java-format/src/test/resources/test-cases/testdata/Sealed-cr.case b/open-java-format/src/test/resources/test-cases/testdata/Sealed-cr.case new file mode 100644 index 000000000..83ad862a4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Sealed-cr.case @@ -0,0 +1 @@ +---------- class T { sealed interface I extends A permits C, B {} final class C implements I {} sealed private interface A permits I {} non-sealed private interface B extends I {} } ---------- class T { sealed interface I extends A permits C, B {} final class C implements I {} private sealed interface A permits I {} private non-sealed interface B extends I {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/Sealed-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/Sealed-crlf.case new file mode 100644 index 000000000..06ce7caa9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Sealed-crlf.case @@ -0,0 +1,17 @@ +---------- +class T { + sealed interface I extends A permits C, B {} + final class C implements I {} + sealed private interface A permits I {} + non-sealed private interface B extends I {} +} +---------- +class T { + sealed interface I extends A permits C, B {} + + final class C implements I {} + + private sealed interface A permits I {} + + private non-sealed interface B extends I {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/Sealed-lf.case b/open-java-format/src/test/resources/test-cases/testdata/Sealed-lf.case new file mode 100644 index 000000000..8d4215a57 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Sealed-lf.case @@ -0,0 +1,17 @@ +---------- +class T { + sealed interface I extends A permits C, B {} + final class C implements I {} + sealed private interface A permits I {} + non-sealed private interface B extends I {} +} +---------- +class T { + sealed interface I extends A permits C, B {} + + final class C implements I {} + + private sealed interface A permits I {} + + private non-sealed interface B extends I {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/SemicolonInClass-cr.case b/open-java-format/src/test/resources/test-cases/testdata/SemicolonInClass-cr.case new file mode 100644 index 000000000..c48295a57 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SemicolonInClass-cr.case @@ -0,0 +1 @@ +---------- class SemicolonInClass { ; } ---------- class SemicolonInClass { ; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/SemicolonInClass-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/SemicolonInClass-crlf.case new file mode 100644 index 000000000..1edbf15ba --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SemicolonInClass-crlf.case @@ -0,0 +1,8 @@ +---------- +class SemicolonInClass { + ; +} +---------- +class SemicolonInClass { + ; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/SemicolonInClass-lf.case b/open-java-format/src/test/resources/test-cases/testdata/SemicolonInClass-lf.case new file mode 100644 index 000000000..1e813a034 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SemicolonInClass-lf.case @@ -0,0 +1,8 @@ +---------- +class SemicolonInClass { + ; +} +---------- +class SemicolonInClass { + ; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/SingleMemberAnnotation-cr.case b/open-java-format/src/test/resources/test-cases/testdata/SingleMemberAnnotation-cr.case new file mode 100644 index 000000000..798d4f542 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SingleMemberAnnotation-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; public @interface SingleMemberAnnotation { int value(); } ---------- package com.google.googlejavaformat.java.test; public @interface SingleMemberAnnotation { int value(); } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/SingleMemberAnnotation-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/SingleMemberAnnotation-crlf.case new file mode 100644 index 000000000..8dddbb0f5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SingleMemberAnnotation-crlf.case @@ -0,0 +1,12 @@ +---------- +package com.google.googlejavaformat.java.test; + +public @interface SingleMemberAnnotation { + int value(); +} +---------- +package com.google.googlejavaformat.java.test; + +public @interface SingleMemberAnnotation { + int value(); +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/SingleMemberAnnotation-lf.case b/open-java-format/src/test/resources/test-cases/testdata/SingleMemberAnnotation-lf.case new file mode 100644 index 000000000..fe0ae55d4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SingleMemberAnnotation-lf.case @@ -0,0 +1,12 @@ +---------- +package com.google.googlejavaformat.java.test; + +public @interface SingleMemberAnnotation { + int value(); +} +---------- +package com.google.googlejavaformat.java.test; + +public @interface SingleMemberAnnotation { + int value(); +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/SuperQualifier-cr.case b/open-java-format/src/test/resources/test-cases/testdata/SuperQualifier-cr.case new file mode 100644 index 000000000..9162c70f1 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SuperQualifier-cr.case @@ -0,0 +1 @@ +---------- class SuperQualifier { String a() { return this.toStringHelper() .add("foo", foo_________________________________________) .add("bar", bar_________________________________________); } String b() { return super.toStringHelper() .add("foo", foo_________________________________________) .add("bar", bar_________________________________________); } { this.aaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb( ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc); } } ---------- class SuperQualifier { String a() { return this.toStringHelper() .add("foo", foo_________________________________________) .add("bar", bar_________________________________________); } String b() { return super.toStringHelper() .add("foo", foo_________________________________________) .add("bar", bar_________________________________________); } { this.aaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb(ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/SuperQualifier-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/SuperQualifier-crlf.case new file mode 100644 index 000000000..3d0bb7d50 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SuperQualifier-crlf.case @@ -0,0 +1,37 @@ +---------- +class SuperQualifier { + String a() { + return this.toStringHelper() + .add("foo", foo_________________________________________) + .add("bar", bar_________________________________________); + } + + String b() { + return super.toStringHelper() + .add("foo", foo_________________________________________) + .add("bar", bar_________________________________________); + } + + { + this.aaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb( + ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc); + } +} +---------- +class SuperQualifier { + String a() { + return this.toStringHelper() + .add("foo", foo_________________________________________) + .add("bar", bar_________________________________________); + } + + String b() { + return super.toStringHelper() + .add("foo", foo_________________________________________) + .add("bar", bar_________________________________________); + } + + { + this.aaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb(ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SuperQualifier.output b/open-java-format/src/test/resources/test-cases/testdata/SuperQualifier-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SuperQualifier.output rename to open-java-format/src/test/resources/test-cases/testdata/SuperQualifier-lf.case index 5061f2c43..674adb426 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SuperQualifier.output +++ b/open-java-format/src/test/resources/test-cases/testdata/SuperQualifier-lf.case @@ -1,3 +1,23 @@ +---------- +class SuperQualifier { + String a() { + return this.toStringHelper() + .add("foo", foo_________________________________________) + .add("bar", bar_________________________________________); + } + + String b() { + return super.toStringHelper() + .add("foo", foo_________________________________________) + .add("bar", bar_________________________________________); + } + + { + this.aaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbb( + ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc); + } +} +---------- class SuperQualifier { String a() { return this.toStringHelper() diff --git a/open-java-format/src/test/resources/test-cases/testdata/SwitchDouble-cr.case b/open-java-format/src/test/resources/test-cases/testdata/SwitchDouble-cr.case new file mode 100644 index 000000000..f13c9830b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchDouble-cr.case @@ -0,0 +1 @@ +---------- class SwitchDouble { void x(Object o) { switch (o) { case null, default: } } } ---------- class SwitchDouble { void x(Object o) { switch (o) { case null, default: } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/SwitchDouble-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/SwitchDouble-crlf.case new file mode 100644 index 000000000..320cf4158 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchDouble-crlf.case @@ -0,0 +1,16 @@ +---------- +class SwitchDouble { + void x(Object o) { + switch (o) { + case null, default: + } + } +} +---------- +class SwitchDouble { + void x(Object o) { + switch (o) { + case null, default: + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/SwitchDouble-lf.case b/open-java-format/src/test/resources/test-cases/testdata/SwitchDouble-lf.case new file mode 100644 index 000000000..bc8be945d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchDouble-lf.case @@ -0,0 +1,16 @@ +---------- +class SwitchDouble { + void x(Object o) { + switch (o) { + case null, default: + } + } +} +---------- +class SwitchDouble { + void x(Object o) { + switch (o) { + case null, default: + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/SwitchGuardClause-cr.case b/open-java-format/src/test/resources/test-cases/testdata/SwitchGuardClause-cr.case new file mode 100644 index 000000000..fd8131b0e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchGuardClause-cr.case @@ -0,0 +1 @@ +---------- class SwitchGuardClause { boolean test(Object x) { return switch (x) { case String s when s.length() < 5 -> true; case Integer i -> false; default -> true; }; } } ---------- class SwitchGuardClause { boolean test(Object x) { return switch (x) { case String s when s.length() < 5 -> true; case Integer i -> false; default -> true; }; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/SwitchGuardClause-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/SwitchGuardClause-crlf.case new file mode 100644 index 000000000..26575a870 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchGuardClause-crlf.case @@ -0,0 +1,20 @@ +---------- +class SwitchGuardClause { + boolean test(Object x) { + return switch (x) { + case String s when s.length() < 5 -> true; + case Integer i -> false; + default -> true; + }; + } +} +---------- +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/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchGuardClause.output b/open-java-format/src/test/resources/test-cases/testdata/SwitchGuardClause-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchGuardClause.output rename to open-java-format/src/test/resources/test-cases/testdata/SwitchGuardClause-lf.case index f42195722..24f7f35aa 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchGuardClause.output +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchGuardClause-lf.case @@ -1,3 +1,14 @@ +---------- +class SwitchGuardClause { + boolean test(Object x) { + return switch (x) { + case String s when s.length() < 5 -> true; + case Integer i -> false; + default -> true; + }; + } +} +---------- class SwitchGuardClause { boolean test(Object x) { return switch (x) { diff --git a/open-java-format/src/test/resources/test-cases/testdata/SwitchRecord-cr.case b/open-java-format/src/test/resources/test-cases/testdata/SwitchRecord-cr.case new file mode 100644 index 000000000..1f8c28d28 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchRecord-cr.case @@ -0,0 +1 @@ +---------- 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; }; } } ---------- 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; }; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/SwitchRecord-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/SwitchRecord-crlf.case new file mode 100644 index 000000000..0fb5abe96 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchRecord-crlf.case @@ -0,0 +1,67 @@ +---------- +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; + }; + } +} +---------- +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/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchRecord.output b/open-java-format/src/test/resources/test-cases/testdata/SwitchRecord-lf.case similarity index 62% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchRecord.output rename to open-java-format/src/test/resources/test-cases/testdata/SwitchRecord-lf.case index f34e15f73..6d351ea49 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchRecord.output +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchRecord-lf.case @@ -1,3 +1,26 @@ +---------- +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; + }; + } +} +---------- record SwitchRecord(int i) { int x(Object o) { return switch (o) { diff --git a/open-java-format/src/test/resources/test-cases/testdata/SwitchUnderscore-cr.case b/open-java-format/src/test/resources/test-cases/testdata/SwitchUnderscore-cr.case new file mode 100644 index 000000000..84cad9dae --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchUnderscore-cr.case @@ -0,0 +1 @@ +---------- public class SwitchUnderscore { void x(Object o) { switch (o) { case String _: default: } } } ---------- public class SwitchUnderscore { void x(Object o) { switch (o) { case String _: default: } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/SwitchUnderscore-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/SwitchUnderscore-crlf.case new file mode 100644 index 000000000..457e2e6cd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchUnderscore-crlf.case @@ -0,0 +1,18 @@ +---------- +public class SwitchUnderscore { + void x(Object o) { + switch (o) { + case String _: + default: + } + } +} +---------- +public class SwitchUnderscore { + void x(Object o) { + switch (o) { + case String _: + default: + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchUnderscore.output b/open-java-format/src/test/resources/test-cases/testdata/SwitchUnderscore-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchUnderscore.output rename to open-java-format/src/test/resources/test-cases/testdata/SwitchUnderscore-lf.case index 6ea58e55a..ccd0c9c9d 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchUnderscore.output +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchUnderscore-lf.case @@ -1,3 +1,13 @@ +---------- +public class SwitchUnderscore { + void x(Object o) { + switch (o) { + case String _: + default: + } + } +} +---------- public class SwitchUnderscore { void x(Object o) { switch (o) { diff --git a/open-java-format/src/test/resources/test-cases/testdata/T-cr.case b/open-java-format/src/test/resources/test-cases/testdata/T-cr.case new file mode 100644 index 000000000..80ea6bc8a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/T-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** * Tests for ThisExpressions, ThrowStatements, TryStatements, TypeDeclarationStatements, * TypeDeclarations, TypeLiterals, TypeMethodReferences, TypeParameters, and Types. */ class T { // TODO(jdd): Add tests for higher language levels. T f(int x) throws Exception { class TT {} if (x == 0 || T.class == null) { return this; } try (AutoCloseable y = null) { throw new RuntimeException(); } } } ---------- package com.google.googlejavaformat.java.test; /** * Tests for ThisExpressions, ThrowStatements, TryStatements, TypeDeclarationStatements, * TypeDeclarations, TypeLiterals, TypeMethodReferences, TypeParameters, and Types. */ class T { // TODO(jdd): Add tests for higher language levels. T f(int x) throws Exception { class TT {} if (x == 0 || T.class == null) { return this; } try (AutoCloseable y = null) { throw new RuntimeException(); } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/T-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/T-crlf.case new file mode 100644 index 000000000..b2aa22596 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/T-crlf.case @@ -0,0 +1,40 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for ThisExpressions, ThrowStatements, TryStatements, TypeDeclarationStatements, + * TypeDeclarations, TypeLiterals, TypeMethodReferences, TypeParameters, and Types. + */ +class T { + // TODO(jdd): Add tests for higher language levels. + + T f(int x) throws Exception { + class TT {} + if (x == 0 || T.class == null) { + return this; + } + try (AutoCloseable y = null) { + throw new RuntimeException(); + } + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for ThisExpressions, ThrowStatements, TryStatements, TypeDeclarationStatements, + * TypeDeclarations, TypeLiterals, TypeMethodReferences, TypeParameters, and Types. + */ +class T { + // TODO(jdd): Add tests for higher language levels. + + T f(int x) throws Exception { + class TT {} + if (x == 0 || T.class == null) { + return this; + } + try (AutoCloseable y = null) { + throw new RuntimeException(); + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/T.output b/open-java-format/src/test/resources/test-cases/testdata/T-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/T.output rename to open-java-format/src/test/resources/test-cases/testdata/T-lf.case index 44788cde6..daf8a3785 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/T.output +++ b/open-java-format/src/test/resources/test-cases/testdata/T-lf.case @@ -1,3 +1,24 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for ThisExpressions, ThrowStatements, TryStatements, TypeDeclarationStatements, + * TypeDeclarations, TypeLiterals, TypeMethodReferences, TypeParameters, and Types. + */ +class T { + // TODO(jdd): Add tests for higher language levels. + + T f(int x) throws Exception { + class TT {} + if (x == 0 || T.class == null) { + return this; + } + try (AutoCloseable y = null) { + throw new RuntimeException(); + } + } +} +---------- package com.google.googlejavaformat.java.test; /** diff --git a/open-java-format/src/test/resources/test-cases/testdata/TabularMixedSignInitializer-cr.case b/open-java-format/src/test/resources/test-cases/testdata/TabularMixedSignInitializer-cr.case new file mode 100644 index 000000000..19410d2af --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/TabularMixedSignInitializer-cr.case @@ -0,0 +1 @@ +---------- public class T { private static final double[] f = { 95.0, 75.0, -95.0, 75.0, -95.0, 75.0, +95.0, 75.0 }; private static final int[] g = { x++, y, ++z, x, y, ~z, --x, ++y, z-- }; private static final bool[] h = { a, b, c, d, !e, a, b, c }; } ---------- public class T { private static final double[] f = { 95.0, 75.0, -95.0, 75.0, -95.0, 75.0, +95.0, 75.0 }; private static final int[] g = { x++, y, ++z, x, y, ~z, --x, ++y, z-- }; private static final bool[] h = { a, b, c, d, !e, a, b, c }; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/TabularMixedSignInitializer-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/TabularMixedSignInitializer-crlf.case new file mode 100644 index 000000000..3f3ae96a4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/TabularMixedSignInitializer-crlf.case @@ -0,0 +1,36 @@ +---------- +public class T { + private static final double[] f = { + 95.0, 75.0, -95.0, 75.0, + -95.0, 75.0, +95.0, 75.0 + }; + + private static final int[] g = { + x++, y, ++z, + x, y, ~z, + --x, ++y, z-- + }; + + private static final bool[] h = { + a, b, c, d, + !e, a, b, c + }; +} +---------- +public class T { + private static final double[] f = { + 95.0, 75.0, -95.0, 75.0, + -95.0, 75.0, +95.0, 75.0 + }; + + private static final int[] g = { + x++, y, ++z, + x, y, ~z, + --x, ++y, z-- + }; + + private static final bool[] h = { + a, b, c, d, + !e, a, b, c + }; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TabularMixedSignInitializer.output b/open-java-format/src/test/resources/test-cases/testdata/TabularMixedSignInitializer-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TabularMixedSignInitializer.output rename to open-java-format/src/test/resources/test-cases/testdata/TabularMixedSignInitializer-lf.case index f2c0c8252..04d8fbb49 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TabularMixedSignInitializer.output +++ b/open-java-format/src/test/resources/test-cases/testdata/TabularMixedSignInitializer-lf.case @@ -1,3 +1,22 @@ +---------- +public class T { + private static final double[] f = { + 95.0, 75.0, -95.0, 75.0, + -95.0, 75.0, +95.0, 75.0 + }; + + private static final int[] g = { + x++, y, ++z, + x, y, ~z, + --x, ++y, z-- + }; + + private static final bool[] h = { + a, b, c, d, + !e, a, b, c + }; +} +---------- public class T { private static final double[] f = { 95.0, 75.0, -95.0, 75.0, diff --git a/open-java-format/src/test/resources/test-cases/testdata/TryWithResources-cr.case b/open-java-format/src/test/resources/test-cases/testdata/TryWithResources-cr.case new file mode 100644 index 000000000..7985fc492 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/TryWithResources-cr.case @@ -0,0 +1 @@ +---------- class TryWtihResources { { try (@A C c = c(); ) {} try (final @A C c = c(); ) {} try (@A final C c = c(); ) {} try (@A final @B C c = c(); ) {} try (final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(testFile, Charset.defaultCharset()))) { writer.append("tom cruise\n").append("avatar\n"); writer.flush(); } try (@SuppressWarnings("resource") Scanner inputScanner = new Scanner(inputStream).useDelimiter("\\s+|,")) { while (inputScanner.hasNextLong()) { placementIds.add(inputScanner.nextLong()); } } } } ---------- class TryWtihResources { { try (@A C c = c(); ) {} try (final @A C c = c(); ) {} try (@A final C c = c(); ) {} try (@A final @B C c = c(); ) {} try (final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(testFile, Charset.defaultCharset()))) { writer.append("tom cruise\n").append("avatar\n"); writer.flush(); } try (@SuppressWarnings("resource") Scanner inputScanner = new Scanner(inputStream).useDelimiter("\\s+|,")) { while (inputScanner.hasNextLong()) { placementIds.add(inputScanner.nextLong()); } } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/TryWithResources-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/TryWithResources-crlf.case new file mode 100644 index 000000000..74b5d8e56 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/TryWithResources-crlf.case @@ -0,0 +1,44 @@ +---------- +class TryWtihResources { + { + try (@A C c = c(); ) {} + try (final @A C c = c(); ) {} + try (@A final C c = c(); ) {} + try (@A final @B C c = c(); ) {} + + try (final BufferedWriter writer = + new BufferedWriter(new OutputStreamWriter(testFile, Charset.defaultCharset()))) { + writer.append("tom cruise\n").append("avatar\n"); + writer.flush(); + } + + try (@SuppressWarnings("resource") + Scanner inputScanner = new Scanner(inputStream).useDelimiter("\\s+|,")) { + while (inputScanner.hasNextLong()) { + placementIds.add(inputScanner.nextLong()); + } + } + } +} +---------- +class TryWtihResources { + { + try (@A C c = c(); ) {} + try (final @A C c = c(); ) {} + try (@A final C c = c(); ) {} + try (@A final @B C c = c(); ) {} + + try (final BufferedWriter writer = + new BufferedWriter(new OutputStreamWriter(testFile, Charset.defaultCharset()))) { + writer.append("tom cruise\n").append("avatar\n"); + writer.flush(); + } + + try (@SuppressWarnings("resource") + Scanner inputScanner = new Scanner(inputStream).useDelimiter("\\s+|,")) { + while (inputScanner.hasNextLong()) { + placementIds.add(inputScanner.nextLong()); + } + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TryWithResources.output b/open-java-format/src/test/resources/test-cases/testdata/TryWithResources-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TryWithResources.output rename to open-java-format/src/test/resources/test-cases/testdata/TryWithResources-lf.case index bbf6a1fe7..a2b835d84 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TryWithResources.output +++ b/open-java-format/src/test/resources/test-cases/testdata/TryWithResources-lf.case @@ -1,3 +1,26 @@ +---------- +class TryWtihResources { + { + try (@A C c = c(); ) {} + try (final @A C c = c(); ) {} + try (@A final C c = c(); ) {} + try (@A final @B C c = c(); ) {} + + try (final BufferedWriter writer = + new BufferedWriter(new OutputStreamWriter(testFile, Charset.defaultCharset()))) { + writer.append("tom cruise\n").append("avatar\n"); + writer.flush(); + } + + try (@SuppressWarnings("resource") + Scanner inputScanner = new Scanner(inputStream).useDelimiter("\\s+|,")) { + while (inputScanner.hasNextLong()) { + placementIds.add(inputScanner.nextLong()); + } + } + } +} +---------- class TryWtihResources { { try (@A C c = c(); ) {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/U-cr.case b/open-java-format/src/test/resources/test-cases/testdata/U-cr.case new file mode 100644 index 000000000..e5ff36ac2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/U-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** Tests for UnionTypes. */ class U { void f() { class Exception0 extends Exception {} class Exception1 extends Exception {} class Exception2 extends Exception {} class Exception3 extends Exception {} class Exception4 extends Exception {} class Exception5 extends Exception {} class Exception6 extends Exception {} class Exception7 extends Exception {} class Exception8 extends Exception {} class Exception9 extends Exception {} try { char c = '\123'; switch (c) { case '0': throw new Exception0(); case '1': throw new Exception1(); case '2': throw new Exception2(); case '3': throw new Exception3(); case '4': throw new Exception4(); case '5': throw new Exception5(); case '6': throw new Exception6(); case '7': throw new Exception7(); case '8': throw new Exception8(); case '9': default: throw new Exception9(); } } catch ( Exception0 | Exception1 | Exception2 | Exception3 | Exception4 | Exception5 | Exception6 | Exception7 | Exception8 | Exception9 e) { } } } ---------- package com.google.googlejavaformat.java.test; /** Tests for UnionTypes. */ class U { void f() { class Exception0 extends Exception {} class Exception1 extends Exception {} class Exception2 extends Exception {} class Exception3 extends Exception {} class Exception4 extends Exception {} class Exception5 extends Exception {} class Exception6 extends Exception {} class Exception7 extends Exception {} class Exception8 extends Exception {} class Exception9 extends Exception {} try { char c = '\123'; switch (c) { case '0': throw new Exception0(); case '1': throw new Exception1(); case '2': throw new Exception2(); case '3': throw new Exception3(); case '4': throw new Exception4(); case '5': throw new Exception5(); case '6': throw new Exception6(); case '7': throw new Exception7(); case '8': throw new Exception8(); case '9': default: throw new Exception9(); } } catch (Exception0 | Exception1 | Exception2 | Exception3 | Exception4 | Exception5 | Exception6 | Exception7 | Exception8 | Exception9 e) { } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/U-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/U-crlf.case new file mode 100644 index 000000000..cfcb2980b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/U-crlf.case @@ -0,0 +1,102 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for UnionTypes. */ +class U { + void f() { + class Exception0 extends Exception {} + class Exception1 extends Exception {} + class Exception2 extends Exception {} + class Exception3 extends Exception {} + class Exception4 extends Exception {} + class Exception5 extends Exception {} + class Exception6 extends Exception {} + class Exception7 extends Exception {} + class Exception8 extends Exception {} + class Exception9 extends Exception {} + try { + char c = '\123'; + switch (c) { + case '0': + throw new Exception0(); + case '1': + throw new Exception1(); + case '2': + throw new Exception2(); + case '3': + throw new Exception3(); + case '4': + throw new Exception4(); + case '5': + throw new Exception5(); + case '6': + throw new Exception6(); + case '7': + throw new Exception7(); + case '8': + throw new Exception8(); + case '9': + default: + throw new Exception9(); + } + } catch ( + Exception0 | Exception1 | Exception2 | Exception3 | Exception4 | Exception5 | Exception6 + | Exception7 | Exception8 | Exception9 + e) { + } + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for UnionTypes. */ +class U { + void f() { + class Exception0 extends Exception {} + class Exception1 extends Exception {} + class Exception2 extends Exception {} + class Exception3 extends Exception {} + class Exception4 extends Exception {} + class Exception5 extends Exception {} + class Exception6 extends Exception {} + class Exception7 extends Exception {} + class Exception8 extends Exception {} + class Exception9 extends Exception {} + try { + char c = '\123'; + switch (c) { + case '0': + throw new Exception0(); + case '1': + throw new Exception1(); + case '2': + throw new Exception2(); + case '3': + throw new Exception3(); + case '4': + throw new Exception4(); + case '5': + throw new Exception5(); + case '6': + throw new Exception6(); + case '7': + throw new Exception7(); + case '8': + throw new Exception8(); + case '9': + default: + throw new Exception9(); + } + } catch (Exception0 + | Exception1 + | Exception2 + | Exception3 + | Exception4 + | Exception5 + | Exception6 + | Exception7 + | Exception8 + | Exception9 e) { + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/U.output b/open-java-format/src/test/resources/test-cases/testdata/U-lf.case similarity index 55% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/U.output rename to open-java-format/src/test/resources/test-cases/testdata/U-lf.case index 52e58ff6d..a0f18f03a 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/U.output +++ b/open-java-format/src/test/resources/test-cases/testdata/U-lf.case @@ -1,3 +1,52 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for UnionTypes. */ +class U { + void f() { + class Exception0 extends Exception {} + class Exception1 extends Exception {} + class Exception2 extends Exception {} + class Exception3 extends Exception {} + class Exception4 extends Exception {} + class Exception5 extends Exception {} + class Exception6 extends Exception {} + class Exception7 extends Exception {} + class Exception8 extends Exception {} + class Exception9 extends Exception {} + try { + char c = '\123'; + switch (c) { + case '0': + throw new Exception0(); + case '1': + throw new Exception1(); + case '2': + throw new Exception2(); + case '3': + throw new Exception3(); + case '4': + throw new Exception4(); + case '5': + throw new Exception5(); + case '6': + throw new Exception6(); + case '7': + throw new Exception7(); + case '8': + throw new Exception8(); + case '9': + default: + throw new Exception9(); + } + } catch ( + Exception0 | Exception1 | Exception2 | Exception3 | Exception4 | Exception5 | Exception6 + | Exception7 | Exception8 | Exception9 + e) { + } + } +} +---------- package com.google.googlejavaformat.java.test; /** Tests for UnionTypes. */ diff --git a/open-java-format/src/test/resources/test-cases/testdata/UnaryMinus-cr.case b/open-java-format/src/test/resources/test-cases/testdata/UnaryMinus-cr.case new file mode 100644 index 000000000..a7f9c67fa --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/UnaryMinus-cr.case @@ -0,0 +1 @@ +---------- class UnaryMinus { { int b = - 1; } } ---------- class UnaryMinus { { int b = -1; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/UnaryMinus-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/UnaryMinus-crlf.case new file mode 100644 index 000000000..33056af37 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/UnaryMinus-crlf.case @@ -0,0 +1,12 @@ +---------- +class UnaryMinus { + { + int b = - 1; + } +} +---------- +class UnaryMinus { + { + int b = -1; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/UnaryMinus-lf.case b/open-java-format/src/test/resources/test-cases/testdata/UnaryMinus-lf.case new file mode 100644 index 000000000..487580bf3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/UnaryMinus-lf.case @@ -0,0 +1,12 @@ +---------- +class UnaryMinus { + { + int b = - 1; + } +} +---------- +class UnaryMinus { + { + int b = -1; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/Unformatted2-cr.case b/open-java-format/src/test/resources/test-cases/testdata/Unformatted2-cr.case new file mode 100644 index 000000000..8be78677b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Unformatted2-cr.case @@ -0,0 +1 @@ +---------- package com . google . googlejavaformat ; /** * Rewrite comments. This interface is implemented by * {@link com.google.googlejavaformat.java.JavaCommentsHelper JavaCommentsHelper}. */ public interface CommentsHelper { /** * Try to rewrite comments, returning rewritten text. * @param text0 the literal comment text to rewrite * @param maxWidth the line length for the output * @param column0 the current column * @return the rewritten comment */ String rewrite ( String text0 , int maxWidth , int column0 ) ; } ---------- package com.google.googlejavaformat; /** * Rewrite comments. This interface is implemented by * {@link com.google.googlejavaformat.java.JavaCommentsHelper JavaCommentsHelper}. */ public interface CommentsHelper { /** * Try to rewrite comments, returning rewritten text. * @param text0 the literal comment text to rewrite * @param maxWidth the line length for the output * @param column0 the current column * @return the rewritten comment */ String rewrite(String text0, int maxWidth, int column0); } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/Unformatted2-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/Unformatted2-crlf.case new file mode 100644 index 000000000..8463d47f2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Unformatted2-crlf.case @@ -0,0 +1,34 @@ +---------- +package com . google . googlejavaformat ; + +/** +* Rewrite comments. This interface is implemented by +* {@link com.google.googlejavaformat.java.JavaCommentsHelper JavaCommentsHelper}. +*/ +public interface CommentsHelper { + /** + * Try to rewrite comments, returning rewritten text. + * @param text0 the literal comment text to rewrite + * @param maxWidth the line length for the output + * @param column0 the current column + * @return the rewritten comment + */ + String rewrite ( String text0 , int maxWidth , int column0 ) ; +} +---------- +package com.google.googlejavaformat; + +/** + * Rewrite comments. This interface is implemented by + * {@link com.google.googlejavaformat.java.JavaCommentsHelper JavaCommentsHelper}. + */ +public interface CommentsHelper { + /** + * Try to rewrite comments, returning rewritten text. + * @param text0 the literal comment text to rewrite + * @param maxWidth the line length for the output + * @param column0 the current column + * @return the rewritten comment + */ + String rewrite(String text0, int maxWidth, int column0); +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/Unformatted2-lf.case b/open-java-format/src/test/resources/test-cases/testdata/Unformatted2-lf.case new file mode 100644 index 000000000..6355d0cd1 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Unformatted2-lf.case @@ -0,0 +1,34 @@ +---------- +package com . google . googlejavaformat ; + +/** +* Rewrite comments. This interface is implemented by +* {@link com.google.googlejavaformat.java.JavaCommentsHelper JavaCommentsHelper}. +*/ +public interface CommentsHelper { + /** + * Try to rewrite comments, returning rewritten text. + * @param text0 the literal comment text to rewrite + * @param maxWidth the line length for the output + * @param column0 the current column + * @return the rewritten comment + */ + String rewrite ( String text0 , int maxWidth , int column0 ) ; +} +---------- +package com.google.googlejavaformat; + +/** + * Rewrite comments. This interface is implemented by + * {@link com.google.googlejavaformat.java.JavaCommentsHelper JavaCommentsHelper}. + */ +public interface CommentsHelper { + /** + * Try to rewrite comments, returning rewritten text. + * @param text0 the literal comment text to rewrite + * @param maxWidth the line length for the output + * @param column0 the current column + * @return the rewritten comment + */ + String rewrite(String text0, int maxWidth, int column0); +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/Unformatted3-cr.case b/open-java-format/src/test/resources/test-cases/testdata/Unformatted3-cr.case new file mode 100644 index 000000000..39e52f5b3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Unformatted3-cr.case @@ -0,0 +1 @@ +---------- package com . google . googlejavaformat ; class Unformatted3 { /** * This comment is not reflowed * because it contains
    preformatted
    * content. */ } ---------- package com.google.googlejavaformat; class Unformatted3 { /** * This comment is not reflowed * because it contains
    preformatted
    * content. */ } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/Unformatted3-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/Unformatted3-crlf.case new file mode 100644 index 000000000..102ed0e4e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Unformatted3-crlf.case @@ -0,0 +1,20 @@ +---------- +package com . google . googlejavaformat ; + +class Unformatted3 { + /** + * This comment is not reflowed + * because it contains
    preformatted
    + * content. + */ +} +---------- +package com.google.googlejavaformat; + +class Unformatted3 { + /** + * This comment is not reflowed + * because it contains
    preformatted
    + * content. + */ +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/Unformatted3-lf.case b/open-java-format/src/test/resources/test-cases/testdata/Unformatted3-lf.case new file mode 100644 index 000000000..baf278380 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Unformatted3-lf.case @@ -0,0 +1,20 @@ +---------- +package com . google . googlejavaformat ; + +class Unformatted3 { + /** + * This comment is not reflowed + * because it contains
    preformatted
    + * content. + */ +} +---------- +package com.google.googlejavaformat; + +class Unformatted3 { + /** + * This comment is not reflowed + * because it contains
    preformatted
    + * content. + */ +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/Unnamed-cr.case b/open-java-format/src/test/resources/test-cases/testdata/Unnamed-cr.case new file mode 100644 index 000000000..139ceb470 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Unnamed-cr.case @@ -0,0 +1 @@ +---------- class Unnamed { { int acc = 0; for (Order _ : orders) { if (acc < LIMIT) { acc++; } } for (int i = 0, _ = sideEffect(); i < 10; i++) { } Queue 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")); } } ---------- class Unnamed { { int acc = 0; for (Order _ : orders) { if (acc < LIMIT) { acc++; } } for (int i = 0, _ = sideEffect(); i < 10; i++) {} Queue 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")); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/Unnamed-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/Unnamed-crlf.case new file mode 100644 index 000000000..61f90fc23 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Unnamed-crlf.case @@ -0,0 +1,96 @@ +---------- +class Unnamed { + { + int acc = 0; + for (Order _ : orders) { + if (acc < LIMIT) { + acc++; + } + } + + + + for (int i = 0, _ = sideEffect(); i < 10; i++) { } + + Queue 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")); + } +} +---------- +class Unnamed { + { + int acc = 0; + for (Order _ : orders) { + if (acc < LIMIT) { + acc++; + } + } + + for (int i = 0, _ = sideEffect(); i < 10; i++) {} + + Queue 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/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unnamed.output b/open-java-format/src/test/resources/test-cases/testdata/Unnamed-lf.case similarity index 54% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unnamed.output rename to open-java-format/src/test/resources/test-cases/testdata/Unnamed-lf.case index 09e3df9a4..cd66dfc06 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unnamed.output +++ b/open-java-format/src/test/resources/test-cases/testdata/Unnamed-lf.case @@ -1,3 +1,51 @@ +---------- +class Unnamed { + { + int acc = 0; + for (Order _ : orders) { + if (acc < LIMIT) { + acc++; + } + } + + + + for (int i = 0, _ = sideEffect(); i < 10; i++) { } + + Queue 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")); + } +} +---------- class Unnamed { { int acc = 0; diff --git a/open-java-format/src/test/resources/test-cases/testdata/UnnamedPattern-cr.case b/open-java-format/src/test/resources/test-cases/testdata/UnnamedPattern-cr.case new file mode 100644 index 000000000..57f75ccfd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/UnnamedPattern-cr.case @@ -0,0 +1 @@ +---------- class UnnamedPattern { sealed interface Shape permits Box {} record Box(Object a, Object b) implements Shape {} record Pair(Box first, Object second) {} int classify(Shape s) { return switch (s) { case Box(Integer i, _) when i > 0 -> i; case Box(Integer i, _) -> i; case Box(_, _) -> 0; }; } int nested(Object o) { return switch (o) { case Pair(Box(var _, Integer i), _) -> i; case Pair(Box(_, _), _) -> 0; default -> -1; }; } boolean isBox(Object o) { return o instanceof Box(Integer _, _); } void swallow(Runnable r) { try { r.run(); } catch (Exception _) { // ignored } } } ---------- class UnnamedPattern { sealed interface Shape permits Box {} record Box(Object a, Object b) implements Shape {} record Pair(Box first, Object second) {} int classify(Shape s) { return switch (s) { case Box(Integer i, _) when i > 0 -> i; case Box(Integer i, _) -> i; case Box(_, _) -> 0; }; } int nested(Object o) { return switch (o) { case Pair(Box(var _, Integer i), _) -> i; case Pair(Box(_, _), _) -> 0; default -> -1; }; } boolean isBox(Object o) { return o instanceof Box(Integer _, _); } void swallow(Runnable r) { try { r.run(); } catch (Exception _) { // ignored } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/UnnamedPattern-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/UnnamedPattern-crlf.case new file mode 100644 index 000000000..0c8a7c8cb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/UnnamedPattern-crlf.case @@ -0,0 +1,71 @@ +---------- +class UnnamedPattern { + sealed interface Shape permits Box {} + record Box(Object a, Object b) implements Shape {} + + record Pair(Box first, Object second) {} + + int classify(Shape s) { + return switch (s) { + case Box(Integer i, _) when i > 0 -> i; + case Box(Integer i, _) -> i; + case Box(_, _) -> 0; + }; + } + + int nested(Object o) { + return switch (o) { + case Pair(Box(var _, Integer i), _) -> i; + case Pair(Box(_, _), _) -> 0; + default -> -1; + }; + } + + boolean isBox(Object o) { + return o instanceof Box(Integer _, _); + } + + void swallow(Runnable r) { + try { + r.run(); + } catch (Exception _) { + // ignored + } + } +} +---------- +class UnnamedPattern { + sealed interface Shape permits Box {} + + record Box(Object a, Object b) implements Shape {} + + record Pair(Box first, Object second) {} + + int classify(Shape s) { + return switch (s) { + case Box(Integer i, _) when i > 0 -> i; + case Box(Integer i, _) -> i; + case Box(_, _) -> 0; + }; + } + + int nested(Object o) { + return switch (o) { + case Pair(Box(var _, Integer i), _) -> i; + case Pair(Box(_, _), _) -> 0; + default -> -1; + }; + } + + boolean isBox(Object o) { + return o instanceof Box(Integer _, _); + } + + void swallow(Runnable r) { + try { + r.run(); + } catch (Exception _) { + // ignored + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnnamedPattern.output b/open-java-format/src/test/resources/test-cases/testdata/UnnamedPattern-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnnamedPattern.output rename to open-java-format/src/test/resources/test-cases/testdata/UnnamedPattern-lf.case index 21a53185f..7c27bfc4f 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnnamedPattern.output +++ b/open-java-format/src/test/resources/test-cases/testdata/UnnamedPattern-lf.case @@ -1,3 +1,39 @@ +---------- +class UnnamedPattern { + sealed interface Shape permits Box {} + record Box(Object a, Object b) implements Shape {} + + record Pair(Box first, Object second) {} + + int classify(Shape s) { + return switch (s) { + case Box(Integer i, _) when i > 0 -> i; + case Box(Integer i, _) -> i; + case Box(_, _) -> 0; + }; + } + + int nested(Object o) { + return switch (o) { + case Pair(Box(var _, Integer i), _) -> i; + case Pair(Box(_, _), _) -> 0; + default -> -1; + }; + } + + boolean isBox(Object o) { + return o instanceof Box(Integer _, _); + } + + void swallow(Runnable r) { + try { + r.run(); + } catch (Exception _) { + // ignored + } + } +} +---------- class UnnamedPattern { sealed interface Shape permits Box {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/V-cr.case b/open-java-format/src/test/resources/test-cases/testdata/V-cr.case new file mode 100644 index 000000000..aa3f10970 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/V-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** * Tests for VariableDeclarationExpressions, VariableDeclarationFragments, and * VariableDeclarationStatements. */ class V { int x = 0, y = 1; void f() { for (int a = 0, b = 1; a < b;) {} } } ---------- package com.google.googlejavaformat.java.test; /** * Tests for VariableDeclarationExpressions, VariableDeclarationFragments, and * VariableDeclarationStatements. */ class V { int x = 0, y = 1; void f() { for (int a = 0, b = 1; a < b; ) {} } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/V-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/V-crlf.case new file mode 100644 index 000000000..2b2bbc55e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/V-crlf.case @@ -0,0 +1,28 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for VariableDeclarationExpressions, VariableDeclarationFragments, and + * VariableDeclarationStatements. + */ +class V { + int x = 0, y = 1; + + void f() { + for (int a = 0, b = 1; a < b;) {} + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for VariableDeclarationExpressions, VariableDeclarationFragments, and + * VariableDeclarationStatements. + */ +class V { + int x = 0, y = 1; + + void f() { + for (int a = 0, b = 1; a < b; ) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/V-lf.case b/open-java-format/src/test/resources/test-cases/testdata/V-lf.case new file mode 100644 index 000000000..4e8d134b6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/V-lf.case @@ -0,0 +1,28 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for VariableDeclarationExpressions, VariableDeclarationFragments, and + * VariableDeclarationStatements. + */ +class V { + int x = 0, y = 1; + + void f() { + for (int a = 0, b = 1; a < b;) {} + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for VariableDeclarationExpressions, VariableDeclarationFragments, and + * VariableDeclarationStatements. + */ +class V { + int x = 0, y = 1; + + void f() { + for (int a = 0, b = 1; a < b; ) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/W-cr.case b/open-java-format/src/test/resources/test-cases/testdata/W-cr.case new file mode 100644 index 000000000..f06bbd57d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/W-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** Tests for WhileStatements and WildcardTypes. */ class W { T f() { while (true == true == true == true == true == true == true == true == true == true == true == true == true) {} } } ---------- package com.google.googlejavaformat.java.test; /** Tests for WhileStatements and WildcardTypes. */ class W { T f() { while (true == true == true == true == true == true == true == true == true == true == true == true == true) {} } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/W-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/W-crlf.case new file mode 100644 index 000000000..527cc4236 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/W-crlf.case @@ -0,0 +1,19 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for WhileStatements and WildcardTypes. */ +class W { + T f() { + while (true == true == true == true == true == true == true == true == true == true == true + == true == true) {} + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for WhileStatements and WildcardTypes. */ +class W { + T f() { + while (true == true == true == true == true == true == true == true == true == true == true == true == true) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/W-lf.case b/open-java-format/src/test/resources/test-cases/testdata/W-lf.case new file mode 100644 index 000000000..97f5d89b0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/W-lf.case @@ -0,0 +1,19 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for WhileStatements and WildcardTypes. */ +class W { + T f() { + while (true == true == true == true == true == true == true == true == true == true == true + == true == true) {} + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** Tests for WhileStatements and WildcardTypes. */ +class W { + T f() { + while (true == true == true == true == true == true == true == true == true == true == true == true == true) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/WildBound-cr.case b/open-java-format/src/test/resources/test-cases/testdata/WildBound-cr.case new file mode 100644 index 000000000..a3e37d4a2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/WildBound-cr.case @@ -0,0 +1 @@ +---------- class WildBound { T f() { return (T) X.class.newInstance((F) f, t); } } ---------- class WildBound { T f() { return (T) X.class.newInstance((F) f, t); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/WildBound-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/WildBound-crlf.case new file mode 100644 index 000000000..69cd0a8e4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/WildBound-crlf.case @@ -0,0 +1,12 @@ +---------- +class WildBound { + T f() { + return (T) X.class.newInstance((F) f, t); + } +} +---------- +class WildBound { + T f() { + return (T) X.class.newInstance((F) f, t); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/WildBound-lf.case b/open-java-format/src/test/resources/test-cases/testdata/WildBound-lf.case new file mode 100644 index 000000000..0e942ea81 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/WildBound-lf.case @@ -0,0 +1,12 @@ +---------- +class WildBound { + T f() { + return (T) X.class.newInstance((F) f, t); + } +} +---------- +class WildBound { + T f() { + return (T) X.class.newInstance((F) f, t); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/b26306390-cr.case b/open-java-format/src/test/resources/test-cases/testdata/b26306390-cr.case new file mode 100644 index 000000000..019c857ef --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/b26306390-cr.case @@ -0,0 +1 @@ +---------- class B26306390 { int resourceId = com.some.extremely.verbose.pkg.name.R.string.some_extremely_long_resource_identifier_that_exceeds_the_column_limit; } ---------- class B26306390 { int resourceId = com.some.extremely.verbose.pkg.name.R.string .some_extremely_long_resource_identifier_that_exceeds_the_column_limit; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/b26306390-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/b26306390-crlf.case new file mode 100644 index 000000000..6c09ab5b8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/b26306390-crlf.case @@ -0,0 +1,9 @@ +---------- +class B26306390 { + int resourceId = com.some.extremely.verbose.pkg.name.R.string.some_extremely_long_resource_identifier_that_exceeds_the_column_limit; +} +---------- +class B26306390 { + int resourceId = com.some.extremely.verbose.pkg.name.R.string + .some_extremely_long_resource_identifier_that_exceeds_the_column_limit; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/b26306390-lf.case b/open-java-format/src/test/resources/test-cases/testdata/b26306390-lf.case new file mode 100644 index 000000000..ebc20d777 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/b26306390-lf.case @@ -0,0 +1,9 @@ +---------- +class B26306390 { + int resourceId = com.some.extremely.verbose.pkg.name.R.string.some_extremely_long_resource_identifier_that_exceeds_the_column_limit; +} +---------- +class B26306390 { + int resourceId = com.some.extremely.verbose.pkg.name.R.string + .some_extremely_long_resource_identifier_that_exceeds_the_column_limit; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i100-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i100-cr.case new file mode 100644 index 000000000..88f326852 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i100-cr.case @@ -0,0 +1 @@ +---------- public class I100 { void f() { Object o; o = new String @A [] {"foo", "bar"}; o = new String @A @B [] @C [] {"foo", "bar"}; } } ---------- public class I100 { void f() { Object o; o = new String @A [] {"foo", "bar"}; o = new String @A @B [] @C [] {"foo", "bar"}; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i100-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i100-crlf.case new file mode 100644 index 000000000..31619a812 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i100-crlf.case @@ -0,0 +1,16 @@ +---------- +public class I100 { + void f() { + Object o; + o = new String @A [] {"foo", "bar"}; + o = new String @A @B [] @C [] {"foo", "bar"}; + } +} +---------- +public class I100 { + void f() { + Object o; + o = new String @A [] {"foo", "bar"}; + o = new String @A @B [] @C [] {"foo", "bar"}; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i100-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i100-lf.case new file mode 100644 index 000000000..1babc0d36 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i100-lf.case @@ -0,0 +1,16 @@ +---------- +public class I100 { + void f() { + Object o; + o = new String @A [] {"foo", "bar"}; + o = new String @A @B [] @C [] {"foo", "bar"}; + } +} +---------- +public class I100 { + void f() { + Object o; + o = new String @A [] {"foo", "bar"}; + o = new String @A @B [] @C [] {"foo", "bar"}; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i101-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i101-cr.case new file mode 100644 index 000000000..63c98d451 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i101-cr.case @@ -0,0 +1 @@ +---------- public @interface kHz {} // No prefix defined in the annotation itself ---------- public @interface kHz {} // No prefix defined in the annotation itself \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i101-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i101-crlf.case new file mode 100644 index 000000000..ecfa58719 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i101-crlf.case @@ -0,0 +1,4 @@ +---------- +public @interface kHz {} // No prefix defined in the annotation itself +---------- +public @interface kHz {} // No prefix defined in the annotation itself diff --git a/open-java-format/src/test/resources/test-cases/testdata/i101-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i101-lf.case new file mode 100644 index 000000000..527c19be5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i101-lf.case @@ -0,0 +1,4 @@ +---------- +public @interface kHz {} // No prefix defined in the annotation itself +---------- +public @interface kHz {} // No prefix defined in the annotation itself diff --git a/open-java-format/src/test/resources/test-cases/testdata/i155-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i155-cr.case new file mode 100644 index 000000000..022a809b0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i155-cr.case @@ -0,0 +1 @@ +---------- class I155 { void walkAndClose(Stream stream) { try (stream) {} } } ---------- class I155 { void walkAndClose(Stream stream) { try (stream) {} } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i155-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i155-crlf.case new file mode 100644 index 000000000..cdf007547 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i155-crlf.case @@ -0,0 +1,12 @@ +---------- +class I155 { + void walkAndClose(Stream stream) { + try (stream) {} + } +} +---------- +class I155 { + void walkAndClose(Stream stream) { + try (stream) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i155-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i155-lf.case new file mode 100644 index 000000000..44846110a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i155-lf.case @@ -0,0 +1,12 @@ +---------- +class I155 { + void walkAndClose(Stream stream) { + try (stream) {} + } +} +---------- +class I155 { + void walkAndClose(Stream stream) { + try (stream) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i176-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i176-cr.case new file mode 100644 index 000000000..fa94bdab6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i176-cr.case @@ -0,0 +1 @@ +---------- interface InterfaceWithPrivateStaticMethod { private static void bar() { } default void foo() { bar(); } } ---------- interface InterfaceWithPrivateStaticMethod { private static void bar() {} default void foo() { bar(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i176-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i176-crlf.case new file mode 100644 index 000000000..5fb6b133c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i176-crlf.case @@ -0,0 +1,15 @@ +---------- +interface +InterfaceWithPrivateStaticMethod +{ + private static void bar() { } + default void foo() { bar(); } +} +---------- +interface InterfaceWithPrivateStaticMethod { + private static void bar() {} + + default void foo() { + bar(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i176-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i176-lf.case new file mode 100644 index 000000000..800fc9ad6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i176-lf.case @@ -0,0 +1,15 @@ +---------- +interface +InterfaceWithPrivateStaticMethod +{ + private static void bar() { } + default void foo() { bar(); } +} +---------- +interface InterfaceWithPrivateStaticMethod { + private static void bar() {} + + default void foo() { + bar(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i221-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i221-cr.case new file mode 100644 index 000000000..f16314c01 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i221-cr.case @@ -0,0 +1 @@ +---------- class I221 { { logger.log( Level.WARNING, "Unable to obtain jst.web facet version from selected project", //$NON-NLS-1$ ex); } } ---------- class I221 { { logger.log( Level.WARNING, "Unable to obtain jst.web facet version from selected project", //$NON-NLS-1$ ex); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i221-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i221-crlf.case new file mode 100644 index 000000000..334c848d5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i221-crlf.case @@ -0,0 +1,18 @@ +---------- +class I221 { + { + logger.log( + Level.WARNING, + "Unable to obtain jst.web facet version from selected project", //$NON-NLS-1$ + ex); + } +} +---------- +class I221 { + { + logger.log( + Level.WARNING, + "Unable to obtain jst.web facet version from selected project", //$NON-NLS-1$ + ex); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i221.output b/open-java-format/src/test/resources/test-cases/testdata/i221-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i221.output rename to open-java-format/src/test/resources/test-cases/testdata/i221-lf.case index 1188f2d54..bee8247ff 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i221.output +++ b/open-java-format/src/test/resources/test-cases/testdata/i221-lf.case @@ -1,3 +1,13 @@ +---------- +class I221 { + { + logger.log( + Level.WARNING, + "Unable to obtain jst.web facet version from selected project", //$NON-NLS-1$ + ex); + } +} +---------- class I221 { { logger.log( diff --git a/open-java-format/src/test/resources/test-cases/testdata/i281-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i281-cr.case new file mode 100644 index 000000000..98df74b83 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i281-cr.case @@ -0,0 +1 @@ +---------- public enum Empty {} public enum Empty {;} public enum Empty {;;;} public enum Empty {; // comment ;;} public enum Empty {; ;; // comment } ---------- public enum Empty {} public enum Empty { ; } public enum Empty { ; ; ; } public enum Empty { ; // comment ; ; } public enum Empty { ; ; ; // comment } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i281-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i281-crlf.case new file mode 100644 index 000000000..a2f9c0aed --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i281-crlf.case @@ -0,0 +1,33 @@ +---------- +public enum Empty {} +public enum Empty {;} +public enum Empty {;;;} +public enum Empty {; // comment +;;} +public enum Empty {; +;; // comment +} +---------- +public enum Empty {} + +public enum Empty { + ; +} + +public enum Empty { + ; + ; + ; +} + +public enum Empty { + ; // comment + ; + ; +} + +public enum Empty { + ; + ; + ; // comment +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i281.output b/open-java-format/src/test/resources/test-cases/testdata/i281-lf.case similarity index 54% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i281.output rename to open-java-format/src/test/resources/test-cases/testdata/i281-lf.case index 408577fc5..3b49de17c 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i281.output +++ b/open-java-format/src/test/resources/test-cases/testdata/i281-lf.case @@ -1,3 +1,13 @@ +---------- +public enum Empty {} +public enum Empty {;} +public enum Empty {;;;} +public enum Empty {; // comment +;;} +public enum Empty {; +;; // comment +} +---------- public enum Empty {} public enum Empty { diff --git a/open-java-format/src/test/resources/test-cases/testdata/i282-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i282-cr.case new file mode 100644 index 000000000..4ffe64aa3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i282-cr.case @@ -0,0 +1 @@ +---------- public class ArrayVsVarargs { void f(String[] arg) {} void g(String... arg) {} void h(String @A [] arg) {} void i(String @B... arg) {} void j(String @C [] @D [] arg) {} void k(String @E [] @F... arg) {} Class c = byte[].class; } ---------- public class ArrayVsVarargs { void f(String[] arg) {} void g(String... arg) {} void h(String @A [] arg) {} void i(String @B ... arg) {} void j(String @C [] @D [] arg) {} void k(String @E [] @F ... arg) {} Class c = byte[].class; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i282-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i282-crlf.case new file mode 100644 index 000000000..e8e1a41b9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i282-crlf.case @@ -0,0 +1,29 @@ +---------- +public class ArrayVsVarargs { + + void f(String[] arg) {} + void g(String... arg) {} + void h(String @A [] arg) {} + void i(String @B... arg) {} + void j(String @C [] @D [] arg) {} + void k(String @E [] @F... arg) {} + + Class c = byte[].class; +} +---------- +public class ArrayVsVarargs { + + void f(String[] arg) {} + + void g(String... arg) {} + + void h(String @A [] arg) {} + + void i(String @B ... arg) {} + + void j(String @C [] @D [] arg) {} + + void k(String @E [] @F ... arg) {} + + Class c = byte[].class; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i282-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i282-lf.case new file mode 100644 index 000000000..e47455898 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i282-lf.case @@ -0,0 +1,29 @@ +---------- +public class ArrayVsVarargs { + + void f(String[] arg) {} + void g(String... arg) {} + void h(String @A [] arg) {} + void i(String @B... arg) {} + void j(String @C [] @D [] arg) {} + void k(String @E [] @F... arg) {} + + Class c = byte[].class; +} +---------- +public class ArrayVsVarargs { + + void f(String[] arg) {} + + void g(String... arg) {} + + void h(String @A [] arg) {} + + void i(String @B ... arg) {} + + void j(String @C [] @D [] arg) {} + + void k(String @E [] @F ... arg) {} + + Class c = byte[].class; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i55-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i55-cr.case new file mode 100644 index 000000000..6dd1b8cc9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i55-cr.case @@ -0,0 +1 @@ +---------- import java.lang.annotation.*; @Target(ElementType.TYPE_USE) @interface Interned {} public class GjfTypeAnnotationOnArrayTest { public static void test() { String @Interned [] iarray1 = new String @Interned [2]; } } ---------- import java.lang.annotation.*; @Target(ElementType.TYPE_USE) @interface Interned {} public class GjfTypeAnnotationOnArrayTest { public static void test() { String @Interned [] iarray1 = new String @Interned [2]; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i55-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i55-crlf.case new file mode 100644 index 000000000..a5eb78a8c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i55-crlf.case @@ -0,0 +1,26 @@ +---------- +import java.lang.annotation.*; + +@Target(ElementType.TYPE_USE) +@interface Interned {} + +public class GjfTypeAnnotationOnArrayTest { + + public static void test() { + String @Interned [] iarray1 = new String @Interned [2]; + } + +} + +---------- +import java.lang.annotation.*; + +@Target(ElementType.TYPE_USE) +@interface Interned {} + +public class GjfTypeAnnotationOnArrayTest { + + public static void test() { + String @Interned [] iarray1 = new String @Interned [2]; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i55-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i55-lf.case new file mode 100644 index 000000000..0a5b9e256 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i55-lf.case @@ -0,0 +1,26 @@ +---------- +import java.lang.annotation.*; + +@Target(ElementType.TYPE_USE) +@interface Interned {} + +public class GjfTypeAnnotationOnArrayTest { + + public static void test() { + String @Interned [] iarray1 = new String @Interned [2]; + } + +} + +---------- +import java.lang.annotation.*; + +@Target(ElementType.TYPE_USE) +@interface Interned {} + +public class GjfTypeAnnotationOnArrayTest { + + public static void test() { + String @Interned [] iarray1 = new String @Interned [2]; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i59-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i59-cr.case new file mode 100644 index 000000000..495fb0c2c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i59-cr.case @@ -0,0 +1 @@ +---------- import org.checkerframework.checker.tainting.qual.*; class Outer { class Nested { class InnerMost { @A Outer context(@B Outer.@C Nested.@D InnerMost this) { return Outer.this; } } } } ---------- import org.checkerframework.checker.tainting.qual.*; class Outer { class Nested { class InnerMost { @A Outer context(@B Outer.@C Nested.@D InnerMost this) { return Outer.this; } } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i59-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i59-crlf.case new file mode 100644 index 000000000..80cd9aec3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i59-crlf.case @@ -0,0 +1,24 @@ +---------- +import org.checkerframework.checker.tainting.qual.*; +class Outer { + class Nested { + class InnerMost { + @A Outer context(@B Outer.@C Nested.@D InnerMost this) { + return Outer.this; + } + } + } +} +---------- +import org.checkerframework.checker.tainting.qual.*; + +class Outer { + class Nested { + class InnerMost { + @A + Outer context(@B Outer.@C Nested.@D InnerMost this) { + return Outer.this; + } + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i59.output b/open-java-format/src/test/resources/test-cases/testdata/i59-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i59.output rename to open-java-format/src/test/resources/test-cases/testdata/i59-lf.case index 292d2b021..63472187e 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i59.output +++ b/open-java-format/src/test/resources/test-cases/testdata/i59-lf.case @@ -1,3 +1,15 @@ +---------- +import org.checkerframework.checker.tainting.qual.*; +class Outer { + class Nested { + class InnerMost { + @A Outer context(@B Outer.@C Nested.@D InnerMost this) { + return Outer.this; + } + } + } +} +---------- import org.checkerframework.checker.tainting.qual.*; class Outer { diff --git a/open-java-format/src/test/resources/test-cases/testdata/i60-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i60-cr.case new file mode 100644 index 000000000..5d1c683b4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i60-cr.case @@ -0,0 +1 @@ +---------- import org.checkerframework.checker.nullness.qual.*; public class FullyQualified { public void format1(java.lang.String a1, java.lang. @Nullable Object... a2) { // body } } ---------- import org.checkerframework.checker.nullness.qual.*; public class FullyQualified { public void format1(java.lang.String a1, java.lang.@Nullable Object... a2) { // body } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i60-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i60-crlf.case new file mode 100644 index 000000000..0a1c042ce --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i60-crlf.case @@ -0,0 +1,19 @@ +---------- +import org.checkerframework.checker.nullness.qual.*; + +public class FullyQualified { + + public void format1(java.lang.String a1, java.lang. @Nullable Object... a2) { + // body + } + +} +---------- +import org.checkerframework.checker.nullness.qual.*; + +public class FullyQualified { + + public void format1(java.lang.String a1, java.lang.@Nullable Object... a2) { + // body + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i60-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i60-lf.case new file mode 100644 index 000000000..8f1a7fb67 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i60-lf.case @@ -0,0 +1,19 @@ +---------- +import org.checkerframework.checker.nullness.qual.*; + +public class FullyQualified { + + public void format1(java.lang.String a1, java.lang. @Nullable Object... a2) { + // body + } + +} +---------- +import org.checkerframework.checker.nullness.qual.*; + +public class FullyQualified { + + public void format1(java.lang.String a1, java.lang.@Nullable Object... a2) { + // body + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i65-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i65-cr.case new file mode 100644 index 000000000..94a7559cd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i65-cr.case @@ -0,0 +1 @@ +---------- import org.checkerframework.checker.nullness.qual.*; class UnannoPrimitives { Object ar = new @Nullable byte[] {4}; } ---------- import org.checkerframework.checker.nullness.qual.*; class UnannoPrimitives { Object ar = new @Nullable byte[] {4}; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i65-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i65-crlf.case new file mode 100644 index 000000000..6db06f400 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i65-crlf.case @@ -0,0 +1,12 @@ +---------- +import org.checkerframework.checker.nullness.qual.*; + +class UnannoPrimitives { + Object ar = new @Nullable byte[] {4}; +} +---------- +import org.checkerframework.checker.nullness.qual.*; + +class UnannoPrimitives { + Object ar = new @Nullable byte[] {4}; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i65-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i65-lf.case new file mode 100644 index 000000000..44bc89379 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i65-lf.case @@ -0,0 +1,12 @@ +---------- +import org.checkerframework.checker.nullness.qual.*; + +class UnannoPrimitives { + Object ar = new @Nullable byte[] {4}; +} +---------- +import org.checkerframework.checker.nullness.qual.*; + +class UnannoPrimitives { + Object ar = new @Nullable byte[] {4}; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i66-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i66-cr.case new file mode 100644 index 000000000..5f8b8f7fe --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i66-cr.case @@ -0,0 +1 @@ +---------- public class AnnotatedCast { public static @Sibling1 int convertSibling2ToSibling1(@Sibling2 int a) { return (@Sibling1 int) 1; } } ---------- public class AnnotatedCast { public static @Sibling1 int convertSibling2ToSibling1(@Sibling2 int a) { return (@Sibling1 int) 1; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i66-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i66-crlf.case new file mode 100644 index 000000000..b0be271de --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i66-crlf.case @@ -0,0 +1,15 @@ +---------- +public class AnnotatedCast { + + public static @Sibling1 int convertSibling2ToSibling1(@Sibling2 int a) { + return (@Sibling1 int) 1; + } + +} +---------- +public class AnnotatedCast { + + public static @Sibling1 int convertSibling2ToSibling1(@Sibling2 int a) { + return (@Sibling1 int) 1; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i66-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i66-lf.case new file mode 100644 index 000000000..47e63bc9d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i66-lf.case @@ -0,0 +1,15 @@ +---------- +public class AnnotatedCast { + + public static @Sibling1 int convertSibling2ToSibling1(@Sibling2 int a) { + return (@Sibling1 int) 1; + } + +} +---------- +public class AnnotatedCast { + + public static @Sibling1 int convertSibling2ToSibling1(@Sibling2 int a) { + return (@Sibling1 int) 1; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i71-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i71-cr.case new file mode 100644 index 000000000..35c6ef78a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i71-cr.case @@ -0,0 +1 @@ +---------- import java.util.Arrays; class Test { Wrapper w = new Wrapper( Arrays.asList( "a", "b", "c", "d", "e" ), 2); Wrapper w = new Wrapper( Arrays.asList( "a", "b", "c", "d", "e" )); } ---------- import java.util.Arrays; class Test { Wrapper w = new Wrapper(Arrays.asList("a", "b", "c", "d", "e"), 2); Wrapper w = new Wrapper(Arrays.asList("a", "b", "c", "d", "e")); } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i71-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i71-crlf.case new file mode 100644 index 000000000..eb0da9c88 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i71-crlf.case @@ -0,0 +1,24 @@ +---------- +import java.util.Arrays; + +class Test { + Wrapper w = new Wrapper( + Arrays.asList( + "a", "b", + "c", "d", + "e" + ), 2); + Wrapper w = new Wrapper( + Arrays.asList( + "a", "b", + "c", "d", + "e" + )); +} +---------- +import java.util.Arrays; + +class Test { + Wrapper w = new Wrapper(Arrays.asList("a", "b", "c", "d", "e"), 2); + Wrapper w = new Wrapper(Arrays.asList("a", "b", "c", "d", "e")); +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i71.input b/open-java-format/src/test/resources/test-cases/testdata/i71-lf.case similarity index 56% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i71.input rename to open-java-format/src/test/resources/test-cases/testdata/i71-lf.case index 324c3d5ef..e469fe646 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i71.input +++ b/open-java-format/src/test/resources/test-cases/testdata/i71-lf.case @@ -1,3 +1,4 @@ +---------- import java.util.Arrays; class Test { @@ -14,3 +15,10 @@ class Test { "e" )); } +---------- +import java.util.Arrays; + +class Test { + Wrapper w = new Wrapper(Arrays.asList("a", "b", "c", "d", "e"), 2); + Wrapper w = new Wrapper(Arrays.asList("a", "b", "c", "d", "e")); +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i95-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i95-cr.case new file mode 100644 index 000000000..9b69ab1ea --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i95-cr.case @@ -0,0 +1 @@ +---------- class I95 { public void format2(Object @Nullable ... a2) {} } ---------- class I95 { public void format2(Object @Nullable ... a2) {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i95-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i95-crlf.case new file mode 100644 index 000000000..28bb9a4c0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i95-crlf.case @@ -0,0 +1,8 @@ +---------- +class I95 { + public void format2(Object @Nullable ... a2) {} +} +---------- +class I95 { + public void format2(Object @Nullable ... a2) {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i95-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i95-lf.case new file mode 100644 index 000000000..bdf2c18ed --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i95-lf.case @@ -0,0 +1,8 @@ +---------- +class I95 { + public void format2(Object @Nullable ... a2) {} +} +---------- +class I95 { + public void format2(Object @Nullable ... a2) {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i98-cr.case b/open-java-format/src/test/resources/test-cases/testdata/i98-cr.case new file mode 100644 index 000000000..a5e5a6163 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i98-cr.case @@ -0,0 +1 @@ +---------- public class AnonInnerDefaults { public void tryStuff(final UIElement e) { PolyIface p = new @UI PolyIface() { }; } } ---------- public class AnonInnerDefaults { public void tryStuff(final UIElement e) { PolyIface p = new @UI PolyIface() {}; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/i98-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/i98-crlf.case new file mode 100644 index 000000000..ad49f4dee --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i98-crlf.case @@ -0,0 +1,16 @@ +---------- +public class AnonInnerDefaults { + + public void tryStuff(final UIElement e) { + PolyIface p = + new @UI PolyIface() { + }; + } +} +---------- +public class AnonInnerDefaults { + + public void tryStuff(final UIElement e) { + PolyIface p = new @UI PolyIface() {}; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/i98-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i98-lf.case new file mode 100644 index 000000000..7ba7c83d5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i98-lf.case @@ -0,0 +1,16 @@ +---------- +public class AnonInnerDefaults { + + public void tryStuff(final UIElement e) { + PolyIface p = + new @UI PolyIface() { + }; + } +} +---------- +public class AnonInnerDefaults { + + public void tryStuff(final UIElement e) { + PolyIface p = new @UI PolyIface() {}; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-101-annotated-lambda-parameters-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-101-annotated-lambda-parameters-cr.case new file mode 100644 index 000000000..35fce75c7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-101-annotated-lambda-parameters-cr.case @@ -0,0 +1 @@ +---------- import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.function.Function; class AnnotatedLambdaParameters { BiFunction withArgs = (final var x, @SuppressWarnings("unused") var y) -> x + y; Function typed = ( @SuppressWarnings( "unused" ) String s )->s.length(); BiFunction two = (@Deprecated @SuppressWarnings("unused") var x, var y) -> x + y; BiFunction marker = (@Deprecated var x, @Deprecated final var y) -> x + y; Consumer block = (@SuppressWarnings({"unused", "rawtypes"}) String s) -> { System.out.println(s); }; BiFunction tooLongForOneLine = (@SuppressWarnings("unused") Integer first, @SuppressWarnings("unused") Integer second) -> first + second; BiFunction parametersDoNotFitOnOneLine = (@SuppressWarnings("unused") Integer firstParameterWithAVeryLongName, @SuppressWarnings("unused") Integer secondParameterWithAVeryLongName) -> firstParameterWithAVeryLongName + secondParameterWithAVeryLongName; void method(@SuppressWarnings("unused") int y, @Deprecated int z) { @SuppressWarnings("unchecked") Function local = o -> (String) o; } } ---------- import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.function.Function; class AnnotatedLambdaParameters { BiFunction withArgs = (final var x, @SuppressWarnings("unused") var y) -> x + y; Function typed = (@SuppressWarnings("unused") String s) -> s.length(); BiFunction two = (@Deprecated @SuppressWarnings("unused") var x, var y) -> x + y; BiFunction marker = (@Deprecated var x, @Deprecated final var y) -> x + y; Consumer block = (@SuppressWarnings({"unused", "rawtypes"}) String s) -> { System.out.println(s); }; BiFunction tooLongForOneLine = (@SuppressWarnings("unused") Integer first, @SuppressWarnings("unused") Integer second) -> first + second; BiFunction parametersDoNotFitOnOneLine = (@SuppressWarnings("unused") Integer firstParameterWithAVeryLongName, @SuppressWarnings("unused") Integer secondParameterWithAVeryLongName) -> firstParameterWithAVeryLongName + secondParameterWithAVeryLongName; void method(@SuppressWarnings("unused") int y, @Deprecated int z) { @SuppressWarnings("unchecked") Function local = o -> (String) o; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-101-annotated-lambda-parameters-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-101-annotated-lambda-parameters-crlf.case new file mode 100644 index 000000000..b266f9ceb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-101-annotated-lambda-parameters-crlf.case @@ -0,0 +1,61 @@ +---------- +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Function; + +class AnnotatedLambdaParameters { + BiFunction withArgs = + (final var x, + @SuppressWarnings("unused") + var y) -> x + y; + + Function typed = ( @SuppressWarnings( "unused" ) String s )->s.length(); + + BiFunction two = (@Deprecated @SuppressWarnings("unused") + var x, var y) -> x + y; + + BiFunction marker = (@Deprecated var x, + @Deprecated final var y) -> x + y; + + Consumer block = (@SuppressWarnings({"unused", "rawtypes"}) + String s) -> { System.out.println(s); }; + + BiFunction tooLongForOneLine = (@SuppressWarnings("unused") Integer first, @SuppressWarnings("unused") Integer second) -> first + second; + + BiFunction parametersDoNotFitOnOneLine = (@SuppressWarnings("unused") Integer firstParameterWithAVeryLongName, @SuppressWarnings("unused") Integer secondParameterWithAVeryLongName) -> firstParameterWithAVeryLongName + secondParameterWithAVeryLongName; + + void method(@SuppressWarnings("unused") int y, @Deprecated int z) { + @SuppressWarnings("unchecked") Function local = o -> (String) o; + } +} +---------- +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Function; + +class AnnotatedLambdaParameters { + BiFunction withArgs = (final var x, @SuppressWarnings("unused") var y) -> x + y; + + Function typed = (@SuppressWarnings("unused") String s) -> s.length(); + + BiFunction two = (@Deprecated @SuppressWarnings("unused") var x, var y) -> x + y; + + BiFunction marker = (@Deprecated var x, @Deprecated final var y) -> x + y; + + Consumer block = (@SuppressWarnings({"unused", "rawtypes"}) String s) -> { + System.out.println(s); + }; + + BiFunction tooLongForOneLine = + (@SuppressWarnings("unused") Integer first, @SuppressWarnings("unused") Integer second) -> first + second; + + BiFunction parametersDoNotFitOnOneLine = + (@SuppressWarnings("unused") Integer firstParameterWithAVeryLongName, + @SuppressWarnings("unused") Integer secondParameterWithAVeryLongName) -> + firstParameterWithAVeryLongName + secondParameterWithAVeryLongName; + + void method(@SuppressWarnings("unused") int y, @Deprecated int z) { + @SuppressWarnings("unchecked") + Function local = o -> (String) o; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-101-annotated-lambda-parameters-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-101-annotated-lambda-parameters-lf.case new file mode 100644 index 000000000..cd3bfca8f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-101-annotated-lambda-parameters-lf.case @@ -0,0 +1,61 @@ +---------- +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Function; + +class AnnotatedLambdaParameters { + BiFunction withArgs = + (final var x, + @SuppressWarnings("unused") + var y) -> x + y; + + Function typed = ( @SuppressWarnings( "unused" ) String s )->s.length(); + + BiFunction two = (@Deprecated @SuppressWarnings("unused") + var x, var y) -> x + y; + + BiFunction marker = (@Deprecated var x, + @Deprecated final var y) -> x + y; + + Consumer block = (@SuppressWarnings({"unused", "rawtypes"}) + String s) -> { System.out.println(s); }; + + BiFunction tooLongForOneLine = (@SuppressWarnings("unused") Integer first, @SuppressWarnings("unused") Integer second) -> first + second; + + BiFunction parametersDoNotFitOnOneLine = (@SuppressWarnings("unused") Integer firstParameterWithAVeryLongName, @SuppressWarnings("unused") Integer secondParameterWithAVeryLongName) -> firstParameterWithAVeryLongName + secondParameterWithAVeryLongName; + + void method(@SuppressWarnings("unused") int y, @Deprecated int z) { + @SuppressWarnings("unchecked") Function local = o -> (String) o; + } +} +---------- +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Function; + +class AnnotatedLambdaParameters { + BiFunction withArgs = (final var x, @SuppressWarnings("unused") var y) -> x + y; + + Function typed = (@SuppressWarnings("unused") String s) -> s.length(); + + BiFunction two = (@Deprecated @SuppressWarnings("unused") var x, var y) -> x + y; + + BiFunction marker = (@Deprecated var x, @Deprecated final var y) -> x + y; + + Consumer block = (@SuppressWarnings({"unused", "rawtypes"}) String s) -> { + System.out.println(s); + }; + + BiFunction tooLongForOneLine = + (@SuppressWarnings("unused") Integer first, @SuppressWarnings("unused") Integer second) -> first + second; + + BiFunction parametersDoNotFitOnOneLine = + (@SuppressWarnings("unused") Integer firstParameterWithAVeryLongName, + @SuppressWarnings("unused") Integer secondParameterWithAVeryLongName) -> + firstParameterWithAVeryLongName + secondParameterWithAVeryLongName; + + void method(@SuppressWarnings("unused") int y, @Deprecated int z) { + @SuppressWarnings("unchecked") + Function local = o -> (String) o; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-cr.case new file mode 100644 index 000000000..dc6c92fbe --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-cr.case @@ -0,0 +1 @@ +---------- class NonNlsTrailingMarker { private static final String FIELD = "field"; //$NON-NLS-1$ String markers() { String a = "x"; //$NON-NLS-1$ String two = "x" + "y"; //$NON-NLS-1$ //$NON-NLS-2$ log( "message" ); //$NON-NLS-1$ return a; //noinspection ReturnOfNull } void ownLine() { //$NON-NLS-1$ String b = "x"; } void otherComments() { String c = "x"; //foo String d = "x"; // bar } } ---------- class NonNlsTrailingMarker { private static final String FIELD = "field"; //$NON-NLS-1$ String markers() { String a = "x"; //$NON-NLS-1$ String two = "x" + "y"; //$NON-NLS-1$ //$NON-NLS-2$ log("message"); //$NON-NLS-1$ return a; //noinspection ReturnOfNull } void ownLine() { //$NON-NLS-1$ String b = "x"; } void otherComments() { String c = "x"; // foo String d = "x"; // bar } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-crlf.case new file mode 100644 index 000000000..ed58a2b8a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-crlf.case @@ -0,0 +1,42 @@ +---------- +class NonNlsTrailingMarker { + private static final String FIELD = "field"; //$NON-NLS-1$ + + String markers() { + String a = "x"; //$NON-NLS-1$ + String two = "x" + "y"; //$NON-NLS-1$ //$NON-NLS-2$ + log( "message" ); //$NON-NLS-1$ + return a; //noinspection ReturnOfNull + } + + void ownLine() { + //$NON-NLS-1$ + String b = "x"; + } + + void otherComments() { + String c = "x"; //foo + String d = "x"; // bar + } +} +---------- +class NonNlsTrailingMarker { + private static final String FIELD = "field"; //$NON-NLS-1$ + + String markers() { + String a = "x"; //$NON-NLS-1$ + String two = "x" + "y"; //$NON-NLS-1$ //$NON-NLS-2$ + log("message"); //$NON-NLS-1$ + return a; //noinspection ReturnOfNull + } + + void ownLine() { + //$NON-NLS-1$ + String b = "x"; + } + + void otherComments() { + String c = "x"; // foo + String d = "x"; // bar + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-non-nls-trailing-marker.output b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-non-nls-trailing-marker.output rename to open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-lf.case index a566f2bed..de77e3d10 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-non-nls-trailing-marker.output +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-lf.case @@ -1,3 +1,25 @@ +---------- +class NonNlsTrailingMarker { + private static final String FIELD = "field"; //$NON-NLS-1$ + + String markers() { + String a = "x"; //$NON-NLS-1$ + String two = "x" + "y"; //$NON-NLS-1$ //$NON-NLS-2$ + log( "message" ); //$NON-NLS-1$ + return a; //noinspection ReturnOfNull + } + + void ownLine() { + //$NON-NLS-1$ + String b = "x"; + } + + void otherComments() { + String c = "x"; //foo + String d = "x"; // bar + } +} +---------- class NonNlsTrailingMarker { private static final String FIELD = "field"; //$NON-NLS-1$ diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-reflowed-literal-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-reflowed-literal-cr.case new file mode 100644 index 000000000..a9f9d8e1d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-reflowed-literal-cr.case @@ -0,0 +1 @@ +---------- class ReflowedLiteral { void markers() { String reflowed = "a single string literal that is far too long to fit into one hundred and twenty columns, so the formatter reflows it"; //$NON-NLS-1$ String unmarked = "a single string literal that is far too long to fit into one hundred and twenty columns, so the formatter reflows it"; log( "short", "a string literal as the second argument that is far too long to fit into one hundred and twenty columns", "after" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ log(KEY, "a string literal as the second argument that is far too long to fit into one hundred and twenty columns, so it reflows", VALUE); //$NON-NLS-1$ String chain = "a string literal that is far too long to fit into one hundred and twenty columns, so it reflows" + "with another literal"; //$NON-NLS-1$ //$NON-NLS-2$ } } ---------- class ReflowedLiteral { void markers() { String reflowed = "a single string literal that is far too long to fit into one hundred and twenty" //$NON-NLS-1$ + " columns, so the formatter reflows it"; //$NON-NLS-1$ String unmarked = "a single string literal that is far too long to fit into one hundred and twenty columns, so the" + " formatter reflows it"; log( "short", //$NON-NLS-1$ "a string literal as the second argument that is far too long to fit into one hundred" //$NON-NLS-1$ + " and twenty columns", //$NON-NLS-1$ "after"); //$NON-NLS-1$ log( KEY, "a string literal as the second argument that is far too long to fit into one hundred" //$NON-NLS-1$ + " and twenty columns, so it reflows", //$NON-NLS-1$ VALUE); String chain = "a string literal that is far too long to fit into one hundred and twenty columns, so it" //$NON-NLS-1$ + " reflows" //$NON-NLS-1$ + "with another literal"; //$NON-NLS-1$ } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-reflowed-literal-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-reflowed-literal-crlf.case new file mode 100644 index 000000000..f0959fb95 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-reflowed-literal-crlf.case @@ -0,0 +1,35 @@ +---------- +class ReflowedLiteral { + void markers() { + String reflowed = "a single string literal that is far too long to fit into one hundred and twenty columns, so the formatter reflows it"; //$NON-NLS-1$ + String unmarked = "a single string literal that is far too long to fit into one hundred and twenty columns, so the formatter reflows it"; + log( "short", "a string literal as the second argument that is far too long to fit into one hundred and twenty columns", "after" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + log(KEY, "a string literal as the second argument that is far too long to fit into one hundred and twenty columns, so it reflows", VALUE); //$NON-NLS-1$ + String chain = "a string literal that is far too long to fit into one hundred and twenty columns, so it reflows" + "with another literal"; //$NON-NLS-1$ //$NON-NLS-2$ + } +} +---------- +class ReflowedLiteral { + void markers() { + String reflowed = + "a single string literal that is far too long to fit into one hundred and twenty" //$NON-NLS-1$ + + " columns, so the formatter reflows it"; //$NON-NLS-1$ + String unmarked = + "a single string literal that is far too long to fit into one hundred and twenty columns, so the" + + " formatter reflows it"; + log( + "short", //$NON-NLS-1$ + "a string literal as the second argument that is far too long to fit into one hundred" //$NON-NLS-1$ + + " and twenty columns", //$NON-NLS-1$ + "after"); //$NON-NLS-1$ + log( + KEY, + "a string literal as the second argument that is far too long to fit into one hundred" //$NON-NLS-1$ + + " and twenty columns, so it reflows", //$NON-NLS-1$ + VALUE); + String chain = + "a string literal that is far too long to fit into one hundred and twenty columns, so it" //$NON-NLS-1$ + + " reflows" //$NON-NLS-1$ + + "with another literal"; //$NON-NLS-1$ + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-reflowed-literal.output b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-reflowed-literal-lf.case similarity index 58% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-reflowed-literal.output rename to open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-reflowed-literal-lf.case index fdc8aaefa..4bac0503a 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-reflowed-literal.output +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-reflowed-literal-lf.case @@ -1,3 +1,14 @@ +---------- +class ReflowedLiteral { + void markers() { + String reflowed = "a single string literal that is far too long to fit into one hundred and twenty columns, so the formatter reflows it"; //$NON-NLS-1$ + String unmarked = "a single string literal that is far too long to fit into one hundred and twenty columns, so the formatter reflows it"; + log( "short", "a string literal as the second argument that is far too long to fit into one hundred and twenty columns", "after" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + log(KEY, "a string literal as the second argument that is far too long to fit into one hundred and twenty columns, so it reflows", VALUE); //$NON-NLS-1$ + String chain = "a string literal that is far too long to fit into one hundred and twenty columns, so it reflows" + "with another literal"; //$NON-NLS-1$ //$NON-NLS-2$ + } +} +---------- class ReflowedLiteral { void markers() { String reflowed = diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-wrapped-arguments-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-wrapped-arguments-cr.case new file mode 100644 index 000000000..526e8e1ec --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-wrapped-arguments-cr.case @@ -0,0 +1 @@ +---------- class WrappedArguments { void markers() { String message = Messages.format("first argument that is long enough to matter", "second argument that is also rather long", "third one"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ String second = Messages.format( "first argument that is long enough to matter", "second argument that is also rather long", "third one" ); //$NON-NLS-2$ String twoOnALine = Messages.format("first argument that is long enough to matter", "a" + "b", "third argument that is also rather long"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ String keyAndValue = Messages.format(KEY, "an argument that is long enough to matter", "second argument that is also rather long", VALUE); //$NON-NLS-1$ //$NON-NLS-2$ String chained = builder.append("first argument that is long enough to matter").append("second argument that is also rather long").toString(); //$NON-NLS-1$ //$NON-NLS-2$ String noSuchLiteral = Messages.format("first argument that is long enough to matter", "second argument that is also rather long", "third one"); //$NON-NLS-1$ //$NON-NLS-5$ String fitsOnTheNextLine = Messages.format("first argument", "second one", "third"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } ---------- class WrappedArguments { void markers() { String message = Messages.format( "first argument that is long enough to matter", //$NON-NLS-1$ "second argument that is also rather long", //$NON-NLS-1$ "third one"); //$NON-NLS-1$ String second = Messages.format( "first argument that is long enough to matter", "second argument that is also rather long", //$NON-NLS-1$ "third one"); String twoOnALine = Messages.format( "first argument that is long enough to matter", //$NON-NLS-1$ "a" + "b", //$NON-NLS-1$ //$NON-NLS-2$ "third argument that is also rather long"); //$NON-NLS-1$ String keyAndValue = Messages.format( KEY, "an argument that is long enough to matter", //$NON-NLS-1$ "second argument that is also rather long", //$NON-NLS-1$ VALUE); String chained = builder.append("first argument that is long enough to matter") //$NON-NLS-1$ .append("second argument that is also rather long") //$NON-NLS-1$ .toString(); String noSuchLiteral = Messages.format( "first argument that is long enough to matter", //$NON-NLS-1$ "second argument that is also rather long", "third one"); //$NON-NLS-5$ String fitsOnTheNextLine = Messages.format("first argument", "second one", "third"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-wrapped-arguments-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-wrapped-arguments-crlf.case new file mode 100644 index 000000000..92f5786c0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-wrapped-arguments-crlf.case @@ -0,0 +1,43 @@ +---------- +class WrappedArguments { + void markers() { + String message = Messages.format("first argument that is long enough to matter", "second argument that is also rather long", "third one"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String second = Messages.format( "first argument that is long enough to matter", "second argument that is also rather long", "third one" ); //$NON-NLS-2$ + String twoOnALine = Messages.format("first argument that is long enough to matter", "a" + "b", "third argument that is also rather long"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + String keyAndValue = Messages.format(KEY, "an argument that is long enough to matter", "second argument that is also rather long", VALUE); //$NON-NLS-1$ //$NON-NLS-2$ + String chained = builder.append("first argument that is long enough to matter").append("second argument that is also rather long").toString(); //$NON-NLS-1$ //$NON-NLS-2$ + String noSuchLiteral = Messages.format("first argument that is long enough to matter", "second argument that is also rather long", "third one"); //$NON-NLS-1$ //$NON-NLS-5$ + String fitsOnTheNextLine = Messages.format("first argument", "second one", "third"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } +} +---------- +class WrappedArguments { + void markers() { + String message = Messages.format( + "first argument that is long enough to matter", //$NON-NLS-1$ + "second argument that is also rather long", //$NON-NLS-1$ + "third one"); //$NON-NLS-1$ + String second = Messages.format( + "first argument that is long enough to matter", + "second argument that is also rather long", //$NON-NLS-1$ + "third one"); + String twoOnALine = Messages.format( + "first argument that is long enough to matter", //$NON-NLS-1$ + "a" + "b", //$NON-NLS-1$ //$NON-NLS-2$ + "third argument that is also rather long"); //$NON-NLS-1$ + String keyAndValue = Messages.format( + KEY, + "an argument that is long enough to matter", //$NON-NLS-1$ + "second argument that is also rather long", //$NON-NLS-1$ + VALUE); + String chained = builder.append("first argument that is long enough to matter") //$NON-NLS-1$ + .append("second argument that is also rather long") //$NON-NLS-1$ + .toString(); + String noSuchLiteral = Messages.format( + "first argument that is long enough to matter", //$NON-NLS-1$ + "second argument that is also rather long", + "third one"); //$NON-NLS-5$ + String fitsOnTheNextLine = + Messages.format("first argument", "second one", "third"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-wrapped-arguments.output b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-wrapped-arguments-lf.case similarity index 55% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-wrapped-arguments.output rename to open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-wrapped-arguments-lf.case index b9d2836f9..76164b5ca 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-wrapped-arguments.output +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-wrapped-arguments-lf.case @@ -1,3 +1,16 @@ +---------- +class WrappedArguments { + void markers() { + String message = Messages.format("first argument that is long enough to matter", "second argument that is also rather long", "third one"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String second = Messages.format( "first argument that is long enough to matter", "second argument that is also rather long", "third one" ); //$NON-NLS-2$ + String twoOnALine = Messages.format("first argument that is long enough to matter", "a" + "b", "third argument that is also rather long"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + String keyAndValue = Messages.format(KEY, "an argument that is long enough to matter", "second argument that is also rather long", VALUE); //$NON-NLS-1$ //$NON-NLS-2$ + String chained = builder.append("first argument that is long enough to matter").append("second argument that is also rather long").toString(); //$NON-NLS-1$ //$NON-NLS-2$ + String noSuchLiteral = Messages.format("first argument that is long enough to matter", "second argument that is also rather long", "third one"); //$NON-NLS-1$ //$NON-NLS-5$ + String fitsOnTheNextLine = Messages.format("first argument", "second one", "third"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } +} +---------- class WrappedArguments { void markers() { String message = Messages.format( diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-compact-source-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-compact-source-cr.case new file mode 100644 index 000000000..1d73c701f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-compact-source-cr.case @@ -0,0 +1 @@ +---------- //usr/bin/env jbang "$0" "$@" ; exit $? //JAVA 25+ //PREVIEW //DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 void main() { IO.println(greeting()); } //DEPS org.example:after-main:1.0 String greeting() { return "Hello"; } ---------- //usr/bin/env jbang "$0" "$@" ; exit $? //JAVA 25+ //PREVIEW //DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 void main() { IO.println(greeting()); } // DEPS org.example:after-main:1.0 String greeting() { return "Hello"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-compact-source-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-compact-source-crlf.case new file mode 100644 index 000000000..6837f5c45 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-compact-source-crlf.case @@ -0,0 +1,23 @@ +---------- +//usr/bin/env jbang "$0" "$@" ; exit $? +//JAVA 25+ +//PREVIEW +//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 + +void main() { IO.println(greeting()); +} +//DEPS org.example:after-main:1.0 +String greeting() { return "Hello"; } +---------- +//usr/bin/env jbang "$0" "$@" ; exit $? +//JAVA 25+ +//PREVIEW +//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 + +void main() { + IO.println(greeting()); +} +// DEPS org.example:after-main:1.0 +String greeting() { + return "Hello"; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-compact-source-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-compact-source-lf.case new file mode 100644 index 000000000..3606b7e31 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-compact-source-lf.case @@ -0,0 +1,23 @@ +---------- +//usr/bin/env jbang "$0" "$@" ; exit $? +//JAVA 25+ +//PREVIEW +//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 + +void main() { IO.println(greeting()); +} +//DEPS org.example:after-main:1.0 +String greeting() { return "Hello"; } +---------- +//usr/bin/env jbang "$0" "$@" ; exit $? +//JAVA 25+ +//PREVIEW +//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 + +void main() { + IO.println(greeting()); +} +// DEPS org.example:after-main:1.0 +String greeting() { + return "Hello"; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-package-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-package-cr.case new file mode 100644 index 000000000..c234c6710 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-package-cr.case @@ -0,0 +1 @@ +---------- ///usr/bin/env bash -c 'command -v jbang >/dev/null 2>&1 || { echo "Bootstrapping JBang..." >&2; curl -Ls https://sh.jbang.dev | bash -s - app setup --quiet ; export PATH="$HOME/.jbang/bin:$PATH"; }; exec jbang "$0" "$@"' "$0" "$@"; exit $? /* * Licensed under the Apache License, Version 2.0. */ //DESCRIPTION Starts a Quarkus REST service that greets whoever calls it, with the startup banner switched off for scripts //CDS //DEPS io.quarkus:quarkus-bom:${quarkus.version:3.15.1}@pom //DEPS io.quarkus:quarkus-rest // the JAX-RS endpoints //Q:CONFIG quarkus.banner.enabled=false package org.example; //SOURCES model/Greeting.java import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; @Path("/hello") public class GreetingResource { @GET public String hello() { return "Hello"; } } ---------- ///usr/bin/env bash -c 'command -v jbang >/dev/null 2>&1 || { echo "Bootstrapping JBang..." >&2; curl -Ls https://sh.jbang.dev | bash -s - app setup --quiet ; export PATH="$HOME/.jbang/bin:$PATH"; }; exec jbang "$0" "$@"' "$0" "$@"; exit $? /* * Licensed under the Apache License, Version 2.0. */ //DESCRIPTION Starts a Quarkus REST service that greets whoever calls it, with the startup banner switched off for scripts //CDS //DEPS io.quarkus:quarkus-bom:${quarkus.version:3.15.1}@pom //DEPS io.quarkus:quarkus-rest // the JAX-RS endpoints //Q:CONFIG quarkus.banner.enabled=false package org.example; // SOURCES model/Greeting.java import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; @Path("/hello") public class GreetingResource { @GET public String hello() { return "Hello"; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-package-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-package-crlf.case new file mode 100644 index 000000000..4f9eb5fdb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-package-crlf.case @@ -0,0 +1,44 @@ +---------- +///usr/bin/env bash -c 'command -v jbang >/dev/null 2>&1 || { echo "Bootstrapping JBang..." >&2; curl -Ls https://sh.jbang.dev | bash -s - app setup --quiet ; export PATH="$HOME/.jbang/bin:$PATH"; }; exec jbang "$0" "$@"' "$0" "$@"; exit $? +/* + * Licensed under the Apache License, Version 2.0. + */ +//DESCRIPTION Starts a Quarkus REST service that greets whoever calls it, with the startup banner switched off for scripts +//CDS +//DEPS io.quarkus:quarkus-bom:${quarkus.version:3.15.1}@pom +//DEPS io.quarkus:quarkus-rest // the JAX-RS endpoints +//Q:CONFIG quarkus.banner.enabled=false +package org.example; +//SOURCES model/Greeting.java + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; + +@Path("/hello") +public class GreetingResource { + @GET public String hello() { + return "Hello"; } +} +---------- +///usr/bin/env bash -c 'command -v jbang >/dev/null 2>&1 || { echo "Bootstrapping JBang..." >&2; curl -Ls https://sh.jbang.dev | bash -s - app setup --quiet ; export PATH="$HOME/.jbang/bin:$PATH"; }; exec jbang "$0" "$@"' "$0" "$@"; exit $? +/* + * Licensed under the Apache License, Version 2.0. + */ +//DESCRIPTION Starts a Quarkus REST service that greets whoever calls it, with the startup banner switched off for scripts +//CDS +//DEPS io.quarkus:quarkus-bom:${quarkus.version:3.15.1}@pom +//DEPS io.quarkus:quarkus-rest // the JAX-RS endpoints +//Q:CONFIG quarkus.banner.enabled=false +package org.example; +// SOURCES model/Greeting.java + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; + +@Path("/hello") +public class GreetingResource { + @GET + public String hello() { + return "Hello"; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-package-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-package-lf.case new file mode 100644 index 000000000..626bb15ca --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-package-lf.case @@ -0,0 +1,44 @@ +---------- +///usr/bin/env bash -c 'command -v jbang >/dev/null 2>&1 || { echo "Bootstrapping JBang..." >&2; curl -Ls https://sh.jbang.dev | bash -s - app setup --quiet ; export PATH="$HOME/.jbang/bin:$PATH"; }; exec jbang "$0" "$@"' "$0" "$@"; exit $? +/* + * Licensed under the Apache License, Version 2.0. + */ +//DESCRIPTION Starts a Quarkus REST service that greets whoever calls it, with the startup banner switched off for scripts +//CDS +//DEPS io.quarkus:quarkus-bom:${quarkus.version:3.15.1}@pom +//DEPS io.quarkus:quarkus-rest // the JAX-RS endpoints +//Q:CONFIG quarkus.banner.enabled=false +package org.example; +//SOURCES model/Greeting.java + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; + +@Path("/hello") +public class GreetingResource { + @GET public String hello() { + return "Hello"; } +} +---------- +///usr/bin/env bash -c 'command -v jbang >/dev/null 2>&1 || { echo "Bootstrapping JBang..." >&2; curl -Ls https://sh.jbang.dev | bash -s - app setup --quiet ; export PATH="$HOME/.jbang/bin:$PATH"; }; exec jbang "$0" "$@"' "$0" "$@"; exit $? +/* + * Licensed under the Apache License, Version 2.0. + */ +//DESCRIPTION Starts a Quarkus REST service that greets whoever calls it, with the startup banner switched off for scripts +//CDS +//DEPS io.quarkus:quarkus-bom:${quarkus.version:3.15.1}@pom +//DEPS io.quarkus:quarkus-rest // the JAX-RS endpoints +//Q:CONFIG quarkus.banner.enabled=false +package org.example; +// SOURCES model/Greeting.java + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; + +@Path("/hello") +public class GreetingResource { + @GET + public String hello() { + return "Hello"; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-argument-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-argument-cr.case new file mode 100644 index 000000000..7257944d6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-argument-cr.case @@ -0,0 +1 @@ +---------- class T { void f() { LOGGER.warning(String.format(""" @Gauge is configured on a bean %s that is neither ApplicationScoped nor \ Singleton. This is most likely a bug. You may set 'metrics.warn-dependent' \ configuration option to 'false' to remove this warning.""", clazz.getName())); } } ---------- class T { void f() { LOGGER.warning(String.format(""" @Gauge is configured on a bean %s that is neither ApplicationScoped nor \ Singleton. This is most likely a bug. You may set 'metrics.warn-dependent' \ configuration option to 'false' to remove this warning.\ """, clazz.getName())); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-argument-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-argument-crlf.case new file mode 100644 index 000000000..5dd833c4d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-argument-crlf.case @@ -0,0 +1,19 @@ +---------- +class T { + void f() { + LOGGER.warning(String.format(""" + @Gauge is configured on a bean %s that is neither ApplicationScoped nor \ + Singleton. This is most likely a bug. You may set 'metrics.warn-dependent' \ + configuration option to 'false' to remove this warning.""", clazz.getName())); + } +} +---------- +class T { + void f() { + LOGGER.warning(String.format(""" + @Gauge is configured on a bean %s that is neither ApplicationScoped nor \ + Singleton. This is most likely a bug. You may set 'metrics.warn-dependent' \ + configuration option to 'false' to remove this warning.\ + """, clazz.getName())); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-argument.input b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-argument-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-argument.input rename to open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-argument-lf.case index ceaabe7d1..ff3de55d6 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-argument.input +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-argument-lf.case @@ -1,3 +1,4 @@ +---------- class T { void f() { LOGGER.warning(String.format(""" @@ -6,3 +7,13 @@ class T { configuration option to 'false' to remove this warning.""", clazz.getName())); } } +---------- +class T { + void f() { + LOGGER.warning(String.format(""" + @Gauge is configured on a bean %s that is neither ApplicationScoped nor \ + Singleton. This is most likely a bug. You may set 'metrics.warn-dependent' \ + configuration option to 'false' to remove this warning.\ + """, clazz.getName())); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-ternary-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-ternary-cr.case new file mode 100644 index 000000000..ebfb62d19 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-ternary-cr.case @@ -0,0 +1 @@ +---------- class TernaryBug { boolean flag = true; String a = flag ? """ yes """ : """ no """; } ---------- class TernaryBug { boolean flag = true; String a = flag ? """ yes """ : """ no """; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-ternary-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-ternary-crlf.case new file mode 100644 index 000000000..d9b19f367 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-ternary-crlf.case @@ -0,0 +1,22 @@ +---------- +class TernaryBug { + boolean flag = true; + + String a = flag + ? """ + yes + """ + : """ + no + """; +} +---------- +class TernaryBug { + boolean flag = true; + + String a = flag ? """ + yes + """ : """ + no + """; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-ternary-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-ternary-lf.case new file mode 100644 index 000000000..d649a2825 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-ternary-lf.case @@ -0,0 +1,22 @@ +---------- +class TernaryBug { + boolean flag = true; + + String a = flag + ? """ + yes + """ + : """ + no + """; +} +---------- +class TernaryBug { + boolean flag = true; + + String a = flag ? """ + yes + """ : """ + no + """; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-cr.case new file mode 100644 index 000000000..b24b5eb5a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-cr.case @@ -0,0 +1 @@ +---------- /* class X { *//** javadoc *//* public void foo(Bar bar) {} *//** javadoc *//* public void foo(Bar bar) {} *//** javadoc *//* public void foo(Bar bar) {} *//** javadoc *//* public void foo(Bar bar) {} }*/ ---------- /* class X { *//** javadoc *//* public void foo(Bar bar) {} *//** javadoc *//* public void foo(Bar bar) {} *//** javadoc *//* public void foo(Bar bar) {} *//** javadoc *//* public void foo(Bar bar) {} }*/ \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-crlf.case new file mode 100644 index 000000000..19539577d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-crlf.case @@ -0,0 +1,30 @@ +---------- +/* +class X { + *//** javadoc *//* + public void foo(Bar bar) {} + + *//** javadoc *//* + public void foo(Bar bar) {} + + *//** javadoc *//* + public void foo(Bar bar) {} + + *//** javadoc *//* + public void foo(Bar bar) {} +}*/ +---------- +/* +class X { + *//** javadoc *//* + public void foo(Bar bar) {} + + *//** javadoc *//* + public void foo(Bar bar) {} + + *//** javadoc *//* + public void foo(Bar bar) {} + + *//** javadoc *//* + public void foo(Bar bar) {} + }*/ diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-36-multiline-comments-on-one-line.output b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-lf.case similarity index 69% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-36-multiline-comments-on-one-line.output rename to open-java-format/src/test/resources/test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-lf.case index 84d857ff0..20cdf8dd2 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-36-multiline-comments-on-one-line.output +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-lf.case @@ -1,3 +1,19 @@ +---------- +/* +class X { + *//** javadoc *//* + public void foo(Bar bar) {} + + *//** javadoc *//* + public void foo(Bar bar) {} + + *//** javadoc *//* + public void foo(Bar bar) {} + + *//** javadoc *//* + public void foo(Bar bar) {} +}*/ +---------- /* class X { *//** javadoc *//* diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-38-nbsp-line-comment-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-38-nbsp-line-comment-cr.case new file mode 100644 index 000000000..31be29622 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-38-nbsp-line-comment-cr.case @@ -0,0 +1 @@ +---------- class NbspLineComment { // Batches are capped: the importer rejects any upstream export file whose total row count is at or above 1 000 000 000 rows, so split larger files first. int rows; //String testString = " thisisnotaHYPERLINKandsoitshouldntbetruncatedinsteaditshouldbedroppedthisisnotaHYPERLINKandsoit \"http://www.example.com/\"" String url; } ---------- class NbspLineComment { // Batches are capped: the importer rejects any upstream export file whose total row count is at or above // 1 000 000 000 rows, so split larger files first. int rows; // String testString = // " thisisnotaHYPERLINKandsoitshouldntbetruncatedinsteaditshouldbedroppedthisisnotaHYPERLINKandsoit // \"http://www.example.com/\"" String url; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-38-nbsp-line-comment-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-38-nbsp-line-comment-crlf.case new file mode 100644 index 000000000..e53735a16 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-38-nbsp-line-comment-crlf.case @@ -0,0 +1,19 @@ +---------- +class NbspLineComment { + // Batches are capped: the importer rejects any upstream export file whose total row count is at or above 1 000 000 000 rows, so split larger files first. + int rows; + + //String testString = " thisisnotaHYPERLINKandsoitshouldntbetruncatedinsteaditshouldbedroppedthisisnotaHYPERLINKandsoit \"http://www.example.com/\"" + String url; +} +---------- +class NbspLineComment { + // Batches are capped: the importer rejects any upstream export file whose total row count is at or above + // 1 000 000 000 rows, so split larger files first. + int rows; + + // String testString = + // " thisisnotaHYPERLINKandsoitshouldntbetruncatedinsteaditshouldbedroppedthisisnotaHYPERLINKandsoit + // \"http://www.example.com/\"" + String url; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-38-nbsp-line-comment.output b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-38-nbsp-line-comment-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-38-nbsp-line-comment.output rename to open-java-format/src/test/resources/test-cases/testdata/ojf-issue-38-nbsp-line-comment-lf.case index a504eee7f..2aec28636 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-38-nbsp-line-comment.output +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-38-nbsp-line-comment-lf.case @@ -1,3 +1,12 @@ +---------- +class NbspLineComment { + // Batches are capped: the importer rejects any upstream export file whose total row count is at or above 1 000 000 000 rows, so split larger files first. + int rows; + + //String testString = " thisisnotaHYPERLINKandsoitshouldntbetruncatedinsteaditshouldbedroppedthisisnotaHYPERLINKandsoit \"http://www.example.com/\"" + String url; +} +---------- class NbspLineComment { // Batches are capped: the importer rejects any upstream export file whose total row count is at or above // 1 000 000 000 rows, so split larger files first. diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-cr.case new file mode 100644 index 000000000..4d4129c3d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-cr.case @@ -0,0 +1 @@ +---------- class TCPTransport { @SuppressWarnings("removal") static final Log tcpLog = Log.getLog( "sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged((PrivilegedAction< String>) () -> System.getProperty("sun.rmi.transport.tcp.logLevel")))); static final Level level = LogStream.parseLevel(AccessController.doPrivileged((PrivilegedAction)()->System.getProperty("sun.rmi.transport.tcp.logLevel.and.some.more"))); static final Log methodReference = Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel( AccessController.doPrivileged( ( PrivilegedAction ) SomeVeryLongClassNameToFillTheLine :: getTheTcpLogLevelProperty))); static final Log twoTypeArguments = Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged((Function< String ,Integer >) s-> System.getProperty("sun.rmi.transport.tcp.logLevel.x")))); static final Log nested = Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged((Map>) () -> System.getProperty("sun.rmi.transport.tcp.lv")))); static final Log qualified = Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged((java.util.function. Function) s -> System.getProperty("sun.rmi.logLevel")))); static final Log intersection = Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel( AccessController.doPrivileged((Runnable &java.io.Serializable) () -> System.getProperty("sun.rmi.transport.tcp.logLevelxx")))); static final Log annotated = Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged((Function<@Nullable String, Integer [ ]>) s -> System.getProperty("sun.rmi.transport.tcp.lvl")))); } ---------- class TCPTransport { @SuppressWarnings("removal") static final Log tcpLog = Log.getLog( "sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged( (PrivilegedAction) () -> System.getProperty("sun.rmi.transport.tcp.logLevel")))); static final Level level = LogStream.parseLevel(AccessController.doPrivileged( (PrivilegedAction) () -> System.getProperty("sun.rmi.transport.tcp.logLevel.and.some.more"))); static final Log methodReference = Log.getLog( "sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged( (PrivilegedAction) SomeVeryLongClassNameToFillTheLine::getTheTcpLogLevelProperty))); static final Log twoTypeArguments = Log.getLog( "sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged( (Function) s -> System.getProperty("sun.rmi.transport.tcp.logLevel.x")))); static final Log nested = Log.getLog( "sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged( (Map>) () -> System.getProperty("sun.rmi.transport.tcp.lv")))); static final Log qualified = Log.getLog( "sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged( (java.util.function.Function) s -> System.getProperty("sun.rmi.logLevel")))); static final Log intersection = Log.getLog( "sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged( (Runnable & java.io.Serializable) () -> System.getProperty("sun.rmi.transport.tcp.logLevelxx")))); static final Log annotated = Log.getLog( "sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged( (Function<@Nullable String, Integer[]>) s -> System.getProperty("sun.rmi.transport.tcp.lvl")))); } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-crlf.case new file mode 100644 index 000000000..630f43311 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-crlf.case @@ -0,0 +1,85 @@ +---------- +class TCPTransport { + @SuppressWarnings("removal") + static final Log tcpLog = Log.getLog( + "sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged((PrivilegedAction< + String>) + () -> System.getProperty("sun.rmi.transport.tcp.logLevel")))); + + static final Level level = LogStream.parseLevel(AccessController.doPrivileged((PrivilegedAction)()->System.getProperty("sun.rmi.transport.tcp.logLevel.and.some.more"))); + + static final Log methodReference = Log.getLog("sun.rmi.transport.tcp", + "tcp", + LogStream.parseLevel( + AccessController.doPrivileged( + ( PrivilegedAction ) + SomeVeryLongClassNameToFillTheLine + :: getTheTcpLogLevelProperty))); + + static final Log twoTypeArguments = + Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged((Function< String ,Integer >) s-> + System.getProperty("sun.rmi.transport.tcp.logLevel.x")))); + + static final Log nested = Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged((Map>) () -> System.getProperty("sun.rmi.transport.tcp.lv")))); + + static final Log qualified = Log.getLog("sun.rmi.transport.tcp", "tcp", + LogStream.parseLevel(AccessController.doPrivileged((java.util.function. + Function) s -> System.getProperty("sun.rmi.logLevel")))); + + static final Log intersection = Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel( + AccessController.doPrivileged((Runnable + &java.io.Serializable) () -> System.getProperty("sun.rmi.transport.tcp.logLevelxx")))); + + static final Log annotated = Log.getLog("sun.rmi.transport.tcp", "tcp", + LogStream.parseLevel(AccessController.doPrivileged((Function<@Nullable String, Integer [ ]>) + s -> System.getProperty("sun.rmi.transport.tcp.lvl")))); +} +---------- +class TCPTransport { + @SuppressWarnings("removal") + static final Log tcpLog = Log.getLog( + "sun.rmi.transport.tcp", + "tcp", + LogStream.parseLevel(AccessController.doPrivileged( + (PrivilegedAction) () -> System.getProperty("sun.rmi.transport.tcp.logLevel")))); + + static final Level level = LogStream.parseLevel(AccessController.doPrivileged( + (PrivilegedAction) () -> System.getProperty("sun.rmi.transport.tcp.logLevel.and.some.more"))); + + static final Log methodReference = Log.getLog( + "sun.rmi.transport.tcp", + "tcp", + LogStream.parseLevel(AccessController.doPrivileged( + (PrivilegedAction) SomeVeryLongClassNameToFillTheLine::getTheTcpLogLevelProperty))); + + static final Log twoTypeArguments = Log.getLog( + "sun.rmi.transport.tcp", + "tcp", + LogStream.parseLevel(AccessController.doPrivileged( + (Function) s -> System.getProperty("sun.rmi.transport.tcp.logLevel.x")))); + + static final Log nested = Log.getLog( + "sun.rmi.transport.tcp", + "tcp", + LogStream.parseLevel(AccessController.doPrivileged( + (Map>) () -> System.getProperty("sun.rmi.transport.tcp.lv")))); + + static final Log qualified = Log.getLog( + "sun.rmi.transport.tcp", + "tcp", + LogStream.parseLevel(AccessController.doPrivileged( + (java.util.function.Function) s -> System.getProperty("sun.rmi.logLevel")))); + + static final Log intersection = Log.getLog( + "sun.rmi.transport.tcp", + "tcp", + LogStream.parseLevel(AccessController.doPrivileged( + (Runnable & java.io.Serializable) () -> System.getProperty("sun.rmi.transport.tcp.logLevelxx")))); + + static final Log annotated = Log.getLog( + "sun.rmi.transport.tcp", + "tcp", + LogStream.parseLevel(AccessController.doPrivileged( + (Function<@Nullable String, Integer[]>) s -> System.getProperty("sun.rmi.transport.tcp.lvl")))); +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-60-cast-type-in-inline-chain.output b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-60-cast-type-in-inline-chain.output rename to open-java-format/src/test/resources/test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-lf.case index c179a2667..4ed18c161 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-60-cast-type-in-inline-chain.output +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-lf.case @@ -1,3 +1,41 @@ +---------- +class TCPTransport { + @SuppressWarnings("removal") + static final Log tcpLog = Log.getLog( + "sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged((PrivilegedAction< + String>) + () -> System.getProperty("sun.rmi.transport.tcp.logLevel")))); + + static final Level level = LogStream.parseLevel(AccessController.doPrivileged((PrivilegedAction)()->System.getProperty("sun.rmi.transport.tcp.logLevel.and.some.more"))); + + static final Log methodReference = Log.getLog("sun.rmi.transport.tcp", + "tcp", + LogStream.parseLevel( + AccessController.doPrivileged( + ( PrivilegedAction ) + SomeVeryLongClassNameToFillTheLine + :: getTheTcpLogLevelProperty))); + + static final Log twoTypeArguments = + Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged((Function< String ,Integer >) s-> + System.getProperty("sun.rmi.transport.tcp.logLevel.x")))); + + static final Log nested = Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel(AccessController.doPrivileged((Map>) () -> System.getProperty("sun.rmi.transport.tcp.lv")))); + + static final Log qualified = Log.getLog("sun.rmi.transport.tcp", "tcp", + LogStream.parseLevel(AccessController.doPrivileged((java.util.function. + Function) s -> System.getProperty("sun.rmi.logLevel")))); + + static final Log intersection = Log.getLog("sun.rmi.transport.tcp", "tcp", LogStream.parseLevel( + AccessController.doPrivileged((Runnable + &java.io.Serializable) () -> System.getProperty("sun.rmi.transport.tcp.logLevelxx")))); + + static final Log annotated = Log.getLog("sun.rmi.transport.tcp", "tcp", + LogStream.parseLevel(AccessController.doPrivileged((Function<@Nullable String, Integer [ ]>) + s -> System.getProperty("sun.rmi.transport.tcp.lvl")))); +} +---------- class TCPTransport { @SuppressWarnings("removal") static final Log tcpLog = Log.getLog( diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-cr.case new file mode 100644 index 000000000..703e35953 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-cr.case @@ -0,0 +1 @@ +---------- import java.util.stream.IntStream; class Repro { int find(Item[] items) { return IntStream.range(0, items.length) .filter(i -> (items[i].getName().equals("alpha") || items[i].getName().equals("beta") || items[i].getName().equals("gamma") // || (items[i].getName().equals("delta") && items.length > i // && items[i + 1].getName().equals("epsilon")) )).findFirst().orElse(-1); } void plainCall() { check(i -> (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(i) || bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(i) // || c(i) )); } void blockComment() { check(i -> (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(i) || bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(i) /* block */ )); } } ---------- import java.util.stream.IntStream; class Repro { int find(Item[] items) { return IntStream.range(0, items.length) .filter(i -> (items[i].getName().equals("alpha") || items[i].getName().equals("beta") || items[i].getName().equals("gamma") // || (items[i].getName().equals("delta") && items.length > i // && items[i + 1].getName().equals("epsilon")) )) .findFirst() .orElse(-1); } void plainCall() { check(i -> (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(i) || bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(i) // || c(i) )); } void blockComment() { check(i -> (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(i) || bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(i) /* block */ )); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-crlf.case new file mode 100644 index 000000000..ad4917d5f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-crlf.case @@ -0,0 +1,58 @@ +---------- +import java.util.stream.IntStream; + +class Repro { + int find(Item[] items) { + return IntStream.range(0, items.length) + .filter(i -> (items[i].getName().equals("alpha") || items[i].getName().equals("beta") + || items[i].getName().equals("gamma") + // || (items[i].getName().equals("delta") && items.length > i + // && items[i + 1].getName().equals("epsilon")) + )).findFirst().orElse(-1); + } + + void plainCall() { + check(i -> (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(i) || bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(i) + // || c(i) + )); + } + + void blockComment() { + check(i -> (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(i) || bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(i) + /* block */ + )); + } +} +---------- +import java.util.stream.IntStream; + +class Repro { + int find(Item[] items) { + return IntStream.range(0, items.length) + .filter(i -> + (items[i].getName().equals("alpha") + || items[i].getName().equals("beta") + || items[i].getName().equals("gamma") + // || (items[i].getName().equals("delta") && items.length > i + // && items[i + 1].getName().equals("epsilon")) + )) + .findFirst() + .orElse(-1); + } + + void plainCall() { + check(i -> + (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(i) + || bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(i) + // || c(i) + )); + } + + void blockComment() { + check(i -> + (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(i) + || bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(i) + /* block */ + )); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-62-comment-before-lambda-close-parens.output b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-lf.case similarity index 54% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-62-comment-before-lambda-close-parens.output rename to open-java-format/src/test/resources/test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-lf.case index f6b141e66..67a7d116a 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-62-comment-before-lambda-close-parens.output +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-lf.case @@ -1,3 +1,29 @@ +---------- +import java.util.stream.IntStream; + +class Repro { + int find(Item[] items) { + return IntStream.range(0, items.length) + .filter(i -> (items[i].getName().equals("alpha") || items[i].getName().equals("beta") + || items[i].getName().equals("gamma") + // || (items[i].getName().equals("delta") && items.length > i + // && items[i + 1].getName().equals("epsilon")) + )).findFirst().orElse(-1); + } + + void plainCall() { + check(i -> (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(i) || bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(i) + // || c(i) + )); + } + + void blockComment() { + check(i -> (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(i) || bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(i) + /* block */ + )); + } +} +---------- import java.util.stream.IntStream; class Repro { diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-long-generic-field-type-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-long-generic-field-type-cr.case new file mode 100644 index 000000000..914785dc4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-long-generic-field-type-cr.case @@ -0,0 +1 @@ +---------- class LongGenericFieldType { private final AtomicReference> gridViewConfigurations = new AtomicReference<>(ImmutableTable.of()); private final AtomicReference> gridViewConfigurationsWithDefault = new AtomicReference<>(ImmutableTable.of()); private final AtomicReference> gridViewConfigurationsWithLongNames = new AtomicReference<>(ImmutableTable.of()); } ---------- class LongGenericFieldType { private final AtomicReference> gridViewConfigurations = new AtomicReference<>(ImmutableTable.of()); private final AtomicReference< Table> gridViewConfigurationsWithDefault = new AtomicReference<>(ImmutableTable.of()); private final AtomicReference< Table< RealmNameIdentifierValue, CoreGridViewConfigurationIdentifierValue, CoreGridViewConfigurationEntryValue, DefaultValue>> gridViewConfigurationsWithLongNames = new AtomicReference<>(ImmutableTable.of()); } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-long-generic-field-type-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-long-generic-field-type-crlf.case new file mode 100644 index 000000000..61d835513 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-long-generic-field-type-crlf.case @@ -0,0 +1,25 @@ +---------- +class LongGenericFieldType { + private final AtomicReference> gridViewConfigurations = new AtomicReference<>(ImmutableTable.of()); + + private final AtomicReference> gridViewConfigurationsWithDefault = new AtomicReference<>(ImmutableTable.of()); + + private final AtomicReference> gridViewConfigurationsWithLongNames = new AtomicReference<>(ImmutableTable.of()); +} +---------- +class LongGenericFieldType { + private final AtomicReference> + gridViewConfigurations = new AtomicReference<>(ImmutableTable.of()); + + private final AtomicReference< + Table> + gridViewConfigurationsWithDefault = new AtomicReference<>(ImmutableTable.of()); + + private final AtomicReference< + Table< + RealmNameIdentifierValue, + CoreGridViewConfigurationIdentifierValue, + CoreGridViewConfigurationEntryValue, + DefaultValue>> + gridViewConfigurationsWithLongNames = new AtomicReference<>(ImmutableTable.of()); +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-long-generic-field-type.output b/open-java-format/src/test/resources/test-cases/testdata/ojf-long-generic-field-type-lf.case similarity index 55% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-long-generic-field-type.output rename to open-java-format/src/test/resources/test-cases/testdata/ojf-long-generic-field-type-lf.case index b684e45a3..60c224b4f 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-long-generic-field-type.output +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-long-generic-field-type-lf.case @@ -1,3 +1,12 @@ +---------- +class LongGenericFieldType { + private final AtomicReference> gridViewConfigurations = new AtomicReference<>(ImmutableTable.of()); + + private final AtomicReference> gridViewConfigurationsWithDefault = new AtomicReference<>(ImmutableTable.of()); + + private final AtomicReference> gridViewConfigurationsWithLongNames = new AtomicReference<>(ImmutableTable.of()); +} +---------- class LongGenericFieldType { private final AtomicReference> gridViewConfigurations = new AtomicReference<>(ImmutableTable.of()); diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-semicolon-only-body-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-semicolon-only-body-cr.case new file mode 100644 index 000000000..87e9fa2fb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-semicolon-only-body-cr.case @@ -0,0 +1 @@ +---------- interface B { ; } enum C { X; ; } record R(int a) { ; } class E { ;; } class F { Object o = new Object() { ; }; } class G { // comment ; } @interface H { ; } class I { ; int x; } ---------- interface B { ; } enum C { X; ; } record R(int a) { ; } class E { ; ; } class F { Object o = new Object() { ; }; } class G { // comment ; } @interface H { ; } class I { ; int x; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-semicolon-only-body-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-semicolon-only-body-crlf.case new file mode 100644 index 000000000..26f2da2eb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-semicolon-only-body-crlf.case @@ -0,0 +1,51 @@ +---------- +interface B { ; } +enum C { X; ; } +record R(int a) { ; } +class E { ;; } +class F { Object o = new Object() { ; }; } +class G { // comment + ; +} +@interface H { ; } +class I { + ; + int x; +} +---------- +interface B { + ; +} + +enum C { + X; + ; +} + +record R(int a) { + ; +} + +class E { + ; + ; +} + +class F { + Object o = new Object() { + ; + }; +} + +class G { // comment + ; +} + +@interface H { + ; +} + +class I { + ; + int x; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-semicolon-only-body.output b/open-java-format/src/test/resources/test-cases/testdata/ojf-semicolon-only-body-lf.case similarity index 54% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-semicolon-only-body.output rename to open-java-format/src/test/resources/test-cases/testdata/ojf-semicolon-only-body-lf.case index 38962018b..45839878f 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-semicolon-only-body.output +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-semicolon-only-body-lf.case @@ -1,3 +1,18 @@ +---------- +interface B { ; } +enum C { X; ; } +record R(int a) { ; } +class E { ;; } +class F { Object o = new Object() { ; }; } +class G { // comment + ; +} +@interface H { ; } +class I { + ; + int x; +} +---------- interface B { ; } diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-1-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-1-cr.case new file mode 100644 index 000000000..e383a2711 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-1-cr.case @@ -0,0 +1 @@ +---------- class Palantir1 { void foo() { for (Double d : Lists.newArrayList(5.0, 10.0, 1.0, 0.0)) { list.add(new BinaryNumericConstantColumnInfoV1( operation, SparkIntegrationTestRuleSets.column("x"), d, Optional.empty())); } } } ---------- class Palantir1 { void foo() { for (Double d : Lists.newArrayList(5.0, 10.0, 1.0, 0.0)) { list.add(new BinaryNumericConstantColumnInfoV1( operation, SparkIntegrationTestRuleSets.column("x"), d, Optional.empty())); } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-1-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-1-crlf.case new file mode 100644 index 000000000..26aff357b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-1-crlf.case @@ -0,0 +1,18 @@ +---------- +class Palantir1 { + void foo() { + for (Double d : Lists.newArrayList(5.0, 10.0, 1.0, 0.0)) { + list.add(new BinaryNumericConstantColumnInfoV1( + operation, SparkIntegrationTestRuleSets.column("x"), d, Optional.empty())); + } + } +} +---------- +class Palantir1 { + void foo() { + for (Double d : Lists.newArrayList(5.0, 10.0, 1.0, 0.0)) { + list.add(new BinaryNumericConstantColumnInfoV1( + operation, SparkIntegrationTestRuleSets.column("x"), d, Optional.empty())); + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-1-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-1-lf.case new file mode 100644 index 000000000..09bb69c8c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-1-lf.case @@ -0,0 +1,18 @@ +---------- +class Palantir1 { + void foo() { + for (Double d : Lists.newArrayList(5.0, 10.0, 1.0, 0.0)) { + list.add(new BinaryNumericConstantColumnInfoV1( + operation, SparkIntegrationTestRuleSets.column("x"), d, Optional.empty())); + } + } +} +---------- +class Palantir1 { + void foo() { + for (Double d : Lists.newArrayList(5.0, 10.0, 1.0, 0.0)) { + list.add(new BinaryNumericConstantColumnInfoV1( + operation, SparkIntegrationTestRuleSets.column("x"), d, Optional.empty())); + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-10-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-10-cr.case new file mode 100644 index 000000000..a1d0aee72 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-10-cr.case @@ -0,0 +1 @@ +---------- class Palantir10 { // We preserve input newlines for this long string concatenation (more than 2 lines) @SqlUpdate("CREATE TABLE things " + "(id VARCHAR(" + MAX_LENGTH + ") NOT NULL, " + "title VARCHAR(" + MAX_LENGTH + ") NOT NULL, " + "description VARCHAR(" + MAX_DESCRIPTION_LENGTH + ") NOT NULL, " + "standard BOOLEAN NOT NULL, " + "documentJson VARCHAR(" + MAX_DOCUMENT_LENGTH + ") NOT NULL, " + "PRIMARY KEY (id))") void createTable(); void foo() { // Test that we still reflow short string concatenations (spanning exactly 2 lines) foo( "foo" + "bar" + THING + "baz"); foo("foo" + "bar" + THING + "baz"); // This causes an NPE if we're not careful when getting the last token of the binary expression if (!partialDataSourceType.equals(dataSourceType)) { throw new ClientException("You may not use a " + partialDataSourceType + " partial in a " + dataSourceType + " query. Caused by partial \"" + partialName + "\"" ); } } } ---------- class Palantir10 { // We preserve input newlines for this long string concatenation (more than 2 lines) @SqlUpdate("CREATE TABLE things " + "(id VARCHAR(" + MAX_LENGTH + ") NOT NULL, " + "title VARCHAR(" + MAX_LENGTH + ") NOT NULL, " + "description VARCHAR(" + MAX_DESCRIPTION_LENGTH + ") NOT NULL, " + "standard BOOLEAN NOT NULL, " + "documentJson VARCHAR(" + MAX_DOCUMENT_LENGTH + ") NOT NULL, " + "PRIMARY KEY (id))") void createTable(); void foo() { // Test that we still reflow short string concatenations (spanning exactly 2 lines) foo("foo" + "bar" + THING + "baz"); foo("foo" + "bar" + THING + "baz"); // This causes an NPE if we're not careful when getting the last token of the binary expression if (!partialDataSourceType.equals(dataSourceType)) { throw new ClientException("You may not use a " + partialDataSourceType + " partial in a " + dataSourceType + " query. Caused by partial \"" + partialName + "\""); } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-10-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-10-crlf.case new file mode 100644 index 000000000..0b37130c3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-10-crlf.case @@ -0,0 +1,52 @@ +---------- +class Palantir10 { + // We preserve input newlines for this long string concatenation (more than 2 lines) + @SqlUpdate("CREATE TABLE things " + + "(id VARCHAR(" + MAX_LENGTH + ") NOT NULL, " + + "title VARCHAR(" + MAX_LENGTH + ") NOT NULL, " + + "description VARCHAR(" + MAX_DESCRIPTION_LENGTH + ") NOT NULL, " + + "standard BOOLEAN NOT NULL, " + + "documentJson VARCHAR(" + MAX_DOCUMENT_LENGTH + ") NOT NULL, " + + "PRIMARY KEY (id))") + void createTable(); + + void foo() { + // Test that we still reflow short string concatenations (spanning exactly 2 lines) + foo( + "foo" + + "bar" + THING + "baz"); + foo("foo" + + "bar" + THING + "baz"); + + // This causes an NPE if we're not careful when getting the last token of the binary expression + if (!partialDataSourceType.equals(dataSourceType)) { + throw new ClientException("You may not use a " + partialDataSourceType + + " partial in a " + dataSourceType + " query. Caused by partial \"" + partialName + "\"" + ); + } + } +} +---------- +class Palantir10 { + // We preserve input newlines for this long string concatenation (more than 2 lines) + @SqlUpdate("CREATE TABLE things " + + "(id VARCHAR(" + MAX_LENGTH + ") NOT NULL, " + + "title VARCHAR(" + MAX_LENGTH + ") NOT NULL, " + + "description VARCHAR(" + MAX_DESCRIPTION_LENGTH + ") NOT NULL, " + + "standard BOOLEAN NOT NULL, " + + "documentJson VARCHAR(" + MAX_DOCUMENT_LENGTH + ") NOT NULL, " + + "PRIMARY KEY (id))") + void createTable(); + + void foo() { + // Test that we still reflow short string concatenations (spanning exactly 2 lines) + foo("foo" + "bar" + THING + "baz"); + foo("foo" + "bar" + THING + "baz"); + + // This causes an NPE if we're not careful when getting the last token of the binary expression + if (!partialDataSourceType.equals(dataSourceType)) { + throw new ClientException("You may not use a " + partialDataSourceType + " partial in a " + dataSourceType + + " query. Caused by partial \"" + partialName + "\""); + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-10.input b/open-java-format/src/test/resources/test-cases/testdata/palantir-10-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-10.input rename to open-java-format/src/test/resources/test-cases/testdata/palantir-10-lf.case index 01de232f9..fcf8aa1cb 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-10.input +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-10-lf.case @@ -1,3 +1,4 @@ +---------- class Palantir10 { // We preserve input newlines for this long string concatenation (more than 2 lines) @SqlUpdate("CREATE TABLE things " @@ -25,3 +26,27 @@ class Palantir10 { } } } +---------- +class Palantir10 { + // We preserve input newlines for this long string concatenation (more than 2 lines) + @SqlUpdate("CREATE TABLE things " + + "(id VARCHAR(" + MAX_LENGTH + ") NOT NULL, " + + "title VARCHAR(" + MAX_LENGTH + ") NOT NULL, " + + "description VARCHAR(" + MAX_DESCRIPTION_LENGTH + ") NOT NULL, " + + "standard BOOLEAN NOT NULL, " + + "documentJson VARCHAR(" + MAX_DOCUMENT_LENGTH + ") NOT NULL, " + + "PRIMARY KEY (id))") + void createTable(); + + void foo() { + // Test that we still reflow short string concatenations (spanning exactly 2 lines) + foo("foo" + "bar" + THING + "baz"); + foo("foo" + "bar" + THING + "baz"); + + // This causes an NPE if we're not careful when getting the last token of the binary expression + if (!partialDataSourceType.equals(dataSourceType)) { + throw new ClientException("You may not use a " + partialDataSourceType + " partial in a " + dataSourceType + + " query. Caused by partial \"" + partialName + "\""); + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-11-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-11-cr.case new file mode 100644 index 000000000..4c15031fb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-11-cr.case @@ -0,0 +1 @@ +---------- public class Palantir11 { private void foo() { boolean answer = strategy.accept(Strategies.visitor( greaterThan -> true, // we don't need to validate greaterThan because it'll roll up to a good version exact -> !coordinates.contains(MavenCoordinate.of(productId, exact.getVersion())), remove -> true, stay -> true, stayWithExceptions -> !coordinates.contains(MavenCoordinate.of( productId, stayWithExceptions.getDeploymentsExceptionVersion().getVersion())))); } } ---------- public class Palantir11 { private void foo() { boolean answer = strategy.accept(Strategies.visitor( greaterThan -> true, // we don't need to validate greaterThan because it'll roll up to a good version exact -> !coordinates.contains(MavenCoordinate.of(productId, exact.getVersion())), remove -> true, stay -> true, stayWithExceptions -> !coordinates.contains(MavenCoordinate.of( productId, stayWithExceptions.getDeploymentsExceptionVersion().getVersion())))); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-11-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-11-crlf.case new file mode 100644 index 000000000..4d2a896c1 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-11-crlf.case @@ -0,0 +1,27 @@ +---------- +public class Palantir11 { + private void foo() { + boolean answer = strategy.accept(Strategies.visitor( + greaterThan -> true, // we don't need to validate greaterThan because it'll roll up to a good version + exact -> !coordinates.contains(MavenCoordinate.of(productId, exact.getVersion())), + remove -> true, + stay -> true, + stayWithExceptions -> + !coordinates.contains(MavenCoordinate.of( + productId, + stayWithExceptions.getDeploymentsExceptionVersion().getVersion())))); + } +} +---------- +public class Palantir11 { + private void foo() { + boolean answer = strategy.accept(Strategies.visitor( + greaterThan -> true, // we don't need to validate greaterThan because it'll roll up to a good version + exact -> !coordinates.contains(MavenCoordinate.of(productId, exact.getVersion())), + remove -> true, + stay -> true, + stayWithExceptions -> !coordinates.contains(MavenCoordinate.of( + productId, + stayWithExceptions.getDeploymentsExceptionVersion().getVersion())))); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-11.input b/open-java-format/src/test/resources/test-cases/testdata/palantir-11-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-11.input rename to open-java-format/src/test/resources/test-cases/testdata/palantir-11-lf.case index ade9eae9a..fbbd85372 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-11.input +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-11-lf.case @@ -1,3 +1,4 @@ +---------- public class Palantir11 { private void foo() { boolean answer = strategy.accept(Strategies.visitor( @@ -11,3 +12,16 @@ public class Palantir11 { stayWithExceptions.getDeploymentsExceptionVersion().getVersion())))); } } +---------- +public class Palantir11 { + private void foo() { + boolean answer = strategy.accept(Strategies.visitor( + greaterThan -> true, // we don't need to validate greaterThan because it'll roll up to a good version + exact -> !coordinates.contains(MavenCoordinate.of(productId, exact.getVersion())), + remove -> true, + stay -> true, + stayWithExceptions -> !coordinates.contains(MavenCoordinate.of( + productId, + stayWithExceptions.getDeploymentsExceptionVersion().getVersion())))); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-12-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-12-cr.case new file mode 100644 index 000000000..c8be7716d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-12-cr.case @@ -0,0 +1 @@ +---------- public class Palantir12 { @Override public void foo() { new DogWalker() .walk( DogBreed.FOX_TERRIER, new RoadWalker() { @Override public Void call(Dog dog) { routes.forEach((route) -> route.getCoordinates() .forEach((coordinate) -> { coordinate.getOtherDogs().forEach(otherDog -> { if (!dog.likes(otherDog)) { badEncounters.computeIfAbsent(coordinate, _x -> new HashSet<>()) .add(dog).add(otherDog); } }); })); } }); } } ---------- public class Palantir12 { @Override public void foo() { new DogWalker().walk(DogBreed.FOX_TERRIER, new RoadWalker() { @Override public Void call(Dog dog) { routes.forEach((route) -> route.getCoordinates().forEach((coordinate) -> { coordinate.getOtherDogs().forEach(otherDog -> { if (!dog.likes(otherDog)) { badEncounters .computeIfAbsent(coordinate, _x -> new HashSet<>()) .add(dog) .add(otherDog); } }); })); } }); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-12-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-12-crlf.case new file mode 100644 index 000000000..cc24b56f8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-12-crlf.case @@ -0,0 +1,48 @@ +---------- +public class Palantir12 { + + @Override + public + void + foo() { + new DogWalker() + .walk( + DogBreed.FOX_TERRIER, + new RoadWalker() { + @Override + public Void call(Dog dog) { + routes.forEach((route) -> route.getCoordinates() + .forEach((coordinate) -> { + coordinate.getOtherDogs().forEach(otherDog -> { + if (!dog.likes(otherDog)) { + badEncounters.computeIfAbsent(coordinate, _x -> new HashSet<>()) + .add(dog).add(otherDog); + } + }); + })); + } + }); + } +} +---------- +public class Palantir12 { + + @Override + public void foo() { + new DogWalker().walk(DogBreed.FOX_TERRIER, new RoadWalker() { + @Override + public Void call(Dog dog) { + routes.forEach((route) -> route.getCoordinates().forEach((coordinate) -> { + coordinate.getOtherDogs().forEach(otherDog -> { + if (!dog.likes(otherDog)) { + badEncounters + .computeIfAbsent(coordinate, _x -> new HashSet<>()) + .add(dog) + .add(otherDog); + } + }); + })); + } + }); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-12.input b/open-java-format/src/test/resources/test-cases/testdata/palantir-12-lf.case similarity index 57% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-12.input rename to open-java-format/src/test/resources/test-cases/testdata/palantir-12-lf.case index fd39ea725..bbf14ab56 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-12.input +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-12-lf.case @@ -1,3 +1,4 @@ +---------- public class Palantir12 { @Override @@ -23,3 +24,25 @@ public class Palantir12 { }); } } +---------- +public class Palantir12 { + + @Override + public void foo() { + new DogWalker().walk(DogBreed.FOX_TERRIER, new RoadWalker() { + @Override + public Void call(Dog dog) { + routes.forEach((route) -> route.getCoordinates().forEach((coordinate) -> { + coordinate.getOtherDogs().forEach(otherDog -> { + if (!dog.likes(otherDog)) { + badEncounters + .computeIfAbsent(coordinate, _x -> new HashSet<>()) + .add(dog) + .add(otherDog); + } + }); + })); + } + }); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-2-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-2-cr.case new file mode 100644 index 000000000..3779a975e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-2-cr.case @@ -0,0 +1 @@ +---------- class Palantir2 { void foo() { operations.put(FunctionDefinition.LOREM_IPSUM_DOLOR_, (func, helper) -> new Column(new GetArrayItem( helper.accessColumnFuncti(func.arguments().get(0)).expr(), helper.accessColumnFuncti( // Subtract 1 from the provided index to move from 1-indexed to 0-indexed. FooBarClassName1.of( func.arguments().get(1), FooBarClassName1.BinaryOperation.SUBTRACT, IntegerLiteral.of(1))) .expr()))); } } ---------- class Palantir2 { void foo() { operations.put( FunctionDefinition.LOREM_IPSUM_DOLOR_, (func, helper) -> new Column(new GetArrayItem( helper.accessColumnFuncti(func.arguments().get(0)).expr(), helper.accessColumnFuncti( // Subtract 1 from the provided index to move from 1-indexed to 0-indexed. FooBarClassName1.of( func.arguments().get(1), FooBarClassName1.BinaryOperation.SUBTRACT, IntegerLiteral.of(1))) .expr()))); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-2-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-2-crlf.case new file mode 100644 index 000000000..fab58686c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-2-crlf.case @@ -0,0 +1,31 @@ +---------- +class Palantir2 { + void foo() { + operations.put(FunctionDefinition.LOREM_IPSUM_DOLOR_, (func, helper) -> new Column(new GetArrayItem( + helper.accessColumnFuncti(func.arguments().get(0)).expr(), + helper.accessColumnFuncti( + // Subtract 1 from the provided index to move from 1-indexed to 0-indexed. + FooBarClassName1.of( + func.arguments().get(1), + FooBarClassName1.BinaryOperation.SUBTRACT, + IntegerLiteral.of(1))) + .expr()))); + } +} + +---------- +class Palantir2 { + void foo() { + operations.put( + FunctionDefinition.LOREM_IPSUM_DOLOR_, + (func, helper) -> new Column(new GetArrayItem( + helper.accessColumnFuncti(func.arguments().get(0)).expr(), + helper.accessColumnFuncti( + // Subtract 1 from the provided index to move from 1-indexed to 0-indexed. + FooBarClassName1.of( + func.arguments().get(1), + FooBarClassName1.BinaryOperation.SUBTRACT, + IntegerLiteral.of(1))) + .expr()))); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-2.output b/open-java-format/src/test/resources/test-cases/testdata/palantir-2-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-2.output rename to open-java-format/src/test/resources/test-cases/testdata/palantir-2-lf.case index 6473cfa0e..461fb3e34 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-2.output +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-2-lf.case @@ -1,3 +1,19 @@ +---------- +class Palantir2 { + void foo() { + operations.put(FunctionDefinition.LOREM_IPSUM_DOLOR_, (func, helper) -> new Column(new GetArrayItem( + helper.accessColumnFuncti(func.arguments().get(0)).expr(), + helper.accessColumnFuncti( + // Subtract 1 from the provided index to move from 1-indexed to 0-indexed. + FooBarClassName1.of( + func.arguments().get(1), + FooBarClassName1.BinaryOperation.SUBTRACT, + IntegerLiteral.of(1))) + .expr()))); + } +} + +---------- class Palantir2 { void foo() { operations.put( diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-3-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-3-cr.case new file mode 100644 index 000000000..57556b032 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-3-cr.case @@ -0,0 +1 @@ +---------- class Palantir3 { void foo() { operations.put(FunctionDefinition.ARRAY_REGEX_REPLACE, (func, helper) -> { return new Column(new ArrayTransform( helper.expressionAsColumn(func.arguments().get(0)).expr(), new LambdaFunction( new RegExpReplace( var, helper.expressionAsColumn(func.arguments().get(1)) .expr(), helper.expressionAsColumn(func.arguments().get(2)) .expr()), JavaConversions.asScalaBuffer(Arrays.asList(var)), false))); }); } } ---------- class Palantir3 { void foo() { operations.put(FunctionDefinition.ARRAY_REGEX_REPLACE, (func, helper) -> { return new Column(new ArrayTransform( helper.expressionAsColumn(func.arguments().get(0)).expr(), new LambdaFunction( new RegExpReplace( var, helper.expressionAsColumn(func.arguments().get(1)) .expr(), helper.expressionAsColumn(func.arguments().get(2)) .expr()), JavaConversions.asScalaBuffer(Arrays.asList(var)), false))); }); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-3-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-3-crlf.case new file mode 100644 index 000000000..19c26ed08 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-3-crlf.case @@ -0,0 +1,36 @@ +---------- +class Palantir3 { + void foo() { + operations.put(FunctionDefinition.ARRAY_REGEX_REPLACE, (func, helper) -> { + return new Column(new ArrayTransform( + helper.expressionAsColumn(func.arguments().get(0)).expr(), new LambdaFunction( + new RegExpReplace( + var, + helper.expressionAsColumn(func.arguments().get(1)) + .expr(), + helper.expressionAsColumn(func.arguments().get(2)) + .expr()), + JavaConversions.asScalaBuffer(Arrays.asList(var)), + false))); + }); + } +} + +---------- +class Palantir3 { + void foo() { + operations.put(FunctionDefinition.ARRAY_REGEX_REPLACE, (func, helper) -> { + return new Column(new ArrayTransform( + helper.expressionAsColumn(func.arguments().get(0)).expr(), + new LambdaFunction( + new RegExpReplace( + var, + helper.expressionAsColumn(func.arguments().get(1)) + .expr(), + helper.expressionAsColumn(func.arguments().get(2)) + .expr()), + JavaConversions.asScalaBuffer(Arrays.asList(var)), + false))); + }); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-3-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-3-lf.case new file mode 100644 index 000000000..05e69e102 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-3-lf.case @@ -0,0 +1,36 @@ +---------- +class Palantir3 { + void foo() { + operations.put(FunctionDefinition.ARRAY_REGEX_REPLACE, (func, helper) -> { + return new Column(new ArrayTransform( + helper.expressionAsColumn(func.arguments().get(0)).expr(), new LambdaFunction( + new RegExpReplace( + var, + helper.expressionAsColumn(func.arguments().get(1)) + .expr(), + helper.expressionAsColumn(func.arguments().get(2)) + .expr()), + JavaConversions.asScalaBuffer(Arrays.asList(var)), + false))); + }); + } +} + +---------- +class Palantir3 { + void foo() { + operations.put(FunctionDefinition.ARRAY_REGEX_REPLACE, (func, helper) -> { + return new Column(new ArrayTransform( + helper.expressionAsColumn(func.arguments().get(0)).expr(), + new LambdaFunction( + new RegExpReplace( + var, + helper.expressionAsColumn(func.arguments().get(1)) + .expr(), + helper.expressionAsColumn(func.arguments().get(2)) + .expr()), + JavaConversions.asScalaBuffer(Arrays.asList(var)), + false))); + }); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-4-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-4-cr.case new file mode 100644 index 000000000..29a07f359 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-4-cr.case @@ -0,0 +1 @@ +---------- class Palantir4 { void foo() { if (useAddedColumnsSetDesription) { resultSet = spark.sparkSetCreator().resolve(initialSetResolver, new LoremIpsumLongClassNameWithDescription( initialSet, list, Optional.empty())); } } } ---------- class Palantir4 { void foo() { if (useAddedColumnsSetDesription) { resultSet = spark.sparkSetCreator() .resolve( initialSetResolver, new LoremIpsumLongClassNameWithDescription(initialSet, list, Optional.empty())); } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-4-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-4-crlf.case new file mode 100644 index 000000000..5d9f90a41 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-4-crlf.case @@ -0,0 +1,21 @@ +---------- +class Palantir4 { + void foo() { + if (useAddedColumnsSetDesription) { + resultSet = spark.sparkSetCreator().resolve(initialSetResolver, new LoremIpsumLongClassNameWithDescription( + initialSet, list, Optional.empty())); + } + } +} + +---------- +class Palantir4 { + void foo() { + if (useAddedColumnsSetDesription) { + resultSet = spark.sparkSetCreator() + .resolve( + initialSetResolver, + new LoremIpsumLongClassNameWithDescription(initialSet, list, Optional.empty())); + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-4.output b/open-java-format/src/test/resources/test-cases/testdata/palantir-4-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-4.output rename to open-java-format/src/test/resources/test-cases/testdata/palantir-4-lf.case index e5d6de758..fc246d7e2 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-4.output +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-4-lf.case @@ -1,3 +1,14 @@ +---------- +class Palantir4 { + void foo() { + if (useAddedColumnsSetDesription) { + resultSet = spark.sparkSetCreator().resolve(initialSetResolver, new LoremIpsumLongClassNameWithDescription( + initialSet, list, Optional.empty())); + } + } +} + +---------- class Palantir4 { void foo() { if (useAddedColumnsSetDesription) { diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-5-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-5-cr.case new file mode 100644 index 000000000..de081fefb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-5-cr.case @@ -0,0 +1 @@ +---------- class Palantir5 { void foo() { ConfigurationBuilder configuration = new ConfigurationBuilder() .addUrls(apiUrls) .filterInputsBy(name -> name != null && !name.contains("Immutable")); } void bar() { TopologicallySortedList sortedNodes = TopologicallySortedList.create( parentIdByNodeId.keySet(), nodeId -> StreamEx.of(parentIdByNodeId.get(nodeId)).toSet()); } } ---------- class Palantir5 { void foo() { ConfigurationBuilder configuration = new ConfigurationBuilder() .addUrls(apiUrls) .filterInputsBy(name -> name != null && !name.contains("Immutable")); } void bar() { TopologicallySortedList sortedNodes = TopologicallySortedList.create( parentIdByNodeId.keySet(), nodeId -> StreamEx.of(parentIdByNodeId.get(nodeId)).toSet()); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-5-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-5-crlf.case new file mode 100644 index 000000000..c838db822 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-5-crlf.case @@ -0,0 +1,29 @@ +---------- +class Palantir5 { + void foo() { + ConfigurationBuilder configuration = new ConfigurationBuilder() + .addUrls(apiUrls) + .filterInputsBy(name -> name != null && !name.contains("Immutable")); + } + + void bar() { + TopologicallySortedList sortedNodes = TopologicallySortedList.create( + parentIdByNodeId.keySet(), + nodeId -> StreamEx.of(parentIdByNodeId.get(nodeId)).toSet()); + } +} + +---------- +class Palantir5 { + void foo() { + ConfigurationBuilder configuration = new ConfigurationBuilder() + .addUrls(apiUrls) + .filterInputsBy(name -> name != null && !name.contains("Immutable")); + } + + void bar() { + TopologicallySortedList sortedNodes = TopologicallySortedList.create( + parentIdByNodeId.keySet(), + nodeId -> StreamEx.of(parentIdByNodeId.get(nodeId)).toSet()); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-5-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-5-lf.case new file mode 100644 index 000000000..f929a550a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-5-lf.case @@ -0,0 +1,29 @@ +---------- +class Palantir5 { + void foo() { + ConfigurationBuilder configuration = new ConfigurationBuilder() + .addUrls(apiUrls) + .filterInputsBy(name -> name != null && !name.contains("Immutable")); + } + + void bar() { + TopologicallySortedList sortedNodes = TopologicallySortedList.create( + parentIdByNodeId.keySet(), + nodeId -> StreamEx.of(parentIdByNodeId.get(nodeId)).toSet()); + } +} + +---------- +class Palantir5 { + void foo() { + ConfigurationBuilder configuration = new ConfigurationBuilder() + .addUrls(apiUrls) + .filterInputsBy(name -> name != null && !name.contains("Immutable")); + } + + void bar() { + TopologicallySortedList sortedNodes = TopologicallySortedList.create( + parentIdByNodeId.keySet(), + nodeId -> StreamEx.of(parentIdByNodeId.get(nodeId)).toSet()); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-6-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-6-cr.case new file mode 100644 index 000000000..e98bd0ba2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-6-cr.case @@ -0,0 +1 @@ +---------- class Palantir6 { void foo() { Optional> maybeCached = OptionalUtils.orElseGetOptional( Optional.ofNullable(localRowsCache.getIfPresent(setDescription)), () -> Optional.ofNullable(datasetCache.getIfPresent(setDescription))); } } ---------- class Palantir6 { void foo() { Optional> maybeCached = OptionalUtils.orElseGetOptional( Optional.ofNullable(localRowsCache.getIfPresent(setDescription)), () -> Optional.ofNullable(datasetCache.getIfPresent(setDescription))); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-6-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-6-crlf.case new file mode 100644 index 000000000..9110a5a42 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-6-crlf.case @@ -0,0 +1,17 @@ +---------- +class Palantir6 { + void foo() { + Optional> maybeCached = OptionalUtils.orElseGetOptional( + Optional.ofNullable(localRowsCache.getIfPresent(setDescription)), + () -> Optional.ofNullable(datasetCache.getIfPresent(setDescription))); + } +} + +---------- +class Palantir6 { + void foo() { + Optional> maybeCached = OptionalUtils.orElseGetOptional( + Optional.ofNullable(localRowsCache.getIfPresent(setDescription)), + () -> Optional.ofNullable(datasetCache.getIfPresent(setDescription))); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-6-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-6-lf.case new file mode 100644 index 000000000..27b8bb3f4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-6-lf.case @@ -0,0 +1,17 @@ +---------- +class Palantir6 { + void foo() { + Optional> maybeCached = OptionalUtils.orElseGetOptional( + Optional.ofNullable(localRowsCache.getIfPresent(setDescription)), + () -> Optional.ofNullable(datasetCache.getIfPresent(setDescription))); + } +} + +---------- +class Palantir6 { + void foo() { + Optional> maybeCached = OptionalUtils.orElseGetOptional( + Optional.ofNullable(localRowsCache.getIfPresent(setDescription)), + () -> Optional.ofNullable(datasetCache.getIfPresent(setDescription))); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-7-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-7-cr.case new file mode 100644 index 000000000..4afb6ead4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-7-cr.case @@ -0,0 +1 @@ +---------- class Palantir7 { void foo() { when(graphService.getPathFromRootToNode(any(GraphId.class), any(NodeId.class))) .thenAnswer(invocation -> invocation.getArguments().length == 2 && invocation.getArguments()[1] != null ? ImmutableList.of(invocation.getArgument(1)) : ImmutableList.of(NodeId.create())); } } ---------- class Palantir7 { void foo() { when(graphService.getPathFromRootToNode(any(GraphId.class), any(NodeId.class))) .thenAnswer(invocation -> invocation.getArguments().length == 2 && invocation.getArguments()[1] != null ? ImmutableList.of(invocation.getArgument(1)) : ImmutableList.of(NodeId.create())); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-7-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-7-crlf.case new file mode 100644 index 000000000..045977fb9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-7-crlf.case @@ -0,0 +1,21 @@ +---------- +class Palantir7 { + void foo() { + when(graphService.getPathFromRootToNode(any(GraphId.class), any(NodeId.class))) + .thenAnswer(invocation -> invocation.getArguments().length == 2 + && invocation.getArguments()[1] != null + ? ImmutableList.of(invocation.getArgument(1)) + : ImmutableList.of(NodeId.create())); + } +} + +---------- +class Palantir7 { + void foo() { + when(graphService.getPathFromRootToNode(any(GraphId.class), any(NodeId.class))) + .thenAnswer(invocation -> + invocation.getArguments().length == 2 && invocation.getArguments()[1] != null + ? ImmutableList.of(invocation.getArgument(1)) + : ImmutableList.of(NodeId.create())); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-7-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-7-lf.case new file mode 100644 index 000000000..2b42abec4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-7-lf.case @@ -0,0 +1,21 @@ +---------- +class Palantir7 { + void foo() { + when(graphService.getPathFromRootToNode(any(GraphId.class), any(NodeId.class))) + .thenAnswer(invocation -> invocation.getArguments().length == 2 + && invocation.getArguments()[1] != null + ? ImmutableList.of(invocation.getArgument(1)) + : ImmutableList.of(NodeId.create())); + } +} + +---------- +class Palantir7 { + void foo() { + when(graphService.getPathFromRootToNode(any(GraphId.class), any(NodeId.class))) + .thenAnswer(invocation -> + invocation.getArguments().length == 2 && invocation.getArguments()[1] != null + ? ImmutableList.of(invocation.getArgument(1)) + : ImmutableList.of(NodeId.create())); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-8-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-8-cr.case new file mode 100644 index 000000000..a170d07cb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-8-cr.case @@ -0,0 +1 @@ +---------- class Palantir8 { void foo() { assertThatServiceExceptionThrownBy( new Aggregation.Builder() .max(max) .aggregations(ImmutableMap.of("bountiful", bountifulAggregation))::build) .hasType(MY_ERROR_TYPE); } } ---------- class Palantir8 { void foo() { assertThatServiceExceptionThrownBy(new Aggregation.Builder() .max(max) .aggregations(ImmutableMap.of("bountiful", bountifulAggregation))::build) .hasType(MY_ERROR_TYPE); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-8-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-8-crlf.case new file mode 100644 index 000000000..28d068898 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-8-crlf.case @@ -0,0 +1,19 @@ +---------- +class Palantir8 { + void foo() { + assertThatServiceExceptionThrownBy( + new Aggregation.Builder() + .max(max) + .aggregations(ImmutableMap.of("bountiful", bountifulAggregation))::build) + .hasType(MY_ERROR_TYPE); + } +} +---------- +class Palantir8 { + void foo() { + assertThatServiceExceptionThrownBy(new Aggregation.Builder() + .max(max) + .aggregations(ImmutableMap.of("bountiful", bountifulAggregation))::build) + .hasType(MY_ERROR_TYPE); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-8-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-8-lf.case new file mode 100644 index 000000000..26b576e1b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-8-lf.case @@ -0,0 +1,19 @@ +---------- +class Palantir8 { + void foo() { + assertThatServiceExceptionThrownBy( + new Aggregation.Builder() + .max(max) + .aggregations(ImmutableMap.of("bountiful", bountifulAggregation))::build) + .hasType(MY_ERROR_TYPE); + } +} +---------- +class Palantir8 { + void foo() { + assertThatServiceExceptionThrownBy(new Aggregation.Builder() + .max(max) + .aggregations(ImmutableMap.of("bountiful", bountifulAggregation))::build) + .hasType(MY_ERROR_TYPE); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-cr.case new file mode 100644 index 000000000..16a1174ad --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-cr.case @@ -0,0 +1 @@ +---------- class PalantirLambdaBreakChain { void foo() { return hello.read(txn -> { doSomeWork(); doSomeMoreWork(); }) .chainedCall(() -> { doSomeWork(); }); } } ---------- class PalantirLambdaBreakChain { void foo() { return hello.read(txn -> { doSomeWork(); doSomeMoreWork(); }) .chainedCall(() -> { doSomeWork(); }); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-crlf.case new file mode 100644 index 000000000..919638d81 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-crlf.case @@ -0,0 +1,24 @@ +---------- +class PalantirLambdaBreakChain { + void foo() { + return hello.read(txn -> { + doSomeWork(); + doSomeMoreWork(); + }) + .chainedCall(() -> { + doSomeWork(); + }); + } +} +---------- +class PalantirLambdaBreakChain { + void foo() { + return hello.read(txn -> { + doSomeWork(); + doSomeMoreWork(); + }) + .chainedCall(() -> { + doSomeWork(); + }); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-lf.case new file mode 100644 index 000000000..9f858b0d6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-lf.case @@ -0,0 +1,24 @@ +---------- +class PalantirLambdaBreakChain { + void foo() { + return hello.read(txn -> { + doSomeWork(); + doSomeMoreWork(); + }) + .chainedCall(() -> { + doSomeWork(); + }); + } +} +---------- +class PalantirLambdaBreakChain { + void foo() { + return hello.read(txn -> { + doSomeWork(); + doSomeMoreWork(); + }) + .chainedCall(() -> { + doSomeWork(); + }); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-no-chain-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-no-chain-cr.case new file mode 100644 index 000000000..49bacc128 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-no-chain-cr.case @@ -0,0 +1 @@ +---------- class PalantirLambdaBreakChain { void foo() { return hello.read(txn -> { doSomeWork(); doSomeMoreWork(); }); } } ---------- class PalantirLambdaBreakChain { void foo() { return hello.read(txn -> { doSomeWork(); doSomeMoreWork(); }); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-no-chain-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-no-chain-crlf.case new file mode 100644 index 000000000..1076a381d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-no-chain-crlf.case @@ -0,0 +1,18 @@ +---------- +class PalantirLambdaBreakChain { + void foo() { + return hello.read(txn -> { + doSomeWork(); + doSomeMoreWork(); + }); + } +} +---------- +class PalantirLambdaBreakChain { + void foo() { + return hello.read(txn -> { + doSomeWork(); + doSomeMoreWork(); + }); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg-no-chain.input b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-no-chain-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg-no-chain.input rename to open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-no-chain-lf.case index a67272d20..c9d43885b 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg-no-chain.input +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-no-chain-lf.case @@ -1,3 +1,4 @@ +---------- class PalantirLambdaBreakChain { void foo() { return hello.read(txn -> { @@ -6,3 +7,12 @@ class PalantirLambdaBreakChain { }); } } +---------- +class PalantirLambdaBreakChain { + void foo() { + return hello.read(txn -> { + doSomeWork(); + doSomeMoreWork(); + }); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-expr-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-expr-cr.case new file mode 100644 index 000000000..c4cf4ade6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-expr-cr.case @@ -0,0 +1 @@ +---------- class PalantirLambdaBreakChain { void foo() { return hello .read(txn -> doSomeWork()) .doMoreWork(); } } ---------- class PalantirLambdaBreakChain { void foo() { return hello.read(txn -> doSomeWork()).doMoreWork(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-expr-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-expr-crlf.case new file mode 100644 index 000000000..096528be9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-expr-crlf.case @@ -0,0 +1,14 @@ +---------- +class PalantirLambdaBreakChain { + void foo() { + return hello + .read(txn -> doSomeWork()) + .doMoreWork(); + } +} +---------- +class PalantirLambdaBreakChain { + void foo() { + return hello.read(txn -> doSomeWork()).doMoreWork(); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-expr.input b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-expr-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-expr.input rename to open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-expr-lf.case index 0ad6c2d16..956358e3e 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-expr.input +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-expr-lf.case @@ -1,3 +1,4 @@ +---------- class PalantirLambdaBreakChain { void foo() { return hello @@ -5,3 +6,9 @@ class PalantirLambdaBreakChain { .doMoreWork(); } } +---------- +class PalantirLambdaBreakChain { + void foo() { + return hello.read(txn -> doSomeWork()).doMoreWork(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-case-statements-block-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-case-statements-block-cr.case new file mode 100644 index 000000000..124279380 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-case-statements-block-cr.case @@ -0,0 +1 @@ +---------- public class PalantirCaseStatementsBlock { private void foo() { switch (true) { case false: { String foo = "bar"; return 5; } { // second block should cause first one not to inline } case true: { String foo = "bar"; return 5; } default: { { String foo = "bar"; } return 5; } } } } ---------- public class PalantirCaseStatementsBlock { private void foo() { switch (true) { case false: { String foo = "bar"; return 5; } { // second block should cause first one not to inline } case true: { String foo = "bar"; return 5; } default: { { String foo = "bar"; } return 5; } } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-case-statements-block-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-case-statements-block-crlf.case new file mode 100644 index 000000000..585282bc6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-case-statements-block-crlf.case @@ -0,0 +1,52 @@ +---------- +public class PalantirCaseStatementsBlock { + private void foo() { + switch (true) { + case false: + { + String foo = "bar"; + return 5; + } + { + // second block should cause first one not to inline + } + case true: + { + String foo = "bar"; + return 5; + } + default: + { + { + String foo = "bar"; + } + return 5; + } + } + } +} +---------- +public class PalantirCaseStatementsBlock { + private void foo() { + switch (true) { + case false: + { + String foo = "bar"; + return 5; + } + { + // second block should cause first one not to inline + } + case true: { + String foo = "bar"; + return 5; + } + default: { + { + String foo = "bar"; + } + return 5; + } + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-case-statements-block-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-case-statements-block-lf.case new file mode 100644 index 000000000..679d74a15 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-case-statements-block-lf.case @@ -0,0 +1,52 @@ +---------- +public class PalantirCaseStatementsBlock { + private void foo() { + switch (true) { + case false: + { + String foo = "bar"; + return 5; + } + { + // second block should cause first one not to inline + } + case true: + { + String foo = "bar"; + return 5; + } + default: + { + { + String foo = "bar"; + } + return 5; + } + } + } +} +---------- +public class PalantirCaseStatementsBlock { + private void foo() { + switch (true) { + case false: + { + String foo = "bar"; + return 5; + } + { + // second block should cause first one not to inline + } + case true: { + String foo = "bar"; + return 5; + } + default: { + { + String foo = "bar"; + } + return 5; + } + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-chain-next-line-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-chain-next-line-cr.case new file mode 100644 index 000000000..b923632bd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-chain-next-line-cr.case @@ -0,0 +1 @@ +---------- class PalantirChainNextLine { void foo() { Iterator> delegateIterator = delegates .entrySet() .iterator(); } } ---------- class PalantirChainNextLine { void foo() { Iterator> delegateIterator = delegates.entrySet().iterator(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-chain-next-line-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-chain-next-line-crlf.case new file mode 100644 index 000000000..8a961ee23 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-chain-next-line-crlf.case @@ -0,0 +1,15 @@ +---------- +class PalantirChainNextLine { + void foo() { + Iterator> delegateIterator = delegates + .entrySet() + .iterator(); + } +} +---------- +class PalantirChainNextLine { + void foo() { + Iterator> delegateIterator = + delegates.entrySet().iterator(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-chain-next-line-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-chain-next-line-lf.case new file mode 100644 index 000000000..a344c397b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-chain-next-line-lf.case @@ -0,0 +1,15 @@ +---------- +class PalantirChainNextLine { + void foo() { + Iterator> delegateIterator = delegates + .entrySet() + .iterator(); + } +} +---------- +class PalantirChainNextLine { + void foo() { + Iterator> delegateIterator = + delegates.entrySet().iterator(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-dangling-method-reference-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-dangling-method-reference-cr.case new file mode 100644 index 000000000..ed7133d5b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-dangling-method-reference-cr.case @@ -0,0 +1 @@ +---------- class PalantirDanglingMethodReference { void foo() { return engageNicely( staleForksFigureBark, staleForksFigureConsecutiveFailedExecutions, isStaleForksFigureInProgress, this ::engageStaleForksUnsafely); } } ---------- class PalantirDanglingMethodReference { void foo() { return engageNicely( staleForksFigureBark, staleForksFigureConsecutiveFailedExecutions, isStaleForksFigureInProgress, this::engageStaleForksUnsafely); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-dangling-method-reference-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-dangling-method-reference-crlf.case new file mode 100644 index 000000000..e82cf4a53 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-dangling-method-reference-crlf.case @@ -0,0 +1,18 @@ +---------- +class PalantirDanglingMethodReference { + void foo() { + return engageNicely( + staleForksFigureBark, staleForksFigureConsecutiveFailedExecutions, isStaleForksFigureInProgress, this + ::engageStaleForksUnsafely); + } +} +---------- +class PalantirDanglingMethodReference { + void foo() { + return engageNicely( + staleForksFigureBark, + staleForksFigureConsecutiveFailedExecutions, + isStaleForksFigureInProgress, + this::engageStaleForksUnsafely); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-dangling-method-reference.output b/open-java-format/src/test/resources/test-cases/testdata/palantir-dangling-method-reference-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-dangling-method-reference.output rename to open-java-format/src/test/resources/test-cases/testdata/palantir-dangling-method-reference-lf.case index 12684e6b8..b8a9377b3 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-dangling-method-reference.output +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-dangling-method-reference-lf.case @@ -1,3 +1,12 @@ +---------- +class PalantirDanglingMethodReference { + void foo() { + return engageNicely( + staleForksFigureBark, staleForksFigureConsecutiveFailedExecutions, isStaleForksFigureInProgress, this + ::engageStaleForksUnsafely); + } +} +---------- class PalantirDanglingMethodReference { void foo() { return engageNicely( diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-cr.case new file mode 100644 index 000000000..9ee971013 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-cr.case @@ -0,0 +1 @@ +---------- class PalantirDeeplyNestedCalls { private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldOneV1)) .baaars(ImmutableList.of(MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) .baaars(ImmutableList.of(MagicConfigV1.builder() .baaars(ImmutableList.of(MagicConfigV1.builder() .baaars(ImmutableList.of(MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldFourV1)) .build())) .build())) .build())) .build())) .build(); void testMethod() { assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) .containsExactlyInAnyOrderElementsOf(Set.of( new ItemWithCustomLocator( ItemConfigV1.DEFAULT_CONFIG.toCustomString(), ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TEST_ITEM_A)) .name(ItemName.of(TEST_API_NAME.get())) .apiName(TEST_API_NAME) .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 .apiName() .get())) .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) .spec(ItemConfigV1Spec.native_( NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), // Discovered items new ItemWithCustomLocator( TestModelCatalog.MODEL_ABC_456.toItemApi(), CustomItemLocator.discovered(DiscoveredItemLocator.of())), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TEST_API_NAME)) .name(ItemName.of(TEST_API_NAME.get())) .apiName(TEST_API_NAME) .spec(ItemConfigV1Spec.native_( NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.discovered(DiscoveredItemLocator.of())))); } public Map otherMethod( FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { return myCustomService .get() .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) .entrySet() .stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> entry.getValue().getMetrics())); } } ---------- class PalantirDeeplyNestedCalls { private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldOneV1)) .baaars(ImmutableList.of(MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) .baaars(ImmutableList.of(MagicConfigV1.builder() .baaars(ImmutableList.of(MagicConfigV1.builder() .baaars(ImmutableList.of(MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldFourV1)) .build())) .build())) .build())) .build())) .build(); void testMethod() { assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) .containsExactlyInAnyOrderElementsOf(Set.of( new ItemWithCustomLocator( ItemConfigV1.DEFAULT_CONFIG.toCustomString(), ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TEST_ITEM_A)) .name(ItemName.of(TEST_API_NAME.get())) .apiName(TEST_API_NAME) .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 .apiName() .get())) .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) .spec(ItemConfigV1Spec.native_( NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), // Discovered items new ItemWithCustomLocator( TestModelCatalog.MODEL_ABC_456.toItemApi(), CustomItemLocator.discovered(DiscoveredItemLocator.of())), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TEST_API_NAME)) .name(ItemName.of(TEST_API_NAME.get())) .apiName(TEST_API_NAME) .spec(ItemConfigV1Spec.native_( NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.discovered(DiscoveredItemLocator.of())))); } public Map otherMethod( FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { return myCustomService .get() .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) .entrySet() .stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> entry.getValue().getMetrics())); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-crlf.case new file mode 100644 index 000000000..2ec2207d8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-crlf.case @@ -0,0 +1,188 @@ +---------- +class PalantirDeeplyNestedCalls { + private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldOneV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldFourV1)) + .build())) + .build())) + .build())) + .build())) + .build(); + + void testMethod() { + assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) + .containsExactlyInAnyOrderElementsOf(Set.of( + new ItemWithCustomLocator( + ItemConfigV1.DEFAULT_CONFIG.toCustomString(), + ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_ITEM_A)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) + .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 + .apiName() + .get())) + .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), + // Discovered items + new ItemWithCustomLocator( + TestModelCatalog.MODEL_ABC_456.toItemApi(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_API_NAME)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())))); + } + + public Map otherMethod( + FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { + return myCustomService + .get() + .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) + .entrySet() + .stream() + .collect(Collectors.toMap( + Map.Entry::getKey, entry -> entry.getValue().getMetrics())); + } +} +---------- +class PalantirDeeplyNestedCalls { + private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldOneV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldFourV1)) + .build())) + .build())) + .build())) + .build())) + .build(); + + void testMethod() { + assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) + .containsExactlyInAnyOrderElementsOf(Set.of( + new ItemWithCustomLocator( + ItemConfigV1.DEFAULT_CONFIG.toCustomString(), + ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_ITEM_A)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) + .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 + .apiName() + .get())) + .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), + // Discovered items + new ItemWithCustomLocator( + TestModelCatalog.MODEL_ABC_456.toItemApi(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_API_NAME)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())))); + } + + public Map otherMethod( + FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { + return myCustomService + .get() + .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) + .entrySet() + .stream() + .collect(Collectors.toMap( + Map.Entry::getKey, entry -> entry.getValue().getMetrics())); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-lf.case new file mode 100644 index 000000000..f1e8e899c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-lf.case @@ -0,0 +1,188 @@ +---------- +class PalantirDeeplyNestedCalls { + private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldOneV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldFourV1)) + .build())) + .build())) + .build())) + .build())) + .build(); + + void testMethod() { + assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) + .containsExactlyInAnyOrderElementsOf(Set.of( + new ItemWithCustomLocator( + ItemConfigV1.DEFAULT_CONFIG.toCustomString(), + ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_ITEM_A)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) + .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 + .apiName() + .get())) + .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), + // Discovered items + new ItemWithCustomLocator( + TestModelCatalog.MODEL_ABC_456.toItemApi(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_API_NAME)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())))); + } + + public Map otherMethod( + FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { + return myCustomService + .get() + .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) + .entrySet() + .stream() + .collect(Collectors.toMap( + Map.Entry::getKey, entry -> entry.getValue().getMetrics())); + } +} +---------- +class PalantirDeeplyNestedCalls { + private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldOneV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldFourV1)) + .build())) + .build())) + .build())) + .build())) + .build(); + + void testMethod() { + assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) + .containsExactlyInAnyOrderElementsOf(Set.of( + new ItemWithCustomLocator( + ItemConfigV1.DEFAULT_CONFIG.toCustomString(), + ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_ITEM_A)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) + .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 + .apiName() + .get())) + .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), + // Discovered items + new ItemWithCustomLocator( + TestModelCatalog.MODEL_ABC_456.toItemApi(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_API_NAME)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())))); + } + + public Map otherMethod( + FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { + return myCustomService + .get() + .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) + .entrySet() + .stream() + .collect(Collectors.toMap( + Map.Entry::getKey, entry -> entry.getValue().getMetrics())); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-1-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-1-cr.case new file mode 100644 index 000000000..b8570de01 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-1-cr.case @@ -0,0 +1 @@ +---------- class PalantirExpressionLambda1 { void foo() { return createInternal(client, config, userAgent, hostEventsSink, serviceClass, RANDOMIZE, reshuffle, () -> new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize())); } } ---------- class PalantirExpressionLambda1 { void foo() { return createInternal( client, config, userAgent, hostEventsSink, serviceClass, RANDOMIZE, reshuffle, () -> new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize())); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-1-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-1-crlf.case new file mode 100644 index 000000000..4f98580b8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-1-crlf.case @@ -0,0 +1,21 @@ +---------- +class PalantirExpressionLambda1 { + void foo() { + return createInternal(client, config, userAgent, hostEventsSink, serviceClass, RANDOMIZE, reshuffle, () -> + new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize())); + } +} +---------- +class PalantirExpressionLambda1 { + void foo() { + return createInternal( + client, + config, + userAgent, + hostEventsSink, + serviceClass, + RANDOMIZE, + reshuffle, + () -> new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize())); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-1.output b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-1-lf.case similarity index 56% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-1.output rename to open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-1-lf.case index f01f50d37..9ec6fe653 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-1.output +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-1-lf.case @@ -1,3 +1,11 @@ +---------- +class PalantirExpressionLambda1 { + void foo() { + return createInternal(client, config, userAgent, hostEventsSink, serviceClass, RANDOMIZE, reshuffle, () -> + new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize())); + } +} +---------- class PalantirExpressionLambda1 { void foo() { return createInternal( diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-2-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-2-cr.case new file mode 100644 index 000000000..47b3adbdd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-2-cr.case @@ -0,0 +1 @@ +---------- class PalantirExpressionLambda2 { void foo() { this(txnManager, foundryResources, commitLogHandler, timestamp -> new UUID(timestamp, UUID.randomUUID().getLeastSignificantBits())); } } ---------- class PalantirExpressionLambda2 { void foo() { this( txnManager, foundryResources, commitLogHandler, timestamp -> new UUID(timestamp, UUID.randomUUID().getLeastSignificantBits())); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-2-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-2-crlf.case new file mode 100644 index 000000000..9ef84266f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-2-crlf.case @@ -0,0 +1,17 @@ +---------- +class PalantirExpressionLambda2 { + void foo() { + this(txnManager, foundryResources, commitLogHandler, timestamp -> + new UUID(timestamp, UUID.randomUUID().getLeastSignificantBits())); + } +} +---------- +class PalantirExpressionLambda2 { + void foo() { + this( + txnManager, + foundryResources, + commitLogHandler, + timestamp -> new UUID(timestamp, UUID.randomUUID().getLeastSignificantBits())); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-2.output b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-2-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-2.output rename to open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-2-lf.case index e0111dc58..1174e6937 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-2.output +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-2-lf.case @@ -1,3 +1,11 @@ +---------- +class PalantirExpressionLambda2 { + void foo() { + this(txnManager, foundryResources, commitLogHandler, timestamp -> + new UUID(timestamp, UUID.randomUUID().getLeastSignificantBits())); + } +} +---------- class PalantirExpressionLambda2 { void foo() { this( diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-2-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-2-cr.case new file mode 100644 index 000000000..c72ae1142 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-2-cr.case @@ -0,0 +1 @@ +---------- class PalantirExpressionLambdas { void foo() { this.sequentialTableFactory = SequentialTableFactory.create( ObjectMappers.newServerObjectMapper(), Event.class, txnManager::getTimestampService, () -> SequentialTableFactory.Strategy.V1); } } ---------- class PalantirExpressionLambdas { void foo() { this.sequentialTableFactory = SequentialTableFactory.create( ObjectMappers.newServerObjectMapper(), Event.class, txnManager::getTimestampService, () -> SequentialTableFactory.Strategy.V1); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-2-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-2-crlf.case new file mode 100644 index 000000000..339ae07ac --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-2-crlf.case @@ -0,0 +1,18 @@ +---------- +class PalantirExpressionLambdas { + void foo() { + this.sequentialTableFactory = SequentialTableFactory.create( + ObjectMappers.newServerObjectMapper(), Event.class, txnManager::getTimestampService, () -> + SequentialTableFactory.Strategy.V1); + } +} +---------- +class PalantirExpressionLambdas { + void foo() { + this.sequentialTableFactory = SequentialTableFactory.create( + ObjectMappers.newServerObjectMapper(), + Event.class, + txnManager::getTimestampService, + () -> SequentialTableFactory.Strategy.V1); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas-2.output b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-2-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas-2.output rename to open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-2-lf.case index 042e1bb8c..bdbcf4096 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas-2.output +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-2-lf.case @@ -1,3 +1,12 @@ +---------- +class PalantirExpressionLambdas { + void foo() { + this.sequentialTableFactory = SequentialTableFactory.create( + ObjectMappers.newServerObjectMapper(), Event.class, txnManager::getTimestampService, () -> + SequentialTableFactory.Strategy.V1); + } +} +---------- class PalantirExpressionLambdas { void foo() { this.sequentialTableFactory = SequentialTableFactory.create( diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-cr.case new file mode 100644 index 000000000..18b5c5ce2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-cr.case @@ -0,0 +1 @@ +---------- class PalantirExpressionLambdas { void foo() { publisher = new ThisThatEventPublisher( txnManager, () -> Events.encoder(keyPair, new TestClock()), EventSeries.THING, () -> DEFAULT_EVENT_BATCH_SIZE); } } ---------- class PalantirExpressionLambdas { void foo() { publisher = new ThisThatEventPublisher( txnManager, () -> Events.encoder(keyPair, new TestClock()), EventSeries.THING, () -> DEFAULT_EVENT_BATCH_SIZE); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-crlf.case new file mode 100644 index 000000000..d5696add5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-crlf.case @@ -0,0 +1,18 @@ +---------- +class PalantirExpressionLambdas { + void foo() { + publisher = new ThisThatEventPublisher( + txnManager, () -> Events.encoder(keyPair, new TestClock()), EventSeries.THING, () -> + DEFAULT_EVENT_BATCH_SIZE); + } +} +---------- +class PalantirExpressionLambdas { + void foo() { + publisher = new ThisThatEventPublisher( + txnManager, + () -> Events.encoder(keyPair, new TestClock()), + EventSeries.THING, + () -> DEFAULT_EVENT_BATCH_SIZE); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas.output b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas.output rename to open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-lf.case index 9d021695e..30b2799c3 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas.output +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-lf.case @@ -1,3 +1,12 @@ +---------- +class PalantirExpressionLambdas { + void foo() { + publisher = new ThisThatEventPublisher( + txnManager, () -> Events.encoder(keyPair, new TestClock()), EventSeries.THING, () -> + DEFAULT_EVENT_BATCH_SIZE); + } +} +---------- class PalantirExpressionLambdas { void foo() { publisher = new ThisThatEventPublisher( diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-issue-1343-text-block-indent-stable-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-issue-1343-text-block-indent-stable-cr.case new file mode 100644 index 000000000..f67165c4c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-issue-1343-text-block-indent-stable-cr.case @@ -0,0 +1 @@ +---------- class PalantirIssue1343TextBlockIndentStable { String[][] withCommentFirstLine = { { """ // tmp fix @Deprecated class Test {} """ }, { """ @Deprecated class Test {} """ } }; String[][] blankLineInTheMiddle = { { """ import java.util.List; @Deprecated class Test {} """ }, { """ class Test {} """ } }; } ---------- class PalantirIssue1343TextBlockIndentStable { String[][] withCommentFirstLine = {{""" // tmp fix @Deprecated class Test {} """}, {""" @Deprecated class Test {} """}}; String[][] blankLineInTheMiddle = {{""" import java.util.List; @Deprecated class Test {} """}, {""" class Test {} """}}; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-issue-1343-text-block-indent-stable-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-issue-1343-text-block-indent-stable-crlf.case new file mode 100644 index 000000000..ec37200b4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-issue-1343-text-block-indent-stable-crlf.case @@ -0,0 +1,58 @@ +---------- +class PalantirIssue1343TextBlockIndentStable { + String[][] withCommentFirstLine = { + { + """ + // tmp fix + @Deprecated + class Test {} + """ + }, + { + """ + + @Deprecated + class Test {} + """ + } + }; + + String[][] blankLineInTheMiddle = { + { + """ + import java.util.List; + + @Deprecated + class Test {} + """ + }, + { + """ + + class Test {} + """ + } + }; +} +---------- +class PalantirIssue1343TextBlockIndentStable { + String[][] withCommentFirstLine = {{""" + // tmp fix + @Deprecated + class Test {} + """}, {""" + + @Deprecated + class Test {} + """}}; + + String[][] blankLineInTheMiddle = {{""" + import java.util.List; + + @Deprecated + class Test {} + """}, {""" + + class Test {} + """}}; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-issue-1343-text-block-indent-stable.input b/open-java-format/src/test/resources/test-cases/testdata/palantir-issue-1343-text-block-indent-stable-lf.case similarity index 56% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-issue-1343-text-block-indent-stable.input rename to open-java-format/src/test/resources/test-cases/testdata/palantir-issue-1343-text-block-indent-stable-lf.case index 162408a62..447508280 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-issue-1343-text-block-indent-stable.input +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-issue-1343-text-block-indent-stable-lf.case @@ -1,3 +1,4 @@ +---------- class PalantirIssue1343TextBlockIndentStable { String[][] withCommentFirstLine = { { @@ -33,3 +34,25 @@ class PalantirIssue1343TextBlockIndentStable { } }; } +---------- +class PalantirIssue1343TextBlockIndentStable { + String[][] withCommentFirstLine = {{""" + // tmp fix + @Deprecated + class Test {} + """}, {""" + + @Deprecated + class Test {} + """}}; + + String[][] blankLineInTheMiddle = {{""" + import java.util.List; + + @Deprecated + class Test {} + """}, {""" + + class Test {} + """}}; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-inlining-prefers-break-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-inlining-prefers-break-cr.case new file mode 100644 index 000000000..0b0043744 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-inlining-prefers-break-cr.case @@ -0,0 +1 @@ +---------- class PalantirLambdaInliningPrefersBreak { void foo() { endpointDefinition.getDeprecated().ifPresent(documentation -> endpointBuilder.addMethod( MethodSpec.methodBuilder("deprecated") .addModifiers(Modifier.PUBLIC) .addAnnotation(Override.class) .returns(ParameterizedTypeName.get(ClassName.get(Optional.class), ClassName.get(String.class))) .addStatement("return $1T.of($2S)", Optional.class, documentation) .build())); } } ---------- class PalantirLambdaInliningPrefersBreak { void foo() { endpointDefinition .getDeprecated() .ifPresent(documentation -> endpointBuilder.addMethod(MethodSpec.methodBuilder("deprecated") .addModifiers(Modifier.PUBLIC) .addAnnotation(Override.class) .returns(ParameterizedTypeName.get(ClassName.get(Optional.class), ClassName.get(String.class))) .addStatement("return $1T.of($2S)", Optional.class, documentation) .build())); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-inlining-prefers-break-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-inlining-prefers-break-crlf.case new file mode 100644 index 000000000..1ac2c843e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-inlining-prefers-break-crlf.case @@ -0,0 +1,25 @@ +---------- +class PalantirLambdaInliningPrefersBreak { + void foo() { + endpointDefinition.getDeprecated().ifPresent(documentation -> endpointBuilder.addMethod( + MethodSpec.methodBuilder("deprecated") + .addModifiers(Modifier.PUBLIC) + .addAnnotation(Override.class) + .returns(ParameterizedTypeName.get(ClassName.get(Optional.class), ClassName.get(String.class))) + .addStatement("return $1T.of($2S)", Optional.class, documentation) + .build())); + } +} +---------- +class PalantirLambdaInliningPrefersBreak { + void foo() { + endpointDefinition + .getDeprecated() + .ifPresent(documentation -> endpointBuilder.addMethod(MethodSpec.methodBuilder("deprecated") + .addModifiers(Modifier.PUBLIC) + .addAnnotation(Override.class) + .returns(ParameterizedTypeName.get(ClassName.get(Optional.class), ClassName.get(String.class))) + .addStatement("return $1T.of($2S)", Optional.class, documentation) + .build())); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-inlining-prefers-break-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-inlining-prefers-break-lf.case new file mode 100644 index 000000000..45a1df8d9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-inlining-prefers-break-lf.case @@ -0,0 +1,25 @@ +---------- +class PalantirLambdaInliningPrefersBreak { + void foo() { + endpointDefinition.getDeprecated().ifPresent(documentation -> endpointBuilder.addMethod( + MethodSpec.methodBuilder("deprecated") + .addModifiers(Modifier.PUBLIC) + .addAnnotation(Override.class) + .returns(ParameterizedTypeName.get(ClassName.get(Optional.class), ClassName.get(String.class))) + .addStatement("return $1T.of($2S)", Optional.class, documentation) + .build())); + } +} +---------- +class PalantirLambdaInliningPrefersBreak { + void foo() { + endpointDefinition + .getDeprecated() + .ifPresent(documentation -> endpointBuilder.addMethod(MethodSpec.methodBuilder("deprecated") + .addModifiers(Modifier.PUBLIC) + .addAnnotation(Override.class) + .returns(ParameterizedTypeName.get(ClassName.get(Optional.class), ClassName.get(String.class))) + .addStatement("return $1T.of($2S)", Optional.class, documentation) + .build())); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-multiline-arg-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-multiline-arg-cr.case new file mode 100644 index 000000000..e2ed5131a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-multiline-arg-cr.case @@ -0,0 +1 @@ +---------- public class Foo { public static void main(String[] args) { String value = myMethod.accept(SomeCreator.Visitor.>builder() .visitWebsite1(() -> Optional.of("https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")) .visitWebsite2(() -> Optional.of("https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").get()) .visitWebsite3(() -> Optional.of("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")) .build()); assertThat(resultThatIsQuiteLong) .containsExactly(SomeResonse.getValue("1".repeat((int) (MyClass.CHAR_LIMIT * 0.5)))); someArgResulsts.forEach((key, value) -> value.sync().ifPresent(myvalue -> { myvalue.put(foo, bar, baz); })); Set convertedSet = castedObj.stream() .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments()[0])) .collect(Collectors.toSet()); EntryStream.of(SOME_NAME_TO_JSON_STRING).forKeyValue((tableName, jsonString) -> doReturn( getSelectJsonResponse(some(other(myValueTahatIsLong(jsonString))))) .when(session) .execute((Statement) argThat(statement -> statement instanceof Statement && statement.toString().contains(tableName)))); return someService.runWithLock( foo, Set.of("Running bar"), () -> getOperationLock(MyClass.DOWNLOAD).runWithLock(MyClass.DOWNLOAD, () -> { return doStuff.builder() .method1() .method2() .build(); })); } public static Value convertToFunctionValue(Object sourceObject, Type sourceType) { if (sourceType instanceof ParameterizedType parameterizedType) { if (sourceObject instanceof Optional castedObj) { if (castedObj.isEmpty()) { return NULL_VALUE; } return convertToFunctionValue(castedObj.get(), parameterizedType.getActualTypeArguments()[0]); } else if (sourceObject instanceof List castedObj) { List convertedList = castedObj.stream() .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments()[0])) .toList(); return Value.list(ListValue.of(convertedList)); } else if (sourceObject instanceof Set castedObj) { Set convertedSet = castedObj.stream() .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments().get())) .collect(Collectors.toSet()); return Value.set(SetValue.of(convertedSet)); } else if (sourceObject instanceof Set castedObj) { Set convertedSet = castedObj.stream() .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments())) .collect(Collectors.toSet()); return Value.set(SetValue.of(convertedSet)); } } return null; } } ---------- public class Foo { public static void main(String[] args) { String value = myMethod.accept(SomeCreator.Visitor.>builder() .visitWebsite1( () -> Optional.of( "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")) .visitWebsite2(() -> Optional.of( "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .get()) .visitWebsite3(() -> Optional.of("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")) .build()); assertThat(resultThatIsQuiteLong) .containsExactly(SomeResonse.getValue("1".repeat((int) (MyClass.CHAR_LIMIT * 0.5)))); someArgResulsts.forEach((key, value) -> value.sync().ifPresent(myvalue -> { myvalue.put(foo, bar, baz); })); Set convertedSet = castedObj.stream() .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments()[0])) .collect(Collectors.toSet()); EntryStream.of(SOME_NAME_TO_JSON_STRING) .forKeyValue((tableName, jsonString) -> doReturn( getSelectJsonResponse(some(other(myValueTahatIsLong(jsonString))))) .when(session) .execute((Statement) argThat(statement -> statement instanceof Statement && statement.toString().contains(tableName)))); return someService.runWithLock( foo, Set.of("Running bar"), () -> getOperationLock(MyClass.DOWNLOAD).runWithLock(MyClass.DOWNLOAD, () -> { return doStuff.builder().method1().method2().build(); })); } public static Value convertToFunctionValue(Object sourceObject, Type sourceType) { if (sourceType instanceof ParameterizedType parameterizedType) { if (sourceObject instanceof Optional castedObj) { if (castedObj.isEmpty()) { return NULL_VALUE; } return convertToFunctionValue(castedObj.get(), parameterizedType.getActualTypeArguments()[0]); } else if (sourceObject instanceof List castedObj) { List convertedList = castedObj.stream() .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments()[0])) .toList(); return Value.list(ListValue.of(convertedList)); } else if (sourceObject instanceof Set castedObj) { Set convertedSet = castedObj.stream() .map(val -> convertToFunctionValue( val, parameterizedType.getActualTypeArguments().get())) .collect(Collectors.toSet()); return Value.set(SetValue.of(convertedSet)); } else if (sourceObject instanceof Set castedObj) { Set convertedSet = castedObj.stream() .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments())) .collect(Collectors.toSet()); return Value.set(SetValue.of(convertedSet)); } } return null; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-multiline-arg-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-multiline-arg-crlf.case new file mode 100644 index 000000000..42335a5d0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-multiline-arg-crlf.case @@ -0,0 +1,136 @@ +---------- +public class Foo { + public static void main(String[] args) { + + String value = myMethod.accept(SomeCreator.Visitor.>builder() + .visitWebsite1(() -> Optional.of("https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")) + .visitWebsite2(() -> Optional.of("https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").get()) + .visitWebsite3(() -> Optional.of("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")) + .build()); + + assertThat(resultThatIsQuiteLong) + .containsExactly(SomeResonse.getValue("1".repeat((int) (MyClass.CHAR_LIMIT * 0.5)))); + + someArgResulsts.forEach((key, value) -> value.sync().ifPresent(myvalue -> { + myvalue.put(foo, bar, baz); + })); + + Set convertedSet = castedObj.stream() + .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments()[0])) + .collect(Collectors.toSet()); + + EntryStream.of(SOME_NAME_TO_JSON_STRING).forKeyValue((tableName, jsonString) -> doReturn( + getSelectJsonResponse(some(other(myValueTahatIsLong(jsonString))))) + .when(session) + .execute((Statement) argThat(statement -> + statement instanceof Statement && statement.toString().contains(tableName)))); + + return someService.runWithLock( + foo, + Set.of("Running bar"), + () -> getOperationLock(MyClass.DOWNLOAD).runWithLock(MyClass.DOWNLOAD, () -> { + return doStuff.builder() + .method1() + .method2() + .build(); + })); + } + + public static Value convertToFunctionValue(Object sourceObject, Type sourceType) { + if (sourceType instanceof ParameterizedType parameterizedType) { + if (sourceObject instanceof Optional castedObj) { + if (castedObj.isEmpty()) { + return NULL_VALUE; + } + return convertToFunctionValue(castedObj.get(), parameterizedType.getActualTypeArguments()[0]); + } else if (sourceObject instanceof List castedObj) { + List convertedList = castedObj.stream() + .map(val -> + convertToFunctionValue(val, parameterizedType.getActualTypeArguments()[0])) + .toList(); + return Value.list(ListValue.of(convertedList)); + } else if (sourceObject instanceof Set castedObj) { + Set convertedSet = castedObj.stream() + .map(val -> + convertToFunctionValue(val, parameterizedType.getActualTypeArguments().get())) + .collect(Collectors.toSet()); + return Value.set(SetValue.of(convertedSet)); + } else if (sourceObject instanceof Set castedObj) { + Set convertedSet = castedObj.stream() + .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments())) + .collect(Collectors.toSet()); + return Value.set(SetValue.of(convertedSet)); + } + } + return null; + } +} +---------- +public class Foo { + public static void main(String[] args) { + + String value = myMethod.accept(SomeCreator.Visitor.>builder() + .visitWebsite1( + () -> Optional.of( + "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")) + .visitWebsite2(() -> Optional.of( + "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + .get()) + .visitWebsite3(() -> Optional.of("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")) + .build()); + + assertThat(resultThatIsQuiteLong) + .containsExactly(SomeResonse.getValue("1".repeat((int) (MyClass.CHAR_LIMIT * 0.5)))); + + someArgResulsts.forEach((key, value) -> value.sync().ifPresent(myvalue -> { + myvalue.put(foo, bar, baz); + })); + + Set convertedSet = castedObj.stream() + .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments()[0])) + .collect(Collectors.toSet()); + + EntryStream.of(SOME_NAME_TO_JSON_STRING) + .forKeyValue((tableName, jsonString) -> doReturn( + getSelectJsonResponse(some(other(myValueTahatIsLong(jsonString))))) + .when(session) + .execute((Statement) argThat(statement -> statement instanceof Statement + && statement.toString().contains(tableName)))); + + return someService.runWithLock( + foo, + Set.of("Running bar"), + () -> getOperationLock(MyClass.DOWNLOAD).runWithLock(MyClass.DOWNLOAD, () -> { + return doStuff.builder().method1().method2().build(); + })); + } + + public static Value convertToFunctionValue(Object sourceObject, Type sourceType) { + if (sourceType instanceof ParameterizedType parameterizedType) { + if (sourceObject instanceof Optional castedObj) { + if (castedObj.isEmpty()) { + return NULL_VALUE; + } + return convertToFunctionValue(castedObj.get(), parameterizedType.getActualTypeArguments()[0]); + } else if (sourceObject instanceof List castedObj) { + List convertedList = castedObj.stream() + .map(val -> + convertToFunctionValue(val, parameterizedType.getActualTypeArguments()[0])) + .toList(); + return Value.list(ListValue.of(convertedList)); + } else if (sourceObject instanceof Set castedObj) { + Set convertedSet = castedObj.stream() + .map(val -> convertToFunctionValue( + val, parameterizedType.getActualTypeArguments().get())) + .collect(Collectors.toSet()); + return Value.set(SetValue.of(convertedSet)); + } else if (sourceObject instanceof Set castedObj) { + Set convertedSet = castedObj.stream() + .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments())) + .collect(Collectors.toSet()); + return Value.set(SetValue.of(convertedSet)); + } + } + return null; + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-multiline-arg.input b/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-multiline-arg-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-multiline-arg.input rename to open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-multiline-arg-lf.case index b57b4c924..ceb9c5ac7 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-multiline-arg.input +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-multiline-arg-lf.case @@ -1,3 +1,4 @@ +---------- public class Foo { public static void main(String[] args) { @@ -64,3 +65,72 @@ public class Foo { return null; } } +---------- +public class Foo { + public static void main(String[] args) { + + String value = myMethod.accept(SomeCreator.Visitor.>builder() + .visitWebsite1( + () -> Optional.of( + "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")) + .visitWebsite2(() -> Optional.of( + "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + .get()) + .visitWebsite3(() -> Optional.of("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")) + .build()); + + assertThat(resultThatIsQuiteLong) + .containsExactly(SomeResonse.getValue("1".repeat((int) (MyClass.CHAR_LIMIT * 0.5)))); + + someArgResulsts.forEach((key, value) -> value.sync().ifPresent(myvalue -> { + myvalue.put(foo, bar, baz); + })); + + Set convertedSet = castedObj.stream() + .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments()[0])) + .collect(Collectors.toSet()); + + EntryStream.of(SOME_NAME_TO_JSON_STRING) + .forKeyValue((tableName, jsonString) -> doReturn( + getSelectJsonResponse(some(other(myValueTahatIsLong(jsonString))))) + .when(session) + .execute((Statement) argThat(statement -> statement instanceof Statement + && statement.toString().contains(tableName)))); + + return someService.runWithLock( + foo, + Set.of("Running bar"), + () -> getOperationLock(MyClass.DOWNLOAD).runWithLock(MyClass.DOWNLOAD, () -> { + return doStuff.builder().method1().method2().build(); + })); + } + + public static Value convertToFunctionValue(Object sourceObject, Type sourceType) { + if (sourceType instanceof ParameterizedType parameterizedType) { + if (sourceObject instanceof Optional castedObj) { + if (castedObj.isEmpty()) { + return NULL_VALUE; + } + return convertToFunctionValue(castedObj.get(), parameterizedType.getActualTypeArguments()[0]); + } else if (sourceObject instanceof List castedObj) { + List convertedList = castedObj.stream() + .map(val -> + convertToFunctionValue(val, parameterizedType.getActualTypeArguments()[0])) + .toList(); + return Value.list(ListValue.of(convertedList)); + } else if (sourceObject instanceof Set castedObj) { + Set convertedSet = castedObj.stream() + .map(val -> convertToFunctionValue( + val, parameterizedType.getActualTypeArguments().get())) + .collect(Collectors.toSet()); + return Value.set(SetValue.of(convertedSet)); + } else if (sourceObject instanceof Set castedObj) { + Set convertedSet = castedObj.stream() + .map(val -> convertToFunctionValue(val, parameterizedType.getActualTypeArguments())) + .collect(Collectors.toSet()); + return Value.set(SetValue.of(convertedSet)); + } + } + return null; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-lamda-cast-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-lamda-cast-cr.case new file mode 100644 index 000000000..dfe5997d0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-lamda-cast-cr.case @@ -0,0 +1 @@ +---------- public class Foo { static String foo(Optional optional) { return optional.orElseGet( (String) () -> { throw new NotFoundException(); }); } static String bar(Optional optional) { return optional.orElseGet( (String) () -> ""); } static String baz(Optional optional) { return optional.orElseGet((String) () -> bar(Optional.of("some thing that is very very very looooooong")).get()); } } ---------- public class Foo { static String foo(Optional optional) { return optional.orElseGet((String) () -> { throw new NotFoundException(); }); } static String bar(Optional optional) { return optional.orElseGet((String) () -> ""); } static String baz(Optional optional) { return optional.orElseGet((String) () -> bar(Optional.of("some thing that is very very very looooooong")).get()); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-lamda-cast-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-lamda-cast-crlf.case new file mode 100644 index 000000000..e97d3e58e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-lamda-cast-crlf.case @@ -0,0 +1,36 @@ +---------- +public class Foo { + static String foo(Optional optional) { + return optional.orElseGet( + (String) + () -> { + throw new NotFoundException(); + }); + } + + static String bar(Optional optional) { + return optional.orElseGet( + (String) () -> ""); + } + + static String baz(Optional optional) { + return optional.orElseGet((String) () -> bar(Optional.of("some thing that is very very very looooooong")).get()); + } +} +---------- +public class Foo { + static String foo(Optional optional) { + return optional.orElseGet((String) () -> { + throw new NotFoundException(); + }); + } + + static String bar(Optional optional) { + return optional.orElseGet((String) () -> ""); + } + + static String baz(Optional optional) { + return optional.orElseGet((String) () -> + bar(Optional.of("some thing that is very very very looooooong")).get()); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lamda-cast.input b/open-java-format/src/test/resources/test-cases/testdata/palantir-lamda-cast-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lamda-cast.input rename to open-java-format/src/test/resources/test-cases/testdata/palantir-lamda-cast-lf.case index dab47ad5b..aae803d76 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lamda-cast.input +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-lamda-cast-lf.case @@ -1,3 +1,4 @@ +---------- public class Foo { static String foo(Optional optional) { return optional.orElseGet( @@ -16,3 +17,20 @@ public class Foo { return optional.orElseGet((String) () -> bar(Optional.of("some thing that is very very very looooooong")).get()); } } +---------- +public class Foo { + static String foo(Optional optional) { + return optional.orElseGet((String) () -> { + throw new NotFoundException(); + }); + } + + static String bar(Optional optional) { + return optional.orElseGet((String) () -> ""); + } + + static String baz(Optional optional) { + return optional.orElseGet((String) () -> + bar(Optional.of("some thing that is very very very looooooong")).get()); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-arg-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-arg-cr.case new file mode 100644 index 000000000..abb771b4d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-arg-cr.case @@ -0,0 +1 @@ +---------- class PalantirLongMethodChainArg { void foo() { return cache.get(ImmutableRequest.builder().group(group).name(artifact).addRepositories("release-jar").build()); } } ---------- class PalantirLongMethodChainArg { void foo() { return cache.get(ImmutableRequest.builder() .group(group) .name(artifact) .addRepositories("release-jar") .build()); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-arg-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-arg-crlf.case new file mode 100644 index 000000000..d24eae179 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-arg-crlf.case @@ -0,0 +1,16 @@ +---------- +class PalantirLongMethodChainArg { + void foo() { + return cache.get(ImmutableRequest.builder().group(group).name(artifact).addRepositories("release-jar").build()); + } +} +---------- +class PalantirLongMethodChainArg { + void foo() { + return cache.get(ImmutableRequest.builder() + .group(group) + .name(artifact) + .addRepositories("release-jar") + .build()); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain-arg.output b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-arg-lf.case similarity index 55% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain-arg.output rename to open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-arg-lf.case index a68f94b4c..ca3ee497d 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain-arg.output +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-arg-lf.case @@ -1,3 +1,10 @@ +---------- +class PalantirLongMethodChainArg { + void foo() { + return cache.get(ImmutableRequest.builder().group(group).name(artifact).addRepositories("release-jar").build()); + } +} +---------- class PalantirLongMethodChainArg { void foo() { return cache.get(ImmutableRequest.builder() From 6536e4ec1246b0df956ea274aeead4a928df6618 Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Tue, 27 Oct 2026 00:40:12 +0300 Subject: [PATCH 5/9] Keep in testdata the two pairs other modules read The benchmarks link src/test/resources/PalantirDeeplyNestedCalls.java to palantir-deeply-nested-calls.input, and the IntelliJ plugin's PalantirJavaFormatFormattingServiceTest reads A.input and A.output by path. Moving both pairs into cases broke the build: CI failed in :open-java-format-benchmarks:processTestResources on the dangling link. The two pairs go back to testdata/ and their six cases go. Level.java pointed at palantir-expression-lambdas.input, which moved; its comment now names the cases. Tests on JDK 21: FormatterIntegrationTest 132 -> 140, FormatterCasesTest 733 -> 727, 1451 tests in the module; ./gradlew test --rerun passes in every module. --- .../com/palantir/javaformat/doc/Level.java | 4 +- .../palantir/javaformat/java/testdata/A.input | 97 +++++++++ .../javaformat/java/testdata/A.output} | 99 --------- .../palantir-deeply-nested-calls.input | 93 +++++++++ .../palantir-deeply-nested-calls.output | 93 +++++++++ .../resources/test-cases/testdata/A-cr.case | 1 - .../resources/test-cases/testdata/A-crlf.case | 186 ----------------- .../palantir-deeply-nested-calls-cr.case | 1 - .../palantir-deeply-nested-calls-crlf.case | 188 ------------------ .../palantir-deeply-nested-calls-lf.case | 188 ------------------ 10 files changed, 285 insertions(+), 665 deletions(-) create mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.input rename open-java-format/src/test/resources/{test-cases/testdata/A-lf.case => com/palantir/javaformat/java/testdata/A.output} (50%) create mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.input create mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.output delete mode 100644 open-java-format/src/test/resources/test-cases/testdata/A-cr.case delete mode 100644 open-java-format/src/test/resources/test-cases/testdata/A-crlf.case delete mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-cr.case delete mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-crlf.case delete mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-lf.case diff --git a/open-java-format/src/main/java/com/palantir/javaformat/doc/Level.java b/open-java-format/src/main/java/com/palantir/javaformat/doc/Level.java index af9bfcc32..971055743 100644 --- a/open-java-format/src/main/java/com/palantir/javaformat/doc/Level.java +++ b/open-java-format/src/main/java/com/palantir/javaformat/doc/Level.java @@ -566,8 +566,8 @@ case BreakOnlyIfInnerLevelsThenFitOnOneLine(boolean keepIndentWhenInlined) -> { // levels that are meant to look good even if partially inlined, e.g. method // chains, which will catch things like builders, but not other kinds of levels like // constant expressions. - // See the palantir-expression-lambdas.input test for an example of what this is - // trying to avoid. + // See the palantir-expression-lambdas cases in test-cases/testdata for an example of + // what this is trying to avoid. // For this, need to actually check the last inner level of `lastLevel` (2 levels down). if (innerLevel.docs.isEmpty() || !(getLast(innerLevel.docs) instanceof Level)) { diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.input new file mode 100644 index 000000000..e9e13844e --- /dev/null +++ b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.input @@ -0,0 +1,97 @@ +package com.google.googlejavaformat.java.test; + +/** + * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, + * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, + * ArrayTypes, AssertStatements, and Assignments. + */ +class A { + public @interface X { + int x(); + + int y() default + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; + } + + @X(x = 1) + private @interface Y {} + + // TODO(jdd): Add annotation declaration with empty body. + + @X(x = 1) + @Y + protected @interface Z {} + + // TODO(jdd): Include type annotations once we can include a higher language level. + + int[] array1 = new int[5]; + int[] array2 = + new int[] { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31 + }; + int[] array3 = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31 + }; + int[][] array4 = { + {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, + {20, 21}, {22, 23} + }; + int[][][] arrayWithLongName = + new int + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + []; + + A a1 = + new A() { + int x = + array1[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array2[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array3[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array4[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0][ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0]; + }; + + void f(int something) { + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + : "that was certainly unexpected!"; + arrayWithLongName[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = + arrayWithLongName[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; + something = + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; + return StreamEx.of(itemsToCreate) + .append(itemsToEdit) + .append(itemsToDelete) + .distinct() + .mapToEntry(item -> getArgsGenerator() + .getNewArgs( + extendedItems.getOrDefault(item, Set.of()), + getOwningResource( + item, + getModificationContext()::getRestrictionStatusOrDefault, + RestrictionStatus::getPackageId, + getModificationContext()))) + .toImmutableMap(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/A-lf.case b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.output similarity index 50% rename from open-java-format/src/test/resources/test-cases/testdata/A-lf.case rename to open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.output index c9af28291..3c44e08e4 100644 --- a/open-java-format/src/test/resources/test-cases/testdata/A-lf.case +++ b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.output @@ -1,102 +1,3 @@ ----------- -package com.google.googlejavaformat.java.test; - -/** - * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, - * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, - * ArrayTypes, AssertStatements, and Assignments. - */ -class A { - public @interface X { - int x(); - - int y() default - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; - } - - @X(x = 1) - private @interface Y {} - - // TODO(jdd): Add annotation declaration with empty body. - - @X(x = 1) - @Y - protected @interface Z {} - - // TODO(jdd): Include type annotations once we can include a higher language level. - - int[] array1 = new int[5]; - int[] array2 = - new int[] { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31 - }; - int[] array3 = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31 - }; - int[][] array4 = { - {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, - {20, 21}, {22, 23} - }; - int[][][] arrayWithLongName = - new int - [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - []; - - A a1 = - new A() { - int x = - array1[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - + array2[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - + array3[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - + array4[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0][ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0]; - }; - - void f(int something) { - assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; - assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - : "that was certainly unexpected!"; - arrayWithLongName[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = - arrayWithLongName[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; - something = - 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 - + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 - + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; - return StreamEx.of(itemsToCreate) - .append(itemsToEdit) - .append(itemsToDelete) - .distinct() - .mapToEntry(item -> getArgsGenerator() - .getNewArgs( - extendedItems.getOrDefault(item, Set.of()), - getOwningResource( - item, - getModificationContext()::getRestrictionStatusOrDefault, - RestrictionStatus::getPackageId, - getModificationContext()))) - .toImmutableMap(); - } -} ----------- package com.google.googlejavaformat.java.test; /** diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.input new file mode 100644 index 000000000..af5ef3b31 --- /dev/null +++ b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.input @@ -0,0 +1,93 @@ +class PalantirDeeplyNestedCalls { + private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldOneV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldFourV1)) + .build())) + .build())) + .build())) + .build())) + .build(); + + void testMethod() { + assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) + .containsExactlyInAnyOrderElementsOf(Set.of( + new ItemWithCustomLocator( + ItemConfigV1.DEFAULT_CONFIG.toCustomString(), + ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_ITEM_A)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) + .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 + .apiName() + .get())) + .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), + // Discovered items + new ItemWithCustomLocator( + TestModelCatalog.MODEL_ABC_456.toItemApi(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_API_NAME)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())))); + } + + public Map otherMethod( + FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { + return myCustomService + .get() + .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) + .entrySet() + .stream() + .collect(Collectors.toMap( + Map.Entry::getKey, entry -> entry.getValue().getMetrics())); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.output new file mode 100644 index 000000000..af5ef3b31 --- /dev/null +++ b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.output @@ -0,0 +1,93 @@ +class PalantirDeeplyNestedCalls { + private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldOneV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldFourV1)) + .build())) + .build())) + .build())) + .build())) + .build(); + + void testMethod() { + assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) + .containsExactlyInAnyOrderElementsOf(Set.of( + new ItemWithCustomLocator( + ItemConfigV1.DEFAULT_CONFIG.toCustomString(), + ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_ITEM_A)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) + .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 + .apiName() + .get())) + .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), + // Discovered items + new ItemWithCustomLocator( + TestModelCatalog.MODEL_ABC_456.toItemApi(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_API_NAME)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())))); + } + + public Map otherMethod( + FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { + return myCustomService + .get() + .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) + .entrySet() + .stream() + .collect(Collectors.toMap( + Map.Entry::getKey, entry -> entry.getValue().getMetrics())); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/A-cr.case b/open-java-format/src/test/resources/test-cases/testdata/A-cr.case deleted file mode 100644 index 3800b6cbf..000000000 --- a/open-java-format/src/test/resources/test-cases/testdata/A-cr.case +++ /dev/null @@ -1 +0,0 @@ ----------- package com.google.googlejavaformat.java.test; /** * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, * ArrayTypes, AssertStatements, and Assignments. */ class A { public @interface X { int x(); int y() default 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; } @X(x = 1) private @interface Y {} // TODO(jdd): Add annotation declaration with empty body. @X(x = 1) @Y protected @interface Z {} // TODO(jdd): Include type annotations once we can include a higher language level. int[] array1 = new int[5]; int[] array2 = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; int[] array3 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; int[][] array4 = { {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, {20, 21}, {22, 23} }; int[][][] arrayWithLongName = new int [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] []; A a1 = new A() { int x = array1[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array2[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array3[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array4[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0][ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; }; void f(int something) { assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 : "that was certainly unexpected!"; arrayWithLongName[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = arrayWithLongName[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; something = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; return StreamEx.of(itemsToCreate) .append(itemsToEdit) .append(itemsToDelete) .distinct() .mapToEntry(item -> getArgsGenerator() .getNewArgs( extendedItems.getOrDefault(item, Set.of()), getOwningResource( item, getModificationContext()::getRestrictionStatusOrDefault, RestrictionStatus::getPackageId, getModificationContext()))) .toImmutableMap(); } } ---------- package com.google.googlejavaformat.java.test; /** * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, * ArrayTypes, AssertStatements, and Assignments. */ class A { public @interface X { int x(); int y() default 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; } @X(x = 1) private @interface Y {} // TODO(jdd): Add annotation declaration with empty body. @X(x = 1) @Y protected @interface Z {} // TODO(jdd): Include type annotations once we can include a higher language level. int[] array1 = new int[5]; int[] array2 = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; int[] array3 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; int[][] array4 = { {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, {20, 21}, {22, 23} }; int[][][] arrayWithLongName = new int [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] []; A a1 = new A() { int x = array1[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array2[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array3[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array4[0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0][ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; }; void f(int something) { assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 : "that was certainly unexpected!"; arrayWithLongName[0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = arrayWithLongName[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; something = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; return StreamEx.of(itemsToCreate) .append(itemsToEdit) .append(itemsToDelete) .distinct() .mapToEntry(item -> getArgsGenerator() .getNewArgs( extendedItems.getOrDefault(item, Set.of()), getOwningResource( item, getModificationContext()::getRestrictionStatusOrDefault, RestrictionStatus::getPackageId, getModificationContext()))) .toImmutableMap(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/A-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/A-crlf.case deleted file mode 100644 index b0b1633bd..000000000 --- a/open-java-format/src/test/resources/test-cases/testdata/A-crlf.case +++ /dev/null @@ -1,186 +0,0 @@ ----------- -package com.google.googlejavaformat.java.test; - -/** - * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, - * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, - * ArrayTypes, AssertStatements, and Assignments. - */ -class A { - public @interface X { - int x(); - - int y() default - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; - } - - @X(x = 1) - private @interface Y {} - - // TODO(jdd): Add annotation declaration with empty body. - - @X(x = 1) - @Y - protected @interface Z {} - - // TODO(jdd): Include type annotations once we can include a higher language level. - - int[] array1 = new int[5]; - int[] array2 = - new int[] { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31 - }; - int[] array3 = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31 - }; - int[][] array4 = { - {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, - {20, 21}, {22, 23} - }; - int[][][] arrayWithLongName = - new int - [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - []; - - A a1 = - new A() { - int x = - array1[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - + array2[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - + array3[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - + array4[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0][ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0]; - }; - - void f(int something) { - assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; - assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - : "that was certainly unexpected!"; - arrayWithLongName[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = - arrayWithLongName[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; - something = - 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 - + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 - + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; - return StreamEx.of(itemsToCreate) - .append(itemsToEdit) - .append(itemsToDelete) - .distinct() - .mapToEntry(item -> getArgsGenerator() - .getNewArgs( - extendedItems.getOrDefault(item, Set.of()), - getOwningResource( - item, - getModificationContext()::getRestrictionStatusOrDefault, - RestrictionStatus::getPackageId, - getModificationContext()))) - .toImmutableMap(); - } -} ----------- -package com.google.googlejavaformat.java.test; - -/** - * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, - * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, - * ArrayTypes, AssertStatements, and Assignments. - */ -class A { - public @interface X { - int x(); - - int y() default - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - + 1 + 1 + 1 + 1 + 1 + 1; - } - - @X(x = 1) - private @interface Y {} - - // TODO(jdd): Add annotation declaration with empty body. - - @X(x = 1) - @Y - protected @interface Z {} - - // TODO(jdd): Include type annotations once we can include a higher language level. - - int[] array1 = new int[5]; - int[] array2 = new int[] { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31 - }; - int[] array3 = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31 - }; - int[][] array4 = { - {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, {20, 21}, {22, 23} - }; - int[][][] arrayWithLongName = new int - [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0] - [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0] - []; - - A a1 = new A() { - int x = array1[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - + array2[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - + array3[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] - + array4[0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0][ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; - }; - - void f(int something) { - assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; - assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - : "that was certainly unexpected!"; - arrayWithLongName[0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = - arrayWithLongName[ - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; - something = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 - + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 - + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; - return StreamEx.of(itemsToCreate) - .append(itemsToEdit) - .append(itemsToDelete) - .distinct() - .mapToEntry(item -> getArgsGenerator() - .getNewArgs( - extendedItems.getOrDefault(item, Set.of()), - getOwningResource( - item, - getModificationContext()::getRestrictionStatusOrDefault, - RestrictionStatus::getPackageId, - getModificationContext()))) - .toImmutableMap(); - } -} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-cr.case deleted file mode 100644 index 9ee971013..000000000 --- a/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-cr.case +++ /dev/null @@ -1 +0,0 @@ ----------- class PalantirDeeplyNestedCalls { private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldOneV1)) .baaars(ImmutableList.of(MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) .baaars(ImmutableList.of(MagicConfigV1.builder() .baaars(ImmutableList.of(MagicConfigV1.builder() .baaars(ImmutableList.of(MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldFourV1)) .build())) .build())) .build())) .build())) .build(); void testMethod() { assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) .containsExactlyInAnyOrderElementsOf(Set.of( new ItemWithCustomLocator( ItemConfigV1.DEFAULT_CONFIG.toCustomString(), ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TEST_ITEM_A)) .name(ItemName.of(TEST_API_NAME.get())) .apiName(TEST_API_NAME) .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 .apiName() .get())) .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) .spec(ItemConfigV1Spec.native_( NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), // Discovered items new ItemWithCustomLocator( TestModelCatalog.MODEL_ABC_456.toItemApi(), CustomItemLocator.discovered(DiscoveredItemLocator.of())), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TEST_API_NAME)) .name(ItemName.of(TEST_API_NAME.get())) .apiName(TEST_API_NAME) .spec(ItemConfigV1Spec.native_( NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.discovered(DiscoveredItemLocator.of())))); } public Map otherMethod( FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { return myCustomService .get() .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) .entrySet() .stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> entry.getValue().getMetrics())); } } ---------- class PalantirDeeplyNestedCalls { private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldOneV1)) .baaars(ImmutableList.of(MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) .baaars(ImmutableList.of(MagicConfigV1.builder() .baaars(ImmutableList.of(MagicConfigV1.builder() .baaars(ImmutableList.of(MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldFourV1)) .build())) .build())) .build())) .build())) .build(); void testMethod() { assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) .containsExactlyInAnyOrderElementsOf(Set.of( new ItemWithCustomLocator( ItemConfigV1.DEFAULT_CONFIG.toCustomString(), ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TEST_ITEM_A)) .name(ItemName.of(TEST_API_NAME.get())) .apiName(TEST_API_NAME) .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 .apiName() .get())) .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) .spec(ItemConfigV1Spec.native_( NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), // Discovered items new ItemWithCustomLocator( TestModelCatalog.MODEL_ABC_456.toItemApi(), CustomItemLocator.discovered(DiscoveredItemLocator.of())), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TEST_API_NAME)) .name(ItemName.of(TEST_API_NAME.get())) .apiName(TEST_API_NAME) .spec(ItemConfigV1Spec.native_( NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.discovered(DiscoveredItemLocator.of())))); } public Map otherMethod( FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { return myCustomService .get() .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) .entrySet() .stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> entry.getValue().getMetrics())); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-crlf.case deleted file mode 100644 index 2ec2207d8..000000000 --- a/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-crlf.case +++ /dev/null @@ -1,188 +0,0 @@ ----------- -class PalantirDeeplyNestedCalls { - private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldOneV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldFourV1)) - .build())) - .build())) - .build())) - .build())) - .build(); - - void testMethod() { - assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) - .containsExactlyInAnyOrderElementsOf(Set.of( - new ItemWithCustomLocator( - ItemConfigV1.DEFAULT_CONFIG.toCustomString(), - ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_ITEM_A)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) - .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 - .apiName() - .get())) - .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), - // Discovered items - new ItemWithCustomLocator( - TestModelCatalog.MODEL_ABC_456.toItemApi(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_API_NAME)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())))); - } - - public Map otherMethod( - FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { - return myCustomService - .get() - .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) - .entrySet() - .stream() - .collect(Collectors.toMap( - Map.Entry::getKey, entry -> entry.getValue().getMetrics())); - } -} ----------- -class PalantirDeeplyNestedCalls { - private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldOneV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldFourV1)) - .build())) - .build())) - .build())) - .build())) - .build(); - - void testMethod() { - assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) - .containsExactlyInAnyOrderElementsOf(Set.of( - new ItemWithCustomLocator( - ItemConfigV1.DEFAULT_CONFIG.toCustomString(), - ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_ITEM_A)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) - .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 - .apiName() - .get())) - .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), - // Discovered items - new ItemWithCustomLocator( - TestModelCatalog.MODEL_ABC_456.toItemApi(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_API_NAME)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())))); - } - - public Map otherMethod( - FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { - return myCustomService - .get() - .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) - .entrySet() - .stream() - .collect(Collectors.toMap( - Map.Entry::getKey, entry -> entry.getValue().getMetrics())); - } -} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-lf.case deleted file mode 100644 index f1e8e899c..000000000 --- a/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-lf.case +++ /dev/null @@ -1,188 +0,0 @@ ----------- -class PalantirDeeplyNestedCalls { - private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldOneV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldFourV1)) - .build())) - .build())) - .build())) - .build())) - .build(); - - void testMethod() { - assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) - .containsExactlyInAnyOrderElementsOf(Set.of( - new ItemWithCustomLocator( - ItemConfigV1.DEFAULT_CONFIG.toCustomString(), - ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_ITEM_A)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) - .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 - .apiName() - .get())) - .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), - // Discovered items - new ItemWithCustomLocator( - TestModelCatalog.MODEL_ABC_456.toItemApi(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_API_NAME)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())))); - } - - public Map otherMethod( - FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { - return myCustomService - .get() - .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) - .entrySet() - .stream() - .collect(Collectors.toMap( - Map.Entry::getKey, entry -> entry.getValue().getMetrics())); - } -} ----------- -class PalantirDeeplyNestedCalls { - private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldOneV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldFourV1)) - .build())) - .build())) - .build())) - .build())) - .build(); - - void testMethod() { - assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) - .containsExactlyInAnyOrderElementsOf(Set.of( - new ItemWithCustomLocator( - ItemConfigV1.DEFAULT_CONFIG.toCustomString(), - ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_ITEM_A)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) - .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 - .apiName() - .get())) - .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), - // Discovered items - new ItemWithCustomLocator( - TestModelCatalog.MODEL_ABC_456.toItemApi(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_API_NAME)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())))); - } - - public Map otherMethod( - FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { - return myCustomService - .get() - .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) - .entrySet() - .stream() - .collect(Collectors.toMap( - Map.Entry::getKey, entry -> entry.getValue().getMetrics())); - } -} From 5503500b802787b134c0ead06860c4ae97a39187 Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Tue, 27 Oct 2026 00:58:55 +0300 Subject: [PATCH 6/9] Move the testdata pairs without a final line break, with the second dashes ending the input A case could not hold an input that does not end in a line break: its before block ran up to a line of dashes, so it always ended in one. Now six or more dashes are a separator wherever they end a line, so the before block can stop right before them, as in a closing brace followed by the dashes, and keeps no line break of its own. The price is that a line of code that ends in six or more dashes cannot be part of a case. None of the cases or pairs has one, and such a file fails with three separators found rather than quietly. The 28 testdata pairs whose input has no final line break, among them JavaFileNoNewLine, become their LF, CRLF and CR cases like the other pairs, and FileBasedTests.VERSIONED_TESTS keeps only ModuleImport. testdata/ now holds the seven pairs that need a setting or that other modules read. Tests on JDK 21: CaseFileTest 14 -> 16, FormatterIntegrationTest 140 -> 28, FormatterCasesTest 727 -> 811; 1425 tests in the module. --- .../palantir/javaformat/java/CaseFile.java | 21 +- .../javaformat/java/CaseFileTest.java | 13 + .../javaformat/java/FileBasedTests.java | 3 - .../java/testdata/AnnotationFields.input | 110 ----- .../javaformat/java/testdata/B18479811.input | 15 - .../javaformat/java/testdata/B21608216.input | 56 --- .../javaformat/java/testdata/B22166687.input | 18 - .../javaformat/java/testdata/B22166687.output | 14 - .../javaformat/java/testdata/B26928842.input | 9 - .../javaformat/java/testdata/B26928842.output | 9 - .../javaformat/java/testdata/B28066276.input | 13 - .../javaformat/java/testdata/B30223986.input | 45 --- .../javaformat/java/testdata/B30764810.input | 16 - .../javaformat/java/testdata/B32397217.input | 6 - .../javaformat/java/testdata/B32397217.output | 5 - .../javaformat/java/testdata/B38241237.input | 7 - .../javaformat/java/testdata/B38241237.output | 7 - .../javaformat/java/testdata/I574.input | 6 - .../javaformat/java/testdata/I574.output | 6 - .../javaformat/java/testdata/I588.input | 8 - .../javaformat/java/testdata/I880.input | 19 - .../java/testdata/JavaFileNoNewLine.input | 3 - .../java/testdata/JavaFileNoNewLine.output | 3 - .../testdata/JavaFileWithExtraSpaces.input | 3 - .../testdata/JavaFileWithExtraSpaces.output | 3 - .../javaformat/java/testdata/M3.input | 6 - .../javaformat/java/testdata/M3.output | 6 - .../javaformat/java/testdata/RSL.input | 191 --------- .../javaformat/java/testdata/Records.input | 29 -- .../javaformat/java/testdata/Var.input | 5 - .../javaformat/java/testdata/Var.output | 5 - .../testdata/palantir-chains-lambdas.input | 15 - ...palantir-conjure-java-runtime-1285-1.input | 20 - ...alantir-conjure-java-runtime-1285-1.output | 20 - ...palantir-conjure-java-runtime-1285-2.input | 16 - .../java/testdata/palantir-gcv-1.output | 18 - .../java/testdata/palantir-long-fqn.input | 7 - .../testdata/palantir-long-method-chain.input | 6 - .../palantir-long-method-reference.input | 9 - .../java/testdata/palantir-long-safearg.input | 7 - .../testdata/palantir-long-safearg.output | 8 - .../testdata/palantir-sandor-lambdas.output | 12 - .../testdata/AnnotationFields-cr.case | 1 + .../testdata/AnnotationFields-crlf.case | 257 ++++++++++++ .../testdata/AnnotationFields-lf.case} | 111 ++++++ .../test-cases/testdata/B18479811-cr.case | 1 + .../test-cases/testdata/B18479811-crlf.case | 54 +++ .../testdata/B18479811-lf.case} | 16 + .../test-cases/testdata/B21608216-cr.case | 1 + .../test-cases/testdata/B21608216-crlf.case | 113 ++++++ .../testdata/B21608216-lf.case} | 57 +++ .../test-cases/testdata/B22166687-cr.case | 1 + .../test-cases/testdata/B22166687-crlf.case | 33 ++ .../test-cases/testdata/B22166687-lf.case | 33 ++ .../test-cases/testdata/B26928842-cr.case | 1 + .../test-cases/testdata/B26928842-crlf.case | 19 + .../test-cases/testdata/B26928842-lf.case | 19 + .../test-cases/testdata/B28066276-cr.case | 1 + .../test-cases/testdata/B28066276-crlf.case | 51 +++ .../testdata/B28066276-lf.case} | 14 + .../test-cases/testdata/B30223986-cr.case | 1 + .../test-cases/testdata/B30223986-crlf.case | 91 +++++ .../testdata/B30223986-lf.case} | 46 +++ .../test-cases/testdata/B30764810-cr.case | 1 + .../test-cases/testdata/B30764810-crlf.case | 33 ++ .../testdata/B30764810-lf.case} | 17 + .../test-cases/testdata/B32397217-cr.case | 1 + .../test-cases/testdata/B32397217-crlf.case | 12 + .../test-cases/testdata/B32397217-lf.case | 12 + .../test-cases/testdata/B38241237-cr.case | 1 + .../test-cases/testdata/B38241237-crlf.case | 15 + .../test-cases/testdata/B38241237-lf.case | 15 + .../test-cases/testdata/I574-cr.case | 1 + .../test-cases/testdata/I574-crlf.case | 13 + .../test-cases/testdata/I574-lf.case | 13 + .../test-cases/testdata/I588-cr.case | 1 + .../test-cases/testdata/I588-crlf.case | 17 + .../testdata/I588-lf.case} | 9 + .../test-cases/testdata/I880-cr.case | 1 + .../test-cases/testdata/I880-crlf.case | 38 ++ .../testdata/I880-lf.case} | 20 + .../testdata/JavaFileNoNewLine-cr.case | 1 + .../testdata/JavaFileNoNewLine-crlf.case | 7 + .../testdata/JavaFileNoNewLine-lf.case | 7 + .../testdata/JavaFileWithExtraSpaces-cr.case | 1 + .../JavaFileWithExtraSpaces-crlf.case | 7 + .../testdata/JavaFileWithExtraSpaces-lf.case | 7 + .../resources/test-cases/testdata/M3-cr.case | 1 + .../test-cases/testdata/M3-crlf.case | 13 + .../resources/test-cases/testdata/M3-lf.case | 13 + .../resources/test-cases/testdata/RSL-cr.case | 1 + .../test-cases/testdata/RSL-crlf.case | 377 ++++++++++++++++++ .../testdata/RSL-lf.case} | 192 +++++++++ .../test-cases/testdata/Records-cr.case | 1 + .../test-cases/testdata/Records-crlf.case | 59 +++ .../testdata/Records-lf.case} | 30 ++ .../resources/test-cases/testdata/Var-cr.case | 1 + .../test-cases/testdata/Var-crlf.case | 11 + .../resources/test-cases/testdata/Var-lf.case | 11 + .../testdata/palantir-chains-lambdas-cr.case | 1 + .../palantir-chains-lambdas-crlf.case | 34 ++ .../testdata/palantir-chains-lambdas-lf.case} | 16 + ...lantir-conjure-java-runtime-1285-1-cr.case | 1 + ...ntir-conjure-java-runtime-1285-1-crlf.case | 41 ++ ...lantir-conjure-java-runtime-1285-1-lf.case | 41 ++ ...lantir-conjure-java-runtime-1285-2-cr.case | 1 + ...ntir-conjure-java-runtime-1285-2-crlf.case | 34 ++ ...antir-conjure-java-runtime-1285-2-lf.case} | 17 + .../testdata/palantir-gcv-1-cr.case | 1 + .../testdata/palantir-gcv-1-crlf.case | 43 ++ .../testdata/palantir-gcv-1-lf.case} | 21 +- .../testdata/palantir-long-fqn-cr.case | 1 + .../testdata/palantir-long-fqn-crlf.case | 16 + .../testdata/palantir-long-fqn-lf.case} | 8 + .../palantir-long-method-chain-cr.case | 1 + .../palantir-long-method-chain-crlf.case | 15 + .../palantir-long-method-chain-lf.case} | 7 + .../palantir-long-method-reference-cr.case | 1 + .../palantir-long-method-reference-crlf.case | 22 + .../palantir-long-method-reference-lf.case} | 10 + .../testdata/palantir-long-safearg-cr.case | 1 + .../testdata/palantir-long-safearg-crlf.case | 16 + .../testdata/palantir-long-safearg-lf.case | 16 + .../testdata/palantir-sandor-lambdas-cr.case | 1 + .../palantir-sandor-lambdas-crlf.case | 27 ++ .../testdata/palantir-sandor-lambdas-lf.case} | 15 +- 126 files changed, 2312 insertions(+), 775 deletions(-) delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/AnnotationFields.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B18479811.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21608216.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22166687.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22166687.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26928842.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26928842.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28066276.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30223986.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30764810.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32397217.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32397217.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38241237.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38241237.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I574.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I574.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I588.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I880.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileNoNewLine.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileNoNewLine.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithExtraSpaces.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithExtraSpaces.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M3.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M3.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/RSL.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Records.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Var.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Var.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chains-lambdas.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-1.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-1.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-2.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-gcv-1.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-fqn.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-reference.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-safearg.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-safearg.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-sandor-lambdas.output create mode 100644 open-java-format/src/test/resources/test-cases/testdata/AnnotationFields-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/AnnotationFields-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/AnnotationFields.output => test-cases/testdata/AnnotationFields-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B18479811-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B18479811-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B18479811.output => test-cases/testdata/B18479811-lf.case} (69%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21608216-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B21608216-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B21608216.output => test-cases/testdata/B21608216-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22166687-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22166687-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B22166687-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26928842-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26928842-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B26928842-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B28066276-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B28066276-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B28066276.output => test-cases/testdata/B28066276-lf.case} (62%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B30223986-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B30223986-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B30223986.output => test-cases/testdata/B30223986-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B30764810-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B30764810-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/B30764810.output => test-cases/testdata/B30764810-lf.case} (57%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B32397217-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B32397217-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B32397217-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B38241237-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B38241237-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/B38241237-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I574-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I574-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I574-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I588-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I588-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/I588.output => test-cases/testdata/I588-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I880-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/I880-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/I880.output => test-cases/testdata/I880-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/JavaFileNoNewLine-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/JavaFileNoNewLine-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/JavaFileNoNewLine-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/JavaFileWithExtraSpaces-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/JavaFileWithExtraSpaces-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/JavaFileWithExtraSpaces-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/M3-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/M3-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/M3-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/RSL-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/RSL-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/RSL.output => test-cases/testdata/RSL-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Records-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Records-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/Records.output => test-cases/testdata/Records-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Var-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Var-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Var-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-chains-lambdas-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-chains-lambdas-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-chains-lambdas.output => test-cases/testdata/palantir-chains-lambdas-lf.case} (53%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-1-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-1-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-1-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-2-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-2-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-2.output => test-cases/testdata/palantir-conjure-java-runtime-1285-2-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-gcv-1-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-gcv-1-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-gcv-1.input => test-cases/testdata/palantir-gcv-1-lf.case} (54%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-long-fqn-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-long-fqn-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-long-fqn.output => test-cases/testdata/palantir-long-fqn-lf.case} (51%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-long-method-chain.output => test-cases/testdata/palantir-long-method-chain-lf.case} (53%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-reference-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-reference-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-long-method-reference.output => test-cases/testdata/palantir-long-method-reference-lf.case} (52%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-long-safearg-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-long-safearg-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-long-safearg-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-sandor-lambdas-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-sandor-lambdas-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/palantir-sandor-lambdas.input => test-cases/testdata/palantir-sandor-lambdas-lf.case} (50%) diff --git a/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFile.java b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFile.java index 0db2bd577..a5f6775bb 100644 --- a/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFile.java +++ b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFile.java @@ -22,20 +22,23 @@ import java.util.regex.Pattern; /** - * A formatter test case written as a file: an optional header, a line of six or more dashes, the code before - * formatting, a second such line and the code expected after it. There are no settings yet, so the header holds only - * blank lines and {@code #} comments, which explain the case; a file without one starts with the first dashes. + * A formatter test case written as a file: an optional header, six or more dashes that end a line, the code before + * formatting, a second run of such dashes and the code expected after it. There are no settings yet, so the header + * holds only blank lines and {@code #} comments, which explain the case; a file without one starts with the first + * dashes. * - *

    The blocks are the text of the file as written. The before block runs from the line after the first dashes to - * the second, its last line break included, and the after block from the line after the second dashes to the end of - * the file. Line breaks stay {@code \n}, {@code \r\n} or {@code \r}, whichever the file has. {@code afterLine} is the - * line of the file the after block starts on, so that a failure can name the line where the output departs from it. + *

    The blocks are the text of the file as written. The before block runs from the line after the first dashes up to + * the second ones: on a line of their own they leave it its last line break, and at the end of its last line they + * leave it none, for code that does not end in one. The after block runs from the line after the second dashes to the + * end of the file. Line breaks stay {@code \n}, {@code \r\n} or {@code \r}, whichever the file has, and a line of code + * that ends in six or more dashes cannot be part of a case. {@code afterLine} is the line of the file the after block + * starts on, so that a failure can name the line where the output departs from it. */ record CaseFile(String before, String after, int afterLine) { static final String EXTENSION = ".case"; - /** Six or more dashes on a line of their own, with the line break that ends them. */ - private static final Pattern SEPARATOR = Pattern.compile("(?:\\A|(?<=[\\r\\n]))-{6,}(?:\\r\\n|\\r|\\n|\\z)"); + /** Six or more dashes that end a line, with the line break after them. */ + private static final Pattern SEPARATOR = Pattern.compile("-{6,}(?:\\r\\n|\\r|\\n|\\z)"); /** Splits the text of the case file at {@code path}, which only names the file in an error. */ static CaseFile parse(String path, String text) { diff --git a/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFileTest.java b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFileTest.java index 1ac2fbce2..dddfbb7bb 100644 --- a/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFileTest.java +++ b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFileTest.java @@ -75,6 +75,19 @@ void lineBreaksTabsAndTrailingSpacesStayAsWritten() { .isEqualTo(new CaseFile("class A {\r\n\tint x; \r\n}\r\n", "class A {\r\n int x;\r\n}", 6)); } + @Test + void dashesThatEndALineCloseTheBlockBeforeThem() { + assertThat(CaseFile.parse("a.case", "------\nclass A{}------\nclass A {}\n")) + .isEqualTo(new CaseFile("class A{}", "class A {}\n", 3)); + } + + @Test + void aCodeLineThatEndsInDashesCountsAsASeparator() { + assertThatThrownBy(() -> CaseFile.parse("a.case", "------\n// ----------\nclass A{}\n------\nclass A {}\n")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("found 3"); + } + @Test void carriageReturnsAloneBreakLinesToo() { assertThat(CaseFile.parse("a.case", "------\rclass A{}\r------\rclass A {}\r")) diff --git a/open-java-format/src/test/java/com/palantir/javaformat/java/FileBasedTests.java b/open-java-format/src/test/java/com/palantir/javaformat/java/FileBasedTests.java index 5c1bab101..6a631bb42 100644 --- a/open-java-format/src/test/java/com/palantir/javaformat/java/FileBasedTests.java +++ b/open-java-format/src/test/java/com/palantir/javaformat/java/FileBasedTests.java @@ -47,9 +47,6 @@ public final class FileBasedTests { // Test files that are only used when run with a minimum Java version private static final ImmutableMultimap VERSIONED_TESTS = ImmutableMultimap.builder() - .putAll(14, "Records", "RSL", "Var", "I574") - .putAll(16, "I588") - .putAll(21, "I880") .putAll(23, "ModuleImport") .build(); diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/AnnotationFields.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/AnnotationFields.input deleted file mode 100644 index 84a47945c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/AnnotationFields.input +++ /dev/null @@ -1,110 +0,0 @@ -@Schema(description = "Type of quote being requested", example = "NEW_BUSINESS", somethingElse= "new", other="my other long string") -public record QuoteRequest( - @Schema(description = "US state of the product being quoted", example = "TX") - RegulatoryState regulatoryState, - @Schema(description = "Reason for a quote", example = "New Business") String amendmentReason, - @Schema(description = "Type of quote being requested", example = "NEW_BUSINESS", somethingElse= "new", other="my other long string") QuoteType quoteType, - @Schema(description = "Date the quoted changes become active", example = "2023-06-25") - LocalDate quoteEffectiveDate -) {} - -public record QuoteRequest( - - int value, - - @SomeInput RegulatoryState regulatoryState, - - @SomeInput - @NotNull - @Deprecated - @JsonValue(name = "something") @Schema(description = "US state of the product being quoted", example = "TX") RegulatoryState regulatoryState, - @Schema(description = "Reason for a quote", example = "New Business") String amendmentReason, - int x, - int j) {} - -public record Url( - int var1, - @JsonValue("value") String var2, - @SomeInput @JsonValue String var3, - int var3, - int var4, - int var5, - int var6) {} - -public record Url( - @NotNull - @JsonValue - @Deprecated - @Annotation1 - @Annotation2 - @Annotation3 - @Annotation4 - @Annotation5 - @Annotation6 - @Annotation7 - @Annotation8 - @Annotation9 - @Annotation10 - @Annotation11 - @Annotation12 - String value) {} - -public record Url(@NotNull String value, int number) {} - -public record Url( - int number, - @JsonValue("value") String value) {} - -public record Url(@New @JsonValue("value") String value) {} - -@JsonIgnoreProperties(ignoreUnknown = true) -@JsonInclude(JsonInclude.Include.NON_NULL) -public record Game( - @JsonProperty("accounting_group") @JsonPropertyDescription("The accounting group of the game.") - String accountingGroup, - @JsonProperty("accumulating") - @JsonPropertyDescription("Marks which games with accumulating bonuses.") Boolean accumulating, - @JsonProperty("bonus_buy") @JsonPropertyDescription("Games with purchasable bonuses.") Boolean bonusBuy, - @JsonProperty("category") - @JsonPropertyDescription( - "Game's category. Allowed values: slots, roulette, card, " - + "casual, lottery, poker, craps, video_poker") - String category, - @JsonProperty("hd") @JsonPropertyDescription("HD format games.") Boolean hd, - - @JsonProperty("new") @JsonPropertyDescription("New format games.") Boolean assa, - @JsonProperty("hit_rate") @JsonPropertyDescription( - "Frequency of wins per 100 bets. The higher, the hit rate the lower the volatility " - + "rating, and vice versa. Positive value. For slots only. " - + "Match pattern: ^\\d{1,18}(\\.\\d{1,12})?$") String hitRate, - @JsonProperty("params") @JsonPropertyDescription("Game's custom parameters.") - Map params) { - - private void get(@JsonNode("value") String value) {} - - private void get2(@JsonNode(value="value") String value) {} - } - -record ApiEndpoint(@JsonValue("name") String name, HttpMethod method, String url) { - ApiEndpoint { - name = name.toUpperCase(); - } -} - -record ApiEndpoint(@JsonProperty("bonus_buy") @JsonValue(some_other_name_that_is_here="value", name_which_is_super_long_that_goes_beyond_the_limit="name", other="other") String name, HttpMethod method, String url) { - ApiEndpoint { - name = name.toUpperCase(); - } -} - -record ApiEndpoint(@JsonValue(name="name") String name, HttpMethod method, String url) { - ApiEndpoint { - name = name.toUpperCase(); - } -} - -record ApiEndpoint(@JsonValue(name="name") String name, HttpMethod method, String url, @JsonValue(name="name") String name) { - ApiEndpoint { - name = name.toUpperCase(); - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B18479811.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B18479811.input deleted file mode 100644 index f805f6734..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B18479811.input +++ /dev/null @@ -1,15 +0,0 @@ -class Test { - public void testPrimitiveFields() { - ConverterVerifier.verifyFieldsAreAnnotatedWithToPojo( - Contact.class, DomainContact.class, - new ImmutableList.Builder().add( - "address1", "address2", "assistant", "assistantPhone", "birthDate", "committed", - "createdBy", "createdDate", "deleted", "department", "description", - "domainObjId", "email1", "email2", "emailOptOut", "firstName", "lastName", - "leadSource", "level", "modifiedBy", "modifiedDate", - "phoneFax", "phoneHome", "phoneMobile", "phoneOther", "phoneWork", - "salutation", "title" - - ).build()); - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21608216.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21608216.input deleted file mode 100644 index e986a8a71..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21608216.input +++ /dev/null @@ -1,56 +0,0 @@ -@PluginInfo(shortName = "chromesuggestions", - owner = "mathp", - demoLink = "unspecified", - modules = { BackendsModule.class, - CommonBackendsModule.class, - ChromeSuggestionsPlugin.ChromeSuggestionsModule.class }) -@Module(library = true, complete = false) -@Module(library = true, complete = false, injects = {ClassInfoTracker.class, JslayoutMetaProto.class}) -@Module( - library = true, - complete = false, - injects = { - ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class - } -) -@Module( - library = true, - complete = false, - injects = { - ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class, JslayoutMeta.class - } -) -@Module(injects = {One.class, Two.class}, includes = {Three.class, Four.class}) -@Module( - library = true, - complete = false, - numbers = {1, 2, 3} -) -@Module( - library = true, - complete = false, - numbers = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 - } -) -@Module( - library = true, - complete = false, - numbers = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30 - } -) -@Module({ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class}) -@Module({ - ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class -}) -@Module({ - ClassInfoTracker.class, - JslayoutMetaProto.class, - JslayoutMetaProto.class, - JslayoutMeta.class, - JslayoutMeta.class -}) -class B21608216 { -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22166687.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22166687.input deleted file mode 100644 index 33b4c1385..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22166687.input +++ /dev/null @@ -1,18 +0,0 @@ -class B22166687 { - public static class Wrapper - extends CrossComponentSetBindingsWrapper< - ExtensionWrapper> - implements CrossComponentSetBindingsWrapper< - ExtensionWrapper> { - void m() {} - } - public static class Wrapper - extends CrossComponentSetBindingsWrapper< - ExtensionWrapper> - implements CrossComponentSetBindingsWrapper< - ExtensionWrapper>, - CrossComponentSetBindingsWrapper< - ExtensionWrapper> { - void m() {} - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22166687.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22166687.output deleted file mode 100644 index 430bda23a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22166687.output +++ /dev/null @@ -1,14 +0,0 @@ -class B22166687 { - public static class Wrapper - extends CrossComponentSetBindingsWrapper> - implements CrossComponentSetBindingsWrapper> { - void m() {} - } - - public static class Wrapper - extends CrossComponentSetBindingsWrapper> - implements CrossComponentSetBindingsWrapper>, - CrossComponentSetBindingsWrapper> { - void m() {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26928842.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26928842.input deleted file mode 100644 index 1ce9dc954..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26928842.input +++ /dev/null @@ -1,9 +0,0 @@ -class B26928842 { - { - curr.setData(curr.getData().toBuilder() - .setPushCertificate( // New - curr.getData().getPushCertficate()) // Old, misspelled - .clearPushCertficate() // Old, misspelled - .build()); - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26928842.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26928842.output deleted file mode 100644 index 19f1cc03d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26928842.output +++ /dev/null @@ -1,9 +0,0 @@ -class B26928842 { - { - curr.setData(curr.getData().toBuilder() - .setPushCertificate( // New - curr.getData().getPushCertficate()) // Old, misspelled - .clearPushCertficate() // Old, misspelled - .build()); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28066276.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28066276.input deleted file mode 100644 index f8d336bcd..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28066276.input +++ /dev/null @@ -1,13 +0,0 @@ -class B28066276 { - class A extends S - implements I________________, I________________, I________________, I________________, - I________________, I________________, I________________, I________________, - I________________, I________________, I________________, I________________, - I________________, I________________, I________________, I________________ {} - - interface B - extends I________________, I________________, I________________, I________________, - I________________, I________________, I________________, I________________, - I________________, I________________, I________________, I________________, - I________________, I________________, I________________, I________________ {} -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30223986.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30223986.input deleted file mode 100644 index 5b6fbb2a0..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30223986.input +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Base class for {@link Foo}. - * - *

    The subclass should implement {@link #bar()}, with the implementation returning a - * new instance of the foo relevant to that baz. - * - * Example: - * - * @Override - * protected Foo bar() { - * return new Foo(); - * } - * - * - * The subclass should call {@link #get()} to get the foo object, - * and should not cache it in the subclass. - * Example: - * - * @Annotation("something") - * public void thing() { - * } - * - * - * @param concrete subclass - */ -class Test { - /** - * Field - * - * Example: - *

    
    -   *   @Annotation("something")
    -   *   public void thing() {
    -   *   }
    -   * 
    - * - * @param asd - */ - int x() {} - - /** - * Inline foo. - */ - int y() {} -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30764810.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30764810.input deleted file mode 100644 index 0643db0d6..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30764810.input +++ /dev/null @@ -1,16 +0,0 @@ -class B30764810 { - @Foo( - x = {0}, - y = 0 - // comment - ) - int a; - - @Foo( - x = {0}, - y = 0 - /* comment - */ - ) - int b; -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32397217.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32397217.input deleted file mode 100644 index b402a4aa5..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32397217.input +++ /dev/null @@ -1,6 +0,0 @@ -class T { - { - f( - 1 /* 1 */, 2 /* 2 */); - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32397217.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32397217.output deleted file mode 100644 index c362b4471..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32397217.output +++ /dev/null @@ -1,5 +0,0 @@ -class T { - { - f(1 /* 1 */, 2 /* 2 */); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38241237.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38241237.input deleted file mode 100644 index 1909e4958..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38241237.input +++ /dev/null @@ -1,7 +0,0 @@ -class B38241237 { - //foo - //bar - //one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt - ///baz - //// -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38241237.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38241237.output deleted file mode 100644 index 8701d2212..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38241237.output +++ /dev/null @@ -1,7 +0,0 @@ -class B38241237 { - // foo - // bar - // one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt - /// baz - //// -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I574.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I574.input deleted file mode 100644 index 27d23d040..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I574.input +++ /dev/null @@ -1,6 +0,0 @@ -public record Record(@NotNull Object o) { - - public Record { - this.o = o; - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I574.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I574.output deleted file mode 100644 index 061a5402d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I574.output +++ /dev/null @@ -1,6 +0,0 @@ -public record Record(@NotNull Object o) { - - public Record { - this.o = o; - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I588.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I588.input deleted file mode 100644 index 9c8f992ea..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I588.input +++ /dev/null @@ -1,8 +0,0 @@ -class T { - int f(Object x) { - if (x instanceof final Integer i) { - return i; - } - return -1; - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I880.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I880.input deleted file mode 100644 index dfc8a4cf5..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I880.input +++ /dev/null @@ -1,19 +0,0 @@ -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/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileNoNewLine.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileNoNewLine.input deleted file mode 100644 index ba054e8fb..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileNoNewLine.input +++ /dev/null @@ -1,3 +0,0 @@ -class MyClass { - private void myFile() {} -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileNoNewLine.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileNoNewLine.output deleted file mode 100644 index 5c185e344..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileNoNewLine.output +++ /dev/null @@ -1,3 +0,0 @@ -class MyClass { - private void myFile() {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithExtraSpaces.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithExtraSpaces.input deleted file mode 100644 index 9d2c099fb..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithExtraSpaces.input +++ /dev/null @@ -1,3 +0,0 @@ -class MyClass { - private void myFile() {} -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithExtraSpaces.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithExtraSpaces.output deleted file mode 100644 index 5c185e344..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithExtraSpaces.output +++ /dev/null @@ -1,3 +0,0 @@ -class MyClass { - private void myFile() {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M3.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M3.input deleted file mode 100644 index c5d29662f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M3.input +++ /dev/null @@ -1,6 +0,0 @@ -@Deprecated -module moduletags { - requires transitive static moduleA; - - exports testpkgmdltags; -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M3.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M3.output deleted file mode 100644 index c73f01b48..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M3.output +++ /dev/null @@ -1,6 +0,0 @@ -@Deprecated -module moduletags { - requires transitive static moduleA; - - exports testpkgmdltags; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/RSL.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/RSL.input deleted file mode 100644 index 6289ed01e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/RSL.input +++ /dev/null @@ -1,191 +0,0 @@ -class RSLs { - String a = """ - lorem - ipsum - """; - String b = """ - lorem - ipsum - """; - String c = """ - lorem - ipsum - """; - String d = """ - ipsum - """; - String e = """ - """; - String f = """ - ipsum"""; - String g = """ - lorem\ - ipsum - """; - String h = """ - lorem\ - ipsum\ - """; - String i = """ - lorem - - ipsum - """; - String j = """ - lorem - one long incredibly unbroken sentence moving from topic to topic so that no one had a chance to interrupt - ipsum - """; - String k = """ - lorem - ipsum - """; - String l = - """ - foo - bar - baz"""; - { - f(""" - lorem - ipsum - """, 42); - - """ - hello %s - """ - .formatted("world"); - f( - /* foo= */ """ - foo - """, - /* bar= */ """ - bar - """); - """ - hello - """.codePoints().forEach(System.err::println); - String s = - """ - foo - """ - + """ - bar - """; - String notBroken = - """ - foo - """ - + """ - bar - """; - String working = - """ - foo - """ - + """ - bar - """; - String u = - stringVariableOne - + - """ - ... - """ + stringVariableTwo - + - """ - ... - """ + sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsfaaaaaaa - + """ - my value - """; - } - - - String x = String.format(""" - this very long string that does something using arguments %s %s %s - """, - "@", "@", "something"); - - { - """ - No tools or answer found in the message. Please try again, following the instructions:\s - - %s - """.someOtherValue(e -> e.getValue().print()).myValue(System.err::println).formatted(toolFormatter.usage()).myOtherValue().someOtherValue().somethingElse(); - } - - String y = refactorFromTo(""" - someCode - """, """ - otherCode - """); - - String z = lotsOfStringParams(""" - aaa - """, """ - bbb - """, """ - ccc - """, """ - ddd - """, """ - eee - """, """ - fff - """, """ - ggg - """); - - String w = lotsOfStringParams(""" - aaa - """, "sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsf", - """ - bbb - """, - """ - ccc - """); - - String w = lotsOfStringParams(""" - aaa - """, "sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsfdasdsadasdsada", """ - bbb - """, """ - ccc - """); - - String x = String.format(""" - this very long string that does something using arguments %s %s %s - """, - "@", "@", "something"); - - String x = String.format(someExtraValue (""" - this very long string that does something using arguments %s %s %s - """ + """ - my other value - """), - "@", "@", "something"); - - CreateABuilder value = CreateABuilder.builder().v(""" - this is a content that should be indented - """) - .otherValue("my other values") - .build(); - - CreateABuilder value = CreateABuilder.builder().v(""" - this is a content that should be indented - """ + """ - and this one - """) - .otherValue("my other values") - .build(); - - CreateABuilder value = CreateABuilder.builder() - .myValue("this is a value") - .someTextBlockContent(""" - this is a content that should be indented - """) - .otherValue("my other values") - .build(); -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Records.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Records.input deleted file mode 100644 index 19ce2c7c9..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Records.input +++ /dev/null @@ -1,29 +0,0 @@ -class Records { - record R1() {} - - private record R2() {} - - @Deprecated - private record R3() {} - - record R4() {} - - record R5(int x) {} - - record R6(@Deprecated int x) {} - - record R7(@Deprecated int x, int... y) {} - - record R8() implements Comparable> { - @Override - public int compareTo(R8 other) { - return 0; - } - } - - record R9(int x) { - R9(int x) { - this.x = x; - } - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Var.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Var.input deleted file mode 100644 index 2633632d6..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Var.input +++ /dev/null @@ -1,5 +0,0 @@ -class Var { - void f() { - for (var x : ImmutableList.of(42)) {} - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Var.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Var.output deleted file mode 100644 index cd40bcca1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Var.output +++ /dev/null @@ -1,5 +0,0 @@ -class Var { - void f() { - for (var x : ImmutableList.of(42)) {} - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chains-lambdas.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chains-lambdas.input deleted file mode 100644 index 5c38ac204..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chains-lambdas.input +++ /dev/null @@ -1,15 +0,0 @@ -public class Foo { - public static void main(String[] args) { - foo - .bar() - .baz(argargargargargargargargargargargargargargargargargargargargarg, param -> doStuff() - .method1() - .method2(arljhfaldjfhalfjhalfjahflahflahfaljfhadlfjhljsahljhfsaljfhlfajhfljh)); - - thisIsMyObject - .callingMethod1() - .callingMethod2(argargargargargargargargargargargargargargargargargargargargarg, param -> doStuff() - .method1() - .method2(arljhfaldjfhalfjhalfjahflahflahfaljfhadlfjhljsahljhfsaljfhlfajhfljh)); - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-1.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-1.input deleted file mode 100644 index 82122a4dc..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-1.input +++ /dev/null @@ -1,20 +0,0 @@ -/** - * https://github.com/palantir/conjure-java-runtime/pull/1285/files/36e437737ed6650a9296ea0414e6d77d48bf0404#r345425759 - */ -class PalantirConjureJavaRuntime1285_SslSocketFactories { - public static SSLContext createSslContext(SslConfiguration config) { - TrustManager[] trustManagers = createTrustManagers(config); - - KeyManager[] keyManagers = null; - if (config.keyStorePath().isPresent()) { - keyManagers = createKeyManagerFactory( - config.keyStorePath().get(), - config.keyStorePassword().get(), - config.keyStoreType(), - config.keyStoreKeyAlias()) - .getKeyManagers(); - } - - return createSslContext(trustManagers, keyManagers); - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-1.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-1.output deleted file mode 100644 index 0c6194789..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-1.output +++ /dev/null @@ -1,20 +0,0 @@ -/** - * https://github.com/palantir/conjure-java-runtime/pull/1285/files/36e437737ed6650a9296ea0414e6d77d48bf0404#r345425759 - */ -class PalantirConjureJavaRuntime1285_SslSocketFactories { - public static SSLContext createSslContext(SslConfiguration config) { - TrustManager[] trustManagers = createTrustManagers(config); - - KeyManager[] keyManagers = null; - if (config.keyStorePath().isPresent()) { - keyManagers = createKeyManagerFactory( - config.keyStorePath().get(), - config.keyStorePassword().get(), - config.keyStoreType(), - config.keyStoreKeyAlias()) - .getKeyManagers(); - } - - return createSslContext(trustManagers, keyManagers); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-2.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-2.input deleted file mode 100644 index 0142623bf..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-2.input +++ /dev/null @@ -1,16 +0,0 @@ -/** - * https://github.com/palantir/conjure-java-runtime/pull/1285/files#r356006884 - */ -class PalantirConjureJavaRuntime1285_Test2 { - public void foo() { - TestService bogusHostProxy = JaxRsClient.create( - TestService.class, - AGENT, - new HostMetricsRegistry(), - ClientConfiguration.builder() - .from(createTestConfig("http://foo-bar-bogus-host.unresolvable:80", "http://localhost:" - + failoverTestCase.server1.getPort())) - .maxNumRetries(2) - .build()); - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-gcv-1.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-gcv-1.output deleted file mode 100644 index 3b67b5047..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-gcv-1.output +++ /dev/null @@ -1,18 +0,0 @@ -class PalantirGcv1 { - public static void main(String[] args) { - constraintsProperty.addAll(project.provider(Suppliers.memoize(() -> { - log.debug( - "Computing publish constraints for {} by resolving {}", - configuration.get(), - configurationForFiltering.get()); - Set modulesToInclude = - configurationForFiltering.get().getIncoming().getResolutionResult().getAllComponents().stream() - .map(ResolvedComponentResult::getModuleVersion) - .filter(Objects::nonNull) - .map(ModuleVersionIdentifier::getModule) - .collect(Collectors.toSet()); - return Collections2.filter( - publishConstraints, constraint -> modulesToInclude.contains(constraint.getModule())); - })::get)); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-fqn.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-fqn.input deleted file mode 100644 index b5757ee79..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-fqn.input +++ /dev/null @@ -1,7 +0,0 @@ -class PalantirLongFqn { - public PalantirLongFqn() { - org.gradle.api.internal.artifacts.configurations.ConflictResolution conflictResolution = - ((org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) conf - .getResolutionStrategy()).getConflictResolution(); - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain.input deleted file mode 100644 index c024d7503..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain.input +++ /dev/null @@ -1,6 +0,0 @@ -class PalantirLongMethodChain { - private static void foo() { - new ObjectMapper().registerModule(new Jdk8Module()).readValue(file, TestCases.class).getClient(); - } - -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-reference.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-reference.input deleted file mode 100644 index 35a514a26..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-reference.input +++ /dev/null @@ -1,9 +0,0 @@ -class PalantirLongArrayInit { - private static FormatterService createFormatter(Optional> implementationClassPath) { - URL[] implementationUrls = implementationClassPath - .map(implementationUris -> { - log.debug("Using palantir-java-format implementation defined by URIs: {}", implementationUris); - return implementationUris.stream().map(PalantirCodeStyleManager::toUrlUnchecked).toArray(URL[]::new); - }).orElse(null); - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-safearg.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-safearg.input deleted file mode 100644 index 839f5e7f7..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-safearg.input +++ /dev/null @@ -1,7 +0,0 @@ -class PalantirLongSafeArg { - public static void foo() { - Preconditions.checkArgument( - hostPortString.charAt(0) == '[', "Bracketed host-port string must start with a bracket", SafeArg.of( - "port", hostPortString)); - } -} \ No newline at end of file diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-safearg.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-safearg.output deleted file mode 100644 index c6d55881a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-safearg.output +++ /dev/null @@ -1,8 +0,0 @@ -class PalantirLongSafeArg { - public static void foo() { - Preconditions.checkArgument( - hostPortString.charAt(0) == '[', - "Bracketed host-port string must start with a bracket", - SafeArg.of("port", hostPortString)); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-sandor-lambdas.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-sandor-lambdas.output deleted file mode 100644 index 5acacdfd1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-sandor-lambdas.output +++ /dev/null @@ -1,12 +0,0 @@ -public class Foo { - public static void main(String[] args) { - List storedCategories = linkedDatasets.getCategories().stream() - .map(storedCategory -> StoredLinkedDatasetCategory.of( - storedCategory.getName(), - storedCategory.getDatasets().stream() - .map(ds -> StoredDatasetAndBranch.of(ds.getDatasetRid(), ds.getBranchName())) - .collect(Collectors.toList()))) - .collect(Collectors.toList()); - int otherVar = 5; - } -} diff --git a/open-java-format/src/test/resources/test-cases/testdata/AnnotationFields-cr.case b/open-java-format/src/test/resources/test-cases/testdata/AnnotationFields-cr.case new file mode 100644 index 000000000..29560b03c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/AnnotationFields-cr.case @@ -0,0 +1 @@ +---------- @Schema(description = "Type of quote being requested", example = "NEW_BUSINESS", somethingElse= "new", other="my other long string") public record QuoteRequest( @Schema(description = "US state of the product being quoted", example = "TX") RegulatoryState regulatoryState, @Schema(description = "Reason for a quote", example = "New Business") String amendmentReason, @Schema(description = "Type of quote being requested", example = "NEW_BUSINESS", somethingElse= "new", other="my other long string") QuoteType quoteType, @Schema(description = "Date the quoted changes become active", example = "2023-06-25") LocalDate quoteEffectiveDate ) {} public record QuoteRequest( int value, @SomeInput RegulatoryState regulatoryState, @SomeInput @NotNull @Deprecated @JsonValue(name = "something") @Schema(description = "US state of the product being quoted", example = "TX") RegulatoryState regulatoryState, @Schema(description = "Reason for a quote", example = "New Business") String amendmentReason, int x, int j) {} public record Url( int var1, @JsonValue("value") String var2, @SomeInput @JsonValue String var3, int var3, int var4, int var5, int var6) {} public record Url( @NotNull @JsonValue @Deprecated @Annotation1 @Annotation2 @Annotation3 @Annotation4 @Annotation5 @Annotation6 @Annotation7 @Annotation8 @Annotation9 @Annotation10 @Annotation11 @Annotation12 String value) {} public record Url(@NotNull String value, int number) {} public record Url( int number, @JsonValue("value") String value) {} public record Url(@New @JsonValue("value") String value) {} @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public record Game( @JsonProperty("accounting_group") @JsonPropertyDescription("The accounting group of the game.") String accountingGroup, @JsonProperty("accumulating") @JsonPropertyDescription("Marks which games with accumulating bonuses.") Boolean accumulating, @JsonProperty("bonus_buy") @JsonPropertyDescription("Games with purchasable bonuses.") Boolean bonusBuy, @JsonProperty("category") @JsonPropertyDescription( "Game's category. Allowed values: slots, roulette, card, " + "casual, lottery, poker, craps, video_poker") String category, @JsonProperty("hd") @JsonPropertyDescription("HD format games.") Boolean hd, @JsonProperty("new") @JsonPropertyDescription("New format games.") Boolean assa, @JsonProperty("hit_rate") @JsonPropertyDescription( "Frequency of wins per 100 bets. The higher, the hit rate the lower the volatility " + "rating, and vice versa. Positive value. For slots only. " + "Match pattern: ^\\d{1,18}(\\.\\d{1,12})?$") String hitRate, @JsonProperty("params") @JsonPropertyDescription("Game's custom parameters.") Map params) { private void get(@JsonNode("value") String value) {} private void get2(@JsonNode(value="value") String value) {} } record ApiEndpoint(@JsonValue("name") String name, HttpMethod method, String url) { ApiEndpoint { name = name.toUpperCase(); } } record ApiEndpoint(@JsonProperty("bonus_buy") @JsonValue(some_other_name_that_is_here="value", name_which_is_super_long_that_goes_beyond_the_limit="name", other="other") String name, HttpMethod method, String url) { ApiEndpoint { name = name.toUpperCase(); } } record ApiEndpoint(@JsonValue(name="name") String name, HttpMethod method, String url) { ApiEndpoint { name = name.toUpperCase(); } } record ApiEndpoint(@JsonValue(name="name") String name, HttpMethod method, String url, @JsonValue(name="name") String name) { ApiEndpoint { name = name.toUpperCase(); } }---------- @Schema( description = "Type of quote being requested", example = "NEW_BUSINESS", somethingElse = "new", other = "my other long string") public record QuoteRequest( @Schema(description = "US state of the product being quoted", example = "TX") RegulatoryState regulatoryState, @Schema(description = "Reason for a quote", example = "New Business") String amendmentReason, @Schema( description = "Type of quote being requested", example = "NEW_BUSINESS", somethingElse = "new", other = "my other long string") QuoteType quoteType, @Schema(description = "Date the quoted changes become active", example = "2023-06-25") LocalDate quoteEffectiveDate) {} public record QuoteRequest( int value, @SomeInput RegulatoryState regulatoryState, @SomeInput @NotNull @Deprecated @JsonValue(name = "something") @Schema(description = "US state of the product being quoted", example = "TX") RegulatoryState regulatoryState, @Schema(description = "Reason for a quote", example = "New Business") String amendmentReason, int x, int j) {} public record Url( int var1, @JsonValue("value") String var2, @SomeInput @JsonValue String var3, int var3, int var4, int var5, int var6) {} public record Url( @NotNull @JsonValue @Deprecated @Annotation1 @Annotation2 @Annotation3 @Annotation4 @Annotation5 @Annotation6 @Annotation7 @Annotation8 @Annotation9 @Annotation10 @Annotation11 @Annotation12 String value) {} public record Url(@NotNull String value, int number) {} public record Url(int number, @JsonValue("value") String value) {} public record Url(@New @JsonValue("value") String value) {} @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public record Game( @JsonProperty("accounting_group") @JsonPropertyDescription("The accounting group of the game.") String accountingGroup, @JsonProperty("accumulating") @JsonPropertyDescription("Marks which games with accumulating bonuses.") Boolean accumulating, @JsonProperty("bonus_buy") @JsonPropertyDescription("Games with purchasable bonuses.") Boolean bonusBuy, @JsonProperty("category") @JsonPropertyDescription("Game's category. Allowed values: slots, roulette, card, " + "casual, lottery, poker, craps, video_poker") String category, @JsonProperty("hd") @JsonPropertyDescription("HD format games.") Boolean hd, @JsonProperty("new") @JsonPropertyDescription("New format games.") Boolean assa, @JsonProperty("hit_rate") @JsonPropertyDescription("Frequency of wins per 100 bets. The higher, the hit rate the lower the volatility " + "rating, and vice versa. Positive value. For slots only. " + "Match pattern: ^\\d{1,18}(\\.\\d{1,12})?$") String hitRate, @JsonProperty("params") @JsonPropertyDescription("Game's custom parameters.") Map params) { private void get(@JsonNode("value") String value) {} private void get2(@JsonNode(value = "value") String value) {} } record ApiEndpoint(@JsonValue("name") String name, HttpMethod method, String url) { ApiEndpoint { name = name.toUpperCase(); } } record ApiEndpoint( @JsonProperty("bonus_buy") @JsonValue( some_other_name_that_is_here = "value", name_which_is_super_long_that_goes_beyond_the_limit = "name", other = "other") String name, HttpMethod method, String url) { ApiEndpoint { name = name.toUpperCase(); } } record ApiEndpoint(@JsonValue(name = "name") String name, HttpMethod method, String url) { ApiEndpoint { name = name.toUpperCase(); } } record ApiEndpoint( @JsonValue(name = "name") String name, HttpMethod method, String url, @JsonValue(name = "name") String name) { ApiEndpoint { name = name.toUpperCase(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/AnnotationFields-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/AnnotationFields-crlf.case new file mode 100644 index 000000000..77b200a72 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/AnnotationFields-crlf.case @@ -0,0 +1,257 @@ +---------- +@Schema(description = "Type of quote being requested", example = "NEW_BUSINESS", somethingElse= "new", other="my other long string") +public record QuoteRequest( + @Schema(description = "US state of the product being quoted", example = "TX") + RegulatoryState regulatoryState, + @Schema(description = "Reason for a quote", example = "New Business") String amendmentReason, + @Schema(description = "Type of quote being requested", example = "NEW_BUSINESS", somethingElse= "new", other="my other long string") QuoteType quoteType, + @Schema(description = "Date the quoted changes become active", example = "2023-06-25") + LocalDate quoteEffectiveDate +) {} + +public record QuoteRequest( + + int value, + + @SomeInput RegulatoryState regulatoryState, + + @SomeInput + @NotNull + @Deprecated + @JsonValue(name = "something") @Schema(description = "US state of the product being quoted", example = "TX") RegulatoryState regulatoryState, + @Schema(description = "Reason for a quote", example = "New Business") String amendmentReason, + int x, + int j) {} + +public record Url( + int var1, + @JsonValue("value") String var2, + @SomeInput @JsonValue String var3, + int var3, + int var4, + int var5, + int var6) {} + +public record Url( + @NotNull + @JsonValue + @Deprecated + @Annotation1 + @Annotation2 + @Annotation3 + @Annotation4 + @Annotation5 + @Annotation6 + @Annotation7 + @Annotation8 + @Annotation9 + @Annotation10 + @Annotation11 + @Annotation12 + String value) {} + +public record Url(@NotNull String value, int number) {} + +public record Url( + int number, + @JsonValue("value") String value) {} + +public record Url(@New @JsonValue("value") String value) {} + +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record Game( + @JsonProperty("accounting_group") @JsonPropertyDescription("The accounting group of the game.") + String accountingGroup, + @JsonProperty("accumulating") + @JsonPropertyDescription("Marks which games with accumulating bonuses.") Boolean accumulating, + @JsonProperty("bonus_buy") @JsonPropertyDescription("Games with purchasable bonuses.") Boolean bonusBuy, + @JsonProperty("category") + @JsonPropertyDescription( + "Game's category. Allowed values: slots, roulette, card, " + + "casual, lottery, poker, craps, video_poker") + String category, + @JsonProperty("hd") @JsonPropertyDescription("HD format games.") Boolean hd, + + @JsonProperty("new") @JsonPropertyDescription("New format games.") Boolean assa, + @JsonProperty("hit_rate") @JsonPropertyDescription( + "Frequency of wins per 100 bets. The higher, the hit rate the lower the volatility " + + "rating, and vice versa. Positive value. For slots only. " + + "Match pattern: ^\\d{1,18}(\\.\\d{1,12})?$") String hitRate, + @JsonProperty("params") @JsonPropertyDescription("Game's custom parameters.") + Map params) { + + private void get(@JsonNode("value") String value) {} + + private void get2(@JsonNode(value="value") String value) {} + } + +record ApiEndpoint(@JsonValue("name") String name, HttpMethod method, String url) { + ApiEndpoint { + name = name.toUpperCase(); + } +} + +record ApiEndpoint(@JsonProperty("bonus_buy") @JsonValue(some_other_name_that_is_here="value", name_which_is_super_long_that_goes_beyond_the_limit="name", other="other") String name, HttpMethod method, String url) { + ApiEndpoint { + name = name.toUpperCase(); + } +} + +record ApiEndpoint(@JsonValue(name="name") String name, HttpMethod method, String url) { + ApiEndpoint { + name = name.toUpperCase(); + } +} + +record ApiEndpoint(@JsonValue(name="name") String name, HttpMethod method, String url, @JsonValue(name="name") String name) { + ApiEndpoint { + name = name.toUpperCase(); + } +}---------- +@Schema( + description = "Type of quote being requested", + example = "NEW_BUSINESS", + somethingElse = "new", + other = "my other long string") +public record QuoteRequest( + @Schema(description = "US state of the product being quoted", example = "TX") + RegulatoryState regulatoryState, + + @Schema(description = "Reason for a quote", example = "New Business") + String amendmentReason, + + @Schema( + description = "Type of quote being requested", + example = "NEW_BUSINESS", + somethingElse = "new", + other = "my other long string") + QuoteType quoteType, + + @Schema(description = "Date the quoted changes become active", example = "2023-06-25") + LocalDate quoteEffectiveDate) {} + +public record QuoteRequest( + int value, + + @SomeInput RegulatoryState regulatoryState, + + @SomeInput + @NotNull + @Deprecated + @JsonValue(name = "something") + @Schema(description = "US state of the product being quoted", example = "TX") + RegulatoryState regulatoryState, + + @Schema(description = "Reason for a quote", example = "New Business") + String amendmentReason, + + int x, + int j) {} + +public record Url( + int var1, + @JsonValue("value") String var2, + @SomeInput @JsonValue String var3, + int var3, + int var4, + int var5, + int var6) {} + +public record Url( + @NotNull + @JsonValue + @Deprecated + @Annotation1 + @Annotation2 + @Annotation3 + @Annotation4 + @Annotation5 + @Annotation6 + @Annotation7 + @Annotation8 + @Annotation9 + @Annotation10 + @Annotation11 + @Annotation12 + String value) {} + +public record Url(@NotNull String value, int number) {} + +public record Url(int number, @JsonValue("value") String value) {} + +public record Url(@New @JsonValue("value") String value) {} + +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record Game( + @JsonProperty("accounting_group") @JsonPropertyDescription("The accounting group of the game.") + String accountingGroup, + + @JsonProperty("accumulating") @JsonPropertyDescription("Marks which games with accumulating bonuses.") + Boolean accumulating, + + @JsonProperty("bonus_buy") @JsonPropertyDescription("Games with purchasable bonuses.") + Boolean bonusBuy, + + @JsonProperty("category") + @JsonPropertyDescription("Game's category. Allowed values: slots, roulette, card, " + + "casual, lottery, poker, craps, video_poker") + String category, + + @JsonProperty("hd") @JsonPropertyDescription("HD format games.") + Boolean hd, + + @JsonProperty("new") @JsonPropertyDescription("New format games.") + Boolean assa, + + @JsonProperty("hit_rate") + @JsonPropertyDescription("Frequency of wins per 100 bets. The higher, the hit rate the lower the volatility " + + "rating, and vice versa. Positive value. For slots only. " + + "Match pattern: ^\\d{1,18}(\\.\\d{1,12})?$") + String hitRate, + + @JsonProperty("params") @JsonPropertyDescription("Game's custom parameters.") + Map params) { + + private void get(@JsonNode("value") String value) {} + + private void get2(@JsonNode(value = "value") String value) {} +} + +record ApiEndpoint(@JsonValue("name") String name, HttpMethod method, String url) { + ApiEndpoint { + name = name.toUpperCase(); + } +} + +record ApiEndpoint( + @JsonProperty("bonus_buy") + @JsonValue( + some_other_name_that_is_here = "value", + name_which_is_super_long_that_goes_beyond_the_limit = "name", + other = "other") + String name, + + HttpMethod method, + String url) { + ApiEndpoint { + name = name.toUpperCase(); + } +} + +record ApiEndpoint(@JsonValue(name = "name") String name, HttpMethod method, String url) { + ApiEndpoint { + name = name.toUpperCase(); + } +} + +record ApiEndpoint( + @JsonValue(name = "name") String name, + HttpMethod method, + String url, + @JsonValue(name = "name") String name) { + ApiEndpoint { + name = name.toUpperCase(); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/AnnotationFields.output b/open-java-format/src/test/resources/test-cases/testdata/AnnotationFields-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/AnnotationFields.output rename to open-java-format/src/test/resources/test-cases/testdata/AnnotationFields-lf.case index 8124ce30c..2655e3cc7 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/AnnotationFields.output +++ b/open-java-format/src/test/resources/test-cases/testdata/AnnotationFields-lf.case @@ -1,3 +1,114 @@ +---------- +@Schema(description = "Type of quote being requested", example = "NEW_BUSINESS", somethingElse= "new", other="my other long string") +public record QuoteRequest( + @Schema(description = "US state of the product being quoted", example = "TX") + RegulatoryState regulatoryState, + @Schema(description = "Reason for a quote", example = "New Business") String amendmentReason, + @Schema(description = "Type of quote being requested", example = "NEW_BUSINESS", somethingElse= "new", other="my other long string") QuoteType quoteType, + @Schema(description = "Date the quoted changes become active", example = "2023-06-25") + LocalDate quoteEffectiveDate +) {} + +public record QuoteRequest( + + int value, + + @SomeInput RegulatoryState regulatoryState, + + @SomeInput + @NotNull + @Deprecated + @JsonValue(name = "something") @Schema(description = "US state of the product being quoted", example = "TX") RegulatoryState regulatoryState, + @Schema(description = "Reason for a quote", example = "New Business") String amendmentReason, + int x, + int j) {} + +public record Url( + int var1, + @JsonValue("value") String var2, + @SomeInput @JsonValue String var3, + int var3, + int var4, + int var5, + int var6) {} + +public record Url( + @NotNull + @JsonValue + @Deprecated + @Annotation1 + @Annotation2 + @Annotation3 + @Annotation4 + @Annotation5 + @Annotation6 + @Annotation7 + @Annotation8 + @Annotation9 + @Annotation10 + @Annotation11 + @Annotation12 + String value) {} + +public record Url(@NotNull String value, int number) {} + +public record Url( + int number, + @JsonValue("value") String value) {} + +public record Url(@New @JsonValue("value") String value) {} + +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public record Game( + @JsonProperty("accounting_group") @JsonPropertyDescription("The accounting group of the game.") + String accountingGroup, + @JsonProperty("accumulating") + @JsonPropertyDescription("Marks which games with accumulating bonuses.") Boolean accumulating, + @JsonProperty("bonus_buy") @JsonPropertyDescription("Games with purchasable bonuses.") Boolean bonusBuy, + @JsonProperty("category") + @JsonPropertyDescription( + "Game's category. Allowed values: slots, roulette, card, " + + "casual, lottery, poker, craps, video_poker") + String category, + @JsonProperty("hd") @JsonPropertyDescription("HD format games.") Boolean hd, + + @JsonProperty("new") @JsonPropertyDescription("New format games.") Boolean assa, + @JsonProperty("hit_rate") @JsonPropertyDescription( + "Frequency of wins per 100 bets. The higher, the hit rate the lower the volatility " + + "rating, and vice versa. Positive value. For slots only. " + + "Match pattern: ^\\d{1,18}(\\.\\d{1,12})?$") String hitRate, + @JsonProperty("params") @JsonPropertyDescription("Game's custom parameters.") + Map params) { + + private void get(@JsonNode("value") String value) {} + + private void get2(@JsonNode(value="value") String value) {} + } + +record ApiEndpoint(@JsonValue("name") String name, HttpMethod method, String url) { + ApiEndpoint { + name = name.toUpperCase(); + } +} + +record ApiEndpoint(@JsonProperty("bonus_buy") @JsonValue(some_other_name_that_is_here="value", name_which_is_super_long_that_goes_beyond_the_limit="name", other="other") String name, HttpMethod method, String url) { + ApiEndpoint { + name = name.toUpperCase(); + } +} + +record ApiEndpoint(@JsonValue(name="name") String name, HttpMethod method, String url) { + ApiEndpoint { + name = name.toUpperCase(); + } +} + +record ApiEndpoint(@JsonValue(name="name") String name, HttpMethod method, String url, @JsonValue(name="name") String name) { + ApiEndpoint { + name = name.toUpperCase(); + } +}---------- @Schema( description = "Type of quote being requested", example = "NEW_BUSINESS", diff --git a/open-java-format/src/test/resources/test-cases/testdata/B18479811-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B18479811-cr.case new file mode 100644 index 000000000..c4a356999 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B18479811-cr.case @@ -0,0 +1 @@ +---------- class Test { public void testPrimitiveFields() { ConverterVerifier.verifyFieldsAreAnnotatedWithToPojo( Contact.class, DomainContact.class, new ImmutableList.Builder().add( "address1", "address2", "assistant", "assistantPhone", "birthDate", "committed", "createdBy", "createdDate", "deleted", "department", "description", "domainObjId", "email1", "email2", "emailOptOut", "firstName", "lastName", "leadSource", "level", "modifiedBy", "modifiedDate", "phoneFax", "phoneHome", "phoneMobile", "phoneOther", "phoneWork", "salutation", "title" ).build()); } }---------- class Test { public void testPrimitiveFields() { ConverterVerifier.verifyFieldsAreAnnotatedWithToPojo( Contact.class, DomainContact.class, new ImmutableList.Builder() .add( "address1", "address2", "assistant", "assistantPhone", "birthDate", "committed", "createdBy", "createdDate", "deleted", "department", "description", "domainObjId", "email1", "email2", "emailOptOut", "firstName", "lastName", "leadSource", "level", "modifiedBy", "modifiedDate", "phoneFax", "phoneHome", "phoneMobile", "phoneOther", "phoneWork", "salutation", "title") .build()); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B18479811-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B18479811-crlf.case new file mode 100644 index 000000000..10a2287cd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B18479811-crlf.case @@ -0,0 +1,54 @@ +---------- +class Test { + public void testPrimitiveFields() { + ConverterVerifier.verifyFieldsAreAnnotatedWithToPojo( + Contact.class, DomainContact.class, + new ImmutableList.Builder().add( + "address1", "address2", "assistant", "assistantPhone", "birthDate", "committed", + "createdBy", "createdDate", "deleted", "department", "description", + "domainObjId", "email1", "email2", "emailOptOut", "firstName", "lastName", + "leadSource", "level", "modifiedBy", "modifiedDate", + "phoneFax", "phoneHome", "phoneMobile", "phoneOther", "phoneWork", + "salutation", "title" + + ).build()); + } +}---------- +class Test { + public void testPrimitiveFields() { + ConverterVerifier.verifyFieldsAreAnnotatedWithToPojo( + Contact.class, + DomainContact.class, + new ImmutableList.Builder() + .add( + "address1", + "address2", + "assistant", + "assistantPhone", + "birthDate", + "committed", + "createdBy", + "createdDate", + "deleted", + "department", + "description", + "domainObjId", + "email1", + "email2", + "emailOptOut", + "firstName", + "lastName", + "leadSource", + "level", + "modifiedBy", + "modifiedDate", + "phoneFax", + "phoneHome", + "phoneMobile", + "phoneOther", + "phoneWork", + "salutation", + "title") + .build()); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B18479811.output b/open-java-format/src/test/resources/test-cases/testdata/B18479811-lf.case similarity index 69% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B18479811.output rename to open-java-format/src/test/resources/test-cases/testdata/B18479811-lf.case index eacebddb1..503a2b2c1 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B18479811.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B18479811-lf.case @@ -1,3 +1,19 @@ +---------- +class Test { + public void testPrimitiveFields() { + ConverterVerifier.verifyFieldsAreAnnotatedWithToPojo( + Contact.class, DomainContact.class, + new ImmutableList.Builder().add( + "address1", "address2", "assistant", "assistantPhone", "birthDate", "committed", + "createdBy", "createdDate", "deleted", "department", "description", + "domainObjId", "email1", "email2", "emailOptOut", "firstName", "lastName", + "leadSource", "level", "modifiedBy", "modifiedDate", + "phoneFax", "phoneHome", "phoneMobile", "phoneOther", "phoneWork", + "salutation", "title" + + ).build()); + } +}---------- class Test { public void testPrimitiveFields() { ConverterVerifier.verifyFieldsAreAnnotatedWithToPojo( diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21608216-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B21608216-cr.case new file mode 100644 index 000000000..8074851f2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21608216-cr.case @@ -0,0 +1 @@ +---------- @PluginInfo(shortName = "chromesuggestions", owner = "mathp", demoLink = "unspecified", modules = { BackendsModule.class, CommonBackendsModule.class, ChromeSuggestionsPlugin.ChromeSuggestionsModule.class }) @Module(library = true, complete = false) @Module(library = true, complete = false, injects = {ClassInfoTracker.class, JslayoutMetaProto.class}) @Module( library = true, complete = false, injects = { ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class } ) @Module( library = true, complete = false, injects = { ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class, JslayoutMeta.class } ) @Module(injects = {One.class, Two.class}, includes = {Three.class, Four.class}) @Module( library = true, complete = false, numbers = {1, 2, 3} ) @Module( library = true, complete = false, numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } ) @Module( library = true, complete = false, numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 } ) @Module({ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class}) @Module({ ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class }) @Module({ ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class, JslayoutMeta.class }) class B21608216 { }---------- @PluginInfo( shortName = "chromesuggestions", owner = "mathp", demoLink = "unspecified", modules = { BackendsModule.class, CommonBackendsModule.class, ChromeSuggestionsPlugin.ChromeSuggestionsModule.class }) @Module(library = true, complete = false) @Module( library = true, complete = false, injects = {ClassInfoTracker.class, JslayoutMetaProto.class}) @Module( library = true, complete = false, injects = {ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class}) @Module( library = true, complete = false, injects = { ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class, JslayoutMeta.class }) @Module( injects = {One.class, Two.class}, includes = {Three.class, Four.class}) @Module( library = true, complete = false, numbers = {1, 2, 3}) @Module( library = true, complete = false, numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26}) @Module( library = true, complete = false, numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 }) @Module({ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class}) @Module({ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class}) @Module({ ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class, JslayoutMeta.class }) class B21608216 {} \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B21608216-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B21608216-crlf.case new file mode 100644 index 000000000..b398d1a8f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21608216-crlf.case @@ -0,0 +1,113 @@ +---------- +@PluginInfo(shortName = "chromesuggestions", + owner = "mathp", + demoLink = "unspecified", + modules = { BackendsModule.class, + CommonBackendsModule.class, + ChromeSuggestionsPlugin.ChromeSuggestionsModule.class }) +@Module(library = true, complete = false) +@Module(library = true, complete = false, injects = {ClassInfoTracker.class, JslayoutMetaProto.class}) +@Module( + library = true, + complete = false, + injects = { + ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class + } +) +@Module( + library = true, + complete = false, + injects = { + ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class, JslayoutMeta.class + } +) +@Module(injects = {One.class, Two.class}, includes = {Three.class, Four.class}) +@Module( + library = true, + complete = false, + numbers = {1, 2, 3} +) +@Module( + library = true, + complete = false, + numbers = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 + } +) +@Module( + library = true, + complete = false, + numbers = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30 + } +) +@Module({ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class}) +@Module({ + ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class +}) +@Module({ + ClassInfoTracker.class, + JslayoutMetaProto.class, + JslayoutMetaProto.class, + JslayoutMeta.class, + JslayoutMeta.class +}) +class B21608216 { +}---------- +@PluginInfo( + shortName = "chromesuggestions", + owner = "mathp", + demoLink = "unspecified", + modules = { + BackendsModule.class, + CommonBackendsModule.class, + ChromeSuggestionsPlugin.ChromeSuggestionsModule.class + }) +@Module(library = true, complete = false) +@Module( + library = true, + complete = false, + injects = {ClassInfoTracker.class, JslayoutMetaProto.class}) +@Module( + library = true, + complete = false, + injects = {ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class}) +@Module( + library = true, + complete = false, + injects = { + ClassInfoTracker.class, + JslayoutMetaProto.class, + JslayoutMetaProto.class, + JslayoutMeta.class, + JslayoutMeta.class + }) +@Module( + injects = {One.class, Two.class}, + includes = {Three.class, Four.class}) +@Module( + library = true, + complete = false, + numbers = {1, 2, 3}) +@Module( + library = true, + complete = false, + numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26}) +@Module( + library = true, + complete = false, + numbers = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30 + }) +@Module({ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class}) +@Module({ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class}) +@Module({ + ClassInfoTracker.class, + JslayoutMetaProto.class, + JslayoutMetaProto.class, + JslayoutMeta.class, + JslayoutMeta.class +}) +class B21608216 {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21608216.output b/open-java-format/src/test/resources/test-cases/testdata/B21608216-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21608216.output rename to open-java-format/src/test/resources/test-cases/testdata/B21608216-lf.case index e47db71d6..bc6330c8e 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21608216.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B21608216-lf.case @@ -1,3 +1,60 @@ +---------- +@PluginInfo(shortName = "chromesuggestions", + owner = "mathp", + demoLink = "unspecified", + modules = { BackendsModule.class, + CommonBackendsModule.class, + ChromeSuggestionsPlugin.ChromeSuggestionsModule.class }) +@Module(library = true, complete = false) +@Module(library = true, complete = false, injects = {ClassInfoTracker.class, JslayoutMetaProto.class}) +@Module( + library = true, + complete = false, + injects = { + ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class + } +) +@Module( + library = true, + complete = false, + injects = { + ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class, JslayoutMeta.class + } +) +@Module(injects = {One.class, Two.class}, includes = {Three.class, Four.class}) +@Module( + library = true, + complete = false, + numbers = {1, 2, 3} +) +@Module( + library = true, + complete = false, + numbers = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 + } +) +@Module( + library = true, + complete = false, + numbers = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30 + } +) +@Module({ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class}) +@Module({ + ClassInfoTracker.class, JslayoutMetaProto.class, JslayoutMetaProto.class, JslayoutMeta.class +}) +@Module({ + ClassInfoTracker.class, + JslayoutMetaProto.class, + JslayoutMetaProto.class, + JslayoutMeta.class, + JslayoutMeta.class +}) +class B21608216 { +}---------- @PluginInfo( shortName = "chromesuggestions", owner = "mathp", diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22166687-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B22166687-cr.case new file mode 100644 index 000000000..da34f6f39 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22166687-cr.case @@ -0,0 +1 @@ +---------- class B22166687 { public static class Wrapper extends CrossComponentSetBindingsWrapper< ExtensionWrapper> implements CrossComponentSetBindingsWrapper< ExtensionWrapper> { void m() {} } public static class Wrapper extends CrossComponentSetBindingsWrapper< ExtensionWrapper> implements CrossComponentSetBindingsWrapper< ExtensionWrapper>, CrossComponentSetBindingsWrapper< ExtensionWrapper> { void m() {} } }---------- class B22166687 { public static class Wrapper extends CrossComponentSetBindingsWrapper> implements CrossComponentSetBindingsWrapper> { void m() {} } public static class Wrapper extends CrossComponentSetBindingsWrapper> implements CrossComponentSetBindingsWrapper>, CrossComponentSetBindingsWrapper> { void m() {} } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22166687-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B22166687-crlf.case new file mode 100644 index 000000000..3dbdef8d7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22166687-crlf.case @@ -0,0 +1,33 @@ +---------- +class B22166687 { + public static class Wrapper + extends CrossComponentSetBindingsWrapper< + ExtensionWrapper> + implements CrossComponentSetBindingsWrapper< + ExtensionWrapper> { + void m() {} + } + public static class Wrapper + extends CrossComponentSetBindingsWrapper< + ExtensionWrapper> + implements CrossComponentSetBindingsWrapper< + ExtensionWrapper>, + CrossComponentSetBindingsWrapper< + ExtensionWrapper> { + void m() {} + } +}---------- +class B22166687 { + public static class Wrapper + extends CrossComponentSetBindingsWrapper> + implements CrossComponentSetBindingsWrapper> { + void m() {} + } + + public static class Wrapper + extends CrossComponentSetBindingsWrapper> + implements CrossComponentSetBindingsWrapper>, + CrossComponentSetBindingsWrapper> { + void m() {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B22166687-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B22166687-lf.case new file mode 100644 index 000000000..1cb17b495 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22166687-lf.case @@ -0,0 +1,33 @@ +---------- +class B22166687 { + public static class Wrapper + extends CrossComponentSetBindingsWrapper< + ExtensionWrapper> + implements CrossComponentSetBindingsWrapper< + ExtensionWrapper> { + void m() {} + } + public static class Wrapper + extends CrossComponentSetBindingsWrapper< + ExtensionWrapper> + implements CrossComponentSetBindingsWrapper< + ExtensionWrapper>, + CrossComponentSetBindingsWrapper< + ExtensionWrapper> { + void m() {} + } +}---------- +class B22166687 { + public static class Wrapper + extends CrossComponentSetBindingsWrapper> + implements CrossComponentSetBindingsWrapper> { + void m() {} + } + + public static class Wrapper + extends CrossComponentSetBindingsWrapper> + implements CrossComponentSetBindingsWrapper>, + CrossComponentSetBindingsWrapper> { + void m() {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26928842-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B26928842-cr.case new file mode 100644 index 000000000..024f80595 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26928842-cr.case @@ -0,0 +1 @@ +---------- class B26928842 { { curr.setData(curr.getData().toBuilder() .setPushCertificate( // New curr.getData().getPushCertficate()) // Old, misspelled .clearPushCertficate() // Old, misspelled .build()); } }---------- class B26928842 { { curr.setData(curr.getData().toBuilder() .setPushCertificate( // New curr.getData().getPushCertficate()) // Old, misspelled .clearPushCertficate() // Old, misspelled .build()); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26928842-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B26928842-crlf.case new file mode 100644 index 000000000..053f4c0d5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26928842-crlf.case @@ -0,0 +1,19 @@ +---------- +class B26928842 { + { + curr.setData(curr.getData().toBuilder() + .setPushCertificate( // New + curr.getData().getPushCertficate()) // Old, misspelled + .clearPushCertficate() // Old, misspelled + .build()); + } +}---------- +class B26928842 { + { + curr.setData(curr.getData().toBuilder() + .setPushCertificate( // New + curr.getData().getPushCertficate()) // Old, misspelled + .clearPushCertficate() // Old, misspelled + .build()); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B26928842-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B26928842-lf.case new file mode 100644 index 000000000..5337e9baa --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26928842-lf.case @@ -0,0 +1,19 @@ +---------- +class B26928842 { + { + curr.setData(curr.getData().toBuilder() + .setPushCertificate( // New + curr.getData().getPushCertficate()) // Old, misspelled + .clearPushCertficate() // Old, misspelled + .build()); + } +}---------- +class B26928842 { + { + curr.setData(curr.getData().toBuilder() + .setPushCertificate( // New + curr.getData().getPushCertficate()) // Old, misspelled + .clearPushCertficate() // Old, misspelled + .build()); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B28066276-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B28066276-cr.case new file mode 100644 index 000000000..fc2a18fdd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B28066276-cr.case @@ -0,0 +1 @@ +---------- class B28066276 { class A extends S implements I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________ {} interface B extends I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________ {} }---------- class B28066276 { class A extends S implements I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________ {} interface B extends I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________, I________________ {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B28066276-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B28066276-crlf.case new file mode 100644 index 000000000..1bf35efed --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B28066276-crlf.case @@ -0,0 +1,51 @@ +---------- +class B28066276 { + class A extends S + implements I________________, I________________, I________________, I________________, + I________________, I________________, I________________, I________________, + I________________, I________________, I________________, I________________, + I________________, I________________, I________________, I________________ {} + + interface B + extends I________________, I________________, I________________, I________________, + I________________, I________________, I________________, I________________, + I________________, I________________, I________________, I________________, + I________________, I________________, I________________, I________________ {} +}---------- +class B28066276 { + class A extends S + implements I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________ {} + + interface B + extends I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________, + I________________ {} +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28066276.output b/open-java-format/src/test/resources/test-cases/testdata/B28066276-lf.case similarity index 62% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28066276.output rename to open-java-format/src/test/resources/test-cases/testdata/B28066276-lf.case index d88d3a2ad..a0b7738ff 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28066276.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B28066276-lf.case @@ -1,3 +1,17 @@ +---------- +class B28066276 { + class A extends S + implements I________________, I________________, I________________, I________________, + I________________, I________________, I________________, I________________, + I________________, I________________, I________________, I________________, + I________________, I________________, I________________, I________________ {} + + interface B + extends I________________, I________________, I________________, I________________, + I________________, I________________, I________________, I________________, + I________________, I________________, I________________, I________________, + I________________, I________________, I________________, I________________ {} +}---------- class B28066276 { class A extends S implements I________________, diff --git a/open-java-format/src/test/resources/test-cases/testdata/B30223986-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B30223986-cr.case new file mode 100644 index 000000000..b73c48791 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B30223986-cr.case @@ -0,0 +1 @@ +---------- /** * Base class for {@link Foo}. * *

    The subclass should implement {@link #bar()}, with the implementation returning a * new instance of the foo relevant to that baz. * * Example: * * @Override * protected Foo bar() { * return new Foo(); * } * * * The subclass should call {@link #get()} to get the foo object, * and should not cache it in the subclass. * Example: * * @Annotation("something") * public void thing() { * } * * * @param concrete subclass */ class Test { /** * Field * * Example: *

    
       *   @Annotation("something")
       *   public void thing() {
       *   }
       * 
    * * @param asd */ int x() {} /** * Inline foo. */ int y() {} }---------- /** * Base class for {@link Foo}. * *

    The subclass should implement {@link #bar()}, with the implementation returning a * new instance of the foo relevant to that baz. * * Example: * * @Override * protected Foo bar() { * return new Foo(); * } * * * The subclass should call {@link #get()} to get the foo object, * and should not cache it in the subclass. * Example: * * @Annotation("something") * public void thing() { * } * * * @param concrete subclass */ class Test { /** * Field * * Example: *

    
         *   @Annotation("something")
         *   public void thing() {
         *   }
         * 
    * * @param asd */ int x() {} /** * Inline foo. */ int y() {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B30223986-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B30223986-crlf.case new file mode 100644 index 000000000..dafea47cd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B30223986-crlf.case @@ -0,0 +1,91 @@ +---------- +/** + * Base class for {@link Foo}. + * + *

    The subclass should implement {@link #bar()}, with the implementation returning a + * new instance of the foo relevant to that baz. + * + * Example: + * + * @Override + * protected Foo bar() { + * return new Foo(); + * } + * + * + * The subclass should call {@link #get()} to get the foo object, + * and should not cache it in the subclass. + * Example: + * + * @Annotation("something") + * public void thing() { + * } + * + * + * @param concrete subclass + */ +class Test { + /** + * Field + * + * Example: + *

    
    +   *   @Annotation("something")
    +   *   public void thing() {
    +   *   }
    +   * 
    + * + * @param asd + */ + int x() {} + + /** + * Inline foo. + */ + int y() {} +}---------- +/** + * Base class for {@link Foo}. + * + *

    The subclass should implement {@link #bar()}, with the implementation returning a + * new instance of the foo relevant to that baz. + * + * Example: + * + * @Override + * protected Foo bar() { + * return new Foo(); + * } + * + * + * The subclass should call {@link #get()} to get the foo object, + * and should not cache it in the subclass. + * Example: + * + * @Annotation("something") + * public void thing() { + * } + * + * + * @param concrete subclass + */ +class Test { + /** + * Field + * + * Example: + *

    
    +     *   @Annotation("something")
    +     *   public void thing() {
    +     *   }
    +     * 
    + * + * @param asd + */ + int x() {} + + /** + * Inline foo. + */ + int y() {} +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30223986.output b/open-java-format/src/test/resources/test-cases/testdata/B30223986-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30223986.output rename to open-java-format/src/test/resources/test-cases/testdata/B30223986-lf.case index ec3decfb8..5d6197432 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30223986.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B30223986-lf.case @@ -1,3 +1,49 @@ +---------- +/** + * Base class for {@link Foo}. + * + *

    The subclass should implement {@link #bar()}, with the implementation returning a + * new instance of the foo relevant to that baz. + * + * Example: + * + * @Override + * protected Foo bar() { + * return new Foo(); + * } + * + * + * The subclass should call {@link #get()} to get the foo object, + * and should not cache it in the subclass. + * Example: + * + * @Annotation("something") + * public void thing() { + * } + * + * + * @param concrete subclass + */ +class Test { + /** + * Field + * + * Example: + *

    
    +   *   @Annotation("something")
    +   *   public void thing() {
    +   *   }
    +   * 
    + * + * @param asd + */ + int x() {} + + /** + * Inline foo. + */ + int y() {} +}---------- /** * Base class for {@link Foo}. * diff --git a/open-java-format/src/test/resources/test-cases/testdata/B30764810-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B30764810-cr.case new file mode 100644 index 000000000..653c1b201 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B30764810-cr.case @@ -0,0 +1 @@ +---------- class B30764810 { @Foo( x = {0}, y = 0 // comment ) int a; @Foo( x = {0}, y = 0 /* comment */ ) int b; }---------- class B30764810 { @Foo( x = {0}, y = 0 // comment ) int a; @Foo( x = {0}, y = 0 /* comment */ ) int b; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B30764810-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B30764810-crlf.case new file mode 100644 index 000000000..256f99e67 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B30764810-crlf.case @@ -0,0 +1,33 @@ +---------- +class B30764810 { + @Foo( + x = {0}, + y = 0 + // comment + ) + int a; + + @Foo( + x = {0}, + y = 0 + /* comment + */ + ) + int b; +}---------- +class B30764810 { + @Foo( + x = {0}, + y = 0 + // comment + ) + int a; + + @Foo( + x = {0}, + y = 0 + /* comment + */ + ) + int b; +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30764810.output b/open-java-format/src/test/resources/test-cases/testdata/B30764810-lf.case similarity index 57% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30764810.output rename to open-java-format/src/test/resources/test-cases/testdata/B30764810-lf.case index e3c53f940..8401df23f 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30764810.output +++ b/open-java-format/src/test/resources/test-cases/testdata/B30764810-lf.case @@ -1,3 +1,20 @@ +---------- +class B30764810 { + @Foo( + x = {0}, + y = 0 + // comment + ) + int a; + + @Foo( + x = {0}, + y = 0 + /* comment + */ + ) + int b; +}---------- class B30764810 { @Foo( x = {0}, diff --git a/open-java-format/src/test/resources/test-cases/testdata/B32397217-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B32397217-cr.case new file mode 100644 index 000000000..6b11fdca9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B32397217-cr.case @@ -0,0 +1 @@ +---------- class T { { f( 1 /* 1 */, 2 /* 2 */); } }---------- class T { { f(1 /* 1 */, 2 /* 2 */); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B32397217-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B32397217-crlf.case new file mode 100644 index 000000000..4349894e4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B32397217-crlf.case @@ -0,0 +1,12 @@ +---------- +class T { + { + f( + 1 /* 1 */, 2 /* 2 */); + } +}---------- +class T { + { + f(1 /* 1 */, 2 /* 2 */); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B32397217-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B32397217-lf.case new file mode 100644 index 000000000..6ac5261ef --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B32397217-lf.case @@ -0,0 +1,12 @@ +---------- +class T { + { + f( + 1 /* 1 */, 2 /* 2 */); + } +}---------- +class T { + { + f(1 /* 1 */, 2 /* 2 */); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B38241237-cr.case b/open-java-format/src/test/resources/test-cases/testdata/B38241237-cr.case new file mode 100644 index 000000000..4a72bff26 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B38241237-cr.case @@ -0,0 +1 @@ +---------- class B38241237 { //foo //bar //one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt ///baz //// }---------- class B38241237 { // foo // bar // one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt /// baz //// } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/B38241237-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/B38241237-crlf.case new file mode 100644 index 000000000..f37f7d1c2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B38241237-crlf.case @@ -0,0 +1,15 @@ +---------- +class B38241237 { + //foo + //bar + //one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt + ///baz + //// +}---------- +class B38241237 { + // foo + // bar + // one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt + /// baz + //// +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/B38241237-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B38241237-lf.case new file mode 100644 index 000000000..6c064eeec --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B38241237-lf.case @@ -0,0 +1,15 @@ +---------- +class B38241237 { + //foo + //bar + //one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt + ///baz + //// +}---------- +class B38241237 { + // foo + // bar + // one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt + /// baz + //// +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I574-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I574-cr.case new file mode 100644 index 000000000..e994f79fb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I574-cr.case @@ -0,0 +1 @@ +---------- public record Record(@NotNull Object o) { public Record { this.o = o; } }---------- public record Record(@NotNull Object o) { public Record { this.o = o; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I574-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I574-crlf.case new file mode 100644 index 000000000..f2450e717 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I574-crlf.case @@ -0,0 +1,13 @@ +---------- +public record Record(@NotNull Object o) { + + public Record { + this.o = o; + } +}---------- +public record Record(@NotNull Object o) { + + public Record { + this.o = o; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I574-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I574-lf.case new file mode 100644 index 000000000..1b0988bee --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I574-lf.case @@ -0,0 +1,13 @@ +---------- +public record Record(@NotNull Object o) { + + public Record { + this.o = o; + } +}---------- +public record Record(@NotNull Object o) { + + public Record { + this.o = o; + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/I588-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I588-cr.case new file mode 100644 index 000000000..be67c1cd2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I588-cr.case @@ -0,0 +1 @@ +---------- class T { int f(Object x) { if (x instanceof final Integer i) { return i; } return -1; } }---------- class T { int f(Object x) { if (x instanceof final Integer i) { return i; } return -1; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/I588-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I588-crlf.case new file mode 100644 index 000000000..1a2b7b966 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I588-crlf.case @@ -0,0 +1,17 @@ +---------- +class T { + int f(Object x) { + if (x instanceof final Integer i) { + return i; + } + return -1; + } +}---------- +class T { + int f(Object x) { + if (x instanceof final Integer i) { + return i; + } + return -1; + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I588.output b/open-java-format/src/test/resources/test-cases/testdata/I588-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I588.output rename to open-java-format/src/test/resources/test-cases/testdata/I588-lf.case index 0b7d6f147..2bebfcb2c 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I588.output +++ b/open-java-format/src/test/resources/test-cases/testdata/I588-lf.case @@ -1,3 +1,12 @@ +---------- +class T { + int f(Object x) { + if (x instanceof final Integer i) { + return i; + } + return -1; + } +}---------- class T { int f(Object x) { if (x instanceof final Integer i) { diff --git a/open-java-format/src/test/resources/test-cases/testdata/I880-cr.case b/open-java-format/src/test/resources/test-cases/testdata/I880-cr.case new file mode 100644 index 000000000..4871a0b6d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I880-cr.case @@ -0,0 +1 @@ +---------- 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; }; } }---------- 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/open-java-format/src/test/resources/test-cases/testdata/I880-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/I880-crlf.case new file mode 100644 index 000000000..3083170b3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I880-crlf.case @@ -0,0 +1,38 @@ +---------- +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; + }; + } +}---------- +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/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I880.output b/open-java-format/src/test/resources/test-cases/testdata/I880-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I880.output rename to open-java-format/src/test/resources/test-cases/testdata/I880-lf.case index ebea3a630..38b41c546 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I880.output +++ b/open-java-format/src/test/resources/test-cases/testdata/I880-lf.case @@ -1,3 +1,23 @@ +---------- +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; + }; + } +}---------- class I880 { public String f(int i) { return switch (i) { diff --git a/open-java-format/src/test/resources/test-cases/testdata/JavaFileNoNewLine-cr.case b/open-java-format/src/test/resources/test-cases/testdata/JavaFileNoNewLine-cr.case new file mode 100644 index 000000000..ea275d595 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/JavaFileNoNewLine-cr.case @@ -0,0 +1 @@ +---------- class MyClass { private void myFile() {} }---------- class MyClass { private void myFile() {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/JavaFileNoNewLine-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/JavaFileNoNewLine-crlf.case new file mode 100644 index 000000000..1496534ca --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/JavaFileNoNewLine-crlf.case @@ -0,0 +1,7 @@ +---------- +class MyClass { + private void myFile() {} +}---------- +class MyClass { + private void myFile() {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/JavaFileNoNewLine-lf.case b/open-java-format/src/test/resources/test-cases/testdata/JavaFileNoNewLine-lf.case new file mode 100644 index 000000000..fd10433bc --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/JavaFileNoNewLine-lf.case @@ -0,0 +1,7 @@ +---------- +class MyClass { + private void myFile() {} +}---------- +class MyClass { + private void myFile() {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithExtraSpaces-cr.case b/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithExtraSpaces-cr.case new file mode 100644 index 000000000..d87be44b0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithExtraSpaces-cr.case @@ -0,0 +1 @@ +---------- class MyClass { private void myFile() {} } ---------- class MyClass { private void myFile() {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithExtraSpaces-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithExtraSpaces-crlf.case new file mode 100644 index 000000000..39ef76f85 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithExtraSpaces-crlf.case @@ -0,0 +1,7 @@ +---------- +class MyClass { + private void myFile() {} +} ---------- +class MyClass { + private void myFile() {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithExtraSpaces-lf.case b/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithExtraSpaces-lf.case new file mode 100644 index 000000000..aecdb98cf --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/JavaFileWithExtraSpaces-lf.case @@ -0,0 +1,7 @@ +---------- +class MyClass { + private void myFile() {} +} ---------- +class MyClass { + private void myFile() {} +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/M3-cr.case b/open-java-format/src/test/resources/test-cases/testdata/M3-cr.case new file mode 100644 index 000000000..d44103917 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/M3-cr.case @@ -0,0 +1 @@ +---------- @Deprecated module moduletags { requires transitive static moduleA; exports testpkgmdltags; }---------- @Deprecated module moduletags { requires transitive static moduleA; exports testpkgmdltags; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/M3-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/M3-crlf.case new file mode 100644 index 000000000..728d851c0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/M3-crlf.case @@ -0,0 +1,13 @@ +---------- +@Deprecated +module moduletags { + requires transitive static moduleA; + + exports testpkgmdltags; +}---------- +@Deprecated +module moduletags { + requires transitive static moduleA; + + exports testpkgmdltags; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/M3-lf.case b/open-java-format/src/test/resources/test-cases/testdata/M3-lf.case new file mode 100644 index 000000000..d72b958f2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/M3-lf.case @@ -0,0 +1,13 @@ +---------- +@Deprecated +module moduletags { + requires transitive static moduleA; + + exports testpkgmdltags; +}---------- +@Deprecated +module moduletags { + requires transitive static moduleA; + + exports testpkgmdltags; +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/RSL-cr.case b/open-java-format/src/test/resources/test-cases/testdata/RSL-cr.case new file mode 100644 index 000000000..6bd086a63 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/RSL-cr.case @@ -0,0 +1 @@ +---------- class RSLs { String a = """ lorem ipsum """; String b = """ lorem ipsum """; String c = """ lorem ipsum """; String d = """ ipsum """; String e = """ """; String f = """ ipsum"""; String g = """ lorem\ ipsum """; String h = """ lorem\ ipsum\ """; String i = """ lorem ipsum """; String j = """ lorem one long incredibly unbroken sentence moving from topic to topic so that no one had a chance to interrupt ipsum """; String k = """ lorem ipsum """; String l = """ foo bar baz"""; { f(""" lorem ipsum """, 42); """ hello %s """ .formatted("world"); f( /* foo= */ """ foo """, /* bar= */ """ bar """); """ hello """.codePoints().forEach(System.err::println); String s = """ foo """ + """ bar """; String notBroken = """ foo """ + """ bar """; String working = """ foo """ + """ bar """; String u = stringVariableOne + """ ... """ + stringVariableTwo + """ ... """ + sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsfaaaaaaa + """ my value """; } String x = String.format(""" this very long string that does something using arguments %s %s %s """, "@", "@", "something"); { """ No tools or answer found in the message. Please try again, following the instructions:\s %s """.someOtherValue(e -> e.getValue().print()).myValue(System.err::println).formatted(toolFormatter.usage()).myOtherValue().someOtherValue().somethingElse(); } String y = refactorFromTo(""" someCode """, """ otherCode """); String z = lotsOfStringParams(""" aaa """, """ bbb """, """ ccc """, """ ddd """, """ eee """, """ fff """, """ ggg """); String w = lotsOfStringParams(""" aaa """, "sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsf", """ bbb """, """ ccc """); String w = lotsOfStringParams(""" aaa """, "sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsfdasdsadasdsada", """ bbb """, """ ccc """); String x = String.format(""" this very long string that does something using arguments %s %s %s """, "@", "@", "something"); String x = String.format(someExtraValue (""" this very long string that does something using arguments %s %s %s """ + """ my other value """), "@", "@", "something"); CreateABuilder value = CreateABuilder.builder().v(""" this is a content that should be indented """) .otherValue("my other values") .build(); CreateABuilder value = CreateABuilder.builder().v(""" this is a content that should be indented """ + """ and this one """) .otherValue("my other values") .build(); CreateABuilder value = CreateABuilder.builder() .myValue("this is a value") .someTextBlockContent(""" this is a content that should be indented """) .otherValue("my other values") .build(); }---------- class RSLs { String a = """ lorem ipsum """; String b = """ lorem ipsum """; String c = """ lorem ipsum """; String d = """ ipsum """; String e = """ """; String f = """ ipsum\ """; String g = """ lorem\ ipsum """; String h = """ lorem\ ipsum\ """; String i = """ lorem ipsum """; String j = """ lorem one long incredibly unbroken sentence moving from topic to topic so that no one had a chance to interrupt ipsum """; String k = """ lorem ipsum """; String l = """ foo bar baz\ """; { f(""" lorem ipsum """, 42); """ hello %s """.formatted("world"); f(/* foo= */ """ foo """, /* bar= */ """ bar """); """ hello """.codePoints().forEach(System.err::println); String s = """ foo """ + """ bar """; String notBroken = """ foo """ + """ bar """; String working = """ foo """ + """ bar """; String u = stringVariableOne + """ ... """ + stringVariableTwo + """ ... """ + sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsfaaaaaaa + """ my value """; } String x = String.format(""" this very long string that does something using arguments %s %s %s """, "@", "@", "something"); { """ No tools or answer found in the message. Please try again, following the instructions:\s %s """.someOtherValue(e -> e.getValue().print()) .myValue(System.err::println) .formatted(toolFormatter.usage()) .myOtherValue() .someOtherValue() .somethingElse(); } String y = refactorFromTo(""" someCode """, """ otherCode """); String z = lotsOfStringParams(""" aaa """, """ bbb """, """ ccc """, """ ddd """, """ eee """, """ fff """, """ ggg """); String w = lotsOfStringParams( """ aaa """, "sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsf", """ bbb """, """ ccc """); String w = lotsOfStringParams( """ aaa """, "sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsfdasdsadasdsada", """ bbb """, """ ccc """); String x = String.format(""" this very long string that does something using arguments %s %s %s """, "@", "@", "something"); String x = String.format(someExtraValue(""" this very long string that does something using arguments %s %s %s """ + """ my other value """), "@", "@", "something"); CreateABuilder value = CreateABuilder.builder().v(""" this is a content that should be indented """).otherValue("my other values").build(); CreateABuilder value = CreateABuilder.builder().v(""" this is a content that should be indented """ + """ and this one """).otherValue("my other values").build(); CreateABuilder value = CreateABuilder.builder() .myValue("this is a value") .someTextBlockContent(""" this is a content that should be indented """) .otherValue("my other values") .build(); } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/RSL-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/RSL-crlf.case new file mode 100644 index 000000000..802aa77ad --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/RSL-crlf.case @@ -0,0 +1,377 @@ +---------- +class RSLs { + String a = """ + lorem + ipsum + """; + String b = """ + lorem + ipsum + """; + String c = """ + lorem + ipsum + """; + String d = """ + ipsum + """; + String e = """ + """; + String f = """ + ipsum"""; + String g = """ + lorem\ + ipsum + """; + String h = """ + lorem\ + ipsum\ + """; + String i = """ + lorem + + ipsum + """; + String j = """ + lorem + one long incredibly unbroken sentence moving from topic to topic so that no one had a chance to interrupt + ipsum + """; + String k = """ + lorem + ipsum + """; + String l = + """ + foo + bar + baz"""; + { + f(""" + lorem + ipsum + """, 42); + + """ + hello %s + """ + .formatted("world"); + f( + /* foo= */ """ + foo + """, + /* bar= */ """ + bar + """); + """ + hello + """.codePoints().forEach(System.err::println); + String s = + """ + foo + """ + + """ + bar + """; + String notBroken = + """ + foo + """ + + """ + bar + """; + String working = + """ + foo + """ + + """ + bar + """; + String u = + stringVariableOne + + + """ + ... + """ + stringVariableTwo + + + """ + ... + """ + sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsfaaaaaaa + + """ + my value + """; + } + + + String x = String.format(""" + this very long string that does something using arguments %s %s %s + """, + "@", "@", "something"); + + { + """ + No tools or answer found in the message. Please try again, following the instructions:\s + + %s + """.someOtherValue(e -> e.getValue().print()).myValue(System.err::println).formatted(toolFormatter.usage()).myOtherValue().someOtherValue().somethingElse(); + } + + String y = refactorFromTo(""" + someCode + """, """ + otherCode + """); + + String z = lotsOfStringParams(""" + aaa + """, """ + bbb + """, """ + ccc + """, """ + ddd + """, """ + eee + """, """ + fff + """, """ + ggg + """); + + String w = lotsOfStringParams(""" + aaa + """, "sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsf", + """ + bbb + """, + """ + ccc + """); + + String w = lotsOfStringParams(""" + aaa + """, "sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsfdasdsadasdsada", """ + bbb + """, """ + ccc + """); + + String x = String.format(""" + this very long string that does something using arguments %s %s %s + """, + "@", "@", "something"); + + String x = String.format(someExtraValue (""" + this very long string that does something using arguments %s %s %s + """ + """ + my other value + """), + "@", "@", "something"); + + CreateABuilder value = CreateABuilder.builder().v(""" + this is a content that should be indented + """) + .otherValue("my other values") + .build(); + + CreateABuilder value = CreateABuilder.builder().v(""" + this is a content that should be indented + """ + """ + and this one + """) + .otherValue("my other values") + .build(); + + CreateABuilder value = CreateABuilder.builder() + .myValue("this is a value") + .someTextBlockContent(""" + this is a content that should be indented + """) + .otherValue("my other values") + .build(); +}---------- +class RSLs { + String a = """ + lorem + ipsum + """; + String b = """ + lorem + ipsum + """; + String c = """ + lorem + ipsum + """; + String d = """ + ipsum + """; + String e = """ + """; + String f = """ + ipsum\ + """; + String g = """ + lorem\ + ipsum + """; + String h = """ + lorem\ + ipsum\ + """; + String i = """ + lorem + + ipsum + """; + String j = """ + lorem + one long incredibly unbroken sentence moving from topic to topic so that no one had a chance to interrupt + ipsum + """; + String k = """ + lorem + ipsum + """; + String l = """ + foo + bar + baz\ + """; + + { + f(""" + lorem + ipsum + """, 42); + + """ + hello %s + """.formatted("world"); + f(/* foo= */ """ + foo + """, /* bar= */ """ + bar + """); + """ + hello + """.codePoints().forEach(System.err::println); + String s = """ + foo + """ + """ + bar + """; + String notBroken = """ + foo + """ + """ + bar + """; + String working = """ + foo + """ + """ + bar + """; + String u = stringVariableOne + + """ + ... + """ + + stringVariableTwo + + """ + ... + """ + + sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsfaaaaaaa + + """ + my value + """; + } + + String x = String.format(""" + this very long string that does something using arguments %s %s %s + """, "@", "@", "something"); + + { + """ + No tools or answer found in the message. Please try again, following the instructions:\s + + %s + """.someOtherValue(e -> e.getValue().print()) + .myValue(System.err::println) + .formatted(toolFormatter.usage()) + .myOtherValue() + .someOtherValue() + .somethingElse(); + } + + String y = refactorFromTo(""" + someCode + """, """ + otherCode + """); + + String z = lotsOfStringParams(""" + aaa + """, """ + bbb + """, """ + ccc + """, """ + ddd + """, """ + eee + """, """ + fff + """, """ + ggg + """); + + String w = lotsOfStringParams( + """ + aaa + """, "sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsf", """ + bbb + """, """ + ccc + """); + + String w = lotsOfStringParams( + """ + aaa + """, + "sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsfdasdsadasdsada", + """ + bbb + """, + """ + ccc + """); + + String x = String.format(""" + this very long string that does something using arguments %s %s %s + """, "@", "@", "something"); + + String x = String.format(someExtraValue(""" + this very long string that does something using arguments %s %s %s + """ + """ + my other value + """), "@", "@", "something"); + + CreateABuilder value = + CreateABuilder.builder().v(""" + this is a content that should be indented + """).otherValue("my other values").build(); + + CreateABuilder value = + CreateABuilder.builder().v(""" + this is a content that should be indented + """ + """ + and this one + """).otherValue("my other values").build(); + + CreateABuilder value = CreateABuilder.builder() + .myValue("this is a value") + .someTextBlockContent(""" + this is a content that should be indented + """) + .otherValue("my other values") + .build(); +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/RSL.output b/open-java-format/src/test/resources/test-cases/testdata/RSL-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/RSL.output rename to open-java-format/src/test/resources/test-cases/testdata/RSL-lf.case index 0fbb58868..671a40d22 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/RSL.output +++ b/open-java-format/src/test/resources/test-cases/testdata/RSL-lf.case @@ -1,3 +1,195 @@ +---------- +class RSLs { + String a = """ + lorem + ipsum + """; + String b = """ + lorem + ipsum + """; + String c = """ + lorem + ipsum + """; + String d = """ + ipsum + """; + String e = """ + """; + String f = """ + ipsum"""; + String g = """ + lorem\ + ipsum + """; + String h = """ + lorem\ + ipsum\ + """; + String i = """ + lorem + + ipsum + """; + String j = """ + lorem + one long incredibly unbroken sentence moving from topic to topic so that no one had a chance to interrupt + ipsum + """; + String k = """ + lorem + ipsum + """; + String l = + """ + foo + bar + baz"""; + { + f(""" + lorem + ipsum + """, 42); + + """ + hello %s + """ + .formatted("world"); + f( + /* foo= */ """ + foo + """, + /* bar= */ """ + bar + """); + """ + hello + """.codePoints().forEach(System.err::println); + String s = + """ + foo + """ + + """ + bar + """; + String notBroken = + """ + foo + """ + + """ + bar + """; + String working = + """ + foo + """ + + """ + bar + """; + String u = + stringVariableOne + + + """ + ... + """ + stringVariableTwo + + + """ + ... + """ + sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsfaaaaaaa + + """ + my value + """; + } + + + String x = String.format(""" + this very long string that does something using arguments %s %s %s + """, + "@", "@", "something"); + + { + """ + No tools or answer found in the message. Please try again, following the instructions:\s + + %s + """.someOtherValue(e -> e.getValue().print()).myValue(System.err::println).formatted(toolFormatter.usage()).myOtherValue().someOtherValue().somethingElse(); + } + + String y = refactorFromTo(""" + someCode + """, """ + otherCode + """); + + String z = lotsOfStringParams(""" + aaa + """, """ + bbb + """, """ + ccc + """, """ + ddd + """, """ + eee + """, """ + fff + """, """ + ggg + """); + + String w = lotsOfStringParams(""" + aaa + """, "sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsf", + """ + bbb + """, + """ + ccc + """); + + String w = lotsOfStringParams(""" + aaa + """, "sdklfjslfkjsadlkgjsdklfjsadlkfjsaklfjaskdsfkljsaklfjsadflkjsdafkljasdfklsjfklsajflkasjfsfdasdsadasdsada", """ + bbb + """, """ + ccc + """); + + String x = String.format(""" + this very long string that does something using arguments %s %s %s + """, + "@", "@", "something"); + + String x = String.format(someExtraValue (""" + this very long string that does something using arguments %s %s %s + """ + """ + my other value + """), + "@", "@", "something"); + + CreateABuilder value = CreateABuilder.builder().v(""" + this is a content that should be indented + """) + .otherValue("my other values") + .build(); + + CreateABuilder value = CreateABuilder.builder().v(""" + this is a content that should be indented + """ + """ + and this one + """) + .otherValue("my other values") + .build(); + + CreateABuilder value = CreateABuilder.builder() + .myValue("this is a value") + .someTextBlockContent(""" + this is a content that should be indented + """) + .otherValue("my other values") + .build(); +}---------- class RSLs { String a = """ lorem diff --git a/open-java-format/src/test/resources/test-cases/testdata/Records-cr.case b/open-java-format/src/test/resources/test-cases/testdata/Records-cr.case new file mode 100644 index 000000000..bbc3ae0df --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Records-cr.case @@ -0,0 +1 @@ +---------- class Records { record R1() {} private record R2() {} @Deprecated private record R3() {} record R4() {} record R5(int x) {} record R6(@Deprecated int x) {} record R7(@Deprecated int x, int... y) {} record R8() implements Comparable> { @Override public int compareTo(R8 other) { return 0; } } record R9(int x) { R9(int x) { this.x = x; } } }---------- class Records { record R1() {} private record R2() {} @Deprecated private record R3() {} record R4() {} record R5(int x) {} record R6(@Deprecated int x) {} record R7(@Deprecated int x, int... y) {} record R8() implements Comparable> { @Override public int compareTo(R8 other) { return 0; } } record R9(int x) { R9(int x) { this.x = x; } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/Records-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/Records-crlf.case new file mode 100644 index 000000000..cf4c94ddb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Records-crlf.case @@ -0,0 +1,59 @@ +---------- +class Records { + record R1() {} + + private record R2() {} + + @Deprecated + private record R3() {} + + record R4() {} + + record R5(int x) {} + + record R6(@Deprecated int x) {} + + record R7(@Deprecated int x, int... y) {} + + record R8() implements Comparable> { + @Override + public int compareTo(R8 other) { + return 0; + } + } + + record R9(int x) { + R9(int x) { + this.x = x; + } + } +}---------- +class Records { + record R1() {} + + private record R2() {} + + @Deprecated + private record R3() {} + + record R4() {} + + record R5(int x) {} + + record R6(@Deprecated int x) {} + + record R7(@Deprecated int x, int... y) {} + + record R8() implements Comparable> { + @Override + public int compareTo(R8 other) { + return 0; + } + } + + record R9(int x) { + R9(int x) { + this.x = x; + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Records.output b/open-java-format/src/test/resources/test-cases/testdata/Records-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Records.output rename to open-java-format/src/test/resources/test-cases/testdata/Records-lf.case index a224ea907..e64c762e4 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Records.output +++ b/open-java-format/src/test/resources/test-cases/testdata/Records-lf.case @@ -1,3 +1,33 @@ +---------- +class Records { + record R1() {} + + private record R2() {} + + @Deprecated + private record R3() {} + + record R4() {} + + record R5(int x) {} + + record R6(@Deprecated int x) {} + + record R7(@Deprecated int x, int... y) {} + + record R8() implements Comparable> { + @Override + public int compareTo(R8 other) { + return 0; + } + } + + record R9(int x) { + R9(int x) { + this.x = x; + } + } +}---------- class Records { record R1() {} diff --git a/open-java-format/src/test/resources/test-cases/testdata/Var-cr.case b/open-java-format/src/test/resources/test-cases/testdata/Var-cr.case new file mode 100644 index 000000000..76f77c916 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Var-cr.case @@ -0,0 +1 @@ +---------- class Var { void f() { for (var x : ImmutableList.of(42)) {} } }---------- class Var { void f() { for (var x : ImmutableList.of(42)) {} } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/Var-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/Var-crlf.case new file mode 100644 index 000000000..30d3829d0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Var-crlf.case @@ -0,0 +1,11 @@ +---------- +class Var { + void f() { + for (var x : ImmutableList.of(42)) {} + } +}---------- +class Var { + void f() { + for (var x : ImmutableList.of(42)) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/Var-lf.case b/open-java-format/src/test/resources/test-cases/testdata/Var-lf.case new file mode 100644 index 000000000..6be5a4599 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Var-lf.case @@ -0,0 +1,11 @@ +---------- +class Var { + void f() { + for (var x : ImmutableList.of(42)) {} + } +}---------- +class Var { + void f() { + for (var x : ImmutableList.of(42)) {} + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-chains-lambdas-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-chains-lambdas-cr.case new file mode 100644 index 000000000..d73e9dbfe --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-chains-lambdas-cr.case @@ -0,0 +1 @@ +---------- public class Foo { public static void main(String[] args) { foo .bar() .baz(argargargargargargargargargargargargargargargargargargargargarg, param -> doStuff() .method1() .method2(arljhfaldjfhalfjhalfjahflahflahfaljfhadlfjhljsahljhfsaljfhlfajhfljh)); thisIsMyObject .callingMethod1() .callingMethod2(argargargargargargargargargargargargargargargargargargargargarg, param -> doStuff() .method1() .method2(arljhfaldjfhalfjhalfjahflahflahfaljfhadlfjhljsahljhfsaljfhlfajhfljh)); } }---------- public class Foo { public static void main(String[] args) { foo.bar() .baz( argargargargargargargargargargargargargargargargargargargargarg, param -> doStuff() .method1() .method2(arljhfaldjfhalfjhalfjahflahflahfaljfhadlfjhljsahljhfsaljfhlfajhfljh)); thisIsMyObject .callingMethod1() .callingMethod2( argargargargargargargargargargargargargargargargargargargargarg, param -> doStuff() .method1() .method2(arljhfaldjfhalfjhalfjahflahflahfaljfhadlfjhljsahljhfsaljfhlfajhfljh)); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-chains-lambdas-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-chains-lambdas-crlf.case new file mode 100644 index 000000000..eeaf02c3e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-chains-lambdas-crlf.case @@ -0,0 +1,34 @@ +---------- +public class Foo { + public static void main(String[] args) { + foo + .bar() + .baz(argargargargargargargargargargargargargargargargargargargargarg, param -> doStuff() + .method1() + .method2(arljhfaldjfhalfjhalfjahflahflahfaljfhadlfjhljsahljhfsaljfhlfajhfljh)); + + thisIsMyObject + .callingMethod1() + .callingMethod2(argargargargargargargargargargargargargargargargargargargargarg, param -> doStuff() + .method1() + .method2(arljhfaldjfhalfjhalfjahflahflahfaljfhadlfjhljsahljhfsaljfhlfajhfljh)); + } +}---------- +public class Foo { + public static void main(String[] args) { + foo.bar() + .baz( + argargargargargargargargargargargargargargargargargargargargarg, + param -> doStuff() + .method1() + .method2(arljhfaldjfhalfjhalfjahflahflahfaljfhadlfjhljsahljhfsaljfhlfajhfljh)); + + thisIsMyObject + .callingMethod1() + .callingMethod2( + argargargargargargargargargargargargargargargargargargargargarg, + param -> doStuff() + .method1() + .method2(arljhfaldjfhalfjhalfjahflahflahfaljfhadlfjhljsahljhfsaljfhlfajhfljh)); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chains-lambdas.output b/open-java-format/src/test/resources/test-cases/testdata/palantir-chains-lambdas-lf.case similarity index 53% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chains-lambdas.output rename to open-java-format/src/test/resources/test-cases/testdata/palantir-chains-lambdas-lf.case index d11faa902..c902017c4 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chains-lambdas.output +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-chains-lambdas-lf.case @@ -1,3 +1,19 @@ +---------- +public class Foo { + public static void main(String[] args) { + foo + .bar() + .baz(argargargargargargargargargargargargargargargargargargargargarg, param -> doStuff() + .method1() + .method2(arljhfaldjfhalfjhalfjahflahflahfaljfhadlfjhljsahljhfsaljfhlfajhfljh)); + + thisIsMyObject + .callingMethod1() + .callingMethod2(argargargargargargargargargargargargargargargargargargargargarg, param -> doStuff() + .method1() + .method2(arljhfaldjfhalfjhalfjahflahflahfaljfhadlfjhljsahljhfsaljfhlfajhfljh)); + } +}---------- public class Foo { public static void main(String[] args) { foo.bar() diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-1-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-1-cr.case new file mode 100644 index 000000000..6b429fff9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-1-cr.case @@ -0,0 +1 @@ +---------- /** * https://github.com/palantir/conjure-java-runtime/pull/1285/files/36e437737ed6650a9296ea0414e6d77d48bf0404#r345425759 */ class PalantirConjureJavaRuntime1285_SslSocketFactories { public static SSLContext createSslContext(SslConfiguration config) { TrustManager[] trustManagers = createTrustManagers(config); KeyManager[] keyManagers = null; if (config.keyStorePath().isPresent()) { keyManagers = createKeyManagerFactory( config.keyStorePath().get(), config.keyStorePassword().get(), config.keyStoreType(), config.keyStoreKeyAlias()) .getKeyManagers(); } return createSslContext(trustManagers, keyManagers); } }---------- /** * https://github.com/palantir/conjure-java-runtime/pull/1285/files/36e437737ed6650a9296ea0414e6d77d48bf0404#r345425759 */ class PalantirConjureJavaRuntime1285_SslSocketFactories { public static SSLContext createSslContext(SslConfiguration config) { TrustManager[] trustManagers = createTrustManagers(config); KeyManager[] keyManagers = null; if (config.keyStorePath().isPresent()) { keyManagers = createKeyManagerFactory( config.keyStorePath().get(), config.keyStorePassword().get(), config.keyStoreType(), config.keyStoreKeyAlias()) .getKeyManagers(); } return createSslContext(trustManagers, keyManagers); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-1-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-1-crlf.case new file mode 100644 index 000000000..03f1ee415 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-1-crlf.case @@ -0,0 +1,41 @@ +---------- +/** + * https://github.com/palantir/conjure-java-runtime/pull/1285/files/36e437737ed6650a9296ea0414e6d77d48bf0404#r345425759 + */ +class PalantirConjureJavaRuntime1285_SslSocketFactories { + public static SSLContext createSslContext(SslConfiguration config) { + TrustManager[] trustManagers = createTrustManagers(config); + + KeyManager[] keyManagers = null; + if (config.keyStorePath().isPresent()) { + keyManagers = createKeyManagerFactory( + config.keyStorePath().get(), + config.keyStorePassword().get(), + config.keyStoreType(), + config.keyStoreKeyAlias()) + .getKeyManagers(); + } + + return createSslContext(trustManagers, keyManagers); + } +}---------- +/** + * https://github.com/palantir/conjure-java-runtime/pull/1285/files/36e437737ed6650a9296ea0414e6d77d48bf0404#r345425759 + */ +class PalantirConjureJavaRuntime1285_SslSocketFactories { + public static SSLContext createSslContext(SslConfiguration config) { + TrustManager[] trustManagers = createTrustManagers(config); + + KeyManager[] keyManagers = null; + if (config.keyStorePath().isPresent()) { + keyManagers = createKeyManagerFactory( + config.keyStorePath().get(), + config.keyStorePassword().get(), + config.keyStoreType(), + config.keyStoreKeyAlias()) + .getKeyManagers(); + } + + return createSslContext(trustManagers, keyManagers); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-1-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-1-lf.case new file mode 100644 index 000000000..65e9d7de9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-1-lf.case @@ -0,0 +1,41 @@ +---------- +/** + * https://github.com/palantir/conjure-java-runtime/pull/1285/files/36e437737ed6650a9296ea0414e6d77d48bf0404#r345425759 + */ +class PalantirConjureJavaRuntime1285_SslSocketFactories { + public static SSLContext createSslContext(SslConfiguration config) { + TrustManager[] trustManagers = createTrustManagers(config); + + KeyManager[] keyManagers = null; + if (config.keyStorePath().isPresent()) { + keyManagers = createKeyManagerFactory( + config.keyStorePath().get(), + config.keyStorePassword().get(), + config.keyStoreType(), + config.keyStoreKeyAlias()) + .getKeyManagers(); + } + + return createSslContext(trustManagers, keyManagers); + } +}---------- +/** + * https://github.com/palantir/conjure-java-runtime/pull/1285/files/36e437737ed6650a9296ea0414e6d77d48bf0404#r345425759 + */ +class PalantirConjureJavaRuntime1285_SslSocketFactories { + public static SSLContext createSslContext(SslConfiguration config) { + TrustManager[] trustManagers = createTrustManagers(config); + + KeyManager[] keyManagers = null; + if (config.keyStorePath().isPresent()) { + keyManagers = createKeyManagerFactory( + config.keyStorePath().get(), + config.keyStorePassword().get(), + config.keyStoreType(), + config.keyStoreKeyAlias()) + .getKeyManagers(); + } + + return createSslContext(trustManagers, keyManagers); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-2-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-2-cr.case new file mode 100644 index 000000000..57e19a466 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-2-cr.case @@ -0,0 +1 @@ +---------- /** * https://github.com/palantir/conjure-java-runtime/pull/1285/files#r356006884 */ class PalantirConjureJavaRuntime1285_Test2 { public void foo() { TestService bogusHostProxy = JaxRsClient.create( TestService.class, AGENT, new HostMetricsRegistry(), ClientConfiguration.builder() .from(createTestConfig("http://foo-bar-bogus-host.unresolvable:80", "http://localhost:" + failoverTestCase.server1.getPort())) .maxNumRetries(2) .build()); } }---------- /** * https://github.com/palantir/conjure-java-runtime/pull/1285/files#r356006884 */ class PalantirConjureJavaRuntime1285_Test2 { public void foo() { TestService bogusHostProxy = JaxRsClient.create( TestService.class, AGENT, new HostMetricsRegistry(), ClientConfiguration.builder() .from(createTestConfig( "http://foo-bar-bogus-host.unresolvable:80", "http://localhost:" + failoverTestCase.server1.getPort())) .maxNumRetries(2) .build()); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-2-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-2-crlf.case new file mode 100644 index 000000000..021311b38 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-2-crlf.case @@ -0,0 +1,34 @@ +---------- +/** + * https://github.com/palantir/conjure-java-runtime/pull/1285/files#r356006884 + */ +class PalantirConjureJavaRuntime1285_Test2 { + public void foo() { + TestService bogusHostProxy = JaxRsClient.create( + TestService.class, + AGENT, + new HostMetricsRegistry(), + ClientConfiguration.builder() + .from(createTestConfig("http://foo-bar-bogus-host.unresolvable:80", "http://localhost:" + + failoverTestCase.server1.getPort())) + .maxNumRetries(2) + .build()); + } +}---------- +/** + * https://github.com/palantir/conjure-java-runtime/pull/1285/files#r356006884 + */ +class PalantirConjureJavaRuntime1285_Test2 { + public void foo() { + TestService bogusHostProxy = JaxRsClient.create( + TestService.class, + AGENT, + new HostMetricsRegistry(), + ClientConfiguration.builder() + .from(createTestConfig( + "http://foo-bar-bogus-host.unresolvable:80", + "http://localhost:" + failoverTestCase.server1.getPort())) + .maxNumRetries(2) + .build()); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-2.output b/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-2-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-2.output rename to open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-2-lf.case index 29c7c172a..5507a0693 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-2.output +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-2-lf.case @@ -1,3 +1,20 @@ +---------- +/** + * https://github.com/palantir/conjure-java-runtime/pull/1285/files#r356006884 + */ +class PalantirConjureJavaRuntime1285_Test2 { + public void foo() { + TestService bogusHostProxy = JaxRsClient.create( + TestService.class, + AGENT, + new HostMetricsRegistry(), + ClientConfiguration.builder() + .from(createTestConfig("http://foo-bar-bogus-host.unresolvable:80", "http://localhost:" + + failoverTestCase.server1.getPort())) + .maxNumRetries(2) + .build()); + } +}---------- /** * https://github.com/palantir/conjure-java-runtime/pull/1285/files#r356006884 */ diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-gcv-1-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-gcv-1-cr.case new file mode 100644 index 000000000..45874c023 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-gcv-1-cr.case @@ -0,0 +1 @@ +---------- class PalantirGcv1 { public static void main(String[] args) { constraintsProperty.addAll(project.provider( Suppliers.memoize(() -> { log.debug( "Computing publish constraints for {} by resolving {}", configuration.get(), configurationForFiltering.get()); Set modulesToInclude = configurationForFiltering .get() .getIncoming() .getResolutionResult() .getAllComponents() .stream() .map(ResolvedComponentResult::getModuleVersion) .filter(Objects::nonNull) .map(ModuleVersionIdentifier::getModule) .collect(Collectors.toSet()); return Collections2.filter(publishConstraints, constraint -> modulesToInclude.contains( constraint.getModule())); }) ::get)); } }---------- class PalantirGcv1 { public static void main(String[] args) { constraintsProperty.addAll(project.provider(Suppliers.memoize(() -> { log.debug( "Computing publish constraints for {} by resolving {}", configuration.get(), configurationForFiltering.get()); Set modulesToInclude = configurationForFiltering.get().getIncoming().getResolutionResult().getAllComponents().stream() .map(ResolvedComponentResult::getModuleVersion) .filter(Objects::nonNull) .map(ModuleVersionIdentifier::getModule) .collect(Collectors.toSet()); return Collections2.filter( publishConstraints, constraint -> modulesToInclude.contains(constraint.getModule())); })::get)); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-gcv-1-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-gcv-1-crlf.case new file mode 100644 index 000000000..3628c1463 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-gcv-1-crlf.case @@ -0,0 +1,43 @@ +---------- +class PalantirGcv1 { + public static void main(String[] args) { + constraintsProperty.addAll(project.provider( + Suppliers.memoize(() -> { + log.debug( + "Computing publish constraints for {} by resolving {}", + configuration.get(), + configurationForFiltering.get()); + Set modulesToInclude = configurationForFiltering + .get() + .getIncoming() + .getResolutionResult() + .getAllComponents() + .stream() + .map(ResolvedComponentResult::getModuleVersion) + .filter(Objects::nonNull) + .map(ModuleVersionIdentifier::getModule) + .collect(Collectors.toSet()); + return Collections2.filter(publishConstraints, constraint -> modulesToInclude.contains( + constraint.getModule())); + }) + ::get)); + } +}---------- +class PalantirGcv1 { + public static void main(String[] args) { + constraintsProperty.addAll(project.provider(Suppliers.memoize(() -> { + log.debug( + "Computing publish constraints for {} by resolving {}", + configuration.get(), + configurationForFiltering.get()); + Set modulesToInclude = + configurationForFiltering.get().getIncoming().getResolutionResult().getAllComponents().stream() + .map(ResolvedComponentResult::getModuleVersion) + .filter(Objects::nonNull) + .map(ModuleVersionIdentifier::getModule) + .collect(Collectors.toSet()); + return Collections2.filter( + publishConstraints, constraint -> modulesToInclude.contains(constraint.getModule())); + })::get)); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-gcv-1.input b/open-java-format/src/test/resources/test-cases/testdata/palantir-gcv-1-lf.case similarity index 54% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-gcv-1.input rename to open-java-format/src/test/resources/test-cases/testdata/palantir-gcv-1-lf.case index 9d963b47a..bd12bc1ad 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-gcv-1.input +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-gcv-1-lf.case @@ -1,3 +1,4 @@ +---------- class PalantirGcv1 { public static void main(String[] args) { constraintsProperty.addAll(project.provider( @@ -21,4 +22,22 @@ class PalantirGcv1 { }) ::get)); } -} \ No newline at end of file +}---------- +class PalantirGcv1 { + public static void main(String[] args) { + constraintsProperty.addAll(project.provider(Suppliers.memoize(() -> { + log.debug( + "Computing publish constraints for {} by resolving {}", + configuration.get(), + configurationForFiltering.get()); + Set modulesToInclude = + configurationForFiltering.get().getIncoming().getResolutionResult().getAllComponents().stream() + .map(ResolvedComponentResult::getModuleVersion) + .filter(Objects::nonNull) + .map(ModuleVersionIdentifier::getModule) + .collect(Collectors.toSet()); + return Collections2.filter( + publishConstraints, constraint -> modulesToInclude.contains(constraint.getModule())); + })::get)); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-long-fqn-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-fqn-cr.case new file mode 100644 index 000000000..3c5e7590c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-fqn-cr.case @@ -0,0 +1 @@ +---------- class PalantirLongFqn { public PalantirLongFqn() { org.gradle.api.internal.artifacts.configurations.ConflictResolution conflictResolution = ((org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) conf .getResolutionStrategy()).getConflictResolution(); } }---------- class PalantirLongFqn { public PalantirLongFqn() { org.gradle.api.internal.artifacts.configurations.ConflictResolution conflictResolution = ((org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) conf.getResolutionStrategy()) .getConflictResolution(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-long-fqn-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-fqn-crlf.case new file mode 100644 index 000000000..0a9427c73 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-fqn-crlf.case @@ -0,0 +1,16 @@ +---------- +class PalantirLongFqn { + public PalantirLongFqn() { + org.gradle.api.internal.artifacts.configurations.ConflictResolution conflictResolution = + ((org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) conf + .getResolutionStrategy()).getConflictResolution(); + } +}---------- +class PalantirLongFqn { + public PalantirLongFqn() { + org.gradle.api.internal.artifacts.configurations.ConflictResolution conflictResolution = + ((org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) + conf.getResolutionStrategy()) + .getConflictResolution(); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-fqn.output b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-fqn-lf.case similarity index 51% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-fqn.output rename to open-java-format/src/test/resources/test-cases/testdata/palantir-long-fqn-lf.case index ce3f37dc3..8c329cdf0 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-fqn.output +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-fqn-lf.case @@ -1,3 +1,11 @@ +---------- +class PalantirLongFqn { + public PalantirLongFqn() { + org.gradle.api.internal.artifacts.configurations.ConflictResolution conflictResolution = + ((org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) conf + .getResolutionStrategy()).getConflictResolution(); + } +}---------- class PalantirLongFqn { public PalantirLongFqn() { org.gradle.api.internal.artifacts.configurations.ConflictResolution conflictResolution = diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-cr.case new file mode 100644 index 000000000..fb7872cea --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-cr.case @@ -0,0 +1 @@ +---------- class PalantirLongMethodChain { private static void foo() { new ObjectMapper().registerModule(new Jdk8Module()).readValue(file, TestCases.class).getClient(); } }---------- class PalantirLongMethodChain { private static void foo() { new ObjectMapper() .registerModule(new Jdk8Module()) .readValue(file, TestCases.class) .getClient(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-crlf.case new file mode 100644 index 000000000..1e8907778 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-crlf.case @@ -0,0 +1,15 @@ +---------- +class PalantirLongMethodChain { + private static void foo() { + new ObjectMapper().registerModule(new Jdk8Module()).readValue(file, TestCases.class).getClient(); + } + +}---------- +class PalantirLongMethodChain { + private static void foo() { + new ObjectMapper() + .registerModule(new Jdk8Module()) + .readValue(file, TestCases.class) + .getClient(); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain.output b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-lf.case similarity index 53% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain.output rename to open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-lf.case index 0d08b6833..e37d55706 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain.output +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-lf.case @@ -1,3 +1,10 @@ +---------- +class PalantirLongMethodChain { + private static void foo() { + new ObjectMapper().registerModule(new Jdk8Module()).readValue(file, TestCases.class).getClient(); + } + +}---------- class PalantirLongMethodChain { private static void foo() { new ObjectMapper() diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-reference-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-reference-cr.case new file mode 100644 index 000000000..70750a194 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-reference-cr.case @@ -0,0 +1 @@ +---------- class PalantirLongArrayInit { private static FormatterService createFormatter(Optional> implementationClassPath) { URL[] implementationUrls = implementationClassPath .map(implementationUris -> { log.debug("Using palantir-java-format implementation defined by URIs: {}", implementationUris); return implementationUris.stream().map(PalantirCodeStyleManager::toUrlUnchecked).toArray(URL[]::new); }).orElse(null); } }---------- class PalantirLongArrayInit { private static FormatterService createFormatter(Optional> implementationClassPath) { URL[] implementationUrls = implementationClassPath .map(implementationUris -> { log.debug("Using palantir-java-format implementation defined by URIs: {}", implementationUris); return implementationUris.stream() .map(PalantirCodeStyleManager::toUrlUnchecked) .toArray(URL[]::new); }) .orElse(null); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-reference-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-reference-crlf.case new file mode 100644 index 000000000..003bbe02f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-reference-crlf.case @@ -0,0 +1,22 @@ +---------- +class PalantirLongArrayInit { + private static FormatterService createFormatter(Optional> implementationClassPath) { + URL[] implementationUrls = implementationClassPath + .map(implementationUris -> { + log.debug("Using palantir-java-format implementation defined by URIs: {}", implementationUris); + return implementationUris.stream().map(PalantirCodeStyleManager::toUrlUnchecked).toArray(URL[]::new); + }).orElse(null); + } +}---------- +class PalantirLongArrayInit { + private static FormatterService createFormatter(Optional> implementationClassPath) { + URL[] implementationUrls = implementationClassPath + .map(implementationUris -> { + log.debug("Using palantir-java-format implementation defined by URIs: {}", implementationUris); + return implementationUris.stream() + .map(PalantirCodeStyleManager::toUrlUnchecked) + .toArray(URL[]::new); + }) + .orElse(null); + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-reference.output b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-reference-lf.case similarity index 52% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-reference.output rename to open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-reference-lf.case index 3165f0d14..c25fca21e 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-reference.output +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-reference-lf.case @@ -1,3 +1,13 @@ +---------- +class PalantirLongArrayInit { + private static FormatterService createFormatter(Optional> implementationClassPath) { + URL[] implementationUrls = implementationClassPath + .map(implementationUris -> { + log.debug("Using palantir-java-format implementation defined by URIs: {}", implementationUris); + return implementationUris.stream().map(PalantirCodeStyleManager::toUrlUnchecked).toArray(URL[]::new); + }).orElse(null); + } +}---------- class PalantirLongArrayInit { private static FormatterService createFormatter(Optional> implementationClassPath) { URL[] implementationUrls = implementationClassPath diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-long-safearg-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-safearg-cr.case new file mode 100644 index 000000000..dcfe68739 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-safearg-cr.case @@ -0,0 +1 @@ +---------- class PalantirLongSafeArg { public static void foo() { Preconditions.checkArgument( hostPortString.charAt(0) == '[', "Bracketed host-port string must start with a bracket", SafeArg.of( "port", hostPortString)); } }---------- class PalantirLongSafeArg { public static void foo() { Preconditions.checkArgument( hostPortString.charAt(0) == '[', "Bracketed host-port string must start with a bracket", SafeArg.of("port", hostPortString)); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-long-safearg-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-safearg-crlf.case new file mode 100644 index 000000000..a8fcb8fd6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-safearg-crlf.case @@ -0,0 +1,16 @@ +---------- +class PalantirLongSafeArg { + public static void foo() { + Preconditions.checkArgument( + hostPortString.charAt(0) == '[', "Bracketed host-port string must start with a bracket", SafeArg.of( + "port", hostPortString)); + } +}---------- +class PalantirLongSafeArg { + public static void foo() { + Preconditions.checkArgument( + hostPortString.charAt(0) == '[', + "Bracketed host-port string must start with a bracket", + SafeArg.of("port", hostPortString)); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-long-safearg-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-safearg-lf.case new file mode 100644 index 000000000..12cd338db --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-safearg-lf.case @@ -0,0 +1,16 @@ +---------- +class PalantirLongSafeArg { + public static void foo() { + Preconditions.checkArgument( + hostPortString.charAt(0) == '[', "Bracketed host-port string must start with a bracket", SafeArg.of( + "port", hostPortString)); + } +}---------- +class PalantirLongSafeArg { + public static void foo() { + Preconditions.checkArgument( + hostPortString.charAt(0) == '[', + "Bracketed host-port string must start with a bracket", + SafeArg.of("port", hostPortString)); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-sandor-lambdas-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-sandor-lambdas-cr.case new file mode 100644 index 000000000..72158feb5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-sandor-lambdas-cr.case @@ -0,0 +1 @@ +---------- public class Foo { public static void main(String[] args) { List storedCategories = linkedDatasets.getCategories() .stream() .map(storedCategory -> StoredLinkedDatasetCategory.of( storedCategory.getName(), storedCategory.getDatasets() .stream() .map(ds -> StoredDatasetAndBranch.of(ds.getDatasetRid(), ds.getBranchName())) .collect(Collectors.toList()))) .collect(Collectors.toList()); int otherVar = 5; } }---------- public class Foo { public static void main(String[] args) { List storedCategories = linkedDatasets.getCategories().stream() .map(storedCategory -> StoredLinkedDatasetCategory.of( storedCategory.getName(), storedCategory.getDatasets().stream() .map(ds -> StoredDatasetAndBranch.of(ds.getDatasetRid(), ds.getBranchName())) .collect(Collectors.toList()))) .collect(Collectors.toList()); int otherVar = 5; } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-sandor-lambdas-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-sandor-lambdas-crlf.case new file mode 100644 index 000000000..58782f009 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-sandor-lambdas-crlf.case @@ -0,0 +1,27 @@ +---------- +public class Foo { + public static void main(String[] args) { + List storedCategories = linkedDatasets.getCategories() + .stream() + .map(storedCategory -> StoredLinkedDatasetCategory.of( + storedCategory.getName(), + storedCategory.getDatasets() + .stream() + .map(ds -> StoredDatasetAndBranch.of(ds.getDatasetRid(), ds.getBranchName())) + .collect(Collectors.toList()))) + .collect(Collectors.toList()); + int otherVar = 5; + } +}---------- +public class Foo { + public static void main(String[] args) { + List storedCategories = linkedDatasets.getCategories().stream() + .map(storedCategory -> StoredLinkedDatasetCategory.of( + storedCategory.getName(), + storedCategory.getDatasets().stream() + .map(ds -> StoredDatasetAndBranch.of(ds.getDatasetRid(), ds.getBranchName())) + .collect(Collectors.toList()))) + .collect(Collectors.toList()); + int otherVar = 5; + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-sandor-lambdas.input b/open-java-format/src/test/resources/test-cases/testdata/palantir-sandor-lambdas-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-sandor-lambdas.input rename to open-java-format/src/test/resources/test-cases/testdata/palantir-sandor-lambdas-lf.case index 2f268fa0b..24b753cb5 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-sandor-lambdas.input +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-sandor-lambdas-lf.case @@ -1,3 +1,4 @@ +---------- public class Foo { public static void main(String[] args) { List storedCategories = linkedDatasets.getCategories() @@ -11,4 +12,16 @@ public class Foo { .collect(Collectors.toList()); int otherVar = 5; } -} \ No newline at end of file +}---------- +public class Foo { + public static void main(String[] args) { + List storedCategories = linkedDatasets.getCategories().stream() + .map(storedCategory -> StoredLinkedDatasetCategory.of( + storedCategory.getName(), + storedCategory.getDatasets().stream() + .map(ds -> StoredDatasetAndBranch.of(ds.getDatasetRid(), ds.getBranchName())) + .collect(Collectors.toList()))) + .collect(Collectors.toList()); + int otherVar = 5; + } +} From 0a65072b949cd5e84f5a4b953322925d019a933d Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Wed, 28 Oct 2026 09:39:02 +0300 Subject: [PATCH 7/9] Move 13 StringWrapperIntegrationTest pairs into cases, lengthened to cross 120 columns StringWrapperIntegrationTest reflowed strings at 40 columns in the GOOGLE style, a setting a case does not have: a case runs OJF, whose strings wrap at 120. Run that way, 11 of the 15 pairs that reflow at 40 columns reflowed nothing, the chain of 14 fit on one line, and the literal of 15 no longer reached the limit. Thirteen pairs become their LF, CRLF and CR cases in test-cases/stringwrapper/, each with a line on what it checks. Eight of them get longer inputs in their old shape: the sentence has the same two insertions everywhere, after "sentence" and after "no-one", and the runs of letters of 13 and 14 are three times as long, as the limit is. 6, 7, 9, 10 and 16 cross 120 columns as they are. Each case does at 120 columns what its pair did at 40, and the formatters from before the fixes behind 16 and the NON-NLS pair, 2.98.0.1 and 2.98.0.3, fail them. The outputs are the same on JDK 21, 25 and 27. Pairs 1, 2, 5, 8 and 11 stay in StringWrapperIntegrationTest for now. Lengthened the same way, they come out with continuation lines four columns in instead of the eight of OJF, which a plain reformat moves; the second run of a case wraps again and does not notice. That is a formatter bug, already in 2.98.0.1; the next commit fixes it and moves those five. Tests on JDK 21: StringWrapperIntegrationTest 72 -> 20, FormatterCasesTest 811 -> 850; 1412 tests in the module. --- .../java/StringWrapperIntegrationTest/0.input | 7 ----- .../StringWrapperIntegrationTest/0.output | 7 ----- .../StringWrapperIntegrationTest/10.input | 4 --- .../StringWrapperIntegrationTest/10.output | 5 ---- .../StringWrapperIntegrationTest/12.input | 10 ------- .../StringWrapperIntegrationTest/12.output | 11 -------- .../StringWrapperIntegrationTest/13.input | 4 --- .../StringWrapperIntegrationTest/13.output | 6 ----- .../StringWrapperIntegrationTest/14.input | 7 ----- .../StringWrapperIntegrationTest/14.output | 6 ----- .../StringWrapperIntegrationTest/15.input | 4 --- .../StringWrapperIntegrationTest/15.output | 5 ---- .../StringWrapperIntegrationTest/16.input | 3 --- .../StringWrapperIntegrationTest/16.output | 8 ------ .../java/StringWrapperIntegrationTest/3.input | 3 --- .../StringWrapperIntegrationTest/3.output | 7 ----- .../java/StringWrapperIntegrationTest/4.input | 8 ------ .../StringWrapperIntegrationTest/4.output | 8 ------ .../java/StringWrapperIntegrationTest/6.input | 3 --- .../StringWrapperIntegrationTest/6.output | 21 --------------- .../java/StringWrapperIntegrationTest/7.input | 3 --- .../StringWrapperIntegrationTest/7.output | 21 --------------- .../java/StringWrapperIntegrationTest/9.input | 3 --- .../StringWrapperIntegrationTest/9.output | 4 --- .../ojf-issue-23-marked-literals.input | 7 ----- .../ojf-issue-23-marked-literals.output | 20 -------------- .../test-cases/stringwrapper/0-cr.case | 1 + .../test-cases/stringwrapper/0-crlf.case | 15 +++++++++++ .../test-cases/stringwrapper/0-lf.case | 15 +++++++++++ .../test-cases/stringwrapper/10-cr.case | 1 + .../test-cases/stringwrapper/10-crlf.case | 12 +++++++++ .../test-cases/stringwrapper/10-lf.case | 12 +++++++++ .../test-cases/stringwrapper/12-cr.case | 1 + .../test-cases/stringwrapper/12-crlf.case | 24 +++++++++++++++++ .../test-cases/stringwrapper/12-lf.case | 24 +++++++++++++++++ .../test-cases/stringwrapper/13-cr.case | 1 + .../test-cases/stringwrapper/13-crlf.case | 13 +++++++++ .../test-cases/stringwrapper/13-lf.case | 13 +++++++++ .../test-cases/stringwrapper/14-cr.case | 1 + .../test-cases/stringwrapper/14-crlf.case | 16 +++++++++++ .../test-cases/stringwrapper/14-lf.case | 16 +++++++++++ .../test-cases/stringwrapper/15-cr.case | 1 + .../test-cases/stringwrapper/15-crlf.case | 12 +++++++++ .../test-cases/stringwrapper/15-lf.case | 12 +++++++++ .../test-cases/stringwrapper/16-cr.case | 1 + .../test-cases/stringwrapper/16-crlf.case | 12 +++++++++ .../test-cases/stringwrapper/16-lf.case | 12 +++++++++ .../test-cases/stringwrapper/3-cr.case | 1 + .../test-cases/stringwrapper/3-crlf.case | 11 ++++++++ .../test-cases/stringwrapper/3-lf.case | 11 ++++++++ .../test-cases/stringwrapper/4-cr.case | 1 + .../test-cases/stringwrapper/4-crlf.case | 18 +++++++++++++ .../test-cases/stringwrapper/4-lf.case | 18 +++++++++++++ .../test-cases/stringwrapper/6-cr.case | 1 + .../test-cases/stringwrapper/6-crlf.case | 27 +++++++++++++++++++ .../test-cases/stringwrapper/6-lf.case | 27 +++++++++++++++++++ .../test-cases/stringwrapper/7-cr.case | 1 + .../test-cases/stringwrapper/7-crlf.case | 27 +++++++++++++++++++ .../test-cases/stringwrapper/7-lf.case | 27 +++++++++++++++++++ .../test-cases/stringwrapper/9-cr.case | 1 + .../test-cases/stringwrapper/9-crlf.case | 10 +++++++ .../test-cases/stringwrapper/9-lf.case | 10 +++++++ .../ojf-issue-23-marked-literals-cr.case | 1 + .../ojf-issue-23-marked-literals-crlf.case | 24 +++++++++++++++++ .../ojf-issue-23-marked-literals-lf.case | 24 +++++++++++++++++ 65 files changed, 455 insertions(+), 195 deletions(-) delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/0.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/0.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/10.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/10.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/12.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/12.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/13.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/13.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/14.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/14.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/15.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/15.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/16.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/16.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/3.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/3.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/4.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/4.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/6.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/6.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/7.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/7.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/9.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/9.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/ojf-issue-23-marked-literals.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/ojf-issue-23-marked-literals.output create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/0-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/0-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/0-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/10-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/10-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/10-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/12-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/12-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/12-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/13-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/13-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/13-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/14-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/14-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/14-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/15-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/15-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/15-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/16-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/16-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/16-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/3-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/3-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/3-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/4-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/4-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/4-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/6-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/6-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/6-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/7-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/7-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/7-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/9-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/9-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/9-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/ojf-issue-23-marked-literals-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/ojf-issue-23-marked-literals-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/ojf-issue-23-marked-literals-lf.case diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/0.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/0.input deleted file mode 100644 index dd0a9247b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/0.input +++ /dev/null @@ -1,7 +0,0 @@ -class T { - String s = - "one long incredibly unbroken sentence" - + " moving from topic to topic" - + " so that no-one had a chance to" - + " interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/0.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/0.output deleted file mode 100644 index 454801545..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/0.output +++ /dev/null @@ -1,7 +0,0 @@ -class T { - String s = "one long incredibly" - + " unbroken sentence moving" - + " from topic to topic so that" - + " no-one had a chance to" - + " interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/10.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/10.input deleted file mode 100644 index 27f5f5359..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/10.input +++ /dev/null @@ -1,4 +0,0 @@ -class T { - String s = - "onelongincrediblyunbrokensentencemovingfromtopictotopicsot atnoonehadachancetointerrupt______________________";; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/10.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/10.output deleted file mode 100644 index 5efeee969..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/10.output +++ /dev/null @@ -1,5 +0,0 @@ -class T { - String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsot" - + " atnoonehadachancetointerrupt______________________"; - ; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/12.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/12.input deleted file mode 100644 index eddb1d4e9..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/12.input +++ /dev/null @@ -1,10 +0,0 @@ -class T { - String s = - "one long incredibly unbroken sentence" - // comment - + " moving from topic to topic" - // comment - + " so that no-one had a chance to" - // comment - + " interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/12.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/12.output deleted file mode 100644 index 047803c63..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/12.output +++ /dev/null @@ -1,11 +0,0 @@ -class T { - String s = "one long incredibly" - + " unbroken sentence" - // comment - + " moving from topic to topic" - // comment - + " so that no-one had a chance" - + " to" - // comment - + " interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/13.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/13.input deleted file mode 100644 index 9a69e87ff..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/13.input +++ /dev/null @@ -1,4 +0,0 @@ -class T { - String s = - "aaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccc dddddddddddddddddd"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/13.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/13.output deleted file mode 100644 index b0225452c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/13.output +++ /dev/null @@ -1,6 +0,0 @@ -class T { - String s = "aaaaaaaaaaaaaaaaaaaaaaaa" - + " bbbbbbbbbbbbbbbbbb" - + " ccccccccccccccccccccccccccc" - + " dddddddddddddddddd"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/14.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/14.input deleted file mode 100644 index ef8ae0c6a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/14.input +++ /dev/null @@ -1,7 +0,0 @@ -class T { - String s = - "aaaaaaaaaaaaaaaaaaaaaaaa " - + "bbbbbbbbbbbbbbbbbb " - + "ccccccccccccccccccccccccccc " - + "dddddddddddddddddd"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/14.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/14.output deleted file mode 100644 index ddf2c6ab8..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/14.output +++ /dev/null @@ -1,6 +0,0 @@ -class T { - String s = "aaaaaaaaaaaaaaaaaaaaaaaa " - + "bbbbbbbbbbbbbbbbbb " - + "ccccccccccccccccccccccccccc " - + "dddddddddddddddddd"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/15.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/15.input deleted file mode 100644 index 64bbab973..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/15.input +++ /dev/null @@ -1,4 +0,0 @@ -class T { - byte[] bytes = - "one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt".getBytes(); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/15.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/15.output deleted file mode 100644 index 708c8ab1e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/15.output +++ /dev/null @@ -1,5 +0,0 @@ -class T { - byte[] bytes = - "one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt" - .getBytes(); -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/16.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/16.input deleted file mode 100644 index 99fb26bc9..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/16.input +++ /dev/null @@ -1,3 +0,0 @@ -class T { - String s = "fields split on \\t, lines on \\r\\n or \\n in C:\\temp\\new\\reports and \\\\server\\share for caf\u00e9\tthen\ndone"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/16.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/16.output deleted file mode 100644 index 4ebf59ae4..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/16.output +++ /dev/null @@ -1,8 +0,0 @@ -class T { - String s = "fields split on \\t," - + " lines on \\r\\n or \\n in" - + " C:\\temp\\new\\reports and" - + " \\\\server\\share for" - + " caf\u00e9\tthen\n" - + "done"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/3.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/3.input deleted file mode 100644 index b2360a739..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/3.input +++ /dev/null @@ -1,3 +0,0 @@ -class T { - String s = "one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/3.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/3.output deleted file mode 100644 index 454801545..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/3.output +++ /dev/null @@ -1,7 +0,0 @@ -class T { - String s = "one long incredibly" - + " unbroken sentence moving" - + " from topic to topic so that" - + " no-one had a chance to" - + " interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/4.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/4.input deleted file mode 100644 index 7c7c6bcf5..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/4.input +++ /dev/null @@ -1,8 +0,0 @@ -class T { - String s = - "one long incredibly unbroken sentence" - + " moving from topic to topic" - + 42 - + " so that no-one had a chance to interr" - + "upt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/4.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/4.output deleted file mode 100644 index 904f43d48..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/4.output +++ /dev/null @@ -1,8 +0,0 @@ -class T { - String s = "one long incredibly" - + " unbroken sentence moving" - + " from topic to topic" - + 42 - + " so that no-one had a chance" - + " to interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/6.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/6.input deleted file mode 100644 index 0e36b3a18..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/6.input +++ /dev/null @@ -1,3 +0,0 @@ -class T { - String s = "\n\none\nlong\nincredibly\nunbroken\nsentence\nmoving\nfrom\n topic\nto\n topic\nso\nthat\nno-one\nhad\na\nchance\nto\ninterrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/6.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/6.output deleted file mode 100644 index 34a24455c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/6.output +++ /dev/null @@ -1,21 +0,0 @@ -class T { - String s = "\n\n" - + "one\n" - + "long\n" - + "incredibly\n" - + "unbroken\n" - + "sentence\n" - + "moving\n" - + "from\n" - + " topic\n" - + "to\n" - + " topic\n" - + "so\n" - + "that\n" - + "no-one\n" - + "had\n" - + "a\n" - + "chance\n" - + "to\n" - + "interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/7.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/7.input deleted file mode 100644 index 876979cf3..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/7.input +++ /dev/null @@ -1,3 +0,0 @@ -class T { - String s = "\n\n\none\n\nlong\n\nincredibly\n\nunbroken\n\nsentence\n\nmoving\n\nfrom\n\n topic\n\nto\n\n topic\n\nso\n\nthat\n\nno-one\n\nhad\n\na\n\nchance\n\nto\n\ninterrupt\n\n"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/7.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/7.output deleted file mode 100644 index 37b5a09a2..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/7.output +++ /dev/null @@ -1,21 +0,0 @@ -class T { - String s = "\n\n\n" - + "one\n\n" - + "long\n\n" - + "incredibly\n\n" - + "unbroken\n\n" - + "sentence\n\n" - + "moving\n\n" - + "from\n\n" - + " topic\n\n" - + "to\n\n" - + " topic\n\n" - + "so\n\n" - + "that\n\n" - + "no-one\n\n" - + "had\n\n" - + "a\n\n" - + "chance\n\n" - + "to\n\n" - + "interrupt\n\n"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/9.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/9.input deleted file mode 100644 index cc5458551..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/9.input +++ /dev/null @@ -1,3 +0,0 @@ -class T { - String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachancetointerrupt_____________________)_"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/9.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/9.output deleted file mode 100644 index 72eab95f9..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/9.output +++ /dev/null @@ -1,4 +0,0 @@ -class T { - String s = - "onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachancetointerrupt_____________________)_"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/ojf-issue-23-marked-literals.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/ojf-issue-23-marked-literals.input deleted file mode 100644 index a8d077bea..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/ojf-issue-23-marked-literals.input +++ /dev/null @@ -1,7 +0,0 @@ -class T { - void f() { - String s = "one long incredibly unbroken sentence moving from topic to topic"; //$NON-NLS-1$ - foo("x", "a long unbroken sentence", "y"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - String t = "short" + " and one long sentence"; //$NON-NLS-1$ //$NON-NLS-2$ - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/ojf-issue-23-marked-literals.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/ojf-issue-23-marked-literals.output deleted file mode 100644 index 8a1a7a10e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/ojf-issue-23-marked-literals.output +++ /dev/null @@ -1,20 +0,0 @@ -class T { - void f() { - String s = "one long" //$NON-NLS-1$ - + " incredibly" //$NON-NLS-1$ - + " unbroken" //$NON-NLS-1$ - + " sentence" //$NON-NLS-1$ - + " moving from" //$NON-NLS-1$ - + " topic to" //$NON-NLS-1$ - + " topic"; //$NON-NLS-1$ - foo( - "x", //$NON-NLS-1$ - "a long" //$NON-NLS-1$ - + " unbroken" //$NON-NLS-1$ - + " sentence", //$NON-NLS-1$ - "y"); //$NON-NLS-1$ - String t = "short" //$NON-NLS-1$ - + " and one long" //$NON-NLS-1$ - + " sentence"; //$NON-NLS-1$ - } -} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/0-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/0-cr.case new file mode 100644 index 000000000..719959d83 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/0-cr.case @@ -0,0 +1 @@ +# A chain of literals that runs past the limit is joined and split again at word boundaries. ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night" + " moving from topic to topic" + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to" + " interrupt"; } ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + " the night moving from topic to topic so that no-one sitting anywhere near the long dining table," + " not even the host or the cook, had a chance to interrupt"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/0-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/0-crlf.case new file mode 100644 index 000000000..630511994 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/0-crlf.case @@ -0,0 +1,15 @@ +# A chain of literals that runs past the limit is joined and split again at word boundaries. +---------- +class T { + String s = + "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night" + + " moving from topic to topic" + + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to" + + " interrupt"; +} +---------- +class T { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + + " the night moving from topic to topic so that no-one sitting anywhere near the long dining table," + + " not even the host or the cook, had a chance to interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/0-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/0-lf.case new file mode 100644 index 000000000..73404d4d4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/0-lf.case @@ -0,0 +1,15 @@ +# A chain of literals that runs past the limit is joined and split again at word boundaries. +---------- +class T { + String s = + "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night" + + " moving from topic to topic" + + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to" + + " interrupt"; +} +---------- +class T { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + + " the night moving from topic to topic so that no-one sitting anywhere near the long dining table," + + " not even the host or the cook, had a chance to interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/10-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/10-cr.case new file mode 100644 index 000000000..289b33126 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/10-cr.case @@ -0,0 +1 @@ +# A long literal before a second semicolon is split at its one space, and the semicolon gets a line of its own. ---------- class T { String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsot atnoonehadachancetointerrupt______________________";; } ---------- class T { String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsot" + " atnoonehadachancetointerrupt______________________"; ; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/10-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/10-crlf.case new file mode 100644 index 000000000..abf1ed6b6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/10-crlf.case @@ -0,0 +1,12 @@ +# A long literal before a second semicolon is split at its one space, and the semicolon gets a line of its own. +---------- +class T { + String s = + "onelongincrediblyunbrokensentencemovingfromtopictotopicsot atnoonehadachancetointerrupt______________________";; +} +---------- +class T { + String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsot" + + " atnoonehadachancetointerrupt______________________"; + ; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/10-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/10-lf.case new file mode 100644 index 000000000..8b3862107 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/10-lf.case @@ -0,0 +1,12 @@ +# A long literal before a second semicolon is split at its one space, and the semicolon gets a line of its own. +---------- +class T { + String s = + "onelongincrediblyunbrokensentencemovingfromtopictotopicsot atnoonehadachancetointerrupt______________________";; +} +---------- +class T { + String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsot" + + " atnoonehadachancetointerrupt______________________"; + ; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/12-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/12-cr.case new file mode 100644 index 000000000..2168445b3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/12-cr.case @@ -0,0 +1 @@ +# Comments between literals split the chain: each run is reflowed on its own, and a run that fits stays. ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night" // comment + " moving from topic to topic" // comment + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to" // comment + " interrupt"; } ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + " the night" // comment + " moving from topic to topic" // comment + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had" + " a chance to" // comment + " interrupt"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/12-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/12-crlf.case new file mode 100644 index 000000000..672a4d7e4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/12-crlf.case @@ -0,0 +1,24 @@ +# Comments between literals split the chain: each run is reflowed on its own, and a run that fits stays. +---------- +class T { + String s = + "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night" + // comment + + " moving from topic to topic" + // comment + + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to" + // comment + + " interrupt"; +} +---------- +class T { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + + " the night" + // comment + + " moving from topic to topic" + // comment + + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had" + + " a chance to" + // comment + + " interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/12-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/12-lf.case new file mode 100644 index 000000000..cb56cec16 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/12-lf.case @@ -0,0 +1,24 @@ +# Comments between literals split the chain: each run is reflowed on its own, and a run that fits stays. +---------- +class T { + String s = + "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night" + // comment + + " moving from topic to topic" + // comment + + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to" + // comment + + " interrupt"; +} +---------- +class T { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + + " the night" + // comment + + " moving from topic to topic" + // comment + + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had" + + " a chance to" + // comment + + " interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/13-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/13-cr.case new file mode 100644 index 000000000..85f0c1763 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/13-cr.case @@ -0,0 +1 @@ +# Words too long to share a line get a piece each, with the space at the start of the next piece. ---------- class T { String s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc dddddddddddddddddddddddddddddddddddddddddddddddddddddd"; } ---------- class T { String s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + " ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" + " dddddddddddddddddddddddddddddddddddddddddddddddddddddd"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/13-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/13-crlf.case new file mode 100644 index 000000000..765382f70 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/13-crlf.case @@ -0,0 +1,13 @@ +# Words too long to share a line get a piece each, with the space at the start of the next piece. +---------- +class T { + String s = + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc dddddddddddddddddddddddddddddddddddddddddddddddddddddd"; +} +---------- +class T { + String s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + + " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + + " ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" + + " dddddddddddddddddddddddddddddddddddddddddddddddddddddd"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/13-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/13-lf.case new file mode 100644 index 000000000..ab2646da0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/13-lf.case @@ -0,0 +1,13 @@ +# Words too long to share a line get a piece each, with the space at the start of the next piece. +---------- +class T { + String s = + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc dddddddddddddddddddddddddddddddddddddddddddddddddddddd"; +} +---------- +class T { + String s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + + " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + + " ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" + + " dddddddddddddddddddddddddddddddddddddddddddddddddddddd"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/14-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/14-cr.case new file mode 100644 index 000000000..e98606de4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/14-cr.case @@ -0,0 +1 @@ +# A chain whose pieces all fit stays as it is, with the spaces at the end of its pieces. ---------- class T { String s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb " + "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc " + "dddddddddddddddddddddddddddddddddddddddddddddddddddddd"; } ---------- class T { String s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb " + "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc " + "dddddddddddddddddddddddddddddddddddddddddddddddddddddd"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/14-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/14-crlf.case new file mode 100644 index 000000000..c81d06171 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/14-crlf.case @@ -0,0 +1,16 @@ +# A chain whose pieces all fit stays as it is, with the spaces at the end of its pieces. +---------- +class T { + String s = + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " + + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb " + + "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc " + + "dddddddddddddddddddddddddddddddddddddddddddddddddddddd"; +} +---------- +class T { + String s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " + + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb " + + "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc " + + "dddddddddddddddddddddddddddddddddddddddddddddddddddddd"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/14-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/14-lf.case new file mode 100644 index 000000000..2010c3ebd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/14-lf.case @@ -0,0 +1,16 @@ +# A chain whose pieces all fit stays as it is, with the spaces at the end of its pieces. +---------- +class T { + String s = + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " + + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb " + + "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc " + + "dddddddddddddddddddddddddddddddddddddddddddddddddddddd"; +} +---------- +class T { + String s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa " + + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb " + + "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc " + + "dddddddddddddddddddddddddddddddddddddddddddddddddddddd"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/15-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/15-cr.case new file mode 100644 index 000000000..916272b13 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/15-cr.case @@ -0,0 +1 @@ +# A literal with a method called on it stays whole, however long. ---------- class T { byte[] bytes = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interrupt".getBytes(); } ---------- class T { byte[] bytes = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interrupt" .getBytes(); } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/15-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/15-crlf.case new file mode 100644 index 000000000..d9b494be4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/15-crlf.case @@ -0,0 +1,12 @@ +# A literal with a method called on it stays whole, however long. +---------- +class T { + byte[] bytes = + "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interrupt".getBytes(); +} +---------- +class T { + byte[] bytes = + "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interrupt" + .getBytes(); +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/15-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/15-lf.case new file mode 100644 index 000000000..873b00762 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/15-lf.case @@ -0,0 +1,12 @@ +# A literal with a method called on it stays whole, however long. +---------- +class T { + byte[] bytes = + "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interrupt".getBytes(); +} +---------- +class T { + byte[] bytes = + "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interrupt" + .getBytes(); +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/16-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/16-cr.case new file mode 100644 index 000000000..32da7b33f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/16-cr.case @@ -0,0 +1 @@ +# An escaped backslash starts no escape of its own: \\t, \\n and \\r\\n stay text, and only the real \t and \n split the string. ---------- class T { String s = "fields split on \\t, lines on \\r\\n or \\n in C:\\temp\\new\\reports and \\\\server\\share for caf\u00e9\tthen\ndone"; } ---------- class T { String s = "fields split on \\t, lines on \\r\\n or \\n in C:\\temp\\new\\reports and \\\\server\\share for caf\u00e9" + "\tthen\n" + "done"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/16-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/16-crlf.case new file mode 100644 index 000000000..be0fdd424 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/16-crlf.case @@ -0,0 +1,12 @@ +# An escaped backslash starts no escape of its own: \\t, \\n and \\r\\n stay text, and only the real \t and \n split the string. +---------- +class T { + String s = "fields split on \\t, lines on \\r\\n or \\n in C:\\temp\\new\\reports and \\\\server\\share for caf\u00e9\tthen\ndone"; +} +---------- +class T { + String s = + "fields split on \\t, lines on \\r\\n or \\n in C:\\temp\\new\\reports and \\\\server\\share for caf\u00e9" + + "\tthen\n" + + "done"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/16-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/16-lf.case new file mode 100644 index 000000000..3049c8db1 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/16-lf.case @@ -0,0 +1,12 @@ +# An escaped backslash starts no escape of its own: \\t, \\n and \\r\\n stay text, and only the real \t and \n split the string. +---------- +class T { + String s = "fields split on \\t, lines on \\r\\n or \\n in C:\\temp\\new\\reports and \\\\server\\share for caf\u00e9\tthen\ndone"; +} +---------- +class T { + String s = + "fields split on \\t, lines on \\r\\n or \\n in C:\\temp\\new\\reports and \\\\server\\share for caf\u00e9" + + "\tthen\n" + + "done"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/3-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/3-cr.case new file mode 100644 index 000000000..5aba4848a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/3-cr.case @@ -0,0 +1 @@ +# One literal past the limit is split at word boundaries, into the same pieces as the chain of 0. ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interrupt"; } ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + " the night moving from topic to topic so that no-one sitting anywhere near the long dining table," + " not even the host or the cook, had a chance to interrupt"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/3-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/3-crlf.case new file mode 100644 index 000000000..b698ac991 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/3-crlf.case @@ -0,0 +1,11 @@ +# One literal past the limit is split at word boundaries, into the same pieces as the chain of 0. +---------- +class T { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interrupt"; +} +---------- +class T { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + + " the night moving from topic to topic so that no-one sitting anywhere near the long dining table," + + " not even the host or the cook, had a chance to interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/3-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/3-lf.case new file mode 100644 index 000000000..67d986ed3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/3-lf.case @@ -0,0 +1,11 @@ +# One literal past the limit is split at word boundaries, into the same pieces as the chain of 0. +---------- +class T { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interrupt"; +} +---------- +class T { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + + " the night moving from topic to topic so that no-one sitting anywhere near the long dining table," + + " not even the host or the cook, had a chance to interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/4-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/4-cr.case new file mode 100644 index 000000000..587b65ed9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/4-cr.case @@ -0,0 +1 @@ +# The literals on each side of the number are reflowed apart, and a word split between two literals is joined. ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night" + " moving from topic to topic" + 42 + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interr" + "upt"; } ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + " the night moving from topic to topic" + 42 + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had" + " a chance to interrupt"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/4-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/4-crlf.case new file mode 100644 index 000000000..8ad0852c9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/4-crlf.case @@ -0,0 +1,18 @@ +# The literals on each side of the number are reflowed apart, and a word split between two literals is joined. +---------- +class T { + String s = + "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night" + + " moving from topic to topic" + + 42 + + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interr" + + "upt"; +} +---------- +class T { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + + " the night moving from topic to topic" + + 42 + + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had" + + " a chance to interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/4-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/4-lf.case new file mode 100644 index 000000000..841e300bd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/4-lf.case @@ -0,0 +1,18 @@ +# The literals on each side of the number are reflowed apart, and a word split between two literals is joined. +---------- +class T { + String s = + "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night" + + " moving from topic to topic" + + 42 + + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interr" + + "upt"; +} +---------- +class T { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + + " the night moving from topic to topic" + + 42 + + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had" + + " a chance to interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/6-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/6-cr.case new file mode 100644 index 000000000..721933f79 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/6-cr.case @@ -0,0 +1 @@ +# A string with \n escapes in it is split after each of them. ---------- class T { String s = "\n\none\nlong\nincredibly\nunbroken\nsentence\nmoving\nfrom\n topic\nto\n topic\nso\nthat\nno-one\nhad\na\nchance\nto\ninterrupt"; } ---------- class T { String s = "\n\n" + "one\n" + "long\n" + "incredibly\n" + "unbroken\n" + "sentence\n" + "moving\n" + "from\n" + " topic\n" + "to\n" + " topic\n" + "so\n" + "that\n" + "no-one\n" + "had\n" + "a\n" + "chance\n" + "to\n" + "interrupt"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/6-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/6-crlf.case new file mode 100644 index 000000000..db63f0bfa --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/6-crlf.case @@ -0,0 +1,27 @@ +# A string with \n escapes in it is split after each of them. +---------- +class T { + String s = "\n\none\nlong\nincredibly\nunbroken\nsentence\nmoving\nfrom\n topic\nto\n topic\nso\nthat\nno-one\nhad\na\nchance\nto\ninterrupt"; +} +---------- +class T { + String s = "\n\n" + + "one\n" + + "long\n" + + "incredibly\n" + + "unbroken\n" + + "sentence\n" + + "moving\n" + + "from\n" + + " topic\n" + + "to\n" + + " topic\n" + + "so\n" + + "that\n" + + "no-one\n" + + "had\n" + + "a\n" + + "chance\n" + + "to\n" + + "interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/6-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/6-lf.case new file mode 100644 index 000000000..8e0b89de4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/6-lf.case @@ -0,0 +1,27 @@ +# A string with \n escapes in it is split after each of them. +---------- +class T { + String s = "\n\none\nlong\nincredibly\nunbroken\nsentence\nmoving\nfrom\n topic\nto\n topic\nso\nthat\nno-one\nhad\na\nchance\nto\ninterrupt"; +} +---------- +class T { + String s = "\n\n" + + "one\n" + + "long\n" + + "incredibly\n" + + "unbroken\n" + + "sentence\n" + + "moving\n" + + "from\n" + + " topic\n" + + "to\n" + + " topic\n" + + "so\n" + + "that\n" + + "no-one\n" + + "had\n" + + "a\n" + + "chance\n" + + "to\n" + + "interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/7-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/7-cr.case new file mode 100644 index 000000000..3407f6904 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/7-cr.case @@ -0,0 +1 @@ +# Two \n escapes in a row stay together at the end of a piece. ---------- class T { String s = "\n\n\none\n\nlong\n\nincredibly\n\nunbroken\n\nsentence\n\nmoving\n\nfrom\n\n topic\n\nto\n\n topic\n\nso\n\nthat\n\nno-one\n\nhad\n\na\n\nchance\n\nto\n\ninterrupt\n\n"; } ---------- class T { String s = "\n\n\n" + "one\n\n" + "long\n\n" + "incredibly\n\n" + "unbroken\n\n" + "sentence\n\n" + "moving\n\n" + "from\n\n" + " topic\n\n" + "to\n\n" + " topic\n\n" + "so\n\n" + "that\n\n" + "no-one\n\n" + "had\n\n" + "a\n\n" + "chance\n\n" + "to\n\n" + "interrupt\n\n"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/7-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/7-crlf.case new file mode 100644 index 000000000..6aae46e41 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/7-crlf.case @@ -0,0 +1,27 @@ +# Two \n escapes in a row stay together at the end of a piece. +---------- +class T { + String s = "\n\n\none\n\nlong\n\nincredibly\n\nunbroken\n\nsentence\n\nmoving\n\nfrom\n\n topic\n\nto\n\n topic\n\nso\n\nthat\n\nno-one\n\nhad\n\na\n\nchance\n\nto\n\ninterrupt\n\n"; +} +---------- +class T { + String s = "\n\n\n" + + "one\n\n" + + "long\n\n" + + "incredibly\n\n" + + "unbroken\n\n" + + "sentence\n\n" + + "moving\n\n" + + "from\n\n" + + " topic\n\n" + + "to\n\n" + + " topic\n\n" + + "so\n\n" + + "that\n\n" + + "no-one\n\n" + + "had\n\n" + + "a\n\n" + + "chance\n\n" + + "to\n\n" + + "interrupt\n\n"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/7-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/7-lf.case new file mode 100644 index 000000000..81543c5a8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/7-lf.case @@ -0,0 +1,27 @@ +# Two \n escapes in a row stay together at the end of a piece. +---------- +class T { + String s = "\n\n\none\n\nlong\n\nincredibly\n\nunbroken\n\nsentence\n\nmoving\n\nfrom\n\n topic\n\nto\n\n topic\n\nso\n\nthat\n\nno-one\n\nhad\n\na\n\nchance\n\nto\n\ninterrupt\n\n"; +} +---------- +class T { + String s = "\n\n\n" + + "one\n\n" + + "long\n\n" + + "incredibly\n\n" + + "unbroken\n\n" + + "sentence\n\n" + + "moving\n\n" + + "from\n\n" + + " topic\n\n" + + "to\n\n" + + " topic\n\n" + + "so\n\n" + + "that\n\n" + + "no-one\n\n" + + "had\n\n" + + "a\n\n" + + "chance\n\n" + + "to\n\n" + + "interrupt\n\n"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/9-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/9-cr.case new file mode 100644 index 000000000..d5b5e20a3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/9-cr.case @@ -0,0 +1 @@ +# A literal past the limit without a space in it stays whole. ---------- class T { String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachancetointerrupt_____________________)_"; } ---------- class T { String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachancetointerrupt_____________________)_"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/9-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/9-crlf.case new file mode 100644 index 000000000..1b913f286 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/9-crlf.case @@ -0,0 +1,10 @@ +# A literal past the limit without a space in it stays whole. +---------- +class T { + String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachancetointerrupt_____________________)_"; +} +---------- +class T { + String s = + "onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachancetointerrupt_____________________)_"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/9-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/9-lf.case new file mode 100644 index 000000000..8e7cf74b8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/9-lf.case @@ -0,0 +1,10 @@ +# A literal past the limit without a space in it stays whole. +---------- +class T { + String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachancetointerrupt_____________________)_"; +} +---------- +class T { + String s = + "onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachancetointerrupt_____________________)_"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/ojf-issue-23-marked-literals-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/ojf-issue-23-marked-literals-cr.case new file mode 100644 index 000000000..2aab13cc5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/ojf-issue-23-marked-literals-cr.case @@ -0,0 +1 @@ +# Every piece of a reflowed literal keeps its //$NON-NLS-n$ marker, numbered on its own line. ---------- class T { void f() { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic"; //$NON-NLS-1$ foo("x", "a long unbroken sentence that went on through breakfast and lunch and dinner and long into the night", "y"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ String t = "short" + " and one long sentence that went on through breakfast and lunch and dinner and long into the night"; //$NON-NLS-1$ //$NON-NLS-2$ } } ---------- class T { void f() { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and" //$NON-NLS-1$ + " dinner and long into the night moving from topic to topic"; //$NON-NLS-1$ foo( "x", //$NON-NLS-1$ "a long unbroken sentence that went on through breakfast and lunch and dinner and long" //$NON-NLS-1$ + " into the night", //$NON-NLS-1$ "y"); //$NON-NLS-1$ String t = "short" //$NON-NLS-1$ + " and one long sentence that went on through breakfast and lunch and dinner and long" //$NON-NLS-1$ + " into the night"; //$NON-NLS-1$ } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/ojf-issue-23-marked-literals-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/ojf-issue-23-marked-literals-crlf.case new file mode 100644 index 000000000..7999df00d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/ojf-issue-23-marked-literals-crlf.case @@ -0,0 +1,24 @@ +# Every piece of a reflowed literal keeps its //$NON-NLS-n$ marker, numbered on its own line. +---------- +class T { + void f() { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic"; //$NON-NLS-1$ + foo("x", "a long unbroken sentence that went on through breakfast and lunch and dinner and long into the night", "y"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String t = "short" + " and one long sentence that went on through breakfast and lunch and dinner and long into the night"; //$NON-NLS-1$ //$NON-NLS-2$ + } +} +---------- +class T { + void f() { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and" //$NON-NLS-1$ + + " dinner and long into the night moving from topic to topic"; //$NON-NLS-1$ + foo( + "x", //$NON-NLS-1$ + "a long unbroken sentence that went on through breakfast and lunch and dinner and long" //$NON-NLS-1$ + + " into the night", //$NON-NLS-1$ + "y"); //$NON-NLS-1$ + String t = "short" //$NON-NLS-1$ + + " and one long sentence that went on through breakfast and lunch and dinner and long" //$NON-NLS-1$ + + " into the night"; //$NON-NLS-1$ + } +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/ojf-issue-23-marked-literals-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/ojf-issue-23-marked-literals-lf.case new file mode 100644 index 000000000..18752b9c9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/ojf-issue-23-marked-literals-lf.case @@ -0,0 +1,24 @@ +# Every piece of a reflowed literal keeps its //$NON-NLS-n$ marker, numbered on its own line. +---------- +class T { + void f() { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic"; //$NON-NLS-1$ + foo("x", "a long unbroken sentence that went on through breakfast and lunch and dinner and long into the night", "y"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String t = "short" + " and one long sentence that went on through breakfast and lunch and dinner and long into the night"; //$NON-NLS-1$ //$NON-NLS-2$ + } +} +---------- +class T { + void f() { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and" //$NON-NLS-1$ + + " dinner and long into the night moving from topic to topic"; //$NON-NLS-1$ + foo( + "x", //$NON-NLS-1$ + "a long unbroken sentence that went on through breakfast and lunch and dinner and long" //$NON-NLS-1$ + + " into the night", //$NON-NLS-1$ + "y"); //$NON-NLS-1$ + String t = "short" //$NON-NLS-1$ + + " and one long sentence that went on through breakfast and lunch and dinner and long" //$NON-NLS-1$ + + " into the night"; //$NON-NLS-1$ + } +} From 32f9155124e326e2225dff373520ca981ef75996 Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Wed, 28 Oct 2026 09:39:25 +0300 Subject: [PATCH 8/9] Continue a wrapped string at the continuation indent of the formatter The pieces of a reflowed string were laid out four columns in, while OJF continues a line eight columns in. The second formatting pass of the wrapper moved them to eight; when that pushed a piece past the limit, the wrapper reflowed the text again and left it unformatted, four columns in. A plain reformat of such output moved the lines, while running the formatter again gave the same output, so nothing noticed. The reflow now takes the continuation indent from the formatter, four columns times the multiplier of its style, for the width of the lines after the first and for the column of their +. Pairs 1, 2, 5, 8 and 11 of StringWrapperIntegrationTest, lengthened like the others, become their LF, CRLF and CR cases. They fail without the fix, and so do 0 and 3, whose continuation line of exactly 120 columns now ends a word earlier: the reflow fills a continuation line up to 119 columns. StringWrapperIntegrationTest and its folder go. A plain reformat leaves the expected output of every case as it is. Of the 15,747 files of the JDK 21 sources, 319 format differently: 292 whose old output a plain reformat changed, and 27 with a continuation line of exactly 120 columns. Tests on JDK 21: FormatterCasesTest 850 -> 865, StringWrapperIntegrationTest 20 -> 0; 1407 tests in the module. --- .../palantir/javaformat/java/Formatter.java | 5 ++ .../javaformat/java/StringWrapper.java | 40 ++++++--- .../java/StringWrapperIntegrationTest.java | 87 ------------------- .../java/StringWrapperIntegrationTest/1.input | 7 -- .../StringWrapperIntegrationTest/1.output | 7 -- .../StringWrapperIntegrationTest/11.input | 3 - .../StringWrapperIntegrationTest/11.output | 4 - .../java/StringWrapperIntegrationTest/2.input | 7 -- .../StringWrapperIntegrationTest/2.output | 7 -- .../java/StringWrapperIntegrationTest/5.input | 3 - .../StringWrapperIntegrationTest/5.output | 4 - .../java/StringWrapperIntegrationTest/8.input | 3 - .../StringWrapperIntegrationTest/8.output | 5 -- .../test-cases/stringwrapper/0-cr.case | 2 +- .../test-cases/stringwrapper/0-crlf.case | 4 +- .../test-cases/stringwrapper/0-lf.case | 4 +- .../test-cases/stringwrapper/1-cr.case | 1 + .../test-cases/stringwrapper/1-crlf.case | 15 ++++ .../test-cases/stringwrapper/1-lf.case | 15 ++++ .../test-cases/stringwrapper/11-cr.case | 1 + .../test-cases/stringwrapper/11-crlf.case | 11 +++ .../test-cases/stringwrapper/11-lf.case | 11 +++ .../test-cases/stringwrapper/2-cr.case | 1 + .../test-cases/stringwrapper/2-crlf.case | 15 ++++ .../test-cases/stringwrapper/2-lf.case | 15 ++++ .../test-cases/stringwrapper/3-cr.case | 2 +- .../test-cases/stringwrapper/3-crlf.case | 4 +- .../test-cases/stringwrapper/3-lf.case | 4 +- .../test-cases/stringwrapper/5-cr.case | 1 + .../test-cases/stringwrapper/5-crlf.case | 11 +++ .../test-cases/stringwrapper/5-lf.case | 11 +++ .../test-cases/stringwrapper/8-cr.case | 1 + .../test-cases/stringwrapper/8-crlf.case | 11 +++ .../test-cases/stringwrapper/8-lf.case | 11 +++ 34 files changed, 175 insertions(+), 158 deletions(-) delete mode 100644 open-java-format/src/test/java/com/palantir/javaformat/java/StringWrapperIntegrationTest.java delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/1.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/1.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/11.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/11.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/2.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/2.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/5.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/5.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/8.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/8.output create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/1-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/1-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/1-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/11-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/11-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/11-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/2-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/2-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/2-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/5-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/5-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/5-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/8-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/8-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/stringwrapper/8-lf.case diff --git a/open-java-format/src/main/java/com/palantir/javaformat/java/Formatter.java b/open-java-format/src/main/java/com/palantir/javaformat/java/Formatter.java index 2f702a474..7c21a6dc6 100644 --- a/open-java-format/src/main/java/com/palantir/javaformat/java/Formatter.java +++ b/open-java-format/src/main/java/com/palantir/javaformat/java/Formatter.java @@ -108,6 +108,11 @@ public static Formatter createFormatter(JavaFormatterOptions options) { return new Formatter(options, false); } + /** The options this formatter formats with. */ + JavaFormatterOptions options() { + return options; + } + /** * Construct a {@code Formatter} given a Java compilation unit. Parses the code; builds a {@link JavaInput} and the * corresponding {@link JavaOutput}. diff --git a/open-java-format/src/main/java/com/palantir/javaformat/java/StringWrapper.java b/open-java-format/src/main/java/com/palantir/javaformat/java/StringWrapper.java index d62ea7e1d..cbcc5a68d 100644 --- a/open-java-format/src/main/java/com/palantir/javaformat/java/StringWrapper.java +++ b/open-java-format/src/main/java/com/palantir/javaformat/java/StringWrapper.java @@ -82,7 +82,10 @@ private static String wrapOnce(final int columnLimit, String input, Formatter fo return input; } - TreeRangeMap replacements = getReflowReplacements(columnLimit, input); + // The pieces continue the way the formatter continues a chain of +: four columns times the multiplier of its + // style, eight in OJF. + var continuationIndent = 4 * formatter.options().indentationMultiplier(); + TreeRangeMap replacements = getReflowReplacements(columnLimit, continuationIndent, input); String firstPass = formatter.formatSource(input, replacements.asMapOfRanges().keySet()); @@ -90,7 +93,7 @@ private static String wrapOnce(final int columnLimit, String input, Formatter fo // If formatting the replacement ranges resulted in a change, recalculate the replacements on // the updated input. input = firstPass; - replacements = getReflowReplacements(columnLimit, input); + replacements = getReflowReplacements(columnLimit, continuationIndent, input); } String result = applyReplacements(input, replacements); @@ -99,7 +102,7 @@ private static String wrapOnce(final int columnLimit, String input, Formatter fo String secondPass = formatter.formatSource(result, rangesAfterAppliedReplacements(replacements)); if (!secondPass.equals(result)) { - replacements = getReflowReplacements(columnLimit, secondPass); + replacements = getReflowReplacements(columnLimit, continuationIndent, secondPass); result = applyReplacements(secondPass, replacements); } @@ -141,21 +144,23 @@ private static ImmutableSet> rangesAfterAppliedReplacements( return outputRanges.build(); } - public static TreeRangeMap getReflowReplacements(int columnLimit, final String input) - throws FormatterException { - return new Reflower(columnLimit, input).getReflowReplacements(); + public static TreeRangeMap getReflowReplacements( + int columnLimit, int continuationIndent, final String input) throws FormatterException { + return new Reflower(columnLimit, continuationIndent, input).getReflowReplacements(); } private static class Reflower { private final String input; private final int columnLimit; + private final int continuationIndent; private final String separator; private final JCTree.JCCompilationUnit unit; private final Position.LineMap lineMap; - Reflower(int columnLimit, String input) throws FormatterException { + Reflower(int columnLimit, int continuationIndent, String input) throws FormatterException { this.columnLimit = columnLimit; + this.continuationIndent = continuationIndent; this.input = input; this.separator = Newlines.guessLineSeparator(input); this.unit = parse(input, /* allowStringFolding= */ false); @@ -418,7 +423,16 @@ private void wrapLongStrings( // Get the original source text of the string literals, excluding `"` and `+`. ImmutableList components = stringComponents(input, unit, flat); - var plain = reflow(columnLimit, trailing, components, first.get(), startColumn, fistLineCol, "", ""); + var plain = reflow( + columnLimit, + continuationIndent, + trailing, + components, + first.get(), + startColumn, + fistLineCol, + "", + ""); chains.add(new Chain( flat, first.get(), @@ -443,6 +457,7 @@ private void wrapLongStrings( var components = stringComponents(input, unit, chain.flat()); var pieces = reflow( columnLimit, + continuationIndent, markers.tail(2).length(), components, chain.firstInChain(), @@ -460,7 +475,7 @@ private String join(Chain chain, List pieces, String firstLineMarkers, S return render( separator, pieces, - chain.firstInChain() ? chain.firstLineColumn() + 4 : chain.startColumn() - 2, + chain.firstInChain() ? chain.firstLineColumn() + continuationIndent : chain.startColumn() - 2, firstLineMarkers, otherLineMarkers); } @@ -680,6 +695,8 @@ private static boolean isEscaped(String input, int idx) { * {@link #render}. * * @param columnLimit the number of columns to wrap at + * @param continuationIndent how far the lines after the first are indented from the start of the first, before + * their {@code + }, when the text begins its chain * @param trailing extra space to leave after the last line * @param components the text to reflow * @param first0 true if the text includes the beginning of its enclosing concat chain, i.e. a @@ -692,6 +709,7 @@ private static boolean isEscaped(String input, int idx) { */ private static List reflow( int columnLimit, + int continuationIndent, int trailing, ImmutableList components, boolean first0, @@ -727,8 +745,8 @@ private static List reflow( // add the split line to the output, and process whatever's left lines.add(String.join("", line)); if (first) { - // Subsequent lines have a four-space continuation indent and a `+ `. - width -= 6; + // Subsequent lines have a continuation indent and a `+ `. + width -= continuationIndent + 2; // Also, switch to firstLineStartColumn in order to account for the fact that continuations // should get indented from the beginning of the first line. // This is to handle cases like: diff --git a/open-java-format/src/test/java/com/palantir/javaformat/java/StringWrapperIntegrationTest.java b/open-java-format/src/test/java/com/palantir/javaformat/java/StringWrapperIntegrationTest.java deleted file mode 100644 index f5fa126b0..000000000 --- a/open-java-format/src/test/java/com/palantir/javaformat/java/StringWrapperIntegrationTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2019 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ - -package com.palantir.javaformat.java; - -import static com.google.common.truth.Truth.assertThat; -import static com.palantir.javaformat.java.FileBasedTests.assumeJavaVersionForTest; -import static com.palantir.javaformat.java.FileBasedTests.isRecreate; - -import com.palantir.javaformat.jupiter.ParameterizedClass; -import java.io.IOException; -import java.util.List; -import org.junit.jupiter.api.Assumptions; -import org.junit.jupiter.api.TestTemplate; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.api.parallel.Execution; -import org.junit.jupiter.api.parallel.ExecutionMode; - -@ExtendWith(ParameterizedClass.class) -@Execution(ExecutionMode.CONCURRENT) -public class StringWrapperIntegrationTest { - - private static FileBasedTests tests = new FileBasedTests(StringWrapperIntegrationTest.class); - - @ParameterizedClass.Parameters(name = "{0}") - public static List parameters() throws IOException { - return tests.paramsAsNameInputOutput(); - } - - private final Formatter formatter = Formatter.create(); - - private final String name; - private final String input; - private final String output; - - public StringWrapperIntegrationTest(String name, String input, String output) { - this.name = name; - this.input = input; - this.output = output; - } - - @TestTemplate - public void test() throws Exception { - assumeJavaVersionForTest(name); - String actualOutput = StringWrapper.wrap(40, formatter.formatSource(input), formatter); - if (isRecreate()) { - tests.writeFormatterOutput(name, actualOutput); - } else { - assertThat(actualOutput).isEqualTo(output); - } - } - - @TestTemplate - public void testCR() throws Exception { - assumeJavaVersionForTest(name); - Assumptions.assumeFalse(isRecreate(), "Not running when recreating test outputs"); - assertThat(StringWrapper.wrap(40, formatter.formatSource(input.replace("\n", "\r")), formatter)) - .isEqualTo(output.replace("\n", "\r")); - } - - @TestTemplate - public void testCRLF() throws Exception { - assumeJavaVersionForTest(name); - Assumptions.assumeFalse(isRecreate(), "Not running when recreating test outputs"); - assertThat(StringWrapper.wrap(40, formatter.formatSource(input.replace("\n", "\r\n")), formatter)) - .isEqualTo(output.replace("\n", "\r\n")); - } - - @TestTemplate - public void idempotent() throws Exception { - assumeJavaVersionForTest(name); - Assumptions.assumeFalse(isRecreate(), "Not running when recreating test outputs"); - String wrap = StringWrapper.wrap(40, formatter.formatSource(input), formatter); - assertThat(formatter.formatSource(wrap)).isEqualTo(wrap); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/1.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/1.input deleted file mode 100644 index 5a9a64abb..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/1.input +++ /dev/null @@ -1,7 +0,0 @@ -class T { - String s = - "one long incredibly unbroken" - + " sentence moving from topic to topic so that" - + " no-one had a chance to" - + " interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/1.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/1.output deleted file mode 100644 index 454801545..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/1.output +++ /dev/null @@ -1,7 +0,0 @@ -class T { - String s = "one long incredibly" - + " unbroken sentence moving" - + " from topic to topic so that" - + " no-one had a chance to" - + " interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/11.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/11.input deleted file mode 100644 index f69b2d852..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/11.input +++ /dev/null @@ -1,3 +0,0 @@ -class T { - String s = "__ onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachanceto interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/11.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/11.output deleted file mode 100644 index 928706bfc..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/11.output +++ /dev/null @@ -1,4 +0,0 @@ -class T { - String s = "__ onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachanceto" - + " interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/2.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/2.input deleted file mode 100644 index 6cf14bc13..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/2.input +++ /dev/null @@ -1,7 +0,0 @@ -class T { - String s = - "one long incredibly unbroken" - + " sentence moving from topic to topic" - + " so that no-one had a chance to interr" - + "upt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/2.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/2.output deleted file mode 100644 index 454801545..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/2.output +++ /dev/null @@ -1,7 +0,0 @@ -class T { - String s = "one long incredibly" - + " unbroken sentence moving" - + " from topic to topic so that" - + " no-one had a chance to" - + " interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/5.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/5.input deleted file mode 100644 index 60c0d0726..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/5.input +++ /dev/null @@ -1,3 +0,0 @@ -class T { - String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachanceto interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/5.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/5.output deleted file mode 100644 index f3041efca..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/5.output +++ /dev/null @@ -1,4 +0,0 @@ -class T { - String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachanceto" - + " interrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/8.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/8.input deleted file mode 100644 index 9d550a66a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/8.input +++ /dev/null @@ -1,3 +0,0 @@ -class T { - String s = "onelongincrediblyunbrokensenten\tcemovingfromtopictotopicsothatnoonehadachance tointerrupt"; -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/8.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/8.output deleted file mode 100644 index e6da0af94..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/8.output +++ /dev/null @@ -1,5 +0,0 @@ -class T { - String s = "onelongincrediblyunbrokensenten" - + "\tcemovingfromtopictotopicsothatnoonehadachance" - + " tointerrupt"; -} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/0-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/0-cr.case index 719959d83..eb46ea9dc 100644 --- a/open-java-format/src/test/resources/test-cases/stringwrapper/0-cr.case +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/0-cr.case @@ -1 +1 @@ -# A chain of literals that runs past the limit is joined and split again at word boundaries. ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night" + " moving from topic to topic" + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to" + " interrupt"; } ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + " the night moving from topic to topic so that no-one sitting anywhere near the long dining table," + " not even the host or the cook, had a chance to interrupt"; } \ No newline at end of file +# A chain of literals that runs past the limit is joined and split again at word boundaries. ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night" + " moving from topic to topic" + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to" + " interrupt"; } ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + " the night moving from topic to topic so that no-one sitting anywhere near the long dining" + " table, not even the host or the cook, had a chance to interrupt"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/0-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/0-crlf.case index 630511994..4a2d4dcb8 100644 --- a/open-java-format/src/test/resources/test-cases/stringwrapper/0-crlf.case +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/0-crlf.case @@ -10,6 +10,6 @@ class T { ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" - + " the night moving from topic to topic so that no-one sitting anywhere near the long dining table," - + " not even the host or the cook, had a chance to interrupt"; + + " the night moving from topic to topic so that no-one sitting anywhere near the long dining" + + " table, not even the host or the cook, had a chance to interrupt"; } diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/0-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/0-lf.case index 73404d4d4..3c344e97d 100644 --- a/open-java-format/src/test/resources/test-cases/stringwrapper/0-lf.case +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/0-lf.case @@ -10,6 +10,6 @@ class T { ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" - + " the night moving from topic to topic so that no-one sitting anywhere near the long dining table," - + " not even the host or the cook, had a chance to interrupt"; + + " the night moving from topic to topic so that no-one sitting anywhere near the long dining" + + " table, not even the host or the cook, had a chance to interrupt"; } diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/1-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/1-cr.case new file mode 100644 index 000000000..b69d91ae5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/1-cr.case @@ -0,0 +1 @@ +# A chain whose second literal runs past the limit is reflowed from its first literal on. ---------- class T { String s = "one long incredibly unbroken" + " sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic so that" + " no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to" + " interrupt"; } ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long" + " into the night moving from topic to topic so that no-one sitting anywhere near the long dining table," + " not even the host or the cook, had a chance to interrupt"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/1-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/1-crlf.case new file mode 100644 index 000000000..d041ff4a7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/1-crlf.case @@ -0,0 +1,15 @@ +# A chain whose second literal runs past the limit is reflowed from its first literal on. +---------- +class T { + String s = + "one long incredibly unbroken" + + " sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic so that" + + " no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to" + + " interrupt"; +} +---------- +class T { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long" + + " into the night moving from topic to topic so that no-one sitting anywhere near the long dining table," + + " not even the host or the cook, had a chance to interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/1-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/1-lf.case new file mode 100644 index 000000000..3eaa315a2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/1-lf.case @@ -0,0 +1,15 @@ +# A chain whose second literal runs past the limit is reflowed from its first literal on. +---------- +class T { + String s = + "one long incredibly unbroken" + + " sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic so that" + + " no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to" + + " interrupt"; +} +---------- +class T { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long" + + " into the night moving from topic to topic so that no-one sitting anywhere near the long dining table," + + " not even the host or the cook, had a chance to interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/11-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/11-cr.case new file mode 100644 index 000000000..9f042d2f8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/11-cr.case @@ -0,0 +1 @@ +# A first word of four characters or less stays with the next one, even when that one runs past the limit. ---------- class T { String s = "__ onelongincrediblyunbrokensentencethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachanceto interrupt"; } ---------- class T { String s = "__ onelongincrediblyunbrokensentencethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachanceto" + " interrupt"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/11-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/11-crlf.case new file mode 100644 index 000000000..4b9784e87 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/11-crlf.case @@ -0,0 +1,11 @@ +# A first word of four characters or less stays with the next one, even when that one runs past the limit. +---------- +class T { + String s = "__ onelongincrediblyunbrokensentencethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachanceto interrupt"; +} +---------- +class T { + String s = + "__ onelongincrediblyunbrokensentencethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachanceto" + + " interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/11-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/11-lf.case new file mode 100644 index 000000000..9a6e929e8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/11-lf.case @@ -0,0 +1,11 @@ +# A first word of four characters or less stays with the next one, even when that one runs past the limit. +---------- +class T { + String s = "__ onelongincrediblyunbrokensentencethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachanceto interrupt"; +} +---------- +class T { + String s = + "__ onelongincrediblyunbrokensentencethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachanceto" + + " interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/2-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/2-cr.case new file mode 100644 index 000000000..422b0fa76 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/2-cr.case @@ -0,0 +1 @@ +# A word split between two literals is joined when their chain is reflowed; 1 gives the same output. ---------- class T { String s = "one long incredibly unbroken" + " sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic" + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interr" + "upt"; } ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long" + " into the night moving from topic to topic so that no-one sitting anywhere near the long dining table," + " not even the host or the cook, had a chance to interrupt"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/2-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/2-crlf.case new file mode 100644 index 000000000..4a93943c1 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/2-crlf.case @@ -0,0 +1,15 @@ +# A word split between two literals is joined when their chain is reflowed; 1 gives the same output. +---------- +class T { + String s = + "one long incredibly unbroken" + + " sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic" + + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interr" + + "upt"; +} +---------- +class T { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long" + + " into the night moving from topic to topic so that no-one sitting anywhere near the long dining table," + + " not even the host or the cook, had a chance to interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/2-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/2-lf.case new file mode 100644 index 000000000..de41c51c3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/2-lf.case @@ -0,0 +1,15 @@ +# A word split between two literals is joined when their chain is reflowed; 1 gives the same output. +---------- +class T { + String s = + "one long incredibly unbroken" + + " sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic" + + " so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interr" + + "upt"; +} +---------- +class T { + String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long" + + " into the night moving from topic to topic so that no-one sitting anywhere near the long dining table," + + " not even the host or the cook, had a chance to interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/3-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/3-cr.case index 5aba4848a..9ac038e61 100644 --- a/open-java-format/src/test/resources/test-cases/stringwrapper/3-cr.case +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/3-cr.case @@ -1 +1 @@ -# One literal past the limit is split at word boundaries, into the same pieces as the chain of 0. ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interrupt"; } ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + " the night moving from topic to topic so that no-one sitting anywhere near the long dining table," + " not even the host or the cook, had a chance to interrupt"; } \ No newline at end of file +# One literal past the limit is split at word boundaries, into the same pieces as the chain of 0. ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into the night moving from topic to topic so that no-one sitting anywhere near the long dining table, not even the host or the cook, had a chance to interrupt"; } ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" + " the night moving from topic to topic so that no-one sitting anywhere near the long dining" + " table, not even the host or the cook, had a chance to interrupt"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/3-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/3-crlf.case index b698ac991..322886bfa 100644 --- a/open-java-format/src/test/resources/test-cases/stringwrapper/3-crlf.case +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/3-crlf.case @@ -6,6 +6,6 @@ class T { ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" - + " the night moving from topic to topic so that no-one sitting anywhere near the long dining table," - + " not even the host or the cook, had a chance to interrupt"; + + " the night moving from topic to topic so that no-one sitting anywhere near the long dining" + + " table, not even the host or the cook, had a chance to interrupt"; } diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/3-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/3-lf.case index 67d986ed3..a97ac9aeb 100644 --- a/open-java-format/src/test/resources/test-cases/stringwrapper/3-lf.case +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/3-lf.case @@ -6,6 +6,6 @@ class T { ---------- class T { String s = "one long incredibly unbroken sentence that went on through breakfast and lunch and dinner and long into" - + " the night moving from topic to topic so that no-one sitting anywhere near the long dining table," - + " not even the host or the cook, had a chance to interrupt"; + + " the night moving from topic to topic so that no-one sitting anywhere near the long dining" + + " table, not even the host or the cook, had a chance to interrupt"; } diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/5-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/5-cr.case new file mode 100644 index 000000000..eab84a48e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/5-cr.case @@ -0,0 +1 @@ +# A word too long for any line is a piece of its own, and the rest of the string goes to the next line. ---------- class T { String s = "onelongincrediblyunbrokensentencethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachanceto interrupt"; } ---------- class T { String s = "onelongincrediblyunbrokensentencethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachanceto" + " interrupt"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/5-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/5-crlf.case new file mode 100644 index 000000000..b1437aaa9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/5-crlf.case @@ -0,0 +1,11 @@ +# A word too long for any line is a piece of its own, and the rest of the string goes to the next line. +---------- +class T { + String s = "onelongincrediblyunbrokensentencethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachanceto interrupt"; +} +---------- +class T { + String s = + "onelongincrediblyunbrokensentencethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachanceto" + + " interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/5-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/5-lf.case new file mode 100644 index 000000000..ea6a904c2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/5-lf.case @@ -0,0 +1,11 @@ +# A word too long for any line is a piece of its own, and the rest of the string goes to the next line. +---------- +class T { + String s = "onelongincrediblyunbrokensentencethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachanceto interrupt"; +} +---------- +class T { + String s = + "onelongincrediblyunbrokensentencethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachanceto" + + " interrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/8-cr.case b/open-java-format/src/test/resources/test-cases/stringwrapper/8-cr.case new file mode 100644 index 000000000..51e0efe9f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/8-cr.case @@ -0,0 +1 @@ +# An escaped tab is a place to split the string, like a space, even inside a word. ---------- class T { String s = "onelongincrediblyunbrokensenten\tcethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachance tointerrupt"; } ---------- class T { String s = "onelongincrediblyunbrokensenten" + "\tcethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachance" + " tointerrupt"; } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/8-crlf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/8-crlf.case new file mode 100644 index 000000000..fbb0d090a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/8-crlf.case @@ -0,0 +1,11 @@ +# An escaped tab is a place to split the string, like a space, even inside a word. +---------- +class T { + String s = "onelongincrediblyunbrokensenten\tcethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachance tointerrupt"; +} +---------- +class T { + String s = "onelongincrediblyunbrokensenten" + + "\tcethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachance" + + " tointerrupt"; +} diff --git a/open-java-format/src/test/resources/test-cases/stringwrapper/8-lf.case b/open-java-format/src/test/resources/test-cases/stringwrapper/8-lf.case new file mode 100644 index 000000000..6ac830e38 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringwrapper/8-lf.case @@ -0,0 +1,11 @@ +# An escaped tab is a place to split the string, like a space, even inside a word. +---------- +class T { + String s = "onelongincrediblyunbrokensenten\tcethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachance tointerrupt"; +} +---------- +class T { + String s = "onelongincrediblyunbrokensenten" + + "\tcethatwentonthroughbreakfastandlunchanddinnerandlongintothenightmovingfromtopictotopicsothatnoonehadachance" + + " tointerrupt"; +} From d5e569eafa60bd52f279813f9db5e3c5e4854932 Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Wed, 28 Oct 2026 09:41:00 +0300 Subject: [PATCH 9/9] Move five more testdata pairs into cases, with copies for the modules that read two of them A and palantir-deeply-nested-calls stayed in testdata/ because other modules read them. Those modules now keep their own copies: the IntelliJ plugin test reads A.input and A.output from its own test resources, and PalantirDeeplyNestedCalls.java of the benchmarks is a file instead of a symlink into testdata/. Both pairs become their LF, CRLF and CR cases byte for byte. M, Unformatted and ojf-issue-24-jbang-script become cases whose after block also takes the import pass, which a case runs and FormatterIntegrationTest skipped: M loses the blank line between its two imports, Unformatted gets its imports sorted into one block, and the JBang script gets a blank line between the comment after its last import and the annotated class. The rest of each output is as before. testdata/ keeps B21647014 and ModuleImport. The import pass would remove the unused import of B21647014 before formatting, and one of the stray semicolons after it with it; ModuleImport needs JDK 23. Tests on JDK 21: FormatterIntegrationTest 28 -> 8, FormatterCasesTest 865 -> 880; 1402 tests in the module. --- open-java-format-benchmarks/build.gradle | 2 +- .../resources/PalantirDeeplyNestedCalls.java | 94 +- ...lantirJavaFormatFormattingServiceTest.java | 6 +- .../src/test/resources}/A.input | 0 .../src/test/resources}/A.output | 0 .../palantir/javaformat/java/testdata/M.input | 399 ----- .../java/testdata/Unformatted.output | 58 - .../testdata/ojf-issue-24-jbang-script.input | 20 - .../palantir-deeply-nested-calls.input | 93 -- .../palantir-deeply-nested-calls.output | 93 -- .../resources/test-cases/testdata/A-cr.case | 1 + .../resources/test-cases/testdata/A-crlf.case | 186 +++ .../resources/test-cases/testdata/A-lf.case | 186 +++ .../resources/test-cases/testdata/M-cr.case | 1 + .../resources/test-cases/testdata/M-crlf.case | 1410 +++++++++++++++++ .../testdata/M-lf.case} | 400 +++++ .../test-cases/testdata/Unformatted-cr.case | 1 + .../test-cases/testdata/Unformatted-crlf.case | 102 ++ .../testdata/Unformatted-lf.case} | 59 + .../ojf-issue-24-jbang-script-cr.case | 1 + .../ojf-issue-24-jbang-script-crlf.case | 47 + .../ojf-issue-24-jbang-script-lf.case} | 23 + .../palantir-deeply-nested-calls-cr.case | 1 + .../palantir-deeply-nested-calls-crlf.case | 188 +++ .../palantir-deeply-nested-calls-lf.case | 188 +++ 25 files changed, 2890 insertions(+), 669 deletions(-) mode change 120000 => 100644 open-java-format-benchmarks/src/test/resources/PalantirDeeplyNestedCalls.java rename {open-java-format/src/test/resources/com/palantir/javaformat/java/testdata => open-java-format-idea-plugin/src/test/resources}/A.input (100%) rename {open-java-format/src/test/resources/com/palantir/javaformat/java/testdata => open-java-format-idea-plugin/src/test/resources}/A.output (100%) delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted.output delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-script.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.input delete mode 100644 open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.output create mode 100644 open-java-format/src/test/resources/test-cases/testdata/A-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/A-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/A-lf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/M-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/M-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/M.output => test-cases/testdata/M-lf.case} (65%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Unformatted-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/Unformatted-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/Unformatted.input => test-cases/testdata/Unformatted-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-script-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-script-crlf.case rename open-java-format/src/test/resources/{com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-script.output => test-cases/testdata/ojf-issue-24-jbang-script-lf.case} (50%) create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-cr.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-crlf.case create mode 100644 open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-lf.case diff --git a/open-java-format-benchmarks/build.gradle b/open-java-format-benchmarks/build.gradle index 0a3688c28..51df42f80 100644 --- a/open-java-format-benchmarks/build.gradle +++ b/open-java-format-benchmarks/build.gradle @@ -32,7 +32,7 @@ tasks.named('jmh', JMHTask.class) { environment.put('JARS_CLASSPATH', configurations.named('formatterNativeJars').map { conf -> conf.collect { it.absolutePath }.join(":") }) } -// src/test/resources/PalantirDeeplyNestedCalls.java is a symlink to a formatter test input, which has to +// src/test/resources/PalantirDeeplyNestedCalls.java is a copy of a formatter test input, which has to // keep its unformatted shape: leave src/test/resources out of any formatting step added to this build. jmhCompileGeneratedClasses { diff --git a/open-java-format-benchmarks/src/test/resources/PalantirDeeplyNestedCalls.java b/open-java-format-benchmarks/src/test/resources/PalantirDeeplyNestedCalls.java deleted file mode 120000 index 1dd966c5c..000000000 --- a/open-java-format-benchmarks/src/test/resources/PalantirDeeplyNestedCalls.java +++ /dev/null @@ -1 +0,0 @@ -../../../../open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.input \ No newline at end of file diff --git a/open-java-format-benchmarks/src/test/resources/PalantirDeeplyNestedCalls.java b/open-java-format-benchmarks/src/test/resources/PalantirDeeplyNestedCalls.java new file mode 100644 index 000000000..af5ef3b31 --- /dev/null +++ b/open-java-format-benchmarks/src/test/resources/PalantirDeeplyNestedCalls.java @@ -0,0 +1,93 @@ +class PalantirDeeplyNestedCalls { + private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldOneV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldFourV1)) + .build())) + .build())) + .build())) + .build())) + .build(); + + void testMethod() { + assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) + .containsExactlyInAnyOrderElementsOf(Set.of( + new ItemWithCustomLocator( + ItemConfigV1.DEFAULT_CONFIG.toCustomString(), + ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_ITEM_A)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) + .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 + .apiName() + .get())) + .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), + // Discovered items + new ItemWithCustomLocator( + TestModelCatalog.MODEL_ABC_456.toItemApi(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_API_NAME)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())))); + } + + public Map otherMethod( + FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { + return myCustomService + .get() + .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) + .entrySet() + .stream() + .collect(Collectors.toMap( + Map.Entry::getKey, entry -> entry.getValue().getMetrics())); + } +} diff --git a/open-java-format-idea-plugin/src/test/java/com/palantir/javaformat/intellij/PalantirJavaFormatFormattingServiceTest.java b/open-java-format-idea-plugin/src/test/java/com/palantir/javaformat/intellij/PalantirJavaFormatFormattingServiceTest.java index 6828b06ad..64050f4d5 100644 --- a/open-java-format-idea-plugin/src/test/java/com/palantir/javaformat/intellij/PalantirJavaFormatFormattingServiceTest.java +++ b/open-java-format-idea-plugin/src/test/java/com/palantir/javaformat/intellij/PalantirJavaFormatFormattingServiceTest.java @@ -82,10 +82,8 @@ void tearDown() throws Exception { @Test void defaultFormatSettings() throws Exception { - String input = Files.readString( - Paths.get("../open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.input")); - String output = Files.readString( - Path.of("../open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.output")); + String input = Files.readString(Paths.get("src/test/resources/A.input")); + String output = Files.readString(Path.of("src/test/resources/A.output")); PsiFile file = createPsiFile("com/foo/FormatTest.java", input); ReformatCodeProcessor processor = new ReformatCodeProcessor(file, false); WriteCommandAction.runWriteCommandAction(file.getProject(), () -> { diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.input b/open-java-format-idea-plugin/src/test/resources/A.input similarity index 100% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.input rename to open-java-format-idea-plugin/src/test/resources/A.input diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.output b/open-java-format-idea-plugin/src/test/resources/A.output similarity index 100% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.output rename to open-java-format-idea-plugin/src/test/resources/A.output diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M.input deleted file mode 100644 index 56f4ccf89..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M.input +++ /dev/null @@ -1,399 +0,0 @@ -package com.google.googlejavaformat.java.test; - -import com.google.common.collect.ImmutableList; - -import java.util.List; - -/** - * Tests for MarkerAnnotations, MemberValuePairs, MethodDeclarations, MethodInvocations, and - * Modifiers. - */ -@MarkerAnnotation -class M { - class Exception0 extends Exception {} - - class Exception1 extends Exception {} - - class Exception2 extends Exception {} - - class Exception3 extends Exception {} - - class Exception4 extends Exception {} - - class Exception5 extends Exception {} - - class Exception6 extends Exception {} - - class Exception7 extends Exception {} - - class Exception8 extends Exception {} - - class Exception9 extends Exception {} - - void methodName1(int x) {} - - void methodName2(int x) throws Exception {} - - /** - * JavaDoc. - */ - void methodName3(int x) - throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, - Exception7, Exception8, Exception9 {} - - /** - * JavaDoc. - */ - void methodName4( - int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, - int n, int o, int p, int q, int r, int s, int t, int u, int v) {} - - /** - * JavaDoc. - */ - void methodName5( - int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, - int n, int o, int p, int q, int r, int s, int t, int u, int v) - throws Exception {} - - /** - * JavaDoc. - */ - void methodName6( - int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, - int n, int o, int p, int q, int r, int s, int t, int u, int v) - throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, - Exception7, Exception8, Exception9 {} - - Pair< - Pair, Pair>, Pair, Pair>>, - Pair, Pair>, Pair, Pair>>> - methodName10(int x) { - return null; - } - - Pair< - Pair, Pair>, Pair, Pair>>, - Pair, Pair>, Pair, Pair>>> - methodName12(int x) throws Exception { - return null; - } - - Pair< - Pair, Pair>, Pair, Pair>>, - Pair, Pair>, Pair, Pair>>> - methodName11(int x) - throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, - Exception7, Exception8, Exception9 { - return null; - } - - Pair< - Pair, Pair>, Pair, Pair>>, - Pair, Pair>, Pair, Pair>>> - methodName15( - int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, - int n, int o, int p, int q, int r, int s, int t, int u, int v) { - return null; - } - - Pair< - Pair, Pair>, Pair, Pair>>, - Pair, Pair>, Pair, Pair>>> - methodName14( - int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, - int n, int o, int p, int q, int r, int s, int t, int u, int v) - throws Exception { - return null; - } - - Pair< - Pair, Pair>, Pair, Pair>>, - Pair, Pair>, Pair, Pair>>> - methodName13( - int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, - int n, int o, int p, int q, int r, int s, int t, int u, int v) - throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, - Exception7, Exception8, Exception9 { - return null; - } - - - T methodName20(int x) { - return null; - } - - - T methodName21(int x) throws Exception { - return null; - } - - - T methodName22(int x) - throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, - Exception7, Exception8, Exception9 { - return null; - } - - - T methodName22( - int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, - int n, int o, int p, int q, int r, int s, int t, int u, int v) { - return null; - } - - - T methodName23( - int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, - int n, int o, int p, int q, int r, int s, int t, int u, int v) - throws Exception { - return null; - } - - - T methodName30( - int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, - int n, int o, int p, int q, int r, int s, int t, int u, int v) - throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, - Exception7, Exception8, Exception9 { - return null; - } - - - Pair< - Pair, Pair>, Pair, Pair>>, - Pair, Pair>, Pair, Pair>>> - methodName31(int x) { - return null; - } - - - Pair< - Pair, Pair>, Pair, Pair>>, - Pair, Pair>, Pair, Pair>>> - methodName32(int x) throws Exception { - return null; - } - - - Pair< - Pair, Pair>, Pair, Pair>>, - Pair, Pair>, Pair, Pair>>> - methodName(int x) - throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, - Exception6, Exception7, Exception8, Exception9 { - return null; - } - - - Pair< - Pair, Pair>, Pair, Pair>>, - Pair, Pair>, Pair, Pair>>> - methodName41( - int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, - int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) { - return null; - } - - - Pair< - Pair, Pair>, Pair, Pair>>, - Pair, Pair>, Pair, Pair>>> - methodName40( - int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, - int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) - throws Exception { - return null; - } - - - Pair< - Pair, Pair>, Pair, Pair>>, - Pair, Pair>, Pair, Pair>>> - methodName( - int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, - int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) - throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, - Exception6, Exception7, Exception8, Exception9 { - return null; - } - - static void m() {} - - M identity() { - return this; - } - - void f(double x) { - List> list1 = ImmutableList.>of(null); - List, Pair>> list2 = - ImmutableList., Pair>>of(null); - List< - Pair< - Pair, Pair>, - Pair, Pair>>> - list3 = - ImmutableList - ., Pair>, - Pair, Pair>>> - of(null); - Pair pair1 = - ImmutableList.>of(null).get( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); - Pair, Pair> pair2 = - ImmutableList., Pair>>of(null).get( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); - Pair< - Pair, Pair>, - Pair, Pair>> - pair3 = - ImmutableList - ., Pair>, - Pair, Pair>>> - of(null) - .get( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); - } - - void f(int... x) { - M m = null; - ((m.identity().identity().identity().identity()).identity().identity().identity().identity()) - .identity() - .identity() - .identity() - .identity(); - f( - x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] + x[11] + x[12] + x[13] - + x[14] + x[15]); - } - - static void method999(Object... args) { - method999(1, 2, 3, 4, 5); - method999(1, 2, 3, 4, 5); - method999( - 1, 2, - 3, 4, - 5, 6); - method999(1, 2, 3, 4, 5, 6); - method999("one", 1, "two", 2, "three", 3); - method999("one", 1); - method999( - "one", 1, - "two", 2); - method999( - "one", 1, - "two", 1 + 1, - "three", 1 + 1 + 1); - method999( - "xxxxxxxxxxxxxx", - "xxxxxxxxxxxxxx", - "xxxxxxxxxxxxxx", - "xxxxxxxxxxxxxx", - "xxxxxxxxxxxxxx", - "xxxxxxxxxxxxxx", - "xxxxxxxxxxxxxx", - "xxxxxxxxxxxxxx", - "xxxxxxxxxxxxxx", - "xxxxxxxxxxxxxx", - "xxxxxxxxxxxxxx"); - } - - static class Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx { - static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx fff( - int x) { - return null; - } - } - - static - class Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx { - static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx fff( - int x) { - return null; - } - - static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - ffffffffff(int x) { - return null; - } - } - - M xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = null; - M xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = - null; - - M fff(int x) { - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0); - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - .ffffffffff(0); - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0).fff(0); - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0 + 0).fff( - 0); - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - .fff( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) - .fff(0); - Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - .ffffffffff(0) - .fff(0); - return this; - } - - M ffffffffff(int x) { - return this; - } - - M ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(int x) { - new M().ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff( - 0 + 0 + 0 + 0); - ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0); - ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff( - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); - ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0).f(0); - ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0) - .fff(0) - .fff(0) - .f(0); - ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0).ffffffffff( - 0); - return this; - } - - - M( - ZZZZZZZZZZ z, - ZZZZZZZZZZ z, - ZZZZZZZZZZ z, - ZZZZZZZZZZ z, - ZZZZZZZZZZ z, - ZZZZZZZZZZ z, - ZZZZZZZZZZ z, - ZZZZZZZZZZ z, - ZZZZZZZZZZ z, - ZZZZZZZZZZ z) - throws EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, - EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE {} -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted.output deleted file mode 100644 index 53382b50a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted.output +++ /dev/null @@ -1,58 +0,0 @@ -package com.google.googlejavaformat.java.javatests; - -import com.google.common.base.Charsets; -import com.google.common.collect.Range; -import com.google.common.collect.RangeSet; -import com.google.common.collect.TreeRangeSet; -import com.google.googlejavaformat.java.Formatter; -import com.google.googlejavaformat.java.JavaCommentsHelper; -import com.google.googlejavaformat.java.JavaInput; -import com.google.googlejavaformat.java.JavaOutput; -import junit.framework.TestCase; - -import java.io.File; -import java.io.StringWriter; -import java.io.Writer; -import java.nio.file.FileSystems; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -/** - * Integration test for google-java-format. Format each file - * in the input directory, and confirm that the result is - * the same as the file in the output directory. - */ -public final class Unformatted extends TestCase { - private static final int MAX_WIDTH = 100; - - public void testFormatter() throws Exception { - Path inputPath = FileSystems.getDefault().getPath(TestPath.getDir(), "input"); - Path outputPath = FileSystems.getDefault().getPath(TestPath.getDir(), "output"); - File inputDirectory = new File(inputPath.toString()); - File outputDirectory = new File(outputPath.toString()); - for (File file : inputDirectory.listFiles()) { - assertTrue(file.isFile()); - String fileName = file.getName(); - assertTrue(fileName.endsWith(".java")); - byte[] inputBytes = - Files.readAllBytes(FileSystems.getDefault().getPath(inputDirectory.toString(), fileName)); - String inputString = new String(inputBytes, Charsets.UTF_8); - byte[] expectedOutputBytes = - Files.readAllBytes(FileSystems.getDefault().getPath(outputDirectory.toString(), fileName)); - String expectedOutputString = new String(expectedOutputBytes, Charsets.UTF_8); - JavaInput javaInput = new JavaInput(inputString); - JavaOutput javaOutput = new JavaOutput(javaInput, new JavaCommentsHelper(), false); - List errors = new ArrayList<>(); - Formatter.format(javaInput, javaOutput, MAX_WIDTH, errors, 1); - assertTrue(errors.isEmpty()); - Writer stringWriter = new StringWriter(); - RangeSet linesFlag = TreeRangeSet.create(); - linesFlag.add(Range.all()); - javaOutput.writeMerged(stringWriter, linesFlag, MAX_WIDTH, errors); - String outputString = stringWriter.toString(); - assertEquals(outputString, expectedOutputString); - } - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-script.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-script.input deleted file mode 100644 index 42d2a3049..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-script.input +++ /dev/null @@ -1,20 +0,0 @@ -///usr/bin/env jbang "$0" "$@" ; exit $? -//JAVA 21+ -//DEPS info.picocli:picocli:4.7.6 -//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13 com.squareup.okhttp3:okhttp:4.12.0 org.jsoup:jsoup:1.18.1 -//JAVA_OPTIONS -Xmx512m -//TODO pin these versions in a BOM - -import picocli.CommandLine; -//SOURCES Helper.java -import picocli.CommandLine.Command; -//RUNTIME_OPTIONS --enable-preview -@Command(name = "hello", mixinStandardHelpOptions = true) -class hello implements Runnable { -//DEPS org.example:in-class:1.0 - public void run() {System.out.println("Hello"); //DEPS org.example:trailing:1.0 - } - - public static void main(String... args) { System.exit(new CommandLine(new hello()).execute(args)); } -} -//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13 com.squareup.okhttp3:okhttp:4.12.0 org.jsoup:jsoup:1.18.1 diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.input deleted file mode 100644 index af5ef3b31..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.input +++ /dev/null @@ -1,93 +0,0 @@ -class PalantirDeeplyNestedCalls { - private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldOneV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldFourV1)) - .build())) - .build())) - .build())) - .build())) - .build(); - - void testMethod() { - assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) - .containsExactlyInAnyOrderElementsOf(Set.of( - new ItemWithCustomLocator( - ItemConfigV1.DEFAULT_CONFIG.toCustomString(), - ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_ITEM_A)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) - .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 - .apiName() - .get())) - .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), - // Discovered items - new ItemWithCustomLocator( - TestModelCatalog.MODEL_ABC_456.toItemApi(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_API_NAME)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())))); - } - - public Map otherMethod( - FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { - return myCustomService - .get() - .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) - .entrySet() - .stream() - .collect(Collectors.toMap( - Map.Entry::getKey, entry -> entry.getValue().getMetrics())); - } -} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.output deleted file mode 100644 index af5ef3b31..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-deeply-nested-calls.output +++ /dev/null @@ -1,93 +0,0 @@ -class PalantirDeeplyNestedCalls { - private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldOneV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .baaars(ImmutableList.of(MagicConfigV1.builder() - .foooos(ImmutableList.of(testFieldFourV1)) - .build())) - .build())) - .build())) - .build())) - .build(); - - void testMethod() { - assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) - .containsExactlyInAnyOrderElementsOf(Set.of( - new ItemWithCustomLocator( - ItemConfigV1.DEFAULT_CONFIG.toCustomString(), - ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_ITEM_A)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) - .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 - .apiName() - .get())) - .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), - // Discovered items - new ItemWithCustomLocator( - TestModelCatalog.MODEL_ABC_456.toItemApi(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())), - new ItemWithCustomLocator( - ItemConfigV1.builder() - .id(getId(TEST_API_NAME)) - .name(ItemName.of(TEST_API_NAME.get())) - .apiName(TEST_API_NAME) - .spec(ItemConfigV1Spec.native_( - NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) - .category(TestCatalog.TEST_CATEGORY_ALPHA) - .creator(TestCatalog.TEST_CREATOR_BETA) - .status(ItemLifecycleStatus.EXPERIMENTAL) - .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) - .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) - .creationDate(ItemMetadataInfo.builder().build()) - .performanceAttributes( - ItemAttributes.builder().build()) - .categories(TestCatalog.TEST_CATEGORY_ALPHA) - .build(), - CustomItemLocator.discovered(DiscoveredItemLocator.of())))); - } - - public Map otherMethod( - FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { - return myCustomService - .get() - .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) - .entrySet() - .stream() - .collect(Collectors.toMap( - Map.Entry::getKey, entry -> entry.getValue().getMetrics())); - } -} diff --git a/open-java-format/src/test/resources/test-cases/testdata/A-cr.case b/open-java-format/src/test/resources/test-cases/testdata/A-cr.case new file mode 100644 index 000000000..3800b6cbf --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/A-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; /** * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, * ArrayTypes, AssertStatements, and Assignments. */ class A { public @interface X { int x(); int y() default 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; } @X(x = 1) private @interface Y {} // TODO(jdd): Add annotation declaration with empty body. @X(x = 1) @Y protected @interface Z {} // TODO(jdd): Include type annotations once we can include a higher language level. int[] array1 = new int[5]; int[] array2 = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; int[] array3 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; int[][] array4 = { {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, {20, 21}, {22, 23} }; int[][][] arrayWithLongName = new int [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] []; A a1 = new A() { int x = array1[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array2[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array3[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array4[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0][ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; }; void f(int something) { assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 : "that was certainly unexpected!"; arrayWithLongName[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = arrayWithLongName[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; something = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; return StreamEx.of(itemsToCreate) .append(itemsToEdit) .append(itemsToDelete) .distinct() .mapToEntry(item -> getArgsGenerator() .getNewArgs( extendedItems.getOrDefault(item, Set.of()), getOwningResource( item, getModificationContext()::getRestrictionStatusOrDefault, RestrictionStatus::getPackageId, getModificationContext()))) .toImmutableMap(); } } ---------- package com.google.googlejavaformat.java.test; /** * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, * ArrayTypes, AssertStatements, and Assignments. */ class A { public @interface X { int x(); int y() default 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; } @X(x = 1) private @interface Y {} // TODO(jdd): Add annotation declaration with empty body. @X(x = 1) @Y protected @interface Z {} // TODO(jdd): Include type annotations once we can include a higher language level. int[] array1 = new int[5]; int[] array2 = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; int[] array3 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; int[][] array4 = { {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, {20, 21}, {22, 23} }; int[][][] arrayWithLongName = new int [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] []; A a1 = new A() { int x = array1[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array2[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array3[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + array4[0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0][ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; }; void f(int something) { assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 : "that was certainly unexpected!"; arrayWithLongName[0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = arrayWithLongName[ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; something = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; return StreamEx.of(itemsToCreate) .append(itemsToEdit) .append(itemsToDelete) .distinct() .mapToEntry(item -> getArgsGenerator() .getNewArgs( extendedItems.getOrDefault(item, Set.of()), getOwningResource( item, getModificationContext()::getRestrictionStatusOrDefault, RestrictionStatus::getPackageId, getModificationContext()))) .toImmutableMap(); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/A-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/A-crlf.case new file mode 100644 index 000000000..b0b1633bd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/A-crlf.case @@ -0,0 +1,186 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, + * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, + * ArrayTypes, AssertStatements, and Assignments. + */ +class A { + public @interface X { + int x(); + + int y() default + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; + } + + @X(x = 1) + private @interface Y {} + + // TODO(jdd): Add annotation declaration with empty body. + + @X(x = 1) + @Y + protected @interface Z {} + + // TODO(jdd): Include type annotations once we can include a higher language level. + + int[] array1 = new int[5]; + int[] array2 = + new int[] { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31 + }; + int[] array3 = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31 + }; + int[][] array4 = { + {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, + {20, 21}, {22, 23} + }; + int[][][] arrayWithLongName = + new int + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + []; + + A a1 = + new A() { + int x = + array1[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array2[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array3[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array4[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0][ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0]; + }; + + void f(int something) { + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + : "that was certainly unexpected!"; + arrayWithLongName[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = + arrayWithLongName[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; + something = + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; + return StreamEx.of(itemsToCreate) + .append(itemsToEdit) + .append(itemsToDelete) + .distinct() + .mapToEntry(item -> getArgsGenerator() + .getNewArgs( + extendedItems.getOrDefault(item, Set.of()), + getOwningResource( + item, + getModificationContext()::getRestrictionStatusOrDefault, + RestrictionStatus::getPackageId, + getModificationContext()))) + .toImmutableMap(); + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, + * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, + * ArrayTypes, AssertStatements, and Assignments. + */ +class A { + public @interface X { + int x(); + + int y() default + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + 1 + 1; + } + + @X(x = 1) + private @interface Y {} + + // TODO(jdd): Add annotation declaration with empty body. + + @X(x = 1) + @Y + protected @interface Z {} + + // TODO(jdd): Include type annotations once we can include a higher language level. + + int[] array1 = new int[5]; + int[] array2 = new int[] { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31 + }; + int[] array3 = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31 + }; + int[][] array4 = { + {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, {20, 21}, {22, 23} + }; + int[][][] arrayWithLongName = new int + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0] + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0] + []; + + A a1 = new A() { + int x = array1[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array2[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array3[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array4[0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0][ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; + }; + + void f(int something) { + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + : "that was certainly unexpected!"; + arrayWithLongName[0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = + arrayWithLongName[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; + something = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; + return StreamEx.of(itemsToCreate) + .append(itemsToEdit) + .append(itemsToDelete) + .distinct() + .mapToEntry(item -> getArgsGenerator() + .getNewArgs( + extendedItems.getOrDefault(item, Set.of()), + getOwningResource( + item, + getModificationContext()::getRestrictionStatusOrDefault, + RestrictionStatus::getPackageId, + getModificationContext()))) + .toImmutableMap(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/A-lf.case b/open-java-format/src/test/resources/test-cases/testdata/A-lf.case new file mode 100644 index 000000000..c9af28291 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/A-lf.case @@ -0,0 +1,186 @@ +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, + * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, + * ArrayTypes, AssertStatements, and Assignments. + */ +class A { + public @interface X { + int x(); + + int y() default + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; + } + + @X(x = 1) + private @interface Y {} + + // TODO(jdd): Add annotation declaration with empty body. + + @X(x = 1) + @Y + protected @interface Z {} + + // TODO(jdd): Include type annotations once we can include a higher language level. + + int[] array1 = new int[5]; + int[] array2 = + new int[] { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31 + }; + int[] array3 = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31 + }; + int[][] array4 = { + {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, + {20, 21}, {22, 23} + }; + int[][][] arrayWithLongName = + new int + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + []; + + A a1 = + new A() { + int x = + array1[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array2[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array3[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array4[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0][ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0]; + }; + + void f(int something) { + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + : "that was certainly unexpected!"; + arrayWithLongName[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = + arrayWithLongName[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; + something = + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; + return StreamEx.of(itemsToCreate) + .append(itemsToEdit) + .append(itemsToDelete) + .distinct() + .mapToEntry(item -> getArgsGenerator() + .getNewArgs( + extendedItems.getOrDefault(item, Set.of()), + getOwningResource( + item, + getModificationContext()::getRestrictionStatusOrDefault, + RestrictionStatus::getPackageId, + getModificationContext()))) + .toImmutableMap(); + } +} +---------- +package com.google.googlejavaformat.java.test; + +/** + * Tests for AbstractTypeDeclarations, AnnotationTypeDeclarations, AnnotationTypeMemberDeclarations, + * Annotations, AnonymousClassDeclarations, ArrayAccesses, ArrayCreations, ArrayInitializers, + * ArrayTypes, AssertStatements, and Assignments. + */ +class A { + public @interface X { + int x(); + + int y() default + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + 1 + 1; + } + + @X(x = 1) + private @interface Y {} + + // TODO(jdd): Add annotation declaration with empty body. + + @X(x = 1) + @Y + protected @interface Z {} + + // TODO(jdd): Include type annotations once we can include a higher language level. + + int[] array1 = new int[5]; + int[] array2 = new int[] { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31 + }; + int[] array3 = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31 + }; + int[][] array4 = { + {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}, {16, 17}, {18, 19}, {20, 21}, {22, 23} + }; + int[][][] arrayWithLongName = new int + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0] + [0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0] + []; + + A a1 = new A() { + int x = array1[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array2[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array3[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] + + array4[0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0][ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; + }; + + void f(int something) { + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; + assert 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + == 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + : "that was certainly unexpected!"; + arrayWithLongName[0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0] = + arrayWithLongName[ + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0]; + something = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; + return StreamEx.of(itemsToCreate) + .append(itemsToEdit) + .append(itemsToDelete) + .distinct() + .mapToEntry(item -> getArgsGenerator() + .getNewArgs( + extendedItems.getOrDefault(item, Set.of()), + getOwningResource( + item, + getModificationContext()::getRestrictionStatusOrDefault, + RestrictionStatus::getPackageId, + getModificationContext()))) + .toImmutableMap(); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/M-cr.case b/open-java-format/src/test/resources/test-cases/testdata/M-cr.case new file mode 100644 index 000000000..d747cd5e3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/M-cr.case @@ -0,0 +1 @@ +---------- package com.google.googlejavaformat.java.test; import com.google.common.collect.ImmutableList; import java.util.List; /** * Tests for MarkerAnnotations, MemberValuePairs, MethodDeclarations, MethodInvocations, and * Modifiers. */ @MarkerAnnotation class M { class Exception0 extends Exception {} class Exception1 extends Exception {} class Exception2 extends Exception {} class Exception3 extends Exception {} class Exception4 extends Exception {} class Exception5 extends Exception {} class Exception6 extends Exception {} class Exception7 extends Exception {} class Exception8 extends Exception {} class Exception9 extends Exception {} void methodName1(int x) {} void methodName2(int x) throws Exception {} /** * JavaDoc. */ void methodName3(int x) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 {} /** * JavaDoc. */ void methodName4( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) {} /** * JavaDoc. */ void methodName5( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception {} /** * JavaDoc. */ void methodName6( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 {} Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName10(int x) { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName12(int x) throws Exception { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName11(int x) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName15( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName14( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName13( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 { return null; } T methodName20(int x) { return null; } T methodName21(int x) throws Exception { return null; } T methodName22(int x) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 { return null; } T methodName22( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) { return null; } T methodName23( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception { return null; } T methodName30( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName31(int x) { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName32(int x) throws Exception { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName(int x) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName41( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName40( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 { return null; } static void m() {} M identity() { return this; } void f(double x) { List> list1 = ImmutableList.>of(null); List, Pair>> list2 = ImmutableList., Pair>>of(null); List< Pair< Pair, Pair>, Pair, Pair>>> list3 = ImmutableList ., Pair>, Pair, Pair>>> of(null); Pair pair1 = ImmutableList.>of(null).get( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); Pair, Pair> pair2 = ImmutableList., Pair>>of(null).get( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); Pair< Pair, Pair>, Pair, Pair>> pair3 = ImmutableList ., Pair>, Pair, Pair>>> of(null) .get( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); } void f(int... x) { M m = null; ((m.identity().identity().identity().identity()).identity().identity().identity().identity()) .identity() .identity() .identity() .identity(); f( x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] + x[11] + x[12] + x[13] + x[14] + x[15]); } static void method999(Object... args) { method999(1, 2, 3, 4, 5); method999(1, 2, 3, 4, 5); method999( 1, 2, 3, 4, 5, 6); method999(1, 2, 3, 4, 5, 6); method999("one", 1, "two", 2, "three", 3); method999("one", 1); method999( "one", 1, "two", 2); method999( "one", 1, "two", 1 + 1, "three", 1 + 1 + 1); method999( "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx"); } static class Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx { static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx fff( int x) { return null; } } static class Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx { static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx fff( int x) { return null; } static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ffffffffff(int x) { return null; } } M xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = null; M xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = null; M fff(int x) { Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0); Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx .ffffffffff(0); Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0).fff(0); Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0 + 0).fff( 0); Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx .fff( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) .fff(0); Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx .ffffffffff(0) .fff(0); return this; } M ffffffffff(int x) { return this; } M ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(int x) { new M().ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff( 0 + 0 + 0 + 0); ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0); ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0).f(0); ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0) .fff(0) .fff(0) .f(0); ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0).ffffffffff( 0); return this; } M( ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z) throws EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE {} } ---------- package com.google.googlejavaformat.java.test; import com.google.common.collect.ImmutableList; import java.util.List; /** * Tests for MarkerAnnotations, MemberValuePairs, MethodDeclarations, MethodInvocations, and * Modifiers. */ @MarkerAnnotation class M { class Exception0 extends Exception {} class Exception1 extends Exception {} class Exception2 extends Exception {} class Exception3 extends Exception {} class Exception4 extends Exception {} class Exception5 extends Exception {} class Exception6 extends Exception {} class Exception7 extends Exception {} class Exception8 extends Exception {} class Exception9 extends Exception {} void methodName1(int x) {} void methodName2(int x) throws Exception {} /** * JavaDoc. */ void methodName3(int x) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 {} /** * JavaDoc. */ void methodName4( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) {} /** * JavaDoc. */ void methodName5( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception {} /** * JavaDoc. */ void methodName6( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 {} Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName10(int x) { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName12(int x) throws Exception { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName11(int x) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName15( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName14( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception { return null; } Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName13( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 { return null; } < T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> T methodName20(int x) { return null; } < T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> T methodName21(int x) throws Exception { return null; } < T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> T methodName22(int x) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 { return null; } < T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> T methodName22( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) { return null; } < T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> T methodName23( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception { return null; } < T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> T methodName30( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 { return null; } < T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName31(int x) { return null; } < T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName32(int x) throws Exception { return null; } < T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName(int x) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 { return null; } < T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName41( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) { return null; } < T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName40( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception { return null; } < T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> Pair< Pair, Pair>, Pair, Pair>>, Pair, Pair>, Pair, Pair>>> methodName( int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, Exception8, Exception9 { return null; } static void m() {} M identity() { return this; } void f(double x) { List> list1 = ImmutableList.>of(null); List, Pair>> list2 = ImmutableList., Pair>>of(null); List< Pair< Pair, Pair>, Pair, Pair>>> list3 = ImmutableList ., Pair>, Pair, Pair>>> of(null); Pair pair1 = ImmutableList.>of(null) .get(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); Pair, Pair> pair2 = ImmutableList., Pair>>of(null) .get(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); Pair, Pair>, Pair, Pair>> pair3 = ImmutableList ., Pair>, Pair, Pair>>> of(null) .get(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); } void f(int... x) { M m = null; ((m.identity().identity().identity().identity()) .identity() .identity() .identity() .identity()) .identity() .identity() .identity() .identity(); f(x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] + x[11] + x[12] + x[13] + x[14] + x[15]); } static void method999(Object... args) { method999(1, 2, 3, 4, 5); method999(1, 2, 3, 4, 5); method999( 1, 2, 3, 4, 5, 6); method999(1, 2, 3, 4, 5, 6); method999("one", 1, "two", 2, "three", 3); method999("one", 1); method999( "one", 1, "two", 2); method999( "one", 1, "two", 1 + 1, "three", 1 + 1 + 1); method999( "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxx"); } static class Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx { static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx fff(int x) { return null; } } static class Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx { static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx fff(int x) { return null; } static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ffffffffff(int x) { return null; } } M xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = null; M xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = null; M fff(int x) { Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0); Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.ffffffffff(0); Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0) .fff(0); Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0 + 0) .fff(0); Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff( 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) .fff(0); Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.ffffffffff(0) .fff(0); return this; } M ffffffffff(int x) { return this; } M ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(int x) { new M().ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0 + 0 + 0 + 0); ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0); ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0) .f(0); ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0) .fff(0) .fff(0) .f(0); ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0) .ffffffffff(0); return this; } < XXXXXXXXXX, XXXXXXXXXX, XXXXXXXXXX, XXXXXXXXXX, XXXXXXXXXX, XXXXXXXXXX, XXXXXXXXXX, XXXXXXXXXX, XXXXXXXXXX, XXXXXXXXXX, XXXXXXXXXX, XXXXXXXXXX> M( ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z, ZZZZZZZZZZ z) throws EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE {} } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/M-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/M-crlf.case new file mode 100644 index 000000000..f593a2b1d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/M-crlf.case @@ -0,0 +1,1410 @@ +---------- +package com.google.googlejavaformat.java.test; + +import com.google.common.collect.ImmutableList; + +import java.util.List; + +/** + * Tests for MarkerAnnotations, MemberValuePairs, MethodDeclarations, MethodInvocations, and + * Modifiers. + */ +@MarkerAnnotation +class M { + class Exception0 extends Exception {} + + class Exception1 extends Exception {} + + class Exception2 extends Exception {} + + class Exception3 extends Exception {} + + class Exception4 extends Exception {} + + class Exception5 extends Exception {} + + class Exception6 extends Exception {} + + class Exception7 extends Exception {} + + class Exception8 extends Exception {} + + class Exception9 extends Exception {} + + void methodName1(int x) {} + + void methodName2(int x) throws Exception {} + + /** + * JavaDoc. + */ + void methodName3(int x) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 {} + + /** + * JavaDoc. + */ + void methodName4( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) {} + + /** + * JavaDoc. + */ + void methodName5( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception {} + + /** + * JavaDoc. + */ + void methodName6( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 {} + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName10(int x) { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName12(int x) throws Exception { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName11(int x) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName15( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName14( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName13( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 { + return null; + } + + + T methodName20(int x) { + return null; + } + + + T methodName21(int x) throws Exception { + return null; + } + + + T methodName22(int x) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 { + return null; + } + + + T methodName22( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) { + return null; + } + + + T methodName23( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception { + return null; + } + + + T methodName30( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 { + return null; + } + + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName31(int x) { + return null; + } + + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName32(int x) throws Exception { + return null; + } + + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName(int x) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, + Exception6, Exception7, Exception8, Exception9 { + return null; + } + + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName41( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, + int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) { + return null; + } + + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName40( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, + int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception { + return null; + } + + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, + int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, + Exception6, Exception7, Exception8, Exception9 { + return null; + } + + static void m() {} + + M identity() { + return this; + } + + void f(double x) { + List> list1 = ImmutableList.>of(null); + List, Pair>> list2 = + ImmutableList., Pair>>of(null); + List< + Pair< + Pair, Pair>, + Pair, Pair>>> + list3 = + ImmutableList + ., Pair>, + Pair, Pair>>> + of(null); + Pair pair1 = + ImmutableList.>of(null).get( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); + Pair, Pair> pair2 = + ImmutableList., Pair>>of(null).get( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); + Pair< + Pair, Pair>, + Pair, Pair>> + pair3 = + ImmutableList + ., Pair>, + Pair, Pair>>> + of(null) + .get( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); + } + + void f(int... x) { + M m = null; + ((m.identity().identity().identity().identity()).identity().identity().identity().identity()) + .identity() + .identity() + .identity() + .identity(); + f( + x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] + x[11] + x[12] + x[13] + + x[14] + x[15]); + } + + static void method999(Object... args) { + method999(1, 2, 3, 4, 5); + method999(1, 2, 3, 4, 5); + method999( + 1, 2, + 3, 4, + 5, 6); + method999(1, 2, 3, 4, 5, 6); + method999("one", 1, "two", 2, "three", 3); + method999("one", 1); + method999( + "one", 1, + "two", 2); + method999( + "one", 1, + "two", 1 + 1, + "three", 1 + 1 + 1); + method999( + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx"); + } + + static class Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx { + static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx fff( + int x) { + return null; + } + } + + static + class Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx { + static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx fff( + int x) { + return null; + } + + static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + ffffffffff(int x) { + return null; + } + } + + M xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = null; + M xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = + null; + + M fff(int x) { + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + .ffffffffff(0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0).fff(0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0 + 0).fff( + 0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + .fff( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) + .fff(0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + .ffffffffff(0) + .fff(0); + return this; + } + + M ffffffffff(int x) { + return this; + } + + M ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(int x) { + new M().ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff( + 0 + 0 + 0 + 0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0).f(0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0) + .fff(0) + .fff(0) + .f(0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0).ffffffffff( + 0); + return this; + } + + + M( + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z) + throws EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, + EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE {} +} +---------- +package com.google.googlejavaformat.java.test; + +import com.google.common.collect.ImmutableList; +import java.util.List; + +/** + * Tests for MarkerAnnotations, MemberValuePairs, MethodDeclarations, MethodInvocations, and + * Modifiers. + */ +@MarkerAnnotation +class M { + class Exception0 extends Exception {} + + class Exception1 extends Exception {} + + class Exception2 extends Exception {} + + class Exception3 extends Exception {} + + class Exception4 extends Exception {} + + class Exception5 extends Exception {} + + class Exception6 extends Exception {} + + class Exception7 extends Exception {} + + class Exception8 extends Exception {} + + class Exception9 extends Exception {} + + void methodName1(int x) {} + + void methodName2(int x) throws Exception {} + + /** + * JavaDoc. + */ + void methodName3(int x) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, + Exception8, Exception9 {} + + /** + * JavaDoc. + */ + void methodName4( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + int i, + int j, + int k, + int l, + int m, + int n, + int o, + int p, + int q, + int r, + int s, + int t, + int u, + int v) {} + + /** + * JavaDoc. + */ + void methodName5( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + int i, + int j, + int k, + int l, + int m, + int n, + int o, + int p, + int q, + int r, + int s, + int t, + int u, + int v) + throws Exception {} + + /** + * JavaDoc. + */ + void methodName6( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + int i, + int j, + int k, + int l, + int m, + int n, + int o, + int p, + int q, + int r, + int s, + int t, + int u, + int v) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, Exception7, + Exception8, Exception9 {} + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName10(int x) { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName12(int x) throws Exception { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName11(int x) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName15( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + int i, + int j, + int k, + int l, + int m, + int n, + int o, + int p, + int q, + int r, + int s, + int t, + int u, + int v) { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName14( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + int i, + int j, + int k, + int l, + int m, + int n, + int o, + int p, + int q, + int r, + int s, + int t, + int u, + int v) + throws Exception { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName13( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + int i, + int j, + int k, + int l, + int m, + int n, + int o, + int p, + int q, + int r, + int s, + int t, + int u, + int v) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 { + return null; + } + + < + T0, + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + T21, + T22, + T23, + T24, + T25, + T26, + T27, + T28, + T29, + T30, + T31> + T methodName20(int x) { + return null; + } + + < + T0, + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + T21, + T22, + T23, + T24, + T25, + T26, + T27, + T28, + T29, + T30, + T31> + T methodName21(int x) throws Exception { + return null; + } + + < + T0, + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + T21, + T22, + T23, + T24, + T25, + T26, + T27, + T28, + T29, + T30, + T31> + T methodName22(int x) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 { + return null; + } + + < + T0, + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + T21, + T22, + T23, + T24, + T25, + T26, + T27, + T28, + T29, + T30, + T31> + T methodName22( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + int i, + int j, + int k, + int l, + int m, + int n, + int o, + int p, + int q, + int r, + int s, + int t, + int u, + int v) { + return null; + } + + < + T0, + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + T21, + T22, + T23, + T24, + T25, + T26, + T27, + T28, + T29, + T30, + T31> + T methodName23( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + int i, + int j, + int k, + int l, + int m, + int n, + int o, + int p, + int q, + int r, + int s, + int t, + int u, + int v) + throws Exception { + return null; + } + + < + T0, + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + T21, + T22, + T23, + T24, + T25, + T26, + T27, + T28, + T29, + T30, + T31> + T methodName30( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + int i, + int j, + int k, + int l, + int m, + int n, + int o, + int p, + int q, + int r, + int s, + int t, + int u, + int v) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 { + return null; + } + + < + T0, + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + T21, + T22, + T23, + T24, + T25, + T26, + T27, + T28, + T29, + T30, + T31> + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName31(int x) { + return null; + } + + < + T0, + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + T21, + T22, + T23, + T24, + T25, + T26, + T27, + T28, + T29, + T30, + T31> + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName32(int x) throws Exception { + return null; + } + + < + T0, + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + T21, + T22, + T23, + T24, + T25, + T26, + T27, + T28, + T29, + T30, + T31> + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName(int x) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 { + return null; + } + + < + T0, + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + T21, + T22, + T23, + T24, + T25, + T26, + T27, + T28, + T29, + T30, + T31> + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName41( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + int i, + int j, + int k, + int l, + int m, + int n, + int o, + int p, + int q, + int r, + int s, + int t, + int u, + int v) { + return null; + } + + < + T0, + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + T21, + T22, + T23, + T24, + T25, + T26, + T27, + T28, + T29, + T30, + T31> + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName40( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + int i, + int j, + int k, + int l, + int m, + int n, + int o, + int p, + int q, + int r, + int s, + int t, + int u, + int v) + throws Exception { + return null; + } + + < + T0, + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + T21, + T22, + T23, + T24, + T25, + T26, + T27, + T28, + T29, + T30, + T31> + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName( + int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + int i, + int j, + int k, + int l, + int m, + int n, + int o, + int p, + int q, + int r, + int s, + int t, + int u, + int v) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 { + return null; + } + + static void m() {} + + M identity() { + return this; + } + + void f(double x) { + List> list1 = ImmutableList.>of(null); + List, Pair>> list2 = + ImmutableList., Pair>>of(null); + List< + Pair< + Pair, Pair>, + Pair, Pair>>> + list3 = ImmutableList + ., Pair>, + Pair, Pair>>> + of(null); + Pair pair1 = ImmutableList.>of(null) + .get(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0); + Pair, Pair> pair2 = + ImmutableList., Pair>>of(null) + .get(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); + Pair, Pair>, Pair, Pair>> + pair3 = ImmutableList + ., Pair>, + Pair, Pair>>> + of(null) + .get(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); + } + + void f(int... x) { + M m = null; + ((m.identity().identity().identity().identity()) + .identity() + .identity() + .identity() + .identity()) + .identity() + .identity() + .identity() + .identity(); + f(x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] + x[11] + x[12] + x[13] + x[14] + x[15]); + } + + static void method999(Object... args) { + method999(1, 2, 3, 4, 5); + method999(1, 2, 3, 4, 5); + method999( + 1, 2, + 3, 4, + 5, 6); + method999(1, 2, 3, 4, 5, 6); + method999("one", 1, "two", 2, "three", 3); + method999("one", 1); + method999( + "one", 1, + "two", 2); + method999( + "one", 1, + "two", 1 + 1, + "three", 1 + 1 + 1); + method999( + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx"); + } + + static class Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx { + static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx fff(int x) { + return null; + } + } + + static class Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx { + static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx fff(int x) { + return null; + } + + static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ffffffffff(int x) { + return null; + } + } + + M xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = null; + M xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = null; + + M fff(int x) { + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.ffffffffff(0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0) + .fff(0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0 + 0) + .fff(0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) + .fff(0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.ffffffffff(0) + .fff(0); + return this; + } + + M ffffffffff(int x) { + return this; + } + + M ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(int x) { + new M().ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0 + 0 + 0 + 0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0) + .f(0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0) + .fff(0) + .fff(0) + .f(0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0) + .ffffffffff(0); + return this; + } + + < + XXXXXXXXXX, + XXXXXXXXXX, + XXXXXXXXXX, + XXXXXXXXXX, + XXXXXXXXXX, + XXXXXXXXXX, + XXXXXXXXXX, + XXXXXXXXXX, + XXXXXXXXXX, + XXXXXXXXXX, + XXXXXXXXXX, + XXXXXXXXXX> + M( + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z) + throws EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, + EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE {} +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M.output b/open-java-format/src/test/resources/test-cases/testdata/M-lf.case similarity index 65% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M.output rename to open-java-format/src/test/resources/test-cases/testdata/M-lf.case index 04db52b1b..c1a6db27f 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M.output +++ b/open-java-format/src/test/resources/test-cases/testdata/M-lf.case @@ -1,9 +1,409 @@ +---------- package com.google.googlejavaformat.java.test; import com.google.common.collect.ImmutableList; import java.util.List; +/** + * Tests for MarkerAnnotations, MemberValuePairs, MethodDeclarations, MethodInvocations, and + * Modifiers. + */ +@MarkerAnnotation +class M { + class Exception0 extends Exception {} + + class Exception1 extends Exception {} + + class Exception2 extends Exception {} + + class Exception3 extends Exception {} + + class Exception4 extends Exception {} + + class Exception5 extends Exception {} + + class Exception6 extends Exception {} + + class Exception7 extends Exception {} + + class Exception8 extends Exception {} + + class Exception9 extends Exception {} + + void methodName1(int x) {} + + void methodName2(int x) throws Exception {} + + /** + * JavaDoc. + */ + void methodName3(int x) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 {} + + /** + * JavaDoc. + */ + void methodName4( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) {} + + /** + * JavaDoc. + */ + void methodName5( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception {} + + /** + * JavaDoc. + */ + void methodName6( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 {} + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName10(int x) { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName12(int x) throws Exception { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName11(int x) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName15( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName14( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception { + return null; + } + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName13( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 { + return null; + } + + + T methodName20(int x) { + return null; + } + + + T methodName21(int x) throws Exception { + return null; + } + + + T methodName22(int x) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 { + return null; + } + + + T methodName22( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) { + return null; + } + + + T methodName23( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception { + return null; + } + + + T methodName30( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, + int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, Exception6, + Exception7, Exception8, Exception9 { + return null; + } + + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName31(int x) { + return null; + } + + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName32(int x) throws Exception { + return null; + } + + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName(int x) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, + Exception6, Exception7, Exception8, Exception9 { + return null; + } + + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName41( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, + int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) { + return null; + } + + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName40( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, + int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception { + return null; + } + + + Pair< + Pair, Pair>, Pair, Pair>>, + Pair, Pair>, Pair, Pair>>> + methodName( + int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, + int m, int n, int o, int p, int q, int r, int s, int t, int u, int v) + throws Exception0, Exception1, Exception2, Exception3, Exception4, Exception5, + Exception6, Exception7, Exception8, Exception9 { + return null; + } + + static void m() {} + + M identity() { + return this; + } + + void f(double x) { + List> list1 = ImmutableList.>of(null); + List, Pair>> list2 = + ImmutableList., Pair>>of(null); + List< + Pair< + Pair, Pair>, + Pair, Pair>>> + list3 = + ImmutableList + ., Pair>, + Pair, Pair>>> + of(null); + Pair pair1 = + ImmutableList.>of(null).get( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); + Pair, Pair> pair2 = + ImmutableList., Pair>>of(null).get( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); + Pair< + Pair, Pair>, + Pair, Pair>> + pair3 = + ImmutableList + ., Pair>, + Pair, Pair>>> + of(null) + .get( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); + } + + void f(int... x) { + M m = null; + ((m.identity().identity().identity().identity()).identity().identity().identity().identity()) + .identity() + .identity() + .identity() + .identity(); + f( + x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] + x[11] + x[12] + x[13] + + x[14] + x[15]); + } + + static void method999(Object... args) { + method999(1, 2, 3, 4, 5); + method999(1, 2, 3, 4, 5); + method999( + 1, 2, + 3, 4, + 5, 6); + method999(1, 2, 3, 4, 5, 6); + method999("one", 1, "two", 2, "three", 3); + method999("one", 1); + method999( + "one", 1, + "two", 2); + method999( + "one", 1, + "two", 1 + 1, + "three", 1 + 1 + 1); + method999( + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx", + "xxxxxxxxxxxxxx"); + } + + static class Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx { + static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx fff( + int x) { + return null; + } + } + + static + class Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx { + static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx fff( + int x) { + return null; + } + + static Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + ffffffffff(int x) { + return null; + } + } + + M xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = null; + M xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = + null; + + M fff(int x) { + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + .ffffffffff(0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0).fff(0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.fff(0 + 0).fff( + 0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + .fff( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0) + .fff(0); + Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + .ffffffffff(0) + .fff(0); + return this; + } + + M ffffffffff(int x) { + return this; + } + + M ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(int x) { + new M().ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff( + 0 + 0 + 0 + 0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff( + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0).f(0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0) + .fff(0) + .fff(0) + .f(0); + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(0).ffffffffff( + 0); + return this; + } + + + M( + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z, + ZZZZZZZZZZ z) + throws EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE, + EEEEEEEEEE, EEEEEEEEEE, EEEEEEEEEE {} +} +---------- +package com.google.googlejavaformat.java.test; + +import com.google.common.collect.ImmutableList; +import java.util.List; + /** * Tests for MarkerAnnotations, MemberValuePairs, MethodDeclarations, MethodInvocations, and * Modifiers. diff --git a/open-java-format/src/test/resources/test-cases/testdata/Unformatted-cr.case b/open-java-format/src/test/resources/test-cases/testdata/Unformatted-cr.case new file mode 100644 index 000000000..17edc9432 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Unformatted-cr.case @@ -0,0 +1 @@ +---------- package com . google . googlejavaformat . java . javatests ; import com . google . common . base . Charsets ; import com . google . common . collect . Range ; import com . google . common . collect . RangeSet ; import com . google . common . collect . TreeRangeSet ; import com . google . googlejavaformat . java . Formatter ; import com . google . googlejavaformat . java . JavaCommentsHelper ; import com . google . googlejavaformat . java . JavaInput ; import com . google . googlejavaformat . java . JavaOutput ; import junit . framework . TestCase ; import java . io . File ; import java . io . StringWriter ; import java . io . Writer ; import java . nio . file . FileSystems ; import java . nio . file . Files ; import java . nio . file . Path ; import java . util . ArrayList ; import java . util . List ; /** * Integration test for google-java-format. Format each file * in the input directory, and confirm that the result is * the same as the file in the output directory. */ public final class Unformatted extends TestCase { private static final int MAX_WIDTH = 100 ; public void testFormatter ( ) throws Exception { Path inputPath = FileSystems . getDefault ( ) . getPath ( TestPath . getDir ( ) , "input" ) ; Path outputPath = FileSystems . getDefault ( ) . getPath ( TestPath . getDir ( ) , "output" ) ; File inputDirectory = new File ( inputPath . toString ( ) ) ; File outputDirectory = new File ( outputPath . toString ( ) ) ; for ( File file : inputDirectory . listFiles ( ) ) { assertTrue ( file . isFile ( ) ) ; String fileName = file . getName ( ) ; assertTrue ( fileName . endsWith ( ".java" ) ) ; byte [ ] inputBytes = Files . readAllBytes ( FileSystems . getDefault ( ) . getPath ( inputDirectory . toString ( ) , fileName ) ) ; String inputString = new String ( inputBytes , Charsets . UTF_8 ) ; byte [ ] expectedOutputBytes = Files . readAllBytes ( FileSystems . getDefault ( ) . getPath ( outputDirectory . toString ( ) , fileName ) ) ; String expectedOutputString = new String ( expectedOutputBytes , Charsets . UTF_8 ) ; JavaInput javaInput = new JavaInput ( inputString ) ; JavaOutput javaOutput = new JavaOutput ( javaInput , new JavaCommentsHelper ( ) , false ) ; List < String > errors = new ArrayList < > ( ) ; Formatter . format ( javaInput , javaOutput , MAX_WIDTH , errors , 1 ) ; assertTrue ( errors . isEmpty ( ) ) ; Writer stringWriter = new StringWriter ( ) ; RangeSet < Integer > linesFlag = TreeRangeSet . create ( ) ; linesFlag . add ( Range .< Integer > all ( ) ) ; javaOutput . writeMerged ( stringWriter , linesFlag , MAX_WIDTH , errors ) ; String outputString = stringWriter . toString ( ) ; assertEquals ( outputString , expectedOutputString ) ; } } } ---------- package com.google.googlejavaformat.java.javatests; import com.google.common.base.Charsets; import com.google.common.collect.Range; import com.google.common.collect.RangeSet; import com.google.common.collect.TreeRangeSet; import com.google.googlejavaformat.java.Formatter; import com.google.googlejavaformat.java.JavaCommentsHelper; import com.google.googlejavaformat.java.JavaInput; import com.google.googlejavaformat.java.JavaOutput; import java.io.File; import java.io.StringWriter; import java.io.Writer; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import junit.framework.TestCase; /** * Integration test for google-java-format. Format each file * in the input directory, and confirm that the result is * the same as the file in the output directory. */ public final class Unformatted extends TestCase { private static final int MAX_WIDTH = 100; public void testFormatter() throws Exception { Path inputPath = FileSystems.getDefault().getPath(TestPath.getDir(), "input"); Path outputPath = FileSystems.getDefault().getPath(TestPath.getDir(), "output"); File inputDirectory = new File(inputPath.toString()); File outputDirectory = new File(outputPath.toString()); for (File file : inputDirectory.listFiles()) { assertTrue(file.isFile()); String fileName = file.getName(); assertTrue(fileName.endsWith(".java")); byte[] inputBytes = Files.readAllBytes(FileSystems.getDefault().getPath(inputDirectory.toString(), fileName)); String inputString = new String(inputBytes, Charsets.UTF_8); byte[] expectedOutputBytes = Files.readAllBytes(FileSystems.getDefault().getPath(outputDirectory.toString(), fileName)); String expectedOutputString = new String(expectedOutputBytes, Charsets.UTF_8); JavaInput javaInput = new JavaInput(inputString); JavaOutput javaOutput = new JavaOutput(javaInput, new JavaCommentsHelper(), false); List errors = new ArrayList<>(); Formatter.format(javaInput, javaOutput, MAX_WIDTH, errors, 1); assertTrue(errors.isEmpty()); Writer stringWriter = new StringWriter(); RangeSet linesFlag = TreeRangeSet.create(); linesFlag.add(Range.all()); javaOutput.writeMerged(stringWriter, linesFlag, MAX_WIDTH, errors); String outputString = stringWriter.toString(); assertEquals(outputString, expectedOutputString); } } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/Unformatted-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/Unformatted-crlf.case new file mode 100644 index 000000000..4a3efc831 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Unformatted-crlf.case @@ -0,0 +1,102 @@ +---------- +package com . google . googlejavaformat . java . javatests ; + +import com . google . common . base . Charsets ; import com . google . common +. collect . Range ; import com . google . common . collect . RangeSet ; import +com . google . common . collect . TreeRangeSet ; import com . google . +googlejavaformat . java . Formatter ; import com . google . googlejavaformat . +java . JavaCommentsHelper ; import com . google . googlejavaformat . java . +JavaInput ; import com . google . googlejavaformat . java . JavaOutput ; +import junit . framework . TestCase ; + +import java . io . File ; import java . io . StringWriter ; import java . io . +Writer ; import java . nio . file . FileSystems ; import java . nio . file . +Files ; import java . nio . file . Path ; import java . util . ArrayList ; +import java . util . List ; + +/** +* Integration test for google-java-format. Format each file +* in the input directory, and confirm that the result is +* the same as the file in the output directory. +*/ +public final class Unformatted extends TestCase { private static final int +MAX_WIDTH = 100 ; public void testFormatter ( ) throws Exception { Path +inputPath = FileSystems . getDefault ( ) . getPath ( TestPath . getDir ( ) , +"input" ) ; Path outputPath = FileSystems . getDefault ( ) . getPath ( +TestPath . getDir ( ) , "output" ) ; File inputDirectory = new File ( +inputPath . toString ( ) ) ; File outputDirectory = new File ( outputPath . +toString ( ) ) ; for ( File file : inputDirectory . listFiles ( ) ) { +assertTrue ( file . isFile ( ) ) ; String fileName = file . getName ( ) ; +assertTrue ( fileName . endsWith ( ".java" ) ) ; byte [ ] inputBytes = Files . +readAllBytes ( FileSystems . getDefault ( ) . getPath ( inputDirectory . +toString ( ) , fileName ) ) ; String inputString = new String ( inputBytes , +Charsets . UTF_8 ) ; byte [ ] expectedOutputBytes = Files . readAllBytes ( +FileSystems . getDefault ( ) . getPath ( outputDirectory . toString ( ) , +fileName ) ) ; String expectedOutputString = new String ( expectedOutputBytes +, Charsets . UTF_8 ) ; JavaInput javaInput = new JavaInput ( inputString ) ; +JavaOutput javaOutput = new JavaOutput ( javaInput , new JavaCommentsHelper ( +) , false ) ; List < String > errors = new ArrayList < > ( ) ; Formatter . +format ( javaInput , javaOutput , MAX_WIDTH , errors , 1 ) ; assertTrue ( +errors . isEmpty ( ) ) ; Writer stringWriter = new StringWriter ( ) ; RangeSet +< Integer > linesFlag = TreeRangeSet . create ( ) ; linesFlag . add ( Range .< +Integer > all ( ) ) ; javaOutput . writeMerged ( stringWriter , linesFlag , +MAX_WIDTH , errors ) ; String outputString = stringWriter . toString ( ) ; +assertEquals ( outputString , expectedOutputString ) ; } } } +---------- +package com.google.googlejavaformat.java.javatests; + +import com.google.common.base.Charsets; +import com.google.common.collect.Range; +import com.google.common.collect.RangeSet; +import com.google.common.collect.TreeRangeSet; +import com.google.googlejavaformat.java.Formatter; +import com.google.googlejavaformat.java.JavaCommentsHelper; +import com.google.googlejavaformat.java.JavaInput; +import com.google.googlejavaformat.java.JavaOutput; +import java.io.File; +import java.io.StringWriter; +import java.io.Writer; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import junit.framework.TestCase; + +/** + * Integration test for google-java-format. Format each file + * in the input directory, and confirm that the result is + * the same as the file in the output directory. + */ +public final class Unformatted extends TestCase { + private static final int MAX_WIDTH = 100; + + public void testFormatter() throws Exception { + Path inputPath = FileSystems.getDefault().getPath(TestPath.getDir(), "input"); + Path outputPath = FileSystems.getDefault().getPath(TestPath.getDir(), "output"); + File inputDirectory = new File(inputPath.toString()); + File outputDirectory = new File(outputPath.toString()); + for (File file : inputDirectory.listFiles()) { + assertTrue(file.isFile()); + String fileName = file.getName(); + assertTrue(fileName.endsWith(".java")); + byte[] inputBytes = + Files.readAllBytes(FileSystems.getDefault().getPath(inputDirectory.toString(), fileName)); + String inputString = new String(inputBytes, Charsets.UTF_8); + byte[] expectedOutputBytes = + Files.readAllBytes(FileSystems.getDefault().getPath(outputDirectory.toString(), fileName)); + String expectedOutputString = new String(expectedOutputBytes, Charsets.UTF_8); + JavaInput javaInput = new JavaInput(inputString); + JavaOutput javaOutput = new JavaOutput(javaInput, new JavaCommentsHelper(), false); + List errors = new ArrayList<>(); + Formatter.format(javaInput, javaOutput, MAX_WIDTH, errors, 1); + assertTrue(errors.isEmpty()); + Writer stringWriter = new StringWriter(); + RangeSet linesFlag = TreeRangeSet.create(); + linesFlag.add(Range.all()); + javaOutput.writeMerged(stringWriter, linesFlag, MAX_WIDTH, errors); + String outputString = stringWriter.toString(); + assertEquals(outputString, expectedOutputString); + } + } +} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted.input b/open-java-format/src/test/resources/test-cases/testdata/Unformatted-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted.input rename to open-java-format/src/test/resources/test-cases/testdata/Unformatted-lf.case index c936d9ecc..b4bb855dc 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted.input +++ b/open-java-format/src/test/resources/test-cases/testdata/Unformatted-lf.case @@ -1,3 +1,4 @@ +---------- package com . google . googlejavaformat . java . javatests ; import com . google . common . base . Charsets ; import com . google . common @@ -41,3 +42,61 @@ errors . isEmpty ( ) ) ; Writer stringWriter = new StringWriter ( ) ; RangeSet Integer > all ( ) ) ; javaOutput . writeMerged ( stringWriter , linesFlag , MAX_WIDTH , errors ) ; String outputString = stringWriter . toString ( ) ; assertEquals ( outputString , expectedOutputString ) ; } } } +---------- +package com.google.googlejavaformat.java.javatests; + +import com.google.common.base.Charsets; +import com.google.common.collect.Range; +import com.google.common.collect.RangeSet; +import com.google.common.collect.TreeRangeSet; +import com.google.googlejavaformat.java.Formatter; +import com.google.googlejavaformat.java.JavaCommentsHelper; +import com.google.googlejavaformat.java.JavaInput; +import com.google.googlejavaformat.java.JavaOutput; +import java.io.File; +import java.io.StringWriter; +import java.io.Writer; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import junit.framework.TestCase; + +/** + * Integration test for google-java-format. Format each file + * in the input directory, and confirm that the result is + * the same as the file in the output directory. + */ +public final class Unformatted extends TestCase { + private static final int MAX_WIDTH = 100; + + public void testFormatter() throws Exception { + Path inputPath = FileSystems.getDefault().getPath(TestPath.getDir(), "input"); + Path outputPath = FileSystems.getDefault().getPath(TestPath.getDir(), "output"); + File inputDirectory = new File(inputPath.toString()); + File outputDirectory = new File(outputPath.toString()); + for (File file : inputDirectory.listFiles()) { + assertTrue(file.isFile()); + String fileName = file.getName(); + assertTrue(fileName.endsWith(".java")); + byte[] inputBytes = + Files.readAllBytes(FileSystems.getDefault().getPath(inputDirectory.toString(), fileName)); + String inputString = new String(inputBytes, Charsets.UTF_8); + byte[] expectedOutputBytes = + Files.readAllBytes(FileSystems.getDefault().getPath(outputDirectory.toString(), fileName)); + String expectedOutputString = new String(expectedOutputBytes, Charsets.UTF_8); + JavaInput javaInput = new JavaInput(inputString); + JavaOutput javaOutput = new JavaOutput(javaInput, new JavaCommentsHelper(), false); + List errors = new ArrayList<>(); + Formatter.format(javaInput, javaOutput, MAX_WIDTH, errors, 1); + assertTrue(errors.isEmpty()); + Writer stringWriter = new StringWriter(); + RangeSet linesFlag = TreeRangeSet.create(); + linesFlag.add(Range.all()); + javaOutput.writeMerged(stringWriter, linesFlag, MAX_WIDTH, errors); + String outputString = stringWriter.toString(); + assertEquals(outputString, expectedOutputString); + } + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-script-cr.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-script-cr.case new file mode 100644 index 000000000..3ad581085 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-script-cr.case @@ -0,0 +1 @@ +---------- ///usr/bin/env jbang "$0" "$@" ; exit $? //JAVA 21+ //DEPS info.picocli:picocli:4.7.6 //DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13 com.squareup.okhttp3:okhttp:4.12.0 org.jsoup:jsoup:1.18.1 //JAVA_OPTIONS -Xmx512m //TODO pin these versions in a BOM import picocli.CommandLine; //SOURCES Helper.java import picocli.CommandLine.Command; //RUNTIME_OPTIONS --enable-preview @Command(name = "hello", mixinStandardHelpOptions = true) class hello implements Runnable { //DEPS org.example:in-class:1.0 public void run() {System.out.println("Hello"); //DEPS org.example:trailing:1.0 } public static void main(String... args) { System.exit(new CommandLine(new hello()).execute(args)); } } //DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13 com.squareup.okhttp3:okhttp:4.12.0 org.jsoup:jsoup:1.18.1 ---------- ///usr/bin/env jbang "$0" "$@" ; exit $? //JAVA 21+ //DEPS info.picocli:picocli:4.7.6 //DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13 com.squareup.okhttp3:okhttp:4.12.0 org.jsoup:jsoup:1.18.1 //JAVA_OPTIONS -Xmx512m // TODO pin these versions in a BOM import picocli.CommandLine; // SOURCES Helper.java import picocli.CommandLine.Command; // RUNTIME_OPTIONS --enable-preview @Command(name = "hello", mixinStandardHelpOptions = true) class hello implements Runnable { // DEPS org.example:in-class:1.0 public void run() { System.out.println("Hello"); // DEPS org.example:trailing:1.0 } public static void main(String... args) { System.exit(new CommandLine(new hello()).execute(args)); } } // DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13 // com.squareup.okhttp3:okhttp:4.12.0 org.jsoup:jsoup:1.18.1 \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-script-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-script-crlf.case new file mode 100644 index 000000000..fe25677a3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-script-crlf.case @@ -0,0 +1,47 @@ +---------- +///usr/bin/env jbang "$0" "$@" ; exit $? +//JAVA 21+ +//DEPS info.picocli:picocli:4.7.6 +//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13 com.squareup.okhttp3:okhttp:4.12.0 org.jsoup:jsoup:1.18.1 +//JAVA_OPTIONS -Xmx512m +//TODO pin these versions in a BOM + +import picocli.CommandLine; +//SOURCES Helper.java +import picocli.CommandLine.Command; +//RUNTIME_OPTIONS --enable-preview +@Command(name = "hello", mixinStandardHelpOptions = true) +class hello implements Runnable { +//DEPS org.example:in-class:1.0 + public void run() {System.out.println("Hello"); //DEPS org.example:trailing:1.0 + } + + public static void main(String... args) { System.exit(new CommandLine(new hello()).execute(args)); } +} +//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13 com.squareup.okhttp3:okhttp:4.12.0 org.jsoup:jsoup:1.18.1 +---------- +///usr/bin/env jbang "$0" "$@" ; exit $? +//JAVA 21+ +//DEPS info.picocli:picocli:4.7.6 +//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13 com.squareup.okhttp3:okhttp:4.12.0 org.jsoup:jsoup:1.18.1 +//JAVA_OPTIONS -Xmx512m +// TODO pin these versions in a BOM + +import picocli.CommandLine; +// SOURCES Helper.java +import picocli.CommandLine.Command; +// RUNTIME_OPTIONS --enable-preview + +@Command(name = "hello", mixinStandardHelpOptions = true) +class hello implements Runnable { + // DEPS org.example:in-class:1.0 + public void run() { + System.out.println("Hello"); // DEPS org.example:trailing:1.0 + } + + public static void main(String... args) { + System.exit(new CommandLine(new hello()).execute(args)); + } +} +// DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13 +// com.squareup.okhttp3:okhttp:4.12.0 org.jsoup:jsoup:1.18.1 diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-script.output b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-script-lf.case similarity index 50% rename from open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-script.output rename to open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-script-lf.case index 26950cb7d..48f068311 100644 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-script.output +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-script-lf.case @@ -1,3 +1,25 @@ +---------- +///usr/bin/env jbang "$0" "$@" ; exit $? +//JAVA 21+ +//DEPS info.picocli:picocli:4.7.6 +//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13 com.squareup.okhttp3:okhttp:4.12.0 org.jsoup:jsoup:1.18.1 +//JAVA_OPTIONS -Xmx512m +//TODO pin these versions in a BOM + +import picocli.CommandLine; +//SOURCES Helper.java +import picocli.CommandLine.Command; +//RUNTIME_OPTIONS --enable-preview +@Command(name = "hello", mixinStandardHelpOptions = true) +class hello implements Runnable { +//DEPS org.example:in-class:1.0 + public void run() {System.out.println("Hello"); //DEPS org.example:trailing:1.0 + } + + public static void main(String... args) { System.exit(new CommandLine(new hello()).execute(args)); } +} +//DEPS com.fasterxml.jackson.core:jackson-databind:2.17.2 org.slf4j:slf4j-simple:2.0.13 com.squareup.okhttp3:okhttp:4.12.0 org.jsoup:jsoup:1.18.1 +---------- ///usr/bin/env jbang "$0" "$@" ; exit $? //JAVA 21+ //DEPS info.picocli:picocli:4.7.6 @@ -9,6 +31,7 @@ import picocli.CommandLine; // SOURCES Helper.java import picocli.CommandLine.Command; // RUNTIME_OPTIONS --enable-preview + @Command(name = "hello", mixinStandardHelpOptions = true) class hello implements Runnable { // DEPS org.example:in-class:1.0 diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-cr.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-cr.case new file mode 100644 index 000000000..9ee971013 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-cr.case @@ -0,0 +1 @@ +---------- class PalantirDeeplyNestedCalls { private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldOneV1)) .baaars(ImmutableList.of(MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) .baaars(ImmutableList.of(MagicConfigV1.builder() .baaars(ImmutableList.of(MagicConfigV1.builder() .baaars(ImmutableList.of(MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldFourV1)) .build())) .build())) .build())) .build())) .build(); void testMethod() { assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) .containsExactlyInAnyOrderElementsOf(Set.of( new ItemWithCustomLocator( ItemConfigV1.DEFAULT_CONFIG.toCustomString(), ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TEST_ITEM_A)) .name(ItemName.of(TEST_API_NAME.get())) .apiName(TEST_API_NAME) .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 .apiName() .get())) .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) .spec(ItemConfigV1Spec.native_( NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), // Discovered items new ItemWithCustomLocator( TestModelCatalog.MODEL_ABC_456.toItemApi(), CustomItemLocator.discovered(DiscoveredItemLocator.of())), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TEST_API_NAME)) .name(ItemName.of(TEST_API_NAME.get())) .apiName(TEST_API_NAME) .spec(ItemConfigV1Spec.native_( NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.discovered(DiscoveredItemLocator.of())))); } public Map otherMethod( FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { return myCustomService .get() .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) .entrySet() .stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> entry.getValue().getMetrics())); } } ---------- class PalantirDeeplyNestedCalls { private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldOneV1)) .baaars(ImmutableList.of(MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) .baaars(ImmutableList.of(MagicConfigV1.builder() .baaars(ImmutableList.of(MagicConfigV1.builder() .baaars(ImmutableList.of(MagicConfigV1.builder() .foooos(ImmutableList.of(testFieldFourV1)) .build())) .build())) .build())) .build())) .build(); void testMethod() { assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) .containsExactlyInAnyOrderElementsOf(Set.of( new ItemWithCustomLocator( ItemConfigV1.DEFAULT_CONFIG.toCustomString(), ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TEST_ITEM_A)) .name(ItemName.of(TEST_API_NAME.get())) .apiName(TEST_API_NAME) .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 .apiName() .get())) .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) .spec(ItemConfigV1Spec.native_( NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), // Discovered items new ItemWithCustomLocator( TestModelCatalog.MODEL_ABC_456.toItemApi(), CustomItemLocator.discovered(DiscoveredItemLocator.of())), new ItemWithCustomLocator( ItemConfigV1.builder() .id(getId(TEST_API_NAME)) .name(ItemName.of(TEST_API_NAME.get())) .apiName(TEST_API_NAME) .spec(ItemConfigV1Spec.native_( NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) .category(TestCatalog.TEST_CATEGORY_ALPHA) .creator(TestCatalog.TEST_CREATOR_BETA) .status(ItemLifecycleStatus.EXPERIMENTAL) .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) .creationDate(ItemMetadataInfo.builder().build()) .performanceAttributes( ItemAttributes.builder().build()) .categories(TestCatalog.TEST_CATEGORY_ALPHA) .build(), CustomItemLocator.discovered(DiscoveredItemLocator.of())))); } public Map otherMethod( FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { return myCustomService .get() .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) .entrySet() .stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> entry.getValue().getMetrics())); } } \ No newline at end of file diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-crlf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-crlf.case new file mode 100644 index 000000000..2ec2207d8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-crlf.case @@ -0,0 +1,188 @@ +---------- +class PalantirDeeplyNestedCalls { + private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldOneV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldFourV1)) + .build())) + .build())) + .build())) + .build())) + .build(); + + void testMethod() { + assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) + .containsExactlyInAnyOrderElementsOf(Set.of( + new ItemWithCustomLocator( + ItemConfigV1.DEFAULT_CONFIG.toCustomString(), + ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_ITEM_A)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) + .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 + .apiName() + .get())) + .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), + // Discovered items + new ItemWithCustomLocator( + TestModelCatalog.MODEL_ABC_456.toItemApi(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_API_NAME)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())))); + } + + public Map otherMethod( + FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { + return myCustomService + .get() + .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) + .entrySet() + .stream() + .collect(Collectors.toMap( + Map.Entry::getKey, entry -> entry.getValue().getMetrics())); + } +} +---------- +class PalantirDeeplyNestedCalls { + private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldOneV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldFourV1)) + .build())) + .build())) + .build())) + .build())) + .build(); + + void testMethod() { + assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) + .containsExactlyInAnyOrderElementsOf(Set.of( + new ItemWithCustomLocator( + ItemConfigV1.DEFAULT_CONFIG.toCustomString(), + ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_ITEM_A)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) + .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 + .apiName() + .get())) + .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), + // Discovered items + new ItemWithCustomLocator( + TestModelCatalog.MODEL_ABC_456.toItemApi(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_API_NAME)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())))); + } + + public Map otherMethod( + FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { + return myCustomService + .get() + .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) + .entrySet() + .stream() + .collect(Collectors.toMap( + Map.Entry::getKey, entry -> entry.getValue().getMetrics())); + } +} diff --git a/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-lf.case new file mode 100644 index 000000000..f1e8e899c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-deeply-nested-calls-lf.case @@ -0,0 +1,188 @@ +---------- +class PalantirDeeplyNestedCalls { + private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldOneV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldFourV1)) + .build())) + .build())) + .build())) + .build())) + .build(); + + void testMethod() { + assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) + .containsExactlyInAnyOrderElementsOf(Set.of( + new ItemWithCustomLocator( + ItemConfigV1.DEFAULT_CONFIG.toCustomString(), + ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_ITEM_A)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) + .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 + .apiName() + .get())) + .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), + // Discovered items + new ItemWithCustomLocator( + TestModelCatalog.MODEL_ABC_456.toItemApi(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_API_NAME)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())))); + } + + public Map otherMethod( + FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { + return myCustomService + .get() + .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) + .entrySet() + .stream() + .collect(Collectors.toMap( + Map.Entry::getKey, entry -> entry.getValue().getMetrics())); + } +} +---------- +class PalantirDeeplyNestedCalls { + private static MagicConfigV1 testSheetV1 = MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldOneV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldTwoV1, testFieldThreeV1)) + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .baaars(ImmutableList.of(MagicConfigV1.builder() + .foooos(ImmutableList.of(testFieldFourV1)) + .build())) + .build())) + .build())) + .build())) + .build(); + + void testMethod() { + assertThat(ConfigServiceV1.getAllItems(item1, item2, item3, item4)) + .containsExactlyInAnyOrderElementsOf(Set.of( + new ItemWithCustomLocator( + ItemConfigV1.DEFAULT_CONFIG.toCustomString(), + ItemConfigV1.createCustomConfig(ItemConfigV1Locator.of(TEST_ITEM_A))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_ITEM_A)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_(NativeItemConfigV1Spec.model(TestModel.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_B))), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TestModelCatalog.MODEL_XYZ_123.apiName())) + .name(ItemName.of(TestModelCatalog.MODEL_XYZ_123 + .apiName() + .get())) + .apiName(TestModelCatalog.MODEL_XYZ_123.apiName()) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.hosted(HostedItemLocator.of(TEST_ITEM_C))), + // Discovered items + new ItemWithCustomLocator( + TestModelCatalog.MODEL_ABC_456.toItemApi(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())), + new ItemWithCustomLocator( + ItemConfigV1.builder() + .id(getId(TEST_API_NAME)) + .name(ItemName.of(TEST_API_NAME.get())) + .apiName(TEST_API_NAME) + .spec(ItemConfigV1Spec.native_( + NativeItemConfigV1Spec.hubModel(HubModelSpec.of()))) + .category(TestCatalog.TEST_CATEGORY_ALPHA) + .creator(TestCatalog.TEST_CREATOR_BETA) + .status(ItemLifecycleStatus.EXPERIMENTAL) + .statusV2(ItemLifecycleStatusV2.experimental(LifecycleStatusExperimental.of())) + .inputSpec(ItemInputSpec.unknownInputType(UnknownInputSpec.of())) + .creationDate(ItemMetadataInfo.builder().build()) + .performanceAttributes( + ItemAttributes.builder().build()) + .categories(TestCatalog.TEST_CATEGORY_ALPHA) + .build(), + CustomItemLocator.discovered(DiscoveredItemLocator.of())))); + } + + public Map otherMethod( + FooAuthHeader authHeader, Set thingRids, WidgetTimeRange timeRange) { + return myCustomService + .get() + .fetchData(authHeader, FooMyCustomClass.of(thingRids, timeRange)) + .entrySet() + .stream() + .collect(Collectors.toMap( + Map.Entry::getKey, entry -> entry.getValue().getMetrics())); + } +}