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-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/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/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/CaseFile.java b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFile.java new file mode 100644 index 000000000..a5f6775bb --- /dev/null +++ b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFile.java @@ -0,0 +1,105 @@ +/* + * 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.List; +import java.util.regex.Pattern; + +/** + * 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 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 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) { + var separators = SEPARATOR.matcher(text).results().toList(); + + if (separators.size() != 2) { + throw new IllegalArgumentException( + path + ": a case has two lines of six or more dashes, found " + separators.size()); + } + + 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( + text.substring(separators.getFirst().end(), separators.getLast().start()), + text.substring(afterStart), + 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..dddfbb7bb --- /dev/null +++ b/open-java-format/src/test/java/com/palantir/javaformat/java/CaseFileTest.java @@ -0,0 +1,144 @@ +/* + * 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 theBlocksLieBetweenTheTwoSeparatorLines() { + assertThat(CaseFile.parse("a.case", "------\nclass A{}\n------\nclass A {}\n")) + .isEqualTo(new CaseFile("class A{}\n", "class A {}\n", 4)); + } + + @Test + 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)); + } + + @Test + void aFileWithoutASeparatorIsNotACase() { + assertThatThrownBy(() -> CaseFile.parse("dir/a.case", "class A {}\n")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("dir/a.case") + .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", "------\ny\n------\nz\n------\nw\n")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("a.case") + .hasMessageContaining("found 3"); + } + + @Test + void fiveDashesOrATrailingSpaceAreNotASeparator() { + 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 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 {\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")) + .isEqualTo(new CaseFile("class A{}\r", "class A {}\r", 4)); + } + + @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/FileBasedTests.java b/open-java-format/src/test/java/com/palantir/javaformat/java/FileBasedTests.java index 4f876343b..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,24 +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", "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(23, "ModuleImport") .build(); 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..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,181 +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" - + " }\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" + // 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_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 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 {")) + assertThatThrownBy(() -> FORMATTER.formatSourceAndFixImports("package foo; public class {")) .isInstanceOf(FormatterException.class); } @@ -488,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" @@ -621,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( @@ -668,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/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/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/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/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/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/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/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/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/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/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/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/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/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/AnnotationFields.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/AnnotationFields.output deleted file mode 100644 index 8124ce30c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/AnnotationFields.output +++ /dev/null @@ -1,146 +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(); - } -} 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/B124394008.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B124394008.output deleted file mode 100644 index 506511917..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B124394008.output +++ /dev/null @@ -1,9 +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/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/B18479811.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B18479811.output deleted file mode 100644 index eacebddb1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B18479811.output +++ /dev/null @@ -1,38 +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()); - } -} 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/B19950815.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950815.output deleted file mode 100644 index af7c123f5..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950815.output +++ /dev/null @@ -1,17 +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/B19996259.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19996259.output deleted file mode 100644 index fd6c1a122..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19996259.output +++ /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/B20128174.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128174.output deleted file mode 100644 index 302fa2f6d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128174.output +++ /dev/null @@ -1,24 +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/B20128588.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128588.output deleted file mode 100644 index 4ead03c80..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128588.output +++ /dev/null @@ -1,147 +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/B20128760.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128760.output deleted file mode 100644 index b19ff68b0..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128760.output +++ /dev/null @@ -1,80 +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> {} - - 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/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/B20341001.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20341001.output deleted file mode 100644 index 3e7d9bb55..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20341001.output +++ /dev/null @@ -1,296 +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/B20529113.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20529113.output deleted file mode 100644 index 24957a2f5..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20529113.output +++ /dev/null @@ -1,16 +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/B20535125.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20535125.output deleted file mode 100644 index 431571cfc..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20535125.output +++ /dev/null @@ -1,160 +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/B20567842.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20567842.output deleted file mode 100644 index 171e34cd0..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20567842.output +++ /dev/null @@ -1,14 +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/B20578077.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20578077.output deleted file mode 100644 index 898534444..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20578077.output +++ /dev/null @@ -1,11 +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/B20580212.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20580212.output deleted file mode 100644 index 26e921476..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20580212.output +++ /dev/null @@ -1,19 +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/B20701054.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20701054.output deleted file mode 100644 index 7693a5fcb..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20701054.output +++ /dev/null @@ -1,180 +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/B20844369.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20844369.output deleted file mode 100644 index 3bf3973e5..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20844369.output +++ /dev/null @@ -1,32 +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/B20915776.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20915776.output deleted file mode 100644 index f1cfdc6e1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20915776.output +++ /dev/null @@ -1,9 +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/B21031147.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21031147.output deleted file mode 100644 index 8d2ff50e4..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21031147.output +++ /dev/null @@ -1,8 +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/B21105569.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21105569.output deleted file mode 100644 index 3a3589f4a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21105569.output +++ /dev/null @@ -1,13 +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/B21192435.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21192435.output deleted file mode 100644 index d7fd41439..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21192435.output +++ /dev/null @@ -1,15 +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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21278211.input deleted file mode 100644 index 13e1559db..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21278211.input +++ /dev/null @@ -1,23 +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/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/B21283374.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21283374.output deleted file mode 100644 index f4e04a92e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21283374.output +++ /dev/null @@ -1,66 +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/B21305044.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21305044.output deleted file mode 100644 index 16f11eeec..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21305044.output +++ /dev/null @@ -1,49 +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< - ? 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/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/B21329312.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21329312.output deleted file mode 100644 index a76d6ec28..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21329312.output +++ /dev/null @@ -1,8 +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/B21465217.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465217.output deleted file mode 100644 index debbfecfb..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465217.output +++ /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/B21465477.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465477.output deleted file mode 100644 index 97df7e812..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465477.output +++ /dev/null @@ -1,16 +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/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/B21608216.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21608216.output deleted file mode 100644 index e47db71d6..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21608216.output +++ /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 {} diff --git a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21954779.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21954779.input deleted file mode 100644 index 804eb98ae..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21954779.input +++ /dev/null @@ -1,46 +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/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/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/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/B22169269.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22169269.output deleted file mode 100644 index 768155ecd..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22169269.output +++ /dev/null @@ -1,13 +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/B22488373.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22488373.output deleted file mode 100644 index e957f5112..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22488373.output +++ /dev/null @@ -1,9 +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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22610221.input deleted file mode 100644 index eb05cfde0..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22610221.input +++ /dev/null @@ -1,12 +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/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/B22815364.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22815364.output deleted file mode 100644 index fd46a9946..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22815364.output +++ /dev/null @@ -1,73 +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/B22873322.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22873322.output deleted file mode 100644 index e285177b2..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22873322.output +++ /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/B23349153.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23349153.output deleted file mode 100644 index 5c87ebff5..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23349153.output +++ /dev/null @@ -1,31 +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/B23708487.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23708487.output deleted file mode 100644 index 9a9be3737..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23708487.output +++ /dev/null @@ -1,9 +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/B23749160.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23749160.output deleted file mode 100644 index b08be17af..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23749160.output +++ /dev/null @@ -1,35 +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/B23804934.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23804934.output deleted file mode 100644 index e4361b21e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23804934.output +++ /dev/null @@ -1,31 +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/B24202287.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24202287.output deleted file mode 100644 index eeb004535..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24202287.output +++ /dev/null @@ -1,33 +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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24543625.input deleted file mode 100644 index 4c8dfb5a2..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24543625.input +++ /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/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/B24702438.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24702438.output deleted file mode 100644 index 99c2fa517..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24702438.output +++ /dev/null @@ -1,63 +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/B24909927.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24909927.output deleted file mode 100644 index ec8d742f4..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24909927.output +++ /dev/null @@ -1,445 +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/B25372815.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25372815.output deleted file mode 100644 index 23fb27764..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25372815.output +++ /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/B25749989.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25749989.output deleted file mode 100644 index 6b34e4739..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25749989.output +++ /dev/null @@ -1,7 +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/B25787055.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25787055.output deleted file mode 100644 index 00e0a3600..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25787055.output +++ /dev/null @@ -1,22 +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/B26159561.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26159561.output deleted file mode 100644 index 274feff20..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26159561.output +++ /dev/null @@ -1,7 +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/B26207047.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26207047.output deleted file mode 100644 index bda87fbc7..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26207047.output +++ /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/B26293162.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26293162.output deleted file mode 100644 index 2fb9282b5..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26293162.output +++ /dev/null @@ -1,42 +0,0 @@ -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/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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26884608.input deleted file mode 100644 index 52764b003..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26884608.input +++ /dev/null @@ -1,34 +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/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/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/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/B26952926.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26952926.output deleted file mode 100644 index 3ac396626..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26952926.output +++ /dev/null @@ -1,56 +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/B27078833.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27078833.output deleted file mode 100644 index c529e1cee..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27078833.output +++ /dev/null @@ -1,18 +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/B27246427.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27246427.output deleted file mode 100644 index bd0446a67..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27246427.output +++ /dev/null @@ -1,11 +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/B27602933.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27602933.output deleted file mode 100644 index 008c945c8..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27602933.output +++ /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/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/B28066276.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28066276.output deleted file mode 100644 index d88d3a2ad..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28066276.output +++ /dev/null @@ -1,37 +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________________ {} -} 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/B29368546.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29368546.output deleted file mode 100644 index cf89a475e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29368546.output +++ /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/B29618429.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29618429.output deleted file mode 100644 index efe20c21b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29618429.output +++ /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/B30153869.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30153869.output deleted file mode 100644 index d0db2afd0..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30153869.output +++ /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/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/B30223986.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30223986.output deleted file mode 100644 index ec3decfb8..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30223986.output +++ /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() {} -} 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/B30764810.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30764810.output deleted file mode 100644 index e3c53f940..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30764810.output +++ /dev/null @@ -1,16 +0,0 @@ -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/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/B308157568.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B308157568.output deleted file mode 100644 index 31eb4bdc2..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B308157568.output +++ /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/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/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/B33358723.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B33358723.output deleted file mode 100644 index 0e64eadbe..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B33358723.output +++ /dev/null @@ -1,21 +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/B37629610.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37629610.output deleted file mode 100644 index 737a69bfa..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37629610.output +++ /dev/null @@ -1,13 +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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37895033.input deleted file mode 100644 index 9ec5e463a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37895033.input +++ /dev/null @@ -1,20 +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/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/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/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/B65214682.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B65214682.output deleted file mode 100644 index 3b192617f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B65214682.output +++ /dev/null @@ -1,15 +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/C.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/C.output deleted file mode 100644 index f593f2dc7..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/C.output +++ /dev/null @@ -1,74 +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/D.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/D.output deleted file mode 100644 index a92d6cd34..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/D.output +++ /dev/null @@ -1,18 +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/E.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/E.output deleted file mode 100644 index 7c43245b9..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/E.output +++ /dev/null @@ -1,80 +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/ExpressionSwitch.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ExpressionSwitch.output deleted file mode 100644 index 5ef1ffadd..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ExpressionSwitch.output +++ /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/F.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/F.output deleted file mode 100644 index a6a38cd04..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/F.output +++ /dev/null @@ -1,48 +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>> - 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/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/FlexibleConstructor.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/FlexibleConstructor.output deleted file mode 100644 index 798bb786c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/FlexibleConstructor.output +++ /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/I.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I.output deleted file mode 100644 index 6482db012..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I.output +++ /dev/null @@ -1,75 +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/I1.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1.output deleted file mode 100644 index 4e5ea999b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1.output +++ /dev/null @@ -1,51 +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/I1260.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260.output deleted file mode 100644 index 85257e8d0..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260.output +++ /dev/null @@ -1,29 +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/I1260EmptyBlocks.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260EmptyBlocks.output deleted file mode 100644 index e58e60f23..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1260EmptyBlocks.output +++ /dev/null @@ -1,40 +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/I1309.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1309.output deleted file mode 100644 index a95fa156b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1309.output +++ /dev/null @@ -1,27 +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/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/I588.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I588.output deleted file mode 100644 index 0b7d6f147..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I588.output +++ /dev/null @@ -1,8 +0,0 @@ -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/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/I643.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I643.output deleted file mode 100644 index 283720369..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I643.output +++ /dev/null @@ -1,18 +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/I683.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I683.output deleted file mode 100644 index eadb3b8e8..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I683.output +++ /dev/null @@ -1,15 +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/I684.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I684.output deleted file mode 100644 index a94d5d818..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I684.output +++ /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/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/I880.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I880.output deleted file mode 100644 index ebea3a630..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I880.output +++ /dev/null @@ -1,18 +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; - }; - } -} 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/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/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/LocalAnnotations.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/LocalAnnotations.output deleted file mode 100644 index d89d9ce66..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/LocalAnnotations.output +++ /dev/null @@ -1,9 +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/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/M.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M.output deleted file mode 100644 index 04db52b1b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M.output +++ /dev/null @@ -1,1010 +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; - } - - < - 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/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/M1.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M1.output deleted file mode 100644 index 39bebebdf..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M1.output +++ /dev/null @@ -1,42 +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/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/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/Multivariables.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Multivariables.output deleted file mode 100644 index cc7f4c91b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Multivariables.output +++ /dev/null @@ -1,16 +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/N.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/N.output deleted file mode 100644 index ad6b0bec7..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/N.output +++ /dev/null @@ -1,36 +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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NON-NLS.input deleted file mode 100644 index ace31c646..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NON-NLS.input +++ /dev/null @@ -1,20 +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/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/NormalAnnotation.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NormalAnnotation.output deleted file mode 100644 index cad348bee..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NormalAnnotation.output +++ /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/P.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/P.output deleted file mode 100644 index d84f154b5..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/P.output +++ /dev/null @@ -1,19 +0,0 @@ -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/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/PairedArguments.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/PairedArguments.output deleted file mode 100644 index f59905b2a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/PairedArguments.output +++ /dev/null @@ -1,55 +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/Q.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Q.output deleted file mode 100644 index 000f766fd..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Q.output +++ /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/R.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/R.output deleted file mode 100644 index 10b49a8d3..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/R.output +++ /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/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/RSL.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/RSL.output deleted file mode 100644 index 0fbb58868..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/RSL.output +++ /dev/null @@ -1,185 +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(); -} 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/Records.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Records.output deleted file mode 100644 index a224ea907..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Records.output +++ /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; - } - } -} 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/S.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/S.output deleted file mode 100644 index 5814f56f2..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/S.output +++ /dev/null @@ -1,45 +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/SuperQualifier.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SuperQualifier.output deleted file mode 100644 index 5061f2c43..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SuperQualifier.output +++ /dev/null @@ -1,17 +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/SwitchGuardClause.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchGuardClause.output deleted file mode 100644 index f42195722..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchGuardClause.output +++ /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/SwitchRecord.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchRecord.output deleted file mode 100644 index f34e15f73..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchRecord.output +++ /dev/null @@ -1,44 +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/SwitchUnderscore.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchUnderscore.output deleted file mode 100644 index 6ea58e55a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchUnderscore.output +++ /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/T.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/T.output deleted file mode 100644 index 44788cde6..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/T.output +++ /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/TabularMixedSignInitializer.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TabularMixedSignInitializer.output deleted file mode 100644 index f2c0c8252..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TabularMixedSignInitializer.output +++ /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/TryWithResources.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TryWithResources.output deleted file mode 100644 index bbf6a1fe7..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/TryWithResources.output +++ /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/U.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/U.output deleted file mode 100644 index 52e58ff6d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/U.output +++ /dev/null @@ -1,53 +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/Unformatted.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted.input deleted file mode 100644 index c936d9ecc..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted.input +++ /dev/null @@ -1,43 +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 < 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 ) ; } } } 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/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/Unnamed.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unnamed.output deleted file mode 100644 index 09e3df9a4..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unnamed.output +++ /dev/null @@ -1,48 +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/UnnamedPattern.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnnamedPattern.output deleted file mode 100644 index 21a53185f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnnamedPattern.output +++ /dev/null @@ -1,35 +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/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/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/i221.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i221.output deleted file mode 100644 index 1188f2d54..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i221.output +++ /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/i281.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i281.output deleted file mode 100644 index 408577fc5..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i281.output +++ /dev/null @@ -1,23 +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/i59.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i59.output deleted file mode 100644 index 292d2b021..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i59.output +++ /dev/null @@ -1,12 +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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i71.input deleted file mode 100644 index 324c3d5ef..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i71.input +++ /dev/null @@ -1,16 +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/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-non-nls-trailing-marker.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-non-nls-trailing-marker.output deleted file mode 100644 index a566f2bed..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-non-nls-trailing-marker.output +++ /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-reflowed-literal.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-reflowed-literal.output deleted file mode 100644 index fdc8aaefa..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-reflowed-literal.output +++ /dev/null @@ -1,24 +0,0 @@ -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-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-23-wrapped-arguments.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-wrapped-arguments.output deleted file mode 100644 index b9d2836f9..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-23-wrapped-arguments.output +++ /dev/null @@ -1,30 +0,0 @@ -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-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-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/ojf-issue-24-jbang-script.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-script.output deleted file mode 100644 index 26950cb7d..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-24-jbang-script.output +++ /dev/null @@ -1,24 +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/ojf-issue-34-text-block-argument.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-argument.input deleted file mode 100644 index ceaabe7d1..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-34-text-block-argument.input +++ /dev/null @@ -1,8 +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-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-36-multiline-comments-on-one-line.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-36-multiline-comments-on-one-line.output deleted file mode 100644 index 84d857ff0..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-36-multiline-comments-on-one-line.output +++ /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-38-nbsp-line-comment.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-38-nbsp-line-comment.output deleted file mode 100644 index a504eee7f..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-38-nbsp-line-comment.output +++ /dev/null @@ -1,10 +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-60-cast-type-in-inline-chain.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-60-cast-type-in-inline-chain.output deleted file mode 100644 index c179a2667..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-60-cast-type-in-inline-chain.output +++ /dev/null @@ -1,47 +0,0 @@ -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-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-issue-62-comment-before-lambda-close-parens.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-62-comment-before-lambda-close-parens.output deleted file mode 100644 index f6b141e66..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-issue-62-comment-before-lambda-close-parens.output +++ /dev/null @@ -1,32 +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-long-generic-field-type.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-long-generic-field-type.output deleted file mode 100644 index b684e45a3..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-long-generic-field-type.output +++ /dev/null @@ -1,16 +0,0 @@ -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-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/ojf-semicolon-only-body.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-semicolon-only-body.output deleted file mode 100644 index 38962018b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ojf-semicolon-only-body.output +++ /dev/null @@ -1,36 +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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-10.input deleted file mode 100644 index 01de232f9..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-10.input +++ /dev/null @@ -1,27 +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-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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-11.input deleted file mode 100644 index ade9eae9a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-11.input +++ /dev/null @@ -1,13 +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-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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-12.input deleted file mode 100644 index fd39ea725..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-12.input +++ /dev/null @@ -1,25 +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-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-2.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-2.output deleted file mode 100644 index 6473cfa0e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-2.output +++ /dev/null @@ -1,15 +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-4.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-4.output deleted file mode 100644 index e5d6de758..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-4.output +++ /dev/null @@ -1,10 +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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg-no-chain.input deleted file mode 100644 index a67272d20..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg-no-chain.input +++ /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-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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-expr.input deleted file mode 100644 index 0ad6c2d16..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-expr.input +++ /dev/null @@ -1,7 +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-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-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-chains-lambdas.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chains-lambdas.output deleted file mode 100644 index d11faa902..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chains-lambdas.output +++ /dev/null @@ -1,18 +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)); - } -} 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-conjure-java-runtime-1285-2.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-2.output deleted file mode 100644 index 29c7c172a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-conjure-java-runtime-1285-2.output +++ /dev/null @@ -1,17 +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()); - } -} 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-dangling-method-reference.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-dangling-method-reference.output deleted file mode 100644 index 12684e6b8..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-dangling-method-reference.output +++ /dev/null @@ -1,9 +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-1.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-1.output deleted file mode 100644 index f01f50d37..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-1.output +++ /dev/null @@ -1,13 +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-lambda-2.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-2.output deleted file mode 100644 index e0111dc58..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-2.output +++ /dev/null @@ -1,9 +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-2.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas-2.output deleted file mode 100644 index 042e1bb8c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas-2.output +++ /dev/null @@ -1,9 +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-expression-lambdas.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas.output deleted file mode 100644 index 9d021695e..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas.output +++ /dev/null @@ -1,9 +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-gcv-1.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-gcv-1.input deleted file mode 100644 index 9d963b47a..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-gcv-1.input +++ /dev/null @@ -1,24 +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)); - } -} \ 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-issue-1343-text-block-indent-stable.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-issue-1343-text-block-indent-stable.input deleted file mode 100644 index 162408a62..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-issue-1343-text-block-indent-stable.input +++ /dev/null @@ -1,35 +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-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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-multiline-arg.input deleted file mode 100644 index b57b4c924..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lambda-multiline-arg.input +++ /dev/null @@ -1,66 +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-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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lamda-cast.input deleted file mode 100644 index dab47ad5b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lamda-cast.input +++ /dev/null @@ -1,18 +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-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-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-fqn.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-fqn.output deleted file mode 100644 index ce3f37dc3..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-fqn.output +++ /dev/null @@ -1,8 +0,0 @@ -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-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/com/palantir/javaformat/java/testdata/palantir-long-method-chain-arg.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain-arg.output deleted file mode 100644 index a68f94b4c..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain-arg.output +++ /dev/null @@ -1,9 +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/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-chain.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain.output deleted file mode 100644 index 0d08b6833..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain.output +++ /dev/null @@ -1,8 +0,0 @@ -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-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-method-reference.output b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-reference.output deleted file mode 100644 index 3165f0d14..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-reference.output +++ /dev/null @@ -1,12 +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); - } -} 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.input b/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-sandor-lambdas.input deleted file mode 100644 index 2f268fa0b..000000000 --- a/open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-sandor-lambdas.input +++ /dev/null @@ -1,14 +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; - } -} \ No newline at end of file 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/badConstructor.case b/open-java-format/src/test/resources/test-cases/badConstructor.case new file mode 100644 index 000000000..4a72f8073 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/badConstructor.case @@ -0,0 +1,6 @@ +---------- +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..2ba6f3d36 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/blankInClassBody.case @@ -0,0 +1,9 @@ +---------- +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..7c4f8fba7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/blockCommentInteriorTrailingBlank.case @@ -0,0 +1,18 @@ +---------- +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..d8889295b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/blockCommentTrailingBlank.case @@ -0,0 +1,12 @@ +---------- +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..e0f703f3c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/docCommentTrailingBlank.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/emptyArray.case b/open-java-format/src/test/resources/test-cases/emptyArray.case new file mode 100644 index 000000000..6de6f16ed --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/emptyArray.case @@ -0,0 +1,6 @@ +---------- +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..3735bfd7f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/importsFixedIfRequested.case @@ -0,0 +1,26 @@ +---------- +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..328c55ca7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/lineCommentTrailingBlank.case @@ -0,0 +1,12 @@ +---------- +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..761680c72 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/noBlankAfterLineCommentWithInteriorBlankLine.case @@ -0,0 +1,14 @@ +---------- +class T { +// asd + +// dsa +int x; +} +---------- +class T { + // asd + + // dsa + int x; +} 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$ + } +} 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..3cfb3fa12 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace.case @@ -0,0 +1,12 @@ +---------- +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..3387ff71e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/onlyWrapLineCommentOnWhitespace_noLeadingWhitespace.case @@ -0,0 +1,12 @@ +---------- +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..548bf658a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/removeTrailingTabsInComments.case @@ -0,0 +1,14 @@ +---------- +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..e87d2d7eb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/stringEscapeLength.case @@ -0,0 +1,8 @@ +---------- +class T {{ f("\""); }} +---------- +class T { + { + f("\""); + } +} 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..eb46ea9dc --- /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..4a2d4dcb8 --- /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..3c344e97d --- /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/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/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/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/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/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 new file mode 100644 index 000000000..9ac038e61 --- /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..322886bfa --- /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..a97ac9aeb --- /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/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/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/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"; +} 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$ + } +} 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/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/test-cases/testdata/AnnotationFields-lf.case b/open-java-format/src/test/resources/test-cases/testdata/AnnotationFields-lf.case new file mode 100644 index 000000000..2655e3cc7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/AnnotationFields-lf.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/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/test-cases/testdata/B124394008-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B124394008-lf.case new file mode 100644 index 000000000..a8a3f45df --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B124394008-lf.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/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/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/test-cases/testdata/B18479811-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B18479811-lf.case new file mode 100644 index 000000000..503a2b2c1 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B18479811-lf.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/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/test-cases/testdata/B19950815-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B19950815-lf.case new file mode 100644 index 000000000..12c2f242f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B19950815-lf.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/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/test-cases/testdata/B19996259-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B19996259-lf.case new file mode 100644 index 000000000..dc856faab --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B19996259-lf.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/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/test-cases/testdata/B20128174-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20128174-lf.case new file mode 100644 index 000000000..bb8cb5955 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128174-lf.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/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/test-cases/testdata/B20128588-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20128588-lf.case new file mode 100644 index 000000000..8dad99c62 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128588-lf.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/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/test-cases/testdata/B20128760-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20128760-lf.case new file mode 100644 index 000000000..eafcf54a2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20128760-lf.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/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/test-cases/testdata/B20341001-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20341001-lf.case new file mode 100644 index 000000000..3f48907d9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20341001-lf.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/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/test-cases/testdata/B20529113-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20529113-lf.case new file mode 100644 index 000000000..f25a3e356 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20529113-lf.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/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/test-cases/testdata/B20535125-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20535125-lf.case new file mode 100644 index 000000000..52e513af4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20535125-lf.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/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/test-cases/testdata/B20567842-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20567842-lf.case new file mode 100644 index 000000000..2cd2ebc8a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20567842-lf.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/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/test-cases/testdata/B20578077-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20578077-lf.case new file mode 100644 index 000000000..73444f55d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20578077-lf.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/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/test-cases/testdata/B20580212-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20580212-lf.case new file mode 100644 index 000000000..3db5f0efd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20580212-lf.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/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/test-cases/testdata/B20701054-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20701054-lf.case new file mode 100644 index 000000000..0b41fd7b7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20701054-lf.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/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/test-cases/testdata/B20844369-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20844369-lf.case new file mode 100644 index 000000000..d727d6286 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20844369-lf.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/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/test-cases/testdata/B20915776-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B20915776-lf.case new file mode 100644 index 000000000..81b9c00f9 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B20915776-lf.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/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/test-cases/testdata/B21031147-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21031147-lf.case new file mode 100644 index 000000000..d5a698a21 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21031147-lf.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/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/test-cases/testdata/B21105569-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21105569-lf.case new file mode 100644 index 000000000..c8f5f0509 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21105569-lf.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/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/test-cases/testdata/B21192435-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21192435-lf.case new file mode 100644 index 000000000..1f4e6b8fa --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21192435-lf.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/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/test-cases/testdata/B21278211-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21278211-lf.case new file mode 100644 index 000000000..7e27ca946 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21278211-lf.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/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/test-cases/testdata/B21283374-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21283374-lf.case new file mode 100644 index 000000000..18b24c934 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21283374-lf.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/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/test-cases/testdata/B21305044-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21305044-lf.case new file mode 100644 index 000000000..ab833617c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21305044-lf.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/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/test-cases/testdata/B21329312-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21329312-lf.case new file mode 100644 index 000000000..997fdd0f7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21329312-lf.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/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/test-cases/testdata/B21465217-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21465217-lf.case new file mode 100644 index 000000000..2d5625d90 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21465217-lf.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/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/test-cases/testdata/B21465477-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21465477-lf.case new file mode 100644 index 000000000..4769ac969 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21465477-lf.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/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/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/test-cases/testdata/B21608216-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21608216-lf.case new file mode 100644 index 000000000..bc6330c8e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21608216-lf.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/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/test-cases/testdata/B21954779-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B21954779-lf.case new file mode 100644 index 000000000..9d71d5e66 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B21954779-lf.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/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/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/test-cases/testdata/B22169269-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B22169269-lf.case new file mode 100644 index 000000000..74f9c27f7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22169269-lf.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/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/test-cases/testdata/B22488373-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B22488373-lf.case new file mode 100644 index 000000000..50ba83ab1 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22488373-lf.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/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/test-cases/testdata/B22610221-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B22610221-lf.case new file mode 100644 index 000000000..6c33995fd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22610221-lf.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/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/test-cases/testdata/B22815364-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B22815364-lf.case new file mode 100644 index 000000000..4bd9004d5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22815364-lf.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/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/test-cases/testdata/B22873322-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B22873322-lf.case new file mode 100644 index 000000000..5caf398f0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B22873322-lf.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/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/test-cases/testdata/B23349153-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B23349153-lf.case new file mode 100644 index 000000000..77ccea4e0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23349153-lf.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/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/test-cases/testdata/B23708487-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B23708487-lf.case new file mode 100644 index 000000000..a34bab5ae --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23708487-lf.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/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/test-cases/testdata/B23749160-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B23749160-lf.case new file mode 100644 index 000000000..5f02f9068 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23749160-lf.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/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/test-cases/testdata/B23804934-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B23804934-lf.case new file mode 100644 index 000000000..81a7cb912 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B23804934-lf.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/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/test-cases/testdata/B24202287-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B24202287-lf.case new file mode 100644 index 000000000..4fac8b93a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24202287-lf.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/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/test-cases/testdata/B24543625-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B24543625-lf.case new file mode 100644 index 000000000..7a9cdb31b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24543625-lf.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/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/test-cases/testdata/B24702438-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B24702438-lf.case new file mode 100644 index 000000000..09d9caae3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24702438-lf.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/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/test-cases/testdata/B24909927-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B24909927-lf.case new file mode 100644 index 000000000..417af336e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B24909927-lf.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/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/test-cases/testdata/B25372815-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B25372815-lf.case new file mode 100644 index 000000000..ab0a9a4d2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B25372815-lf.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/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/test-cases/testdata/B25749989-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B25749989-lf.case new file mode 100644 index 000000000..62ea0fff5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B25749989-lf.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/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/test-cases/testdata/B25787055-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B25787055-lf.case new file mode 100644 index 000000000..ede3878c5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B25787055-lf.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/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/test-cases/testdata/B26159561-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B26159561-lf.case new file mode 100644 index 000000000..461eca986 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26159561-lf.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/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/test-cases/testdata/B26207047-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B26207047-lf.case new file mode 100644 index 000000000..51fdd39ac --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26207047-lf.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/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/test-cases/testdata/B26293162-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B26293162-lf.case new file mode 100644 index 000000000..29ece1e1f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26293162-lf.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/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/test-cases/testdata/B26884608-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B26884608-lf.case new file mode 100644 index 000000000..734d22e75 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26884608-lf.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/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/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/test-cases/testdata/B26952926-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B26952926-lf.case new file mode 100644 index 000000000..340ed17c8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B26952926-lf.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/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/test-cases/testdata/B27078833-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B27078833-lf.case new file mode 100644 index 000000000..abb3f0075 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B27078833-lf.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/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/test-cases/testdata/B27246427-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B27246427-lf.case new file mode 100644 index 000000000..fd9ee16b8 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B27246427-lf.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/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/test-cases/testdata/B27602933-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B27602933-lf.case new file mode 100644 index 000000000..8e367cab3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B27602933-lf.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/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/test-cases/testdata/B28066276-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B28066276-lf.case new file mode 100644 index 000000000..a0b7738ff --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B28066276-lf.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/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/test-cases/testdata/B29368546-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B29368546-lf.case new file mode 100644 index 000000000..f8dd52e00 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B29368546-lf.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/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/test-cases/testdata/B29618429-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B29618429-lf.case new file mode 100644 index 000000000..f303ccbdd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B29618429-lf.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/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/test-cases/testdata/B30153869-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B30153869-lf.case new file mode 100644 index 000000000..59ce25c10 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B30153869-lf.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/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/test-cases/testdata/B30223986-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B30223986-lf.case new file mode 100644 index 000000000..5d6197432 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B30223986-lf.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/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/test-cases/testdata/B30764810-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B30764810-lf.case new file mode 100644 index 000000000..8401df23f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B30764810-lf.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/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/test-cases/testdata/B308157568-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B308157568-lf.case new file mode 100644 index 000000000..ceeabc700 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B308157568-lf.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/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/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/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/test-cases/testdata/B33358723-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B33358723-lf.case new file mode 100644 index 000000000..a4397d3a4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B33358723-lf.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/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/test-cases/testdata/B37629610-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B37629610-lf.case new file mode 100644 index 000000000..07b24de63 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B37629610-lf.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/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/test-cases/testdata/B37895033-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B37895033-lf.case new file mode 100644 index 000000000..6ffcee90d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B37895033-lf.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/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/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/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/test-cases/testdata/B65214682-lf.case b/open-java-format/src/test/resources/test-cases/testdata/B65214682-lf.case new file mode 100644 index 000000000..ff9f207ab --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/B65214682-lf.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/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/test-cases/testdata/C-lf.case b/open-java-format/src/test/resources/test-cases/testdata/C-lf.case new file mode 100644 index 000000000..c605ba4ef --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/C-lf.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/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/test-cases/testdata/D-lf.case b/open-java-format/src/test/resources/test-cases/testdata/D-lf.case new file mode 100644 index 000000000..16a7f2311 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/D-lf.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/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/test-cases/testdata/E-lf.case b/open-java-format/src/test/resources/test-cases/testdata/E-lf.case new file mode 100644 index 000000000..65a889214 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/E-lf.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/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/test-cases/testdata/ExpressionSwitch-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ExpressionSwitch-lf.case new file mode 100644 index 000000000..1c7530e0d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ExpressionSwitch-lf.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/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/test-cases/testdata/F-lf.case b/open-java-format/src/test/resources/test-cases/testdata/F-lf.case new file mode 100644 index 000000000..0db8d4820 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/F-lf.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/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/test-cases/testdata/FlexibleConstructor-lf.case b/open-java-format/src/test/resources/test-cases/testdata/FlexibleConstructor-lf.case new file mode 100644 index 000000000..d4f49fe43 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/FlexibleConstructor-lf.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/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/test-cases/testdata/I-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I-lf.case new file mode 100644 index 000000000..5d5419d69 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I-lf.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/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/test-cases/testdata/I1-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I1-lf.case new file mode 100644 index 000000000..67cd98550 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1-lf.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/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/test-cases/testdata/I1260-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I1260-lf.case new file mode 100644 index 000000000..59bda850b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1260-lf.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/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/test-cases/testdata/I1260EmptyBlocks-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I1260EmptyBlocks-lf.case new file mode 100644 index 000000000..67888fb4a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1260EmptyBlocks-lf.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/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/test-cases/testdata/I1309-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I1309-lf.case new file mode 100644 index 000000000..32a46d240 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I1309-lf.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/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/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/test-cases/testdata/I588-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I588-lf.case new file mode 100644 index 000000000..2bebfcb2c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I588-lf.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/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/test-cases/testdata/I643-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I643-lf.case new file mode 100644 index 000000000..47502f7ad --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I643-lf.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/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/test-cases/testdata/I683-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I683-lf.case new file mode 100644 index 000000000..90740a11d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I683-lf.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/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/test-cases/testdata/I684-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I684-lf.case new file mode 100644 index 000000000..a388fa68f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I684-lf.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/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/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/test-cases/testdata/I880-lf.case b/open-java-format/src/test/resources/test-cases/testdata/I880-lf.case new file mode 100644 index 000000000..38b41c546 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/I880-lf.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/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/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/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/test-cases/testdata/LocalAnnotations-lf.case b/open-java-format/src/test/resources/test-cases/testdata/LocalAnnotations-lf.case new file mode 100644 index 000000000..54ffdb729 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/LocalAnnotations-lf.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/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/test-cases/testdata/M-lf.case b/open-java-format/src/test/resources/test-cases/testdata/M-lf.case new file mode 100644 index 000000000..c1a6db27f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/M-lf.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/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/test-cases/testdata/M1-lf.case b/open-java-format/src/test/resources/test-cases/testdata/M1-lf.case new file mode 100644 index 000000000..f9a67fe98 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/M1-lf.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/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/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/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/test-cases/testdata/Multivariables-lf.case b/open-java-format/src/test/resources/test-cases/testdata/Multivariables-lf.case new file mode 100644 index 000000000..b99aeaf39 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Multivariables-lf.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/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/test-cases/testdata/N-lf.case b/open-java-format/src/test/resources/test-cases/testdata/N-lf.case new file mode 100644 index 000000000..088dbb0bc --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/N-lf.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/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/test-cases/testdata/NON-NLS-lf.case b/open-java-format/src/test/resources/test-cases/testdata/NON-NLS-lf.case new file mode 100644 index 000000000..f759c8ab5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/NON-NLS-lf.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/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/test-cases/testdata/NormalAnnotation-lf.case b/open-java-format/src/test/resources/test-cases/testdata/NormalAnnotation-lf.case new file mode 100644 index 000000000..d97a63627 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/NormalAnnotation-lf.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/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/test-cases/testdata/P-lf.case b/open-java-format/src/test/resources/test-cases/testdata/P-lf.case new file mode 100644 index 000000000..cb4fb7364 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/P-lf.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/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/test-cases/testdata/PairedArguments-lf.case b/open-java-format/src/test/resources/test-cases/testdata/PairedArguments-lf.case new file mode 100644 index 000000000..43d75f8ed --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/PairedArguments-lf.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/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/test-cases/testdata/Q-lf.case b/open-java-format/src/test/resources/test-cases/testdata/Q-lf.case new file mode 100644 index 000000000..e444e84dc --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Q-lf.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/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/test-cases/testdata/R-lf.case b/open-java-format/src/test/resources/test-cases/testdata/R-lf.case new file mode 100644 index 000000000..325b1ff33 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/R-lf.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/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/test-cases/testdata/RSL-lf.case b/open-java-format/src/test/resources/test-cases/testdata/RSL-lf.case new file mode 100644 index 000000000..671a40d22 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/RSL-lf.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/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/test-cases/testdata/Records-lf.case b/open-java-format/src/test/resources/test-cases/testdata/Records-lf.case new file mode 100644 index 000000000..e64c762e4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Records-lf.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/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/test-cases/testdata/S-lf.case b/open-java-format/src/test/resources/test-cases/testdata/S-lf.case new file mode 100644 index 000000000..f032856a2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/S-lf.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/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/test-cases/testdata/SuperQualifier-lf.case b/open-java-format/src/test/resources/test-cases/testdata/SuperQualifier-lf.case new file mode 100644 index 000000000..674adb426 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SuperQualifier-lf.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/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/test-cases/testdata/SwitchGuardClause-lf.case b/open-java-format/src/test/resources/test-cases/testdata/SwitchGuardClause-lf.case new file mode 100644 index 000000000..24f7f35aa --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchGuardClause-lf.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/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/test-cases/testdata/SwitchRecord-lf.case b/open-java-format/src/test/resources/test-cases/testdata/SwitchRecord-lf.case new file mode 100644 index 000000000..6d351ea49 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchRecord-lf.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/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/test-cases/testdata/SwitchUnderscore-lf.case b/open-java-format/src/test/resources/test-cases/testdata/SwitchUnderscore-lf.case new file mode 100644 index 000000000..ccd0c9c9d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/SwitchUnderscore-lf.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/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/test-cases/testdata/T-lf.case b/open-java-format/src/test/resources/test-cases/testdata/T-lf.case new file mode 100644 index 000000000..daf8a3785 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/T-lf.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/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/test-cases/testdata/TabularMixedSignInitializer-lf.case b/open-java-format/src/test/resources/test-cases/testdata/TabularMixedSignInitializer-lf.case new file mode 100644 index 000000000..04d8fbb49 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/TabularMixedSignInitializer-lf.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/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/test-cases/testdata/TryWithResources-lf.case b/open-java-format/src/test/resources/test-cases/testdata/TryWithResources-lf.case new file mode 100644 index 000000000..a2b835d84 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/TryWithResources-lf.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/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/test-cases/testdata/U-lf.case b/open-java-format/src/test/resources/test-cases/testdata/U-lf.case new file mode 100644 index 000000000..a0f18f03a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/U-lf.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/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/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/test-cases/testdata/Unformatted-lf.case b/open-java-format/src/test/resources/test-cases/testdata/Unformatted-lf.case new file mode 100644 index 000000000..b4bb855dc --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Unformatted-lf.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/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/test-cases/testdata/Unnamed-lf.case b/open-java-format/src/test/resources/test-cases/testdata/Unnamed-lf.case new file mode 100644 index 000000000..cd66dfc06 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/Unnamed-lf.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/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/test-cases/testdata/UnnamedPattern-lf.case b/open-java-format/src/test/resources/test-cases/testdata/UnnamedPattern-lf.case new file mode 100644 index 000000000..7c27bfc4f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/UnnamedPattern-lf.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/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/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/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/test-cases/testdata/i221-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i221-lf.case new file mode 100644 index 000000000..bee8247ff --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i221-lf.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/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/test-cases/testdata/i281-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i281-lf.case new file mode 100644 index 000000000..3b49de17c --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i281-lf.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/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/test-cases/testdata/i59-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i59-lf.case new file mode 100644 index 000000000..63472187e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i59-lf.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/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/test-cases/testdata/i71-lf.case b/open-java-format/src/test/resources/test-cases/testdata/i71-lf.case new file mode 100644 index 000000000..e469fe646 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/i71-lf.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/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/test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-lf.case new file mode 100644 index 000000000..de77e3d10 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-non-nls-trailing-marker-lf.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/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/test-cases/testdata/ojf-issue-23-reflowed-literal-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-reflowed-literal-lf.case new file mode 100644 index 000000000..4bac0503a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-reflowed-literal-lf.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/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/test-cases/testdata/ojf-issue-23-wrapped-arguments-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-wrapped-arguments-lf.case new file mode 100644 index 000000000..76164b5ca --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-23-wrapped-arguments-lf.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/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-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/test-cases/testdata/ojf-issue-24-jbang-script-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-script-lf.case new file mode 100644 index 000000000..48f068311 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-24-jbang-script-lf.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/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/test-cases/testdata/ojf-issue-34-text-block-argument-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-argument-lf.case new file mode 100644 index 000000000..ff3de55d6 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-34-text-block-argument-lf.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/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/test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-lf.case new file mode 100644 index 000000000..20cdf8dd2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-36-multiline-comments-on-one-line-lf.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/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/test-cases/testdata/ojf-issue-38-nbsp-line-comment-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-38-nbsp-line-comment-lf.case new file mode 100644 index 000000000..2aec28636 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-38-nbsp-line-comment-lf.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/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/test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-lf.case new file mode 100644 index 000000000..4ed18c161 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-60-cast-type-in-inline-chain-lf.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/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/test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-lf.case new file mode 100644 index 000000000..67a7d116a --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-issue-62-comment-before-lambda-close-parens-lf.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/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/test-cases/testdata/ojf-long-generic-field-type-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-long-generic-field-type-lf.case new file mode 100644 index 000000000..60c224b4f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-long-generic-field-type-lf.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/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/test-cases/testdata/ojf-semicolon-only-body-lf.case b/open-java-format/src/test/resources/test-cases/testdata/ojf-semicolon-only-body-lf.case new file mode 100644 index 000000000..45839878f --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/ojf-semicolon-only-body-lf.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/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/test-cases/testdata/palantir-10-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-10-lf.case new file mode 100644 index 000000000..fcf8aa1cb --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-10-lf.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/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/test-cases/testdata/palantir-11-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-11-lf.case new file mode 100644 index 000000000..fbbd85372 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-11-lf.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/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/test-cases/testdata/palantir-12-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-12-lf.case new file mode 100644 index 000000000..bbf14ab56 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-12-lf.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/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/test-cases/testdata/palantir-2-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-2-lf.case new file mode 100644 index 000000000..461fb3e34 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-2-lf.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/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/test-cases/testdata/palantir-4-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-4-lf.case new file mode 100644 index 000000000..fc246d7e2 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-4-lf.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/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/test-cases/testdata/palantir-break-lambda-arg-no-chain-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-no-chain-lf.case new file mode 100644 index 000000000..c9d43885b --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-arg-no-chain-lf.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/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/test-cases/testdata/palantir-break-lambda-expr-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-expr-lf.case new file mode 100644 index 000000000..956358e3e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-break-lambda-expr-lf.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/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-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/test-cases/testdata/palantir-chains-lambdas-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-chains-lambdas-lf.case new file mode 100644 index 000000000..c902017c4 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-chains-lambdas-lf.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/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/test-cases/testdata/palantir-conjure-java-runtime-1285-2-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-2-lf.case new file mode 100644 index 000000000..5507a0693 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-conjure-java-runtime-1285-2-lf.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/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/test-cases/testdata/palantir-dangling-method-reference-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-dangling-method-reference-lf.case new file mode 100644 index 000000000..b8a9377b3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-dangling-method-reference-lf.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/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/test-cases/testdata/palantir-expression-lambda-1-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-1-lf.case new file mode 100644 index 000000000..9ec6fe653 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-1-lf.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/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/test-cases/testdata/palantir-expression-lambda-2-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-2-lf.case new file mode 100644 index 000000000..1174e6937 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambda-2-lf.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/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/test-cases/testdata/palantir-expression-lambdas-2-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-2-lf.case new file mode 100644 index 000000000..bdbcf4096 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-2-lf.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/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/test-cases/testdata/palantir-expression-lambdas-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-lf.case new file mode 100644 index 000000000..30b2799c3 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-expression-lambdas-lf.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/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/test-cases/testdata/palantir-gcv-1-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-gcv-1-lf.case new file mode 100644 index 000000000..bd12bc1ad --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-gcv-1-lf.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/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/test-cases/testdata/palantir-issue-1343-text-block-indent-stable-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-issue-1343-text-block-indent-stable-lf.case new file mode 100644 index 000000000..447508280 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-issue-1343-text-block-indent-stable-lf.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/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/test-cases/testdata/palantir-lambda-multiline-arg-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-multiline-arg-lf.case new file mode 100644 index 000000000..ceb9c5ac7 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-lambda-multiline-arg-lf.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/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/test-cases/testdata/palantir-lamda-cast-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-lamda-cast-lf.case new file mode 100644 index 000000000..aae803d76 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-lamda-cast-lf.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/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/test-cases/testdata/palantir-long-fqn-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-fqn-lf.case new file mode 100644 index 000000000..8c329cdf0 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-fqn-lf.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/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/test-cases/testdata/palantir-long-method-chain-arg-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-arg-lf.case new file mode 100644 index 000000000..ca3ee497d --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-arg-lf.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/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/test-cases/testdata/palantir-long-method-chain-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-lf.case new file mode 100644 index 000000000..e37d55706 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-chain-lf.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/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/test-cases/testdata/palantir-long-method-reference-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-reference-lf.case new file mode 100644 index 000000000..c25fca21e --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-long-method-reference-lf.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/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/test-cases/testdata/palantir-sandor-lambdas-lf.case b/open-java-format/src/test/resources/test-cases/testdata/palantir-sandor-lambdas-lf.case new file mode 100644 index 000000000..24b753cb5 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/testdata/palantir-sandor-lambdas-lf.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/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..ef2807b29 --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/voidMethod.case @@ -0,0 +1,6 @@ +---------- +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..2992cbcbd --- /dev/null +++ b/open-java-format/src/test/resources/test-cases/wrapMarkdownDocstringComment.case @@ -0,0 +1,11 @@ +---------- +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() {} +}