├── changelog ├── @unreleased │ └── .gitkeep ├── 0.0.1 │ ├── pr-49.v2.yml │ ├── pr-81.v2.yml │ ├── pr-77.v2.yml │ ├── pr-2.v2.yml │ └── pr-44.v2.yml ├── 2.19.0 │ └── pr-671.v2.yml ├── 2.25.0 │ └── pr-772.v2.yml ├── 2.41.0 │ ├── pr-988.v2.yml │ └── pr-1029.v2.yml ├── 2.61.0 │ └── pr-1247.v2.yml ├── 2.0.1 │ └── pr-394.v2.yml ├── 2.17.0 │ └── pr-644.v2.yml ├── 2.36.0 │ └── pr-921.v2.yml ├── 2.42.0 │ └── pr-1069.v2.yml ├── 2.67.0 │ └── pr-1243.v2.yml ├── 2.68.0 │ ├── pr-1312.v2.yml │ └── pr-1298.v2.yml ├── 1.1.0 │ └── pr-358.v2.yml ├── 2.14.0 │ └── pr-622.v2.yml ├── 2.18.0 │ └── pr-676.v2.yml ├── 2.3.0 │ └── pr-559.v2.yml ├── 2.45.0 │ └── pr-1037.v2.yml ├── 2.73.0 │ └── pr-1384.v2.yml ├── 2.9.0 │ └── pr-583.v2.yml ├── 0.3.21 │ └── pr-163.v2.yml ├── 2.10.0 │ └── pr-615.v2.yml ├── 2.26.0 │ └── pr-784.v2.yml ├── 2.57.0 │ └── pr-1211.v2.yml ├── 2.62.0 │ └── pr-1263.v2.yml ├── 2.16.0 │ └── pr-636.v2.yml ├── 2.23.0 │ └── pr-728.v2.yml ├── 2.54.0 │ └── pr-1216.v2.yml ├── 2.56.0 │ └── pr-1226.v2.yml ├── 2.58.0 │ └── pr-1232.v2.yml ├── 2.8.0 │ └── pr-582.v2.yml ├── 0.3.11 │ └── pr-123.v2.yml ├── 0.3.16 │ └── pr-152.v2.yml ├── 2.40.0 │ └── pr-980.v2.yml ├── 2.47.0 │ ├── pr-1089.v2.yml │ └── pr-1084.v2.yml ├── 2.5.0 │ └── pr-566.v2.yml ├── 2.55.0 │ └── pr-1217.v2.yml ├── 2.63.0 │ └── pr-1273.v2.yml ├── 0.3.2 │ └── pr-71.v2.yml ├── 2.12.0 │ └── pr-619.v2.yml ├── 2.24.0 │ └── pr-731.v2.yml ├── 2.34.0 │ └── pr-906.v2.yml ├── 2.59.0 │ └── pr-1237.v2.yml ├── 2.7.0 │ └── pr-580.v2.yml ├── 2.4.0 │ └── pr-562.v2.yml ├── 2.13.0 │ └── pr-620.v2.yml ├── 2.48.0 │ └── pr-1110.v2.yml ├── 2.49.0 │ └── pr-1112.v2.yml ├── 2.51.0 │ ├── pr-1194.v2.yml │ └── pr-1127.v2.yml ├── 2.53.0 │ ├── pr-1194.v2.yml │ └── pr-1212.v2.yml ├── 2.6.0 │ └── pr-575.v2.yml ├── 0.3.4 │ └── pr-94.v2.yml ├── 2.27.0 │ └── pr-798.v2.yml ├── 2.70.0 │ └── pr-1338.v2.yml ├── 0.2.4 │ └── pr-30.v2.yml ├── 2.72.0 │ └── pr-1306.v2.yml ├── 0.2.7 │ └── pr-44.v2.yml ├── 0.3.6 │ └── pr-102.v2.yml ├── 2.44.0 │ └── pr-1078.v2.yml ├── 0.3.13 │ └── pr-131.v2.yml ├── 2.31.0 │ └── pr-874.v2.yml ├── 2.66.0 │ └── pr-1295.v2.yml ├── 0.3.3 │ ├── pr-85.v2.yml │ ├── pr-51.v2.yml │ └── pr-80.v2.yml ├── 0.1.1 │ ├── pr-22.v2.yml │ └── pr-18.v2.yml ├── 0.3.28 │ └── pr-257.v2.yml ├── 0.3.8 │ └── pr-104.v2.yml ├── 2.2.0 │ └── pr-503.v2.yml ├── 0.3.15 │ └── pr-144.v2.yml ├── 0.3.17 │ └── pr-157.v2.yml ├── 0.3.26 │ └── pr-203.v2.yml ├── 0.3.27 │ └── pr-252.v2.yml ├── 0.2.6 │ ├── pr-37.v2.yml │ └── pr-39.v2.yml ├── 0.3.12 │ └── pr-125.v2.yml ├── 0.2.1 │ ├── pr-17.v2.yml │ └── pr-24.v2.yml ├── 0.2.2 │ └── pr-26.v2.yml ├── 0.3.24 │ ├── pr-191.v2.yml │ └── pr-192.v2.yml ├── 0.3.20 │ └── pr-161.v2.yml ├── 2.28.0 │ └── pr-810.v2.yml ├── 2.46.0 │ └── pr-1083.v2.yml ├── 0.3.7 │ └── pr-101.v2.yml ├── 2.32.0 │ └── pr-875.v2.yml ├── 2.64.0 │ └── pr-1286.v2.yml ├── 2.29.0 │ └── pr-862.v2.yml ├── 0.3.22 │ └── pr-164.v2.yml ├── 0.3.25 │ └── pr-193.v2.yml ├── 2.0.0-rc1 │ └── pr-365.v2.yml ├── 0.2.3 │ └── pr-29.v2.yml ├── 2.11.0 │ └── pr-617.v2.yml ├── 0.3.23 │ └── pr-169.v2.yml ├── 2.60.0 │ └── pr-1240.v2.yml ├── 0.3.0 │ └── pr-48.v2.yml ├── 1.0.1 │ └── pr-313.v2.yml ├── 0.2.5 │ └── pr-35.v2.yml ├── 0.2.8 │ └── pr-45.v2.yml ├── 0.3.19 │ └── pr-147.v2.yml ├── 2.69.0 │ └── pr-1313.v2.yml ├── 0.3.10 │ └── pr-120.v2.yml ├── 0.3.18 │ └── pr-158.v2.yml ├── 0.3.5 │ └── pr-99.v2.yml ├── 2.1.0 │ └── pr-502.v2.yml ├── 2.22.0 │ └── pr-708.v2.yml ├── 0.3.1 │ └── pr-70.v2.yml ├── 0.3.14 │ └── pr-138.v2.yml ├── 0.3.9 │ └── pr-107.v2.yml ├── 2.71.0 │ └── pr-1367.v2.yml └── 2.0.0 │ └── pr-365.v2.yml ├── gradle ├── gradle-daemon-jdk-version ├── jdks │ ├── 17 │ │ ├── macos │ │ │ ├── aarch64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ │ └── x86-64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ ├── windows │ │ │ └── x86-64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ ├── linux-glibc │ │ │ ├── x86-64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ │ └── aarch64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ └── linux-musl │ │ │ ├── aarch64 │ │ │ ├── local-path │ │ │ └── download-url │ │ │ └── x86-64 │ │ │ ├── local-path │ │ │ └── download-url │ ├── 21 │ │ ├── macos │ │ │ ├── aarch64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ │ └── x86-64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ ├── windows │ │ │ └── x86-64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ ├── linux-glibc │ │ │ ├── aarch64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ │ └── x86-64 │ │ │ │ ├── local-path │ │ │ │ └── download-url │ │ └── linux-musl │ │ │ ├── aarch64 │ │ │ ├── local-path │ │ │ └── download-url │ │ │ └── x86-64 │ │ │ ├── local-path │ │ │ └── download-url │ └── 23 │ │ ├── macos │ │ ├── x86 │ │ │ ├── local-path │ │ │ └── download-url │ │ ├── aarch64 │ │ │ ├── local-path │ │ │ └── download-url │ │ └── x86-64 │ │ │ ├── local-path │ │ │ └── download-url │ │ ├── windows │ │ ├── aarch64 │ │ │ ├── local-path │ │ │ └── download-url │ │ ├── x86-64 │ │ │ ├── local-path │ │ │ └── download-url │ │ └── x86 │ │ │ ├── local-path │ │ │ └── download-url │ │ ├── linux-musl │ │ ├── x86 │ │ │ ├── local-path │ │ │ └── download-url │ │ ├── aarch64 │ │ │ ├── local-path │ │ │ └── download-url │ │ └── x86-64 │ │ │ ├── local-path │ │ │ └── download-url │ │ └── linux-glibc │ │ ├── aarch64 │ │ ├── local-path │ │ └── download-url │ │ ├── x86-64 │ │ ├── local-path │ │ └── download-url │ │ └── x86 │ │ ├── local-path │ │ └── download-url ├── gradle-jdks-setup.jar └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── debugger ├── src │ ├── react-app-env.d.ts │ ├── Data.ts │ ├── state.ts │ ├── common.tsx │ ├── index.tsx │ ├── App.test.tsx │ └── index.css ├── .gitignore └── tsconfig.json ├── eclipse_plugin ├── .gitignore └── src │ └── main │ └── resources │ ├── plugin.xml │ └── META-INF │ └── MANIFEST.MF ├── palantir-java-format └── src │ ├── main │ └── resources │ │ └── META-INF │ │ └── native-image │ │ ├── proxy-config.json │ │ ├── predefined-classes-config.json │ │ ├── serialization-config.json │ │ └── resource-config.json │ └── test │ └── resources │ └── com │ └── palantir │ └── javaformat │ └── java │ ├── testdata │ ├── M2.input │ ├── M2.output │ ├── B20524742.input │ ├── B23626035.input │ ├── B28786284.input │ ├── B21327412.input │ ├── B21327412.output │ ├── B23626035.output │ ├── B28786284.output │ ├── B20524742.output │ ├── B32729600.input │ ├── JavaFileNoNewLine.input │ ├── B19950468.input │ ├── EnumAnnotation.input │ ├── JavaFileNoNewLine.output │ ├── UnaryMinus.input │ ├── i101.input │ ├── i95.input │ ├── B19950468.output │ ├── B22424362.output │ ├── B32729600.output │ ├── Fields.input │ ├── Fields.output │ ├── JavaFileWithExtraSpaces.input │ ├── JavaFileWithExtraSpaces.output │ ├── UnaryMinus.output │ ├── i101.output │ ├── i95.output │ ├── B21585653.input │ ├── B21585653.output │ ├── B25811323.input │ ├── JavaFileWithMultipleLines.output │ ├── B25749989.input │ ├── B28774859.input │ ├── B28774859.output │ ├── B35797074.input │ ├── Var.input │ ├── B21185365.input │ ├── B22424362.input │ ├── B24494875.input │ ├── B35797074.output │ ├── B24494875.output │ ├── ForMany.input │ ├── JavaFileWithMultipleLines.input │ ├── i155.input │ ├── B21185365.output │ ├── B25811323.output │ ├── B30789352.input │ ├── B30789352.output │ ├── B38352414.input │ ├── B38352414.output │ ├── EnumAnnotation.output │ ├── I574.input │ ├── Var.output │ ├── B38203081.input │ ├── ForMany.output │ ├── i155.output │ ├── B26159561.input │ ├── B32284705.input │ ├── B36194204.input │ ├── B377585941.input │ ├── B38203081.output │ ├── WildBound.input │ ├── B32284705.output │ ├── B36194204.output │ ├── B377585941.output │ ├── I13.output │ ├── I202.input │ ├── I574.output │ ├── M3.input │ ├── I1205.input │ ├── WildBound.output │ ├── B25749989.output │ ├── I13.input │ ├── M3.output │ ├── I1205.output │ ├── I202.output │ ├── SwitchDouble.input │ ├── i176.input │ ├── B27246427.input │ ├── B29705613.input │ ├── I588.input │ ├── I959.input │ ├── MarkerAnnotation.input │ ├── MarkerAnnotation.output │ ├── i65.input │ ├── B22469536.input │ ├── I959.output │ ├── i65.output │ ├── B26159561.output │ ├── SingleMemberAnnotation.input │ ├── SingleMemberAnnotation.output │ ├── B21105569.input │ ├── B29705613.output │ ├── I12.output │ ├── SwitchDouble.output │ ├── B22469536.output │ ├── B32397217.input │ ├── LocalAnnotations.input │ ├── i176.output │ ├── i98.output │ ├── B32397217.output │ ├── SwitchUnderscore.input │ ├── palantir-break-lambda-expr.output │ ├── B23514513.output │ ├── I588.output │ ├── i66.input │ ├── i98.input │ ├── i100.input │ ├── i281.input │ ├── i66.output │ ├── B20128921.input │ ├── B23514513.input │ ├── B380299722.input │ ├── B21031147.input │ ├── B27246427.output │ ├── B38241237.input │ ├── I594.input │ ├── SwitchUnderscore.output │ ├── i100.output │ ├── B380299722.output │ ├── i221.input │ ├── palantir-break-lambda-expr.input │ ├── B20128921.output │ ├── B21647014.input │ ├── B19950219.input │ ├── B20128174.input │ ├── B21105569.output │ ├── B38241237.output │ ├── I365.output │ ├── i71.output │ ├── B29618429.input │ ├── I12.input │ ├── I594.output │ ├── LocalAnnotations.output │ ├── palantir-long-method-chain.input │ ├── i60.output │ ├── palantir-break-lambda-arg-no-chain.output │ ├── palantir-chain-next-line.output │ ├── B19996259.input │ ├── B24862959.output │ ├── B30764810.input │ ├── I696.output │ ├── i221.output │ ├── i60.input │ ├── palantir-long-method-chain-arg.input │ ├── B22913048.input │ ├── B29618429.output │ ├── B72507902.input │ ├── I365.input │ ├── Unformatted3.output │ ├── B19950219.output │ ├── B72507902.output │ ├── Unformatted3.input │ ├── B21031147.output │ ├── B27602933.input │ ├── B32114928.output │ ├── B22913048.output │ ├── B24862959.input │ ├── palantir-break-lambda-arg-no-chain.input │ ├── palantir-chain-next-line.input │ ├── I696.input │ ├── SwitchGuardClause.input │ ├── B126411718.output │ ├── B22610221.output │ ├── Pair.input │ ├── palantir-expression-lambda-2.input │ ├── B32114928.input │ ├── i59.input │ ├── B27602933.output │ ├── B21329312.input │ ├── Pair.output │ ├── B22848286.input │ ├── SwitchGuardClause.output │ ├── palantir-long-method-chain.output │ ├── B21647014.output │ ├── B22848286.output │ ├── L.input │ ├── B20577626.output │ ├── i55.input │ ├── i55.output │ ├── B124394008.input │ ├── B126411718.input │ ├── W.output │ ├── B20577626.input │ ├── B26275739.output │ ├── L.output │ ├── i282.input │ ├── palantir-expression-lambdas.input │ ├── W.input │ ├── i281.output │ ├── palantir-1.input │ ├── palantir-1.output │ ├── palantir-expression-lambda-1.input │ ├── palantir-long-safearg.input │ ├── B22610221.input │ ├── B26928842.input │ ├── B30764810.output │ ├── V.input │ ├── i59.output │ ├── palantir-6.output │ ├── palantir-8.output │ ├── palantir-dangling-method-reference.input │ ├── palantir-long-method-chain-arg.output │ ├── palantir-4.input │ ├── palantir-6.input │ ├── palantir-long-safearg.output │ ├── B20915776.input │ ├── B24988078.input │ ├── B26275739.input │ ├── V.output │ ├── B21329312.output │ ├── B24988078.output │ ├── B26928842.output │ ├── i71.input │ ├── palantir-expression-lambda-2.output │ ├── palantir-chains-lambdas.output │ ├── palantir-expression-lambdas-2.input │ ├── B21465477.input │ ├── B22169269.input │ ├── B30153869.input │ ├── I1309.input │ ├── R.input │ ├── i282.output │ ├── palantir-8.input │ ├── palantir-break-lambda-arg.input │ ├── palantir-break-lambda-arg.output │ ├── palantir-expression-lambdas.output │ ├── B124394008.output │ ├── B19996259.output │ ├── B22488373.input │ ├── palantir-long-fqn.input │ ├── B37895033.output │ ├── palantir-dangling-method-reference.output │ ├── B20915776.output │ ├── B22488373.output │ ├── Q.input │ ├── R.output │ ├── B30153869.output │ ├── B112853497.output │ ├── palantir-4.output │ ├── B22169269.output │ ├── palantir-expression-lambdas-2.output │ ├── I684.input │ ├── Q.output │ ├── palantir-chains-lambdas.input │ ├── B112853497.input │ ├── B21465477.output │ ├── I683.input │ ├── palantir-long-fqn.output │ ├── B.input │ ├── B20128174.output │ ├── I684.output │ ├── B.output │ ├── B23708487.input │ ├── B19950815.input │ ├── B20531711.output │ ├── B37895033.input │ ├── B23708487.output │ ├── B33358723.input │ ├── B20578077.input │ ├── I683.output │ ├── B20531711.input │ ├── palantir-expression-lambda-1.output │ ├── B27078833.input │ ├── palantir-7.input │ ├── B21465217.input │ ├── palantir-7.output │ ├── B20578077.output │ ├── B27078833.output │ ├── Multivariables.input │ ├── B21331232.output │ ├── B21331232.input │ ├── B21465217.output │ ├── palantir-5.output │ ├── B20567842.input │ ├── palantir-5.input │ ├── B21278211.output │ ├── Multivariables.output │ ├── B20580212.input │ ├── palantir-long-method-reference.input │ ├── B65214682.input │ ├── Records.input │ ├── B19950815.output │ ├── B64493529.input │ ├── B64493529.output │ ├── B22873322.input │ ├── palantir-lamda-cast.output │ ├── NON-NLS.output │ ├── T.input │ └── I643.input │ ├── testjavadoc │ ├── B31404367.input │ └── B31404367.output │ └── StringWrapperIntegrationTest │ ├── 11.input │ ├── 5.input │ ├── 8.input │ ├── 13.input │ ├── 3.input │ ├── 5.output │ ├── 11.output │ ├── 9.input │ ├── 10.input │ ├── 8.output │ ├── 9.output │ ├── 15.input │ ├── 6.input │ ├── 10.output │ ├── 13.output │ ├── 14.output │ ├── 15.output │ ├── 14.input │ ├── 0.output │ ├── 1.output │ ├── 2.output │ ├── 3.output │ ├── 0.input │ ├── 1.input │ ├── 2.input │ ├── 7.input │ ├── 4.output │ ├── 4.input │ ├── 12.output │ ├── 12.input │ ├── 6.output │ └── 7.output ├── .circleci └── .gitattributes ├── docs └── images │ └── install_plugin_from_disk.png ├── .changelog.yml ├── palantir-java-format-jdk-bootstrap └── src │ └── test │ └── resources │ ├── format.input │ └── format.output ├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .bulldozer.yml ├── .baseline ├── checkstyle │ └── custom-suppressions.xml └── copyright │ ├── 000_google-apache-2.0-2.txt │ ├── 000_google-apache-2.0-5.txt │ └── 000_google-apache-2.0-4.txt ├── .excavator.yml └── gradle.properties /changelog/@unreleased/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /gradle/gradle-daemon-jdk-version: -------------------------------------------------------------------------------- 1 | 21 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/macos/x86/local-path: -------------------------------------------------------------------------------- 1 | graalvm-ce-23.0.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/macos/aarch64/local-path: -------------------------------------------------------------------------------- 1 | graalvm-ce-23.0.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/macos/x86-64/local-path: -------------------------------------------------------------------------------- 1 | graalvm-ce-23.0.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/windows/aarch64/local-path: -------------------------------------------------------------------------------- 1 | graalvm-ce-23.0.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/windows/x86-64/local-path: -------------------------------------------------------------------------------- 1 | graalvm-ce-23.0.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/windows/x86/local-path: -------------------------------------------------------------------------------- 1 | graalvm-ce-23.0.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/linux-musl/x86/local-path: -------------------------------------------------------------------------------- 1 | graalvm-ce-23.0.1-musl 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/macos/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/macos/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/windows/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/macos/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-21.0.9.10.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/macos/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-21.0.9.10.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/windows/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-21.0.9.10.1 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/linux-glibc/aarch64/local-path: -------------------------------------------------------------------------------- 1 | graalvm-ce-23.0.1-glibc 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/linux-glibc/x86-64/local-path: -------------------------------------------------------------------------------- 1 | graalvm-ce-23.0.1-glibc 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/linux-glibc/x86/local-path: -------------------------------------------------------------------------------- 1 | graalvm-ce-23.0.1-glibc 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/linux-musl/aarch64/local-path: -------------------------------------------------------------------------------- 1 | graalvm-ce-23.0.1-musl 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/linux-musl/x86-64/local-path: -------------------------------------------------------------------------------- 1 | graalvm-ce-23.0.1-musl 2 | -------------------------------------------------------------------------------- /debugger/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /eclipse_plugin/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.mvn/wrapper/maven-wrapper.jar 3 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-glibc/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1-glibc 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-musl/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1-musl 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-musl/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1-musl 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-glibc/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-21.0.9.11.1-glibc 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-glibc/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-21.0.9.11.1-glibc 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-musl/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-21.0.9.11.1-musl 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-musl/x86-64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-21.0.9.11.1-musl 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-glibc/aarch64/local-path: -------------------------------------------------------------------------------- 1 | amazon-corretto-17.0.17.10.1-glibc 2 | -------------------------------------------------------------------------------- /palantir-java-format/src/main/resources/META-INF/native-image/proxy-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /debugger/src/Data.ts: -------------------------------------------------------------------------------- 1 | export type Id = number; 2 | 3 | export interface HasId { 4 | id: Id 5 | } 6 | -------------------------------------------------------------------------------- /changelog/0.0.1/pr-49.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Publish intellij plugin 4 | -------------------------------------------------------------------------------- /gradle/gradle-jdks-setup.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palantir/palantir-java-format/HEAD/gradle/gradle-jdks-setup.jar -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M2.input: -------------------------------------------------------------------------------- 1 | open module com.google.m { 2 | } 3 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M2.output: -------------------------------------------------------------------------------- 1 | open module com.google.m {} 2 | -------------------------------------------------------------------------------- /.circleci/.gitattributes: -------------------------------------------------------------------------------- 1 | # Mark .circleci/config.yml as generated for github reviews 2 | config.yml linguist-generated=true 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palantir/palantir-java-format/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20524742.input: -------------------------------------------------------------------------------- 1 | class Test {{ 2 | int x; 3 | }} 4 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23626035.input: -------------------------------------------------------------------------------- 1 | class Test2 { void f(Test2... xs) {} } 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/macos/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/21.0.9.10.1/amazon-corretto-21.0.9.10.1-macosx-x64.tar.gz 2 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28786284.input: -------------------------------------------------------------------------------- 1 | enum E { 2 | ONE, 3 | TWO; 4 | ; 5 | } 6 | -------------------------------------------------------------------------------- /docs/images/install_plugin_from_disk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palantir/palantir-java-format/HEAD/docs/images/install_plugin_from_disk.png -------------------------------------------------------------------------------- /gradle/jdks/17/macos/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-macosx-x64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-glibc/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/21.0.9.11.1/amazon-corretto-21.0.9.11.1-linux-x64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/macos/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/21.0.9.10.1/amazon-corretto-21.0.9.10.1-macosx-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/windows/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/21.0.9.10.1/amazon-corretto-21.0.9.10.1-windows-x64-jdk.zip 2 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21327412.input: -------------------------------------------------------------------------------- 1 | class B21327412 { 2 | int i = Data._ID; 3 | } 4 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21327412.output: -------------------------------------------------------------------------------- 1 | class B21327412 { 2 | int i = Data._ID; 3 | } 4 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-glibc/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-linux-x64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/macos/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-macosx-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/windows/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-windows-x64-jdk.zip 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-glibc/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/21.0.9.11.1/amazon-corretto-21.0.9.11.1-linux-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23626035.output: -------------------------------------------------------------------------------- 1 | class Test2 { 2 | void f(Test2... xs) {} 3 | } 4 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28786284.output: -------------------------------------------------------------------------------- 1 | enum E { 2 | ONE, 3 | TWO; 4 | ; 5 | } 6 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-glibc/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-linux-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/17/linux-musl/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-alpine-linux-x64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-musl/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/21.0.9.11.1/amazon-corretto-21.0.9.11.1-alpine-linux-x64.tar.gz 2 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20524742.output: -------------------------------------------------------------------------------- 1 | class Test { 2 | { 3 | int x; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32729600.input: -------------------------------------------------------------------------------- 1 | class B32729600 { 2 | { 3 | f(() -> {}); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileNoNewLine.input: -------------------------------------------------------------------------------- 1 | class MyClass { 2 | private void myFile() {} 3 | } -------------------------------------------------------------------------------- /gradle/jdks/17/linux-musl/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-alpine-linux-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/21/linux-musl/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://corretto.aws/downloads/resources/21.0.9.11.1/amazon-corretto-21.0.9.11.1-alpine-linux-aarch64.tar.gz 2 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950468.input: -------------------------------------------------------------------------------- 1 | class B19950468 { 2 | int code() {} 3 | 4 | // comment 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/EnumAnnotation.input: -------------------------------------------------------------------------------- 1 | enum E { 2 | @A ONE, 3 | TWO, 4 | @B @C THREE; 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileNoNewLine.output: -------------------------------------------------------------------------------- 1 | class MyClass { 2 | private void myFile() {} 3 | } 4 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnaryMinus.input: -------------------------------------------------------------------------------- 1 | class UnaryMinus { 2 | { 3 | int b = - 1; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i101.input: -------------------------------------------------------------------------------- 1 | public @interface kHz {} // No prefix defined in the annotation itself 2 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i95.input: -------------------------------------------------------------------------------- 1 | class I95 { 2 | public void format2(Object @Nullable ... a2) {} 3 | } 4 | -------------------------------------------------------------------------------- /gradle/jdks/23/macos/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_macos-x64_bin.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/macos/x86/download-url: -------------------------------------------------------------------------------- 1 | https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_macos-x64_bin.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/windows/x86/download-url: -------------------------------------------------------------------------------- 1 | https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_windows-x64_bin.zip 2 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950468.output: -------------------------------------------------------------------------------- 1 | class B19950468 { 2 | int code() {} 3 | 4 | // comment 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22424362.output: -------------------------------------------------------------------------------- 1 | class Test { 2 | { 3 | int x = 1 + 2; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32729600.output: -------------------------------------------------------------------------------- 1 | class B32729600 { 2 | { 3 | f(() -> {}); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Fields.input: -------------------------------------------------------------------------------- 1 | class Fields { 2 | 3 | int x = 1; 4 | 5 | int y = 1; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Fields.output: -------------------------------------------------------------------------------- 1 | class Fields { 2 | 3 | int x = 1; 4 | 5 | int y = 1; 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithExtraSpaces.input: -------------------------------------------------------------------------------- 1 | class MyClass { 2 | private void myFile() {} 3 | } -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithExtraSpaces.output: -------------------------------------------------------------------------------- 1 | class MyClass { 2 | private void myFile() {} 3 | } 4 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/UnaryMinus.output: -------------------------------------------------------------------------------- 1 | class UnaryMinus { 2 | { 3 | int b = -1; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i101.output: -------------------------------------------------------------------------------- 1 | public @interface kHz {} // No prefix defined in the annotation itself 2 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i95.output: -------------------------------------------------------------------------------- 1 | class I95 { 2 | public void format2(Object @Nullable ... a2) {} 3 | } 4 | -------------------------------------------------------------------------------- /gradle/jdks/23/linux-glibc/x86/download-url: -------------------------------------------------------------------------------- 1 | https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_linux-x64_bin.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/linux-musl/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_linux-x64_bin.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/linux-musl/x86/download-url: -------------------------------------------------------------------------------- 1 | https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_linux-x64_bin.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/macos/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_macos-aarch64_bin.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/windows/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_windows-x64_bin.zip 2 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21585653.input: -------------------------------------------------------------------------------- 1 | class B21585653 { 2 | { 3 | try (X x = x;) { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21585653.output: -------------------------------------------------------------------------------- 1 | class B21585653 { 2 | { 3 | try (X x = x; ) {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25811323.input: -------------------------------------------------------------------------------- 1 | class B25811323 { 2 | void f() { 3 | class Inner {}; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithMultipleLines.output: -------------------------------------------------------------------------------- 1 | class MyClass { 2 | private void myFile() {} 3 | } 4 | -------------------------------------------------------------------------------- /changelog/2.19.0/pr-671.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Handle non-sealed modifier 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/671 6 | -------------------------------------------------------------------------------- /changelog/2.25.0/pr-772.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix problems on windows 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/772 6 | -------------------------------------------------------------------------------- /gradle/jdks/23/linux-glibc/x86-64/download-url: -------------------------------------------------------------------------------- 1 | https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_linux-x64_bin.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/linux-musl/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_linux-aarch64_bin.tar.gz 2 | -------------------------------------------------------------------------------- /gradle/jdks/23/windows/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_windows-aarch64_bin.zip 2 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25749989.input: -------------------------------------------------------------------------------- 1 | class Dummy { 2 | /** 3 | */private static void method(){MISSING();} 4 | } 5 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28774859.input: -------------------------------------------------------------------------------- 1 | class B28774859 { 2 | java.util. /*comment*/ Map. /*comment*/ Entry e; 3 | } 4 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B28774859.output: -------------------------------------------------------------------------------- 1 | class B28774859 { 2 | java.util./*comment*/ Map./*comment*/ Entry e; 3 | } 4 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35797074.input: -------------------------------------------------------------------------------- 1 | class B35797074 { 2 | /** javadoc */ 3 | /* package */ final int x; 4 | } 5 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Var.input: -------------------------------------------------------------------------------- 1 | class Var { 2 | void f() { 3 | for (var x : ImmutableList.of(42)) {} 4 | } 5 | } -------------------------------------------------------------------------------- /changelog/0.0.1/pr-81.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix sitaution where branching causes Breaks to not be cleared after 4 | deciding a Level can be `oneLine`. 5 | -------------------------------------------------------------------------------- /changelog/2.41.0/pr-988.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Enable Nullaway 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/988 6 | -------------------------------------------------------------------------------- /changelog/2.61.0/pr-1247.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix pluginVersion discovery 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1247 6 | -------------------------------------------------------------------------------- /gradle/jdks/23/linux-glibc/aarch64/download-url: -------------------------------------------------------------------------------- 1 | https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_linux-aarch64_bin.tar.gz 2 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21185365.input: -------------------------------------------------------------------------------- 1 | class B21185365 { 2 | { 3 | for (int i = 0; i < s.length();) {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22424362.input: -------------------------------------------------------------------------------- 1 | class Test { 2 | { 3 | int x = 4 | 1 5 | 6 | + 2; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24494875.input: -------------------------------------------------------------------------------- 1 | public enum B24494875 { 2 | ; 3 | public static final String ONE = "ONE"; 4 | } 5 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B35797074.output: -------------------------------------------------------------------------------- 1 | class B35797074 { 2 | /** javadoc */ 3 | /* package */ final int x; 4 | } 5 | -------------------------------------------------------------------------------- /changelog/2.0.1/pr-394.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix line breaks in switch expression 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/394 6 | -------------------------------------------------------------------------------- /changelog/2.17.0/pr-644.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Handle empty implementation version 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/644 6 | -------------------------------------------------------------------------------- /changelog/2.36.0/pr-921.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: Add option to format javadoc 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/921 6 | -------------------------------------------------------------------------------- /changelog/2.42.0/pr-1069.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Properly format switch expressions 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1069 6 | -------------------------------------------------------------------------------- /changelog/2.67.0/pr-1243.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: SpotlessApply uses Java 21 version 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1243 6 | -------------------------------------------------------------------------------- /changelog/2.68.0/pr-1312.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Support for var in record patterns 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1312 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24494875.output: -------------------------------------------------------------------------------- 1 | public enum B24494875 { 2 | ; 3 | public static final String ONE = "ONE"; 4 | } 5 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ForMany.input: -------------------------------------------------------------------------------- 1 | class ForMany { 2 | { 3 | A a; 4 | for (b = B; c != C; d = D) {} 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/JavaFileWithMultipleLines.input: -------------------------------------------------------------------------------- 1 | class MyClass { 2 | private void myFile() {} 3 | } 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i155.input: -------------------------------------------------------------------------------- 1 | class I155 { 2 | void walkAndClose(Stream stream) { 3 | try (stream) {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /changelog/1.1.0/pr-358.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Update spotless to 5.7.0 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/358 6 | -------------------------------------------------------------------------------- /changelog/2.14.0/pr-622.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Handle empty format response replacements 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/622 6 | -------------------------------------------------------------------------------- /changelog/2.18.0/pr-676.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: bump jackson to 2.13.2 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/676 6 | -------------------------------------------------------------------------------- /changelog/2.3.0/pr-559.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Fix java 16 compatibility 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/559 6 | -------------------------------------------------------------------------------- /changelog/2.45.0/pr-1037.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix error message link for filing bugs 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1037 6 | -------------------------------------------------------------------------------- /changelog/2.73.0/pr-1384.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: bump spotless to version to `7.2.1` 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1384 6 | -------------------------------------------------------------------------------- /changelog/2.9.0/pr-583.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix deadlock trying to format large input 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/583 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/main/resources/META-INF/native-image/predefined-classes-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "type":"agent-extracted", 4 | "classes":[ 5 | ] 6 | } 7 | ] 8 | 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/main/resources/META-INF/native-image/serialization-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "types":[ 3 | ], 4 | "lambdaCapturingTypes":[ 5 | ], 6 | "proxies":[ 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21185365.output: -------------------------------------------------------------------------------- 1 | class B21185365 { 2 | { 3 | for (int i = 0; i < s.length(); ) {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25811323.output: -------------------------------------------------------------------------------- 1 | class B25811323 { 2 | void f() { 3 | class Inner {} 4 | ; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30789352.input: -------------------------------------------------------------------------------- 1 | /** 2 | * Body. 3 | * 4 | * @param

the protobuf type 5 | */ 6 | class B30789352

{} 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30789352.output: -------------------------------------------------------------------------------- 1 | /** 2 | * Body. 3 | * 4 | * @param

the protobuf type 5 | */ 6 | class B30789352

{} 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38352414.input: -------------------------------------------------------------------------------- 1 | @Redacted(Redacted.REDACTED + "/redacted", redacted = Redacted.class) 2 | class B38352414 {} 3 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38352414.output: -------------------------------------------------------------------------------- 1 | @Redacted(Redacted.REDACTED + "/redacted", redacted = Redacted.class) 2 | class B38352414 {} 3 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/EnumAnnotation.output: -------------------------------------------------------------------------------- 1 | enum E { 2 | @A 3 | ONE, 4 | TWO, 5 | @B 6 | @C 7 | THREE; 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I574.input: -------------------------------------------------------------------------------- 1 | public record Record(@NotNull Object o) { 2 | 3 | public Record { 4 | this.o = o; 5 | } 6 | } -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Var.output: -------------------------------------------------------------------------------- 1 | class Var { 2 | void f() { 3 | for (var x : ImmutableList.of(42)) {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testjavadoc/B31404367.input: -------------------------------------------------------------------------------- 1 | /** 2 | * Foo. 3 | * 4 | *

7 | */ 8 | class Foo {} 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testjavadoc/B31404367.output: -------------------------------------------------------------------------------- 1 | /** 2 | * Foo. 3 | * 4 | * 7 | */ 8 | class Foo {} 9 | -------------------------------------------------------------------------------- /changelog/0.3.21/pr-163.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Support source=9 across all formatter steps. 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/163 6 | -------------------------------------------------------------------------------- /changelog/2.10.0/pr-615.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Cherry-pick upstream changes. 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/615 6 | -------------------------------------------------------------------------------- /changelog/2.26.0/pr-784.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Support ea versions of Java 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/784 6 | -------------------------------------------------------------------------------- /changelog/2.57.0/pr-1211.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Java 21 with Graal support 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1211 6 | -------------------------------------------------------------------------------- /changelog/2.62.0/pr-1263.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Add formatter Intellij logs 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1263 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38203081.input: -------------------------------------------------------------------------------- 1 | class B38203081 { 2 | void f(int @A []... xs) {} 3 | 4 | void g(int @A [] @B... xs) {} 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/ForMany.output: -------------------------------------------------------------------------------- 1 | class ForMany { 2 | { 3 | A a; 4 | for (b = B; c != C; d = D) {} 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i155.output: -------------------------------------------------------------------------------- 1 | class I155 { 2 | void walkAndClose(Stream stream) { 3 | try (stream) {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /changelog/2.16.0/pr-636.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix idea plugin failures due to slf4j references 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/636 6 | -------------------------------------------------------------------------------- /changelog/2.23.0/pr-728.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Fix lambda compactness regression 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/728 6 | -------------------------------------------------------------------------------- /changelog/2.54.0/pr-1216.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix MissingResourceRegistration for native-image 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1216 6 | -------------------------------------------------------------------------------- /changelog/2.56.0/pr-1226.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Use modern infra to support multiple JDK versions 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1226 6 | -------------------------------------------------------------------------------- /changelog/2.58.0/pr-1232.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Make palantir-java-format dynamically unloadable 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1232 6 | -------------------------------------------------------------------------------- /changelog/2.8.0/pr-582.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Revert using bootstrapping formatter for Java 15 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/582 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26159561.input: -------------------------------------------------------------------------------- 1 | class B26159561 { 2 | { 3 | try (A a = a(); B b = b()) {} 4 | try (A a = a();) {} 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32284705.input: -------------------------------------------------------------------------------- 1 | /** 2 | * Foo 3 | *
4 |  * bar
5 |  * 
6 | *
7 | */ 8 | class B32284705 {} 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B36194204.input: -------------------------------------------------------------------------------- 1 | class B36194204 { 2 | { 3 | Function f = (String... s) -> s[0]; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B377585941.input: -------------------------------------------------------------------------------- 1 | class T { 2 | { 3 | f( 4 | /* foo */ """ 5 | hello 6 | """); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38203081.output: -------------------------------------------------------------------------------- 1 | class B38203081 { 2 | void f(int @A []... xs) {} 3 | 4 | void g(int @A [] @B ... xs) {} 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/WildBound.input: -------------------------------------------------------------------------------- 1 | class WildBound { 2 | T f() { 3 | return (T) X.class.newInstance((F) f, t); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /changelog/0.0.1/pr-77.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: When assignment initializers are too long, try to inline the initializer prefix if it fits, rather than always breaking. 4 | -------------------------------------------------------------------------------- /changelog/0.3.11/pr-123.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Nested method chains now also adhere to column limit. 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/123 6 | -------------------------------------------------------------------------------- /changelog/0.3.16/pr-152.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Turn off the javadoc formatter entirely. 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/152 6 | -------------------------------------------------------------------------------- /changelog/2.40.0/pr-980.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix "Could not determine jdk version for project" error 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/980 6 | -------------------------------------------------------------------------------- /changelog/2.47.0/pr-1089.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Stops optimizing imports via palantir-java-formatter 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1089 6 | -------------------------------------------------------------------------------- /changelog/2.5.0/pr-566.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Add required exports to the jar manifest 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/566 6 | -------------------------------------------------------------------------------- /changelog/2.55.0/pr-1217.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix nativeImageClassPath for Intellij configuration 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1217 6 | -------------------------------------------------------------------------------- /changelog/2.63.0/pr-1273.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Set working directory for the native image process 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1273 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32284705.output: -------------------------------------------------------------------------------- 1 | /** 2 | * Foo 3 | *
4 |  * bar
5 |  * 
6 | *
7 | */ 8 | class B32284705 {} 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B36194204.output: -------------------------------------------------------------------------------- 1 | class B36194204 { 2 | { 3 | Function f = (String... s) -> s[0]; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B377585941.output: -------------------------------------------------------------------------------- 1 | class T { 2 | { 3 | f(/* foo */ """ 4 | hello 5 | """); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I13.output: -------------------------------------------------------------------------------- 1 | class I13 { 2 | 3 | @Nullable 4 | public int f; 5 | 6 | @Override 7 | public void m() {} 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I202.input: -------------------------------------------------------------------------------- 1 | class I202 { 2 | { 3 | //noinspection CheckResult 4 | methodWhoseResultShouldBeChecked(); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I574.output: -------------------------------------------------------------------------------- 1 | public record Record(@NotNull Object o) { 2 | 3 | public Record { 4 | this.o = o; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M3.input: -------------------------------------------------------------------------------- 1 | @Deprecated 2 | module moduletags { 3 | requires transitive static moduleA; 4 | 5 | exports testpkgmdltags; 6 | } -------------------------------------------------------------------------------- /changelog/0.3.2/pr-71.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Limit dotted chains for expressions starting with constructor. 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/71 6 | -------------------------------------------------------------------------------- /changelog/2.12.0/pr-619.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix the intellij plugin when the bundled formatter is used 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/619 6 | -------------------------------------------------------------------------------- /changelog/2.24.0/pr-731.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Publish gradle plugin to gradle plugin portal 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/731 6 | -------------------------------------------------------------------------------- /changelog/2.34.0/pr-906.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Ensure imports are optimised on save, as well as formatting. 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/906 6 | -------------------------------------------------------------------------------- /changelog/2.59.0/pr-1237.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Sets min-version for pjf Intellij plugin 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1237 6 | -------------------------------------------------------------------------------- /changelog/2.7.0/pr-580.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Enable bootstrapping formatter on java 15+ 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/580 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1205.input: -------------------------------------------------------------------------------- 1 | public interface Foo { 2 | 3 | private static String foo = 4 | """ 5 | foo\ 6 | bar """; 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/WildBound.output: -------------------------------------------------------------------------------- 1 | class WildBound { 2 | T f() { 3 | return (T) X.class.newInstance((F) f, t); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /changelog/2.4.0/pr-562.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Bootstrap new jvm for running formatter with flags 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/562 6 | -------------------------------------------------------------------------------- /changelog/2.41.0/pr-1029.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Avoid computing expensive debug info for all checkState() calls 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1029 6 | -------------------------------------------------------------------------------- /changelog/2.68.0/pr-1298.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: bump `gradle-idea-configuration` and move off deprecated methods 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1298 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B25749989.output: -------------------------------------------------------------------------------- 1 | class Dummy { 2 | /** 3 | */ 4 | private static void method() { 5 | MISSING(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I13.input: -------------------------------------------------------------------------------- 1 | class I13 { 2 | 3 | @Nullable 4 | 5 | public int f; 6 | 7 | @Override 8 | 9 | public void m() {} 10 | } 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/M3.output: -------------------------------------------------------------------------------- 1 | @Deprecated 2 | module moduletags { 3 | requires transitive static moduleA; 4 | 5 | exports testpkgmdltags; 6 | } 7 | -------------------------------------------------------------------------------- /changelog/0.0.1/pr-2.v2.yml: -------------------------------------------------------------------------------- 1 | type: feature 2 | feature: 3 | description: |- 4 | Attempt to introduce more information into specific levels, such that early (more outer) breaks are not taken in certain conditions. 5 | -------------------------------------------------------------------------------- /changelog/2.13.0/pr-620.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Fix Idea plugin regression self-bootstrapping for jdk17 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/620 6 | -------------------------------------------------------------------------------- /changelog/2.48.0/pr-1110.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: The formatter should now always been enabled on save in intellij. 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1110 6 | -------------------------------------------------------------------------------- /changelog/2.49.0/pr-1112.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Ensure Actions on Save is configured properly in IntelliJ <=2023.3.6 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1112 6 | -------------------------------------------------------------------------------- /changelog/2.51.0/pr-1194.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Initial Graal native-image creation and Benchmarks 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1194 6 | -------------------------------------------------------------------------------- /changelog/2.53.0/pr-1194.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Initial Graal native-image creation and Benchmarks 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1194 6 | -------------------------------------------------------------------------------- /changelog/2.6.0/pr-575.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: 'Idea plugin: Fix NumberFormatException: For input string: "15.0.5"' 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/575 6 | -------------------------------------------------------------------------------- /debugger/src/state.ts: -------------------------------------------------------------------------------- 1 | export interface State { 2 | lastIndent: number, 3 | indent: number, 4 | column: number, 5 | mustBreak: boolean, 6 | numLines: number, 7 | branchingCoefficient: number, 8 | } -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1205.output: -------------------------------------------------------------------------------- 1 | public interface Foo { 2 | 3 | private static String foo = """ 4 | foo\ 5 | bar\ 6 | """; 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I202.output: -------------------------------------------------------------------------------- 1 | class I202 { 2 | { 3 | //noinspection CheckResult 4 | methodWhoseResultShouldBeChecked(); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchDouble.input: -------------------------------------------------------------------------------- 1 | class SwitchDouble { 2 | void x(Object o) { 3 | switch (o) { 4 | case null, default: 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i176.input: -------------------------------------------------------------------------------- 1 | interface 2 | InterfaceWithPrivateStaticMethod 3 | { 4 | private static void bar() { } 5 | default void foo() { bar(); } 6 | } 7 | -------------------------------------------------------------------------------- /changelog/0.3.4/pr-94.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Stop indiscriminately stopping an inlining at method calls like `SafeArg.of`. 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/94 6 | -------------------------------------------------------------------------------- /changelog/2.27.0/pr-798.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Use bootstrapping formatter starting from Intellij 2022.2 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/798 6 | -------------------------------------------------------------------------------- /changelog/2.70.0/pr-1338.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Update to use the new configuration cache safe `GradleOperatingSystem` 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1338 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27246427.input: -------------------------------------------------------------------------------- 1 | enum TrailingComment { 2 | /** foo */ FOO, /** bar */ 3 | BAR; 4 | 5 | /** a */ Object a; /** b */ 6 | Object b; 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29705613.input: -------------------------------------------------------------------------------- 1 | class B29705613 { 2 | /** 3 | * This tag isn't closed: {@link Foo 4 | * 5 | *

A paragraph 6 | */ 7 | int x; 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I588.input: -------------------------------------------------------------------------------- 1 | class T { 2 | int f(Object x) { 3 | if (x instanceof final Integer i) { 4 | return i; 5 | } 6 | return -1; 7 | } 8 | } -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I959.input: -------------------------------------------------------------------------------- 1 | class I959 { 2 | public void test() { 3 | new File(".").listFiles((final var dir, final var name) -> true); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkerAnnotation.input: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** JavaDoc comment. */ 4 | public @interface MarkerAnnotation {} 5 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/MarkerAnnotation.output: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** JavaDoc comment. */ 4 | public @interface MarkerAnnotation {} 5 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i65.input: -------------------------------------------------------------------------------- 1 | import org.checkerframework.checker.nullness.qual.*; 2 | 3 | class UnannoPrimitives { 4 | Object ar = new @Nullable byte[] {4}; 5 | } 6 | -------------------------------------------------------------------------------- /changelog/0.2.4/pr-30.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Allow long binary operations to wrap starting from the current line. 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/30 6 | -------------------------------------------------------------------------------- /changelog/2.51.0/pr-1127.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Use com.palantir.external-publish-intellij for idea plugins 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1127 6 | -------------------------------------------------------------------------------- /changelog/2.72.0/pr-1306.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Intellij uses the native image from `.gradle/palantir-java-formatter-caches` 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1306 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22469536.input: -------------------------------------------------------------------------------- 1 | public class Test { 2 | public static void foo() { 3 | long x = -9223372036854775808L; 4 | int y = -2147483648; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I959.output: -------------------------------------------------------------------------------- 1 | class I959 { 2 | public void test() { 3 | new File(".").listFiles((final var dir, final var name) -> true); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i65.output: -------------------------------------------------------------------------------- 1 | import org.checkerframework.checker.nullness.qual.*; 2 | 3 | class UnannoPrimitives { 4 | Object ar = new @Nullable byte[] {4}; 5 | } 6 | -------------------------------------------------------------------------------- /changelog/0.2.7/pr-44.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Prefer inlining method references after whatever expression they follow. 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/44 6 | -------------------------------------------------------------------------------- /changelog/0.3.6/pr-102.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Never put field annotations on the same line as the field declaration. 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/102 6 | -------------------------------------------------------------------------------- /changelog/2.44.0/pr-1078.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix palantir-java-format not running on IntelliJ >=2024.1 by moving to new APIs. 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1078 6 | -------------------------------------------------------------------------------- /debugger/src/common.tsx: -------------------------------------------------------------------------------- 1 | import { HasId } from "./Data"; 2 | import { CSSProperties } from "react"; 3 | 4 | export function backgroundColor(item: HasId): CSSProperties { 5 | return {background: `hsl(${item.id % 256}, 60%, 90%)`}; 6 | } -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/11.input: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "__ onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachanceto interrupt"; 3 | } 4 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/5.input: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachanceto interrupt"; 3 | } 4 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/8.input: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "onelongincrediblyunbrokensenten\tcemovingfromtopictotopicsothatnoonehadachance tointerrupt"; 3 | } 4 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26159561.output: -------------------------------------------------------------------------------- 1 | class B26159561 { 2 | { 3 | try (A a = a(); 4 | B b = b()) {} 5 | try (A a = a(); ) {} 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SingleMemberAnnotation.input: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | public @interface SingleMemberAnnotation { 4 | int value(); 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SingleMemberAnnotation.output: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | public @interface SingleMemberAnnotation { 4 | int value(); 5 | } 6 | -------------------------------------------------------------------------------- /changelog/0.3.13/pr-131.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Re-allow wrapping long inline tags like `{@link` from the 2nd whitespace 4 | onwards. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/131 7 | -------------------------------------------------------------------------------- /changelog/2.31.0/pr-874.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Update intellij compatibility range in IntelliJ plugin `plugin.xml` 4 | metadata file. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/874 7 | -------------------------------------------------------------------------------- /changelog/2.47.0/pr-1084.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Add instructions for how to run a prerelease version of the idea plugin 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1084 6 | -------------------------------------------------------------------------------- /changelog/2.53.0/pr-1212.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: 'Update native image build flags: add `--exact-reachability-metadata`' 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/1212 6 | -------------------------------------------------------------------------------- /changelog/2.66.0/pr-1295.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Use recommended project.getService & update sinceBuild to match intellij 4 | version 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/1295 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21105569.input: -------------------------------------------------------------------------------- 1 | class B21105569 { 2 | void f() { 3 | // asd 4 | } 5 | void g() { 6 | /* asd */ 7 | } 8 | void h() { /* asd */ } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29705613.output: -------------------------------------------------------------------------------- 1 | class B29705613 { 2 | /** 3 | * This tag isn't closed: {@link Foo 4 | * 5 | *

A paragraph 6 | */ 7 | int x; 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I12.output: -------------------------------------------------------------------------------- 1 | public class Test {} 2 | 3 | public class Test {} 4 | 5 | public class Test {} 6 | 7 | public class Test {} 8 | 9 | public class Test {} 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchDouble.output: -------------------------------------------------------------------------------- 1 | class SwitchDouble { 2 | void x(Object o) { 3 | switch (o) { 4 | case null, default: 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.changelog.yml: -------------------------------------------------------------------------------- 1 | # Excavator auto-updates this file. Please contribute improvements to the central template. 2 | 3 | # This file is intentionally empty. The file's existence enables changelog-app and is empty to use the default configuration. 4 | -------------------------------------------------------------------------------- /changelog/0.3.3/pr-85.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: "When inlining a level's leading docs, check that no breaks were introduced 4 | more robustly." 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/85 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/13.input: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = 3 | "aaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccc dddddddddddddddddd"; 4 | } 5 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22469536.output: -------------------------------------------------------------------------------- 1 | public class Test { 2 | public static void foo() { 3 | long x = -9223372036854775808L; 4 | int y = -2147483648; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32397217.input: -------------------------------------------------------------------------------- 1 | class T { 2 | { 3 | f( 4 | 1 /* 1 */, 2 /* 2 */); 5 | } 6 | } -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/LocalAnnotations.input: -------------------------------------------------------------------------------- 1 | class LocalAnnotations { 2 | { 3 | @Foo final Object x; 4 | @Foo(1) final Object y; 5 | @Foo(x=1) final Object y; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i176.output: -------------------------------------------------------------------------------- 1 | interface InterfaceWithPrivateStaticMethod { 2 | private static void bar() {} 3 | 4 | default void foo() { 5 | bar(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i98.output: -------------------------------------------------------------------------------- 1 | public class AnonInnerDefaults { 2 | 3 | public void tryStuff(final UIElement e) { 4 | PolyIface p = new @UI PolyIface() {}; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /changelog/0.1.1/pr-22.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: IntelliJ plugin not enabled by default, instead it is turned on when 4 | using the gradle plugin. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/22 7 | -------------------------------------------------------------------------------- /changelog/0.3.28/pr-257.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix edge case with empty levels causing formattings very close to the 4 | column limit to throw. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/257 7 | -------------------------------------------------------------------------------- /changelog/0.3.3/pr-51.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Get rid of constant error in new Intellij 193 by replacing `CodeStyleManager` 4 | programmatically. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/51 7 | -------------------------------------------------------------------------------- /changelog/0.3.8/pr-104.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: No longer break string concats unless they are a method's only argument 4 | on the line so far. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/104 7 | -------------------------------------------------------------------------------- /changelog/2.2.0/pr-503.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Convert InitialConfigurationComponent from project component to postStartupActivity 4 | links: 5 | - https://github.com/palantir/palantir-java-format/pull/503 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/3.input: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt"; 3 | } 4 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/5.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachanceto" 3 | + " interrupt"; 4 | } 5 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32397217.output: -------------------------------------------------------------------------------- 1 | class T { 2 | { 3 | f(1 /* 1 */, 2 /* 2 */); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchUnderscore.input: -------------------------------------------------------------------------------- 1 | public class SwitchUnderscore { 2 | void x(Object o) { 3 | switch (o) { 4 | case String _: 5 | default: 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-expr.output: -------------------------------------------------------------------------------- 1 | class PalantirLambdaBreakChain { 2 | void foo() { 3 | return hello.read(txn -> doSomeWork()).doMoreWork(); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /changelog/0.3.15/pr-144.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Make `formatDiff` task more resilient by waiting 30 seconds for git 4 | diff output before giving up. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/144 7 | -------------------------------------------------------------------------------- /changelog/0.3.17/pr-157.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Don't inline constructor calls without a custom body (i.e. if they 4 | are not anonymous classes). 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/157 7 | -------------------------------------------------------------------------------- /changelog/0.3.26/pr-203.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Make lambda/assignment logic more resilient so it doesn't crash when 4 | encountering long comments. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/203 7 | -------------------------------------------------------------------------------- /changelog/0.3.27/pr-252.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Case statements with a body consisting of a single block now inline 4 | their block. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/252 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/11.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "__ onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachanceto" 3 | + " interrupt"; 4 | } 5 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/9.input: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachancetointerrupt_____________________)_"; 3 | } 4 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23514513.output: -------------------------------------------------------------------------------- 1 | class Test { 2 | { 3 | f(rrr.kkkkk.uuuuuuuu, rrr.iiiiii.ggggggggggggggggg, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I588.output: -------------------------------------------------------------------------------- 1 | class T { 2 | int f(Object x) { 3 | if (x instanceof final Integer i) { 4 | return i; 5 | } 6 | return -1; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i66.input: -------------------------------------------------------------------------------- 1 | public class AnnotatedCast { 2 | 3 | public static @Sibling1 int convertSibling2ToSibling1(@Sibling2 int a) { 4 | return (@Sibling1 int) 1; 5 | } 6 | 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i98.input: -------------------------------------------------------------------------------- 1 | public class AnonInnerDefaults { 2 | 3 | public void tryStuff(final UIElement e) { 4 | PolyIface p = 5 | new @UI PolyIface() { 6 | }; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /changelog/0.2.6/pr-37.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Stop breaking method invocations after `(` except in very few particular 4 | circumstances. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/37 7 | -------------------------------------------------------------------------------- /changelog/0.3.12/pr-125.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: In javadocs, keep inline tags like `{@link ...}` on the same line if 4 | not already split. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/125 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i100.input: -------------------------------------------------------------------------------- 1 | public class I100 { 2 | void f() { 3 | Object o; 4 | o = new String @A [] {"foo", "bar"}; 5 | o = new String @A @B [] @C [] {"foo", "bar"}; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i281.input: -------------------------------------------------------------------------------- 1 | public enum Empty {} 2 | public enum Empty {;} 3 | public enum Empty {;;;} 4 | public enum Empty {; // comment 5 | ;;} 6 | public enum Empty {; 7 | ;; // comment 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i66.output: -------------------------------------------------------------------------------- 1 | public class AnnotatedCast { 2 | 3 | public static @Sibling1 int convertSibling2ToSibling1(@Sibling2 int a) { 4 | return (@Sibling1 int) 1; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /changelog/0.2.1/pr-17.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: "Inline prefix of initializer for variable and field assignments too, 4 | not just declarations." 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/17 7 | -------------------------------------------------------------------------------- /changelog/0.2.2/pr-26.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: When using the gradle plugin, users will receive a notification to 4 | install the IntelliJ plugin 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/26 7 | -------------------------------------------------------------------------------- /changelog/0.3.24/pr-191.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Long annotation args are now partially inlined, such that concatenated 4 | strings look better. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/191 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/10.input: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = 3 | "onelongincrediblyunbrokensentencemovingfromtopictotopicsot atnoonehadachancetointerrupt______________________";; 4 | } 5 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/8.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "onelongincrediblyunbrokensenten" 3 | + "\tcemovingfromtopictotopicsothatnoonehadachance" 4 | + " tointerrupt"; 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/9.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = 3 | "onelongincrediblyunbrokensentencemovingfromtopictotopicsothatnoonehadachancetointerrupt_____________________)_"; 4 | } 5 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128921.input: -------------------------------------------------------------------------------- 1 | public class B20128921 { 2 | 3 | void m(Iterable ax) { 4 | 5 | for (T a : ax) { 6 | 7 | System.err.println(x); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /changelog/0.3.20/pr-161.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Only allow expressions with prefix to be inlined after a lambda/simple 4 | expression if they contain method calls. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/161 7 | -------------------------------------------------------------------------------- /changelog/2.28.0/pr-810.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Write configuration to IPR file if it exists, as well as the .idea 4 | directory, to avoid errors in legacy projects 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/810 7 | -------------------------------------------------------------------------------- /changelog/2.46.0/pr-1083.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fixes bug where generated code or automated refactoring is formatted 4 | incorrectly by removing AD_HOC_FORMATTING 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/1083 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23514513.input: -------------------------------------------------------------------------------- 1 | class Test { 2 | { 3 | f( 4 | rrr.kkkkk.uuuuuuuu, rrr.iiiiii.ggggggggggggggggg, 5 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B380299722.input: -------------------------------------------------------------------------------- 1 | package com.helloworld; 2 | 3 | class Foo { 4 | void foo() { 5 | var bar = """ 6 | bar\ 7 | bar\ 8 | """; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /changelog/0.3.7/pr-101.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Partially inlined levels are now also limited such that the last dot 4 | in method call chains can't exceed 80 characters. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/101 7 | -------------------------------------------------------------------------------- /changelog/2.32.0/pr-875.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Update intellij compatibility range in IntelliJ plugin `plugin.xml` 4 | metadata file, but hopefully correctly this time. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/875 7 | -------------------------------------------------------------------------------- /changelog/2.64.0/pr-1286.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Allow `palantir-java-format` idea plugin dependency configuration via 4 | `idea-configuration` plugin 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/1286 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/15.input: -------------------------------------------------------------------------------- 1 | class T { 2 | byte[] bytes = 3 | "one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt".getBytes(); 4 | } 5 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/6.input: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "\n\none\nlong\nincredibly\nunbroken\nsentence\nmoving\nfrom\n topic\nto\n topic\nso\nthat\nno-one\nhad\na\nchance\nto\ninterrupt"; 3 | } 4 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21031147.input: -------------------------------------------------------------------------------- 1 | public class B21031147 { 2 | { 3 | return new StringBuilder(maxLength) 4 | .append(seq, 0, truncationLength).append(truncationIndicator).toString(); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27246427.output: -------------------------------------------------------------------------------- 1 | enum TrailingComment { 2 | /** foo */ 3 | FOO, 4 | /** bar */ 5 | BAR; 6 | 7 | /** a */ 8 | Object a; 9 | /** b */ 10 | Object b; 11 | } 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38241237.input: -------------------------------------------------------------------------------- 1 | class B38241237 { 2 | //foo 3 | //bar 4 | //one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt 5 | ///baz 6 | //// 7 | } -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I594.input: -------------------------------------------------------------------------------- 1 | public class I594 { 2 | public void thisIsNotFormattedCorrectly(Object something){ 3 | if(something instanceof String somethingAsString){ 4 | return; 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchUnderscore.output: -------------------------------------------------------------------------------- 1 | public class SwitchUnderscore { 2 | void x(Object o) { 3 | switch (o) { 4 | case String _: 5 | default: 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i100.output: -------------------------------------------------------------------------------- 1 | public class I100 { 2 | void f() { 3 | Object o; 4 | o = new String @A [] {"foo", "bar"}; 5 | o = new String @A @B [] @C [] {"foo", "bar"}; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /changelog/0.2.6/pr-39.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: A new `FormatDiffCli` class reads the output of `git diff -U0` and 4 | runs the formatter on modified lines only. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/39 7 | -------------------------------------------------------------------------------- /changelog/2.29.0/pr-862.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Stop using the Save Actions plugin (broken in IntelliJ 2023.1) and 4 | use native format on save (requires IntelliJ >=2021.2) 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/862 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/10.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "onelongincrediblyunbrokensentencemovingfromtopictotopicsot" 3 | + " atnoonehadachancetointerrupt______________________"; 4 | ; 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/13.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "aaaaaaaaaaaaaaaaaaaaaaaa" 3 | + " bbbbbbbbbbbbbbbbbb" 4 | + " ccccccccccccccccccccccccccc" 5 | + " dddddddddddddddddd"; 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/14.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "aaaaaaaaaaaaaaaaaaaaaaaa " 3 | + "bbbbbbbbbbbbbbbbbb " 4 | + "ccccccccccccccccccccccccccc " 5 | + "dddddddddddddddddd"; 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B380299722.output: -------------------------------------------------------------------------------- 1 | package com.helloworld; 2 | 3 | class Foo { 4 | void foo() { 5 | var bar = """ 6 | bar\ 7 | bar\ 8 | """; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i221.input: -------------------------------------------------------------------------------- 1 | class I221 { 2 | { 3 | logger.log( 4 | Level.WARNING, 5 | "Unable to obtain jst.web facet version from selected project", //$NON-NLS-1$ 6 | ex); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-expr.input: -------------------------------------------------------------------------------- 1 | class PalantirLambdaBreakChain { 2 | void foo() { 3 | return hello 4 | .read(txn -> doSomeWork()) 5 | .doMoreWork(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /changelog/0.3.22/pr-164.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Method references are no longer split onto their own line unless the 4 | expression they're referencing is also completely split. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/164 7 | -------------------------------------------------------------------------------- /changelog/0.3.25/pr-193.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Fix bug in 0.3.24 that could sometimes cause a NPE when encountering 4 | a newline right after a string concatenation expression. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/193 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128921.output: -------------------------------------------------------------------------------- 1 | public class B20128921 { 2 | 3 | void m(Iterable ax) { 4 | 5 | for (T a : ax) { 6 | 7 | System.err.println(x); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /changelog/0.3.3/pr-80.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: '"Before commit -> Reformat code" now correctly uses the PJF formatter 4 | if it is enabled, rather than the IntelliJ default formatter.' 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/80 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/15.output: -------------------------------------------------------------------------------- 1 | class T { 2 | byte[] bytes = 3 | "one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt" 4 | .getBytes(); 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21647014.input: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | import java.util.List;; 4 | 5 | ; 6 | class Test { 7 | ; 8 | public int x = 42;; 9 | ;;; 10 | { 11 | int x = 1;;; 12 | } 13 | ; 14 | } 15 | ; 16 | -------------------------------------------------------------------------------- /changelog/2.0.0-rc1/pr-365.v2.yml: -------------------------------------------------------------------------------- 1 | type: break 2 | break: 3 | description: | 4 | * Add support for java 14 language features. 5 | * **Break:** Increase minimum source compatibility from java 8 to java 11. 6 | links: 7 | - https://github.com/palantir/palantir-java-format/pull/365 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950219.input: -------------------------------------------------------------------------------- 1 | class B19950219 { 2 | @Override 3 | String normalizeWord(String word) { 4 | return Ascii.toLowerCase(word); 5 | } 6 | @Override 7 | String convert(CaseFormat format, String s) { 8 | }} 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128174.input: -------------------------------------------------------------------------------- 1 | class B20128174 { 2 | 3 | enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES }; 4 | 5 | enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES; }; 6 | 7 | enum Suit { DIAMONDS, HEARTS, CLUBS, SPADES,; }; 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21105569.output: -------------------------------------------------------------------------------- 1 | class B21105569 { 2 | void f() { 3 | // asd 4 | } 5 | 6 | void g() { 7 | /* asd */ 8 | } 9 | 10 | void h() { 11 | /* asd */ 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B38241237.output: -------------------------------------------------------------------------------- 1 | class B38241237 { 2 | // foo 3 | // bar 4 | // one long incredibly unbroken sentence moving from topic to topic so that no-one had a chance to interrupt 5 | /// baz 6 | //// 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I365.output: -------------------------------------------------------------------------------- 1 | class I365 { 2 | { 3 | return foo____________.bar__________().baz____________().parallelStream() 4 | .map(Baz::getId) 5 | .collect(toList()); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i71.output: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | class Test { 4 | Wrapper w = new Wrapper(Arrays.asList("a", "b", "c", "d", "e"), 2); 5 | Wrapper w = new Wrapper(Arrays.asList("a", "b", "c", "d", "e")); 6 | } 7 | -------------------------------------------------------------------------------- /changelog/0.2.3/pr-29.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Make `Formatter.formatSourceAndFixImports` work with the PALANTIR style. 4 | This can now be used to format a whole file including reflowing strings. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/29 7 | -------------------------------------------------------------------------------- /changelog/2.11.0/pr-617.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: palantir-java-format intellij plugin supports the new `PLUGIN_DIR/lib/*.jar` 4 | structure in addition to the old `PLUGIN_DIR/impl/*.jar` location 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/617 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29618429.input: -------------------------------------------------------------------------------- 1 | class B29618429 { 2 | /** 3 | * Hello 4 | * 5 | *

World 6 | *

 7 |    * @LooksLikeATag(
 8 |    *   foo = "bar"
 9 |    * )
10 |    * 
11 | */ 12 | int x; 13 | } 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I12.input: -------------------------------------------------------------------------------- 1 | public class Test { 2 | 3 | 4 | 5 | } 6 | 7 | public class Test { 8 | 9 | 10 | } 11 | 12 | public class Test { 13 | 14 | } 15 | 16 | public class Test { 17 | } 18 | 19 | public class Test {} 20 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I594.output: -------------------------------------------------------------------------------- 1 | public class I594 { 2 | public void thisIsNotFormattedCorrectly(Object something) { 3 | if (something instanceof String somethingAsString) { 4 | return; 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/LocalAnnotations.output: -------------------------------------------------------------------------------- 1 | class LocalAnnotations { 2 | { 3 | @Foo final Object x; 4 | @Foo(1) 5 | final Object y; 6 | @Foo(x = 1) 7 | final Object y; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /changelog/0.2.1/pr-24.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: We are now publishing the intellij plugin to the plugin portal. See 4 | https://plugins.jetbrains.com/plugin/13180-palantir-java-format 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/24 7 | -------------------------------------------------------------------------------- /changelog/0.3.23/pr-169.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Reduce situations where an inlined lambda can get a newline after the 4 | arrow, and allow inlining new Class() calls in more contexts. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/169 7 | -------------------------------------------------------------------------------- /changelog/2.60.0/pr-1240.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Native image IncludeAllLocales and updates reachability-metadata's 4 | resources glob to include all entries under `com/sun/tools/javac/resources/**` 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/1240 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/14.input: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = 3 | "aaaaaaaaaaaaaaaaaaaaaaaa " 4 | + "bbbbbbbbbbbbbbbbbb " 5 | + "ccccccccccccccccccccccccccc " 6 | + "dddddddddddddddddd"; 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain.input: -------------------------------------------------------------------------------- 1 | class PalantirLongMethodChain { 2 | private static void foo() { 3 | new ObjectMapper().registerModule(new Jdk8Module()).readValue(file, TestCases.class).getClient(); 4 | } 5 | 6 | } -------------------------------------------------------------------------------- /palantir-java-format-jdk-bootstrap/src/test/resources/format.input: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | class B { 4 | int x; private int y; public int z; 5 | 6 | void f() { 7 | while (true != false) { 8 | if (false == true) 9 | break; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/0.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "one long incredibly" 3 | + " unbroken sentence moving" 4 | + " from topic to topic so that" 5 | + " no-one had a chance to" 6 | + " interrupt"; 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/1.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "one long incredibly" 3 | + " unbroken sentence moving" 4 | + " from topic to topic so that" 5 | + " no-one had a chance to" 6 | + " interrupt"; 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/2.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "one long incredibly" 3 | + " unbroken sentence moving" 4 | + " from topic to topic so that" 5 | + " no-one had a chance to" 6 | + " interrupt"; 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/3.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "one long incredibly" 3 | + " unbroken sentence moving" 4 | + " from topic to topic so that" 5 | + " no-one had a chance to" 6 | + " interrupt"; 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i60.output: -------------------------------------------------------------------------------- 1 | import org.checkerframework.checker.nullness.qual.*; 2 | 3 | public class FullyQualified { 4 | 5 | public void format1(java.lang.String a1, java.lang.@Nullable Object... a2) { 6 | // body 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg-no-chain.output: -------------------------------------------------------------------------------- 1 | class PalantirLambdaBreakChain { 2 | void foo() { 3 | return hello.read(txn -> { 4 | doSomeWork(); 5 | doSomeMoreWork(); 6 | }); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chain-next-line.output: -------------------------------------------------------------------------------- 1 | class PalantirChainNextLine { 2 | void foo() { 3 | Iterator> delegateIterator = 4 | delegates.entrySet().iterator(); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /changelog/0.3.0/pr-48.v2.yml: -------------------------------------------------------------------------------- 1 | type: break 2 | break: 3 | description: The standalone `com.palantir.java-format` plugin provides a `formatDiff` 4 | task. IntelliJ setup has been moved to a `com.palantir.java-format-idea` plugin. 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/48 7 | -------------------------------------------------------------------------------- /debugger/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import '@blueprintjs/core/lib/css/blueprint.css'; 5 | import App from './App'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/0.input: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = 3 | "one long incredibly unbroken sentence" 4 | + " moving from topic to topic" 5 | + " so that no-one had a chance to" 6 | + " interrupt"; 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/1.input: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = 3 | "one long incredibly unbroken" 4 | + " sentence moving from topic to topic so that" 5 | + " no-one had a chance to" 6 | + " interrupt"; 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/2.input: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = 3 | "one long incredibly unbroken" 4 | + " sentence moving from topic to topic" 5 | + " so that no-one had a chance to interr" 6 | + "upt"; 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/7.input: -------------------------------------------------------------------------------- 1 | class T { 2 | 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"; 3 | } 4 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19996259.input: -------------------------------------------------------------------------------- 1 | class B19996259 { 2 | void g( // line comment 3 | int x) {} 4 | 5 | void // 6 | g // 7 | ( // 8 | int // 9 | x // 10 | , // 11 | int // 12 | y // 13 | ) // 14 | { // 15 | } // 16 | } 17 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24862959.output: -------------------------------------------------------------------------------- 1 | public enum XxxxxxxXxxx implements XxxxxxXxxxxxxXxxx { 2 | XXXXXXXXX_XXXX_XXX_XXXXXXXX(" ", Xxxxxx.XXXXXXX, XxxxXxxxxxxXxxxxxxx.XXXXX), 3 | // 4 | // 5 | // 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30764810.input: -------------------------------------------------------------------------------- 1 | class B30764810 { 2 | @Foo( 3 | x = {0}, 4 | y = 0 5 | // comment 6 | ) 7 | int a; 8 | 9 | @Foo( 10 | x = {0}, 11 | y = 0 12 | /* comment 13 | */ 14 | ) 15 | int b; 16 | } -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I696.output: -------------------------------------------------------------------------------- 1 | public abstract non-sealed class A extends SealedClass {} 2 | 3 | non-sealed class B extends SealedClass {} 4 | 5 | non-sealed @A class B extends SealedClass {} 6 | 7 | @A 8 | non-sealed class B extends SealedClass {} 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i221.output: -------------------------------------------------------------------------------- 1 | class I221 { 2 | { 3 | logger.log( 4 | Level.WARNING, 5 | "Unable to obtain jst.web facet version from selected project", //$NON-NLS-1$ 6 | ex); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i60.input: -------------------------------------------------------------------------------- 1 | import org.checkerframework.checker.nullness.qual.*; 2 | 3 | public class FullyQualified { 4 | 5 | public void format1(java.lang.String a1, java.lang. @Nullable Object... a2) { 6 | // body 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain-arg.input: -------------------------------------------------------------------------------- 1 | class PalantirLongMethodChainArg { 2 | void foo() { 3 | return cache.get(ImmutableRequest.builder().group(group).name(artifact).addRepositories("release-jar").build()); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /debugger/src/App.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22913048.input: -------------------------------------------------------------------------------- 1 | private class Yellow extends Red.Orange { 2 | Yellow(Red red) { 3 | red.super(); 4 | } 5 | 6 | Class getClassB() { 7 | return new TypeToken(getClass()) {}.getRawType(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B29618429.output: -------------------------------------------------------------------------------- 1 | class B29618429 { 2 | /** 3 | * Hello 4 | * 5 | *

World 6 | *

 7 |      * @LooksLikeATag(
 8 |      *   foo = "bar"
 9 |      * )
10 |      * 
11 | */ 12 | int x; 13 | } 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B72507902.input: -------------------------------------------------------------------------------- 1 | class B72507902 { 2 | private static class Xxxxxxxxxxxxxxxxxxxx 3 | extends Xxxxxxxxxxx< 4 | Pair>, Xxxxxxxxxxxxxxxxxxxx, 5 | List> {} 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I365.input: -------------------------------------------------------------------------------- 1 | class I365 { 2 | { 3 | return foo____________ 4 | .bar__________() 5 | .baz____________() 6 | .parallelStream() 7 | .map(Baz::getId) 8 | .collect(toList()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted3.output: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat; 2 | 3 | class Unformatted3 { 4 | /** 5 | * This comment is not reflowed 6 | * because it contains
preformatted
7 | * content. 8 | */ 9 | } 10 | -------------------------------------------------------------------------------- /changelog/0.3.24/pr-192.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Preserve the user's newlines in a long string concatenation (defined 4 | as a concatenation with `+` where at least one expression is a literal string). 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/192 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/4.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "one long incredibly" 3 | + " unbroken sentence moving" 4 | + " from topic to topic" 5 | + 42 6 | + " so that no-one had a chance" 7 | + " to interrupt"; 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950219.output: -------------------------------------------------------------------------------- 1 | class B19950219 { 2 | @Override 3 | String normalizeWord(String word) { 4 | return Ascii.toLowerCase(word); 5 | } 6 | 7 | @Override 8 | String convert(CaseFormat format, String s) {} 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B72507902.output: -------------------------------------------------------------------------------- 1 | class B72507902 { 2 | private static class Xxxxxxxxxxxxxxxxxxxx 3 | extends Xxxxxxxxxxx< 4 | Pair>, Xxxxxxxxxxxxxxxxxxxx, List> {} 5 | } 6 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Unformatted3.input: -------------------------------------------------------------------------------- 1 | package com . google . googlejavaformat ; 2 | 3 | class Unformatted3 { 4 | /** 5 | * This comment is not reflowed 6 | * because it contains
preformatted
7 | * content. 8 | */ 9 | } 10 | -------------------------------------------------------------------------------- /changelog/1.0.1/pr-313.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Explicitly extend the IntelliJ CodeStyleManagerImpl so that any methods 4 | added in newer releases are inherited automatically with a reasonable default 5 | implementation. 6 | links: 7 | - https://github.com/palantir/palantir-java-format/pull/313 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21031147.output: -------------------------------------------------------------------------------- 1 | public class B21031147 { 2 | { 3 | return new StringBuilder(maxLength) 4 | .append(seq, 0, truncationLength) 5 | .append(truncationIndicator) 6 | .toString(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27602933.input: -------------------------------------------------------------------------------- 1 | class B27602933 { 2 | { 3 | try { 4 | } catch (final A | B x) { 5 | } 6 | 7 | try { 8 | } catch (@SuppressWarnings("unused") IllegalArgumentException | RuntimeException e) { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32114928.output: -------------------------------------------------------------------------------- 1 | class B32114928 { 2 | { 3 | Class tClass = 4 | (Class) verifyNotNull((ParameterizedType) getClass().getGenericSuperclass()) 5 | .getActualTypeArguments()[0]; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /changelog/0.0.1/pr-44.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Javadoc follows the line length configured in the [JavaFormatterOptions.Style](https://github.com/palantir/palantir-java-format/blob/05df9d3b5c10f2bdd434181b6f046309a1040a37/core/src/main/java/com/google/googlejavaformat/java/JavaFormatterOptions.java#L32-L57). 4 | 5 | -------------------------------------------------------------------------------- /changelog/0.2.5/pr-35.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Reflow long strings more thoroughly, taking into account that once 4 | a string is broken, its first chunk might fit on the starting line and thus it 5 | needs to be reflowed again. 6 | links: 7 | - https://github.com/palantir/palantir-java-format/pull/35 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/4.input: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = 3 | "one long incredibly unbroken sentence" 4 | + " moving from topic to topic" 5 | + 42 6 | + " so that no-one had a chance to interr" 7 | + "upt"; 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22913048.output: -------------------------------------------------------------------------------- 1 | private class Yellow extends Red.Orange { 2 | Yellow(Red red) { 3 | red.super(); 4 | } 5 | 6 | Class getClassB() { 7 | return new TypeToken(getClass()) {}.getRawType(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24862959.input: -------------------------------------------------------------------------------- 1 | public enum XxxxxxxXxxx implements XxxxxxXxxxxxxXxxx { 2 | XXXXXXXXX_XXXX_XXX_XXXXXXXX( 3 | " ", Xxxxxx.XXXXXXX, XxxxXxxxxxxXxxxxxxx.XXXXX), 4 | // 5 | // 6 | // 7 | } 8 | 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg-no-chain.input: -------------------------------------------------------------------------------- 1 | class PalantirLambdaBreakChain { 2 | void foo() { 3 | return hello.read(txn -> { 4 | doSomeWork(); 5 | doSomeMoreWork(); 6 | }); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chain-next-line.input: -------------------------------------------------------------------------------- 1 | class PalantirChainNextLine { 2 | void foo() { 3 | Iterator> delegateIterator = delegates 4 | .entrySet() 5 | .iterator(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format-jdk-bootstrap/src/test/resources/format.output: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | class B { 4 | int x; 5 | private int y; 6 | public int z; 7 | 8 | void f() { 9 | while (true != false) { 10 | if (false == true) break; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I696.input: -------------------------------------------------------------------------------- 1 | public abstract non-sealed class A extends SealedClass { 2 | } 3 | 4 | non-sealed class B extends SealedClass { 5 | } 6 | 7 | non-sealed @A class B extends SealedClass { 8 | } 9 | 10 | @A non-sealed class B extends SealedClass { 11 | } 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchGuardClause.input: -------------------------------------------------------------------------------- 1 | class SwitchGuardClause { 2 | boolean test(Object x) { 3 | return switch (x) { 4 | case String s when s.length() < 5 -> true; 5 | case Integer i -> false; 6 | default -> true; 7 | }; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /changelog/0.2.8/pr-45.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: NON-NLS comments are moved behind `+` tokens in string concatenations. 4 | This is a heuristic that doesn't look at what the thing before the `+` is, so 5 | it might produce confusing results. 6 | links: 7 | - https://github.com/palantir/palantir-java-format/pull/45 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B126411718.output: -------------------------------------------------------------------------------- 1 | class B126411718 { 2 | { 3 | logger.atDebug().log( 4 | "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", 5 | deletedPersistentNames.size(), deletedPersistentNames); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22610221.output: -------------------------------------------------------------------------------- 1 | class B22610221 { 2 | { 3 | for (Map.Entry, Object> entry : 4 | FOO.bar().bazs().thing(someThing).entrySet()) { 5 | output.put(entry.getKey(), entry.getValue()); 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Pair.input: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** JavaDoc comment. */ 4 | public class Pair { 5 | public final T1 x; 6 | public final T2 y; 7 | 8 | Pair(T1 x, T2 y) { 9 | this.x = x; 10 | this.y = y; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-2.input: -------------------------------------------------------------------------------- 1 | class PalantirExpressionLambda2 { 2 | void foo() { 3 | this(txnManager, foundryResources, commitLogHandler, timestamp -> 4 | new UUID(timestamp, UUID.randomUUID().getLeastSignificantBits())); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## What happened? 2 | 3 | 7 | 8 | ## What did you want to happen? 9 | 10 | 13 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B32114928.input: -------------------------------------------------------------------------------- 1 | class B32114928 { 2 | { 3 | Class tClass = 4 | (Class) 5 | verifyNotNull((ParameterizedType) getClass().getGenericSuperclass()) 6 | .getActualTypeArguments()[ 7 | 0]; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i59.input: -------------------------------------------------------------------------------- 1 | import org.checkerframework.checker.tainting.qual.*; 2 | class Outer { 3 | class Nested { 4 | class InnerMost { 5 | @A Outer context(@B Outer.@C Nested.@D InnerMost this) { 6 | return Outer.this; 7 | } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27602933.output: -------------------------------------------------------------------------------- 1 | class B27602933 { 2 | { 3 | try { 4 | } catch (final A | B x) { 5 | } 6 | 7 | try { 8 | } catch (@SuppressWarnings("unused") IllegalArgumentException | RuntimeException e) { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /changelog/0.3.19/pr-147.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: More strictly control when we can inline a chunk of code followed by 4 | an expression lambda, to avoid pathological cases with a very simple expression 5 | being split onto the next line. 6 | links: 7 | - https://github.com/palantir/palantir-java-format/pull/147 8 | -------------------------------------------------------------------------------- /changelog/2.69.0/pr-1313.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: Make palantir-java-format support spotless 6.22.0, which is [transitively 4 | brought in from baseline to support the configuration cache](https://github.com/palantir/gradle-baseline/pull/3119) 5 | links: 6 | - https://github.com/palantir/palantir-java-format/pull/1313 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21329312.input: -------------------------------------------------------------------------------- 1 | public class B21329312 { 2 | boolean test() { 3 | return wasEdited || didContactsChange || medicalInfoManager.getTemporaryProfilePicture() != null 4 | || inMemoryAccessMedicalProfileAboveKeyguard != originalAccessMedicalProfileAboveKeyguard; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Pair.output: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** JavaDoc comment. */ 4 | public class Pair { 5 | public final T1 x; 6 | public final T2 y; 7 | 8 | Pair(T1 x, T2 y) { 9 | this.x = x; 10 | this.y = y; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22848286.input: -------------------------------------------------------------------------------- 1 | class B22848286 { 2 | 3 | @FxxxSxxx(xxxx = "xxxxxx_xxxxxxx_xxxxxxxxx_xxxx", xxxx = "Xxxxx xxxx xx xxxxxx xxxxxxx xxxxxxxxx.") 4 | int x; 5 | 6 | @FxxxGxxxxxxxx(xxxx = "Xxx xxxxxx xxxxxxxxy xxx xxx xxxxxxxxx, x.x. xxx xxxxxx xxxxxxxx xxxxxxxxy") 7 | int y; 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/SwitchGuardClause.output: -------------------------------------------------------------------------------- 1 | class SwitchGuardClause { 2 | boolean test(Object x) { 3 | return switch (x) { 4 | case String s when s.length() < 5 -> true; 5 | case Integer i -> false; 6 | default -> true; 7 | }; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain.output: -------------------------------------------------------------------------------- 1 | class PalantirLongMethodChain { 2 | private static void foo() { 3 | new ObjectMapper() 4 | .registerModule(new Jdk8Module()) 5 | .readValue(file, TestCases.class) 6 | .getClient(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /changelog/0.1.1/pr-18.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: IntelliJ plugin can be automatically configured with a custom version 4 | of the formatter, by applying `com.palantir.java-format` in gradle and setting 5 | the `palantirJavaFormat.implementationVersion`. 6 | links: 7 | - https://github.com/palantir/palantir-java-format/pull/18 8 | -------------------------------------------------------------------------------- /changelog/0.3.10/pr-120.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: When importing a gradle project with `com.palantir.java-format-idea` 4 | from IntelliJ, eagerly configure the necessary XML files in `.idea` rather than 5 | relying on unwieldy IntelliJ task triggers. 6 | links: 7 | - https://github.com/palantir/palantir-java-format/pull/120 8 | -------------------------------------------------------------------------------- /changelog/0.3.18/pr-158.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: 'Only service load the formatter implementation once, rather than once 4 | per gradle project. This avoids gradle potentially exceedding the `MaxMetaspaceSize` 5 | and throwing `java.lang.OutOfMemoryError: Metaspace`.' 6 | links: 7 | - https://github.com/palantir/palantir-java-format/pull/158 8 | -------------------------------------------------------------------------------- /changelog/0.3.5/pr-99.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Bring back inlining the prefix of method calls *iff* the levels inlined 4 | so far have all been simple. This fixes the regression introduced in 0.3.4 where 5 | long nested method calls would end up with too many indents. 6 | links: 7 | - https://github.com/palantir/palantir-java-format/pull/99 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21647014.output: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | import java.util.List; 4 | ; 5 | ; 6 | 7 | class Test { 8 | ; 9 | public int x = 42; 10 | ; 11 | ; 12 | ; 13 | ; 14 | 15 | { 16 | int x = 1; 17 | ; 18 | ; 19 | } 20 | ; 21 | } 22 | ; 23 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22848286.output: -------------------------------------------------------------------------------- 1 | class B22848286 { 2 | 3 | @FxxxSxxx(xxxx = "xxxxxx_xxxxxxx_xxxxxxxxx_xxxx", xxxx = "Xxxxx xxxx xx xxxxxx xxxxxxx xxxxxxxxx.") 4 | int x; 5 | 6 | @FxxxGxxxxxxxx(xxxx = "Xxx xxxxxx xxxxxxxxy xxx xxx xxxxxxxxx, x.x. xxx xxxxxx xxxxxxxx xxxxxxxxy") 7 | int y; 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/L.input: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** Tests for LabeledStatements and LambdaExpressions. */ 4 | class L { 5 | // TODO(jdd): Include high language-level tests. 6 | 7 | void f() { 8 | LABEL: 9 | for (int i = 0; i < 10; i++) {} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20577626.output: -------------------------------------------------------------------------------- 1 | class B20577626 { 2 | private @Mock GsaConfigFlags mGsaConfig; 3 | 4 | @Foo 5 | @Bar 6 | private @Mock GsaConfigFlags mGsaConfig; 7 | 8 | @Foo 9 | abstract @Bar void m() {} 10 | 11 | @Foo 12 | @Baz 13 | abstract @Bar void m() {} 14 | } 15 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i55.input: -------------------------------------------------------------------------------- 1 | import java.lang.annotation.*; 2 | 3 | @Target(ElementType.TYPE_USE) 4 | @interface Interned {} 5 | 6 | public class GjfTypeAnnotationOnArrayTest { 7 | 8 | public static void test() { 9 | String @Interned [] iarray1 = new String @Interned [2]; 10 | } 11 | 12 | } 13 | 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i55.output: -------------------------------------------------------------------------------- 1 | import java.lang.annotation.*; 2 | 3 | @Target(ElementType.TYPE_USE) 4 | @interface Interned {} 5 | 6 | public class GjfTypeAnnotationOnArrayTest { 7 | 8 | public static void test() { 9 | String @Interned [] iarray1 = new String @Interned [2]; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B124394008.input: -------------------------------------------------------------------------------- 1 | class B124394008 { 2 | { 3 | LocalReviewProto.Builder newReview = 4 | readProfileResponse.flatMap(authorExtractor::extract) 5 | .map(luReviewsExtractor::toLocalReviewProto) 6 | .orElse(LocalReviewProto.getDefaultInstance()).toBuilder(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B126411718.input: -------------------------------------------------------------------------------- 1 | class B126411718 { 2 | { 3 | logger 4 | .atDebug() 5 | .log( 6 | "Scratch Session Cleaner exiting. Number of deleted sessions: %d, names: %s", 7 | deletedPersistentNames.size(), 8 | deletedPersistentNames); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/W.output: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** Tests for WhileStatements and WildcardTypes. */ 4 | class W { 5 | T f() { 6 | while (true == true == true == true == true == true == true == true == true == true == true == true == true) {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20577626.input: -------------------------------------------------------------------------------- 1 | class B20577626 { 2 | private @Mock 3 | GsaConfigFlags mGsaConfig; 4 | 5 | @Foo 6 | @Bar 7 | private @Mock 8 | GsaConfigFlags mGsaConfig; 9 | 10 | @Foo 11 | abstract @Bar 12 | void m() {} 13 | 14 | @Foo 15 | @Baz 16 | abstract @Bar 17 | void m() {} 18 | } 19 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26275739.output: -------------------------------------------------------------------------------- 1 | public class B26275739 { 2 | { 3 | f(/* x */ 1, /* xx */ 2, /* x */ 3, /* xx */ 4); 4 | f( 5 | 1, 2, 6 | 3, 4); 7 | f( 8 | /* asd */ 9 | 1, 2, 10 | 3, 4); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/L.output: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** Tests for LabeledStatements and LambdaExpressions. */ 4 | class L { 5 | // TODO(jdd): Include high language-level tests. 6 | 7 | void f() { 8 | LABEL: 9 | for (int i = 0; i < 10; i++) {} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i282.input: -------------------------------------------------------------------------------- 1 | public class ArrayVsVarargs { 2 | 3 | void f(String[] arg) {} 4 | void g(String... arg) {} 5 | void h(String @A [] arg) {} 6 | void i(String @B... arg) {} 7 | void j(String @C [] @D [] arg) {} 8 | void k(String @E [] @F... arg) {} 9 | 10 | Class c = byte[].class; 11 | } 12 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Before this PR 2 | 3 | 4 | ## After this PR 5 | 6 | ==COMMIT_MSG== 7 | ==COMMIT_MSG== 8 | 9 | ## Possible downsides? 10 | 11 | 12 | -------------------------------------------------------------------------------- /changelog/2.1.0/pr-502.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: Support Intellij 212 API level (2021.2 EAP). The type signature changed 4 | from `Collection` to `Collection`. This is inspired 5 | by same fix in bazel intellij plugin to avoid compiling multiple versions 6 | links: 7 | - https://github.com/palantir/palantir-java-format/pull/502 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas.input: -------------------------------------------------------------------------------- 1 | class PalantirExpressionLambdas { 2 | void foo() { 3 | publisher = new ThisThatEventPublisher( 4 | txnManager, () -> Events.encoder(keyPair, new TestClock()), EventSeries.THING, () -> 5 | DEFAULT_EVENT_BATCH_SIZE); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/12.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "one long incredibly" 3 | + " unbroken sentence" 4 | // comment 5 | + " moving from topic to topic" 6 | // comment 7 | + " so that no-one had a chance" 8 | + " to" 9 | // comment 10 | + " interrupt"; 11 | } 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/W.input: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** Tests for WhileStatements and WildcardTypes. */ 4 | class W { 5 | T f() { 6 | while (true == true == true == true == true == true == true == true == true == true == true 7 | == true == true) {} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i281.output: -------------------------------------------------------------------------------- 1 | public enum Empty {} 2 | 3 | public enum Empty { 4 | ; 5 | } 6 | 7 | public enum Empty { 8 | ; 9 | ; 10 | ; 11 | } 12 | 13 | public enum Empty { 14 | ; // comment 15 | ; 16 | ; 17 | } 18 | 19 | public enum Empty { 20 | ; 21 | ; 22 | ; // comment 23 | } 24 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-1.input: -------------------------------------------------------------------------------- 1 | class Palantir1 { 2 | void foo() { 3 | for (Double d : Lists.newArrayList(5.0, 10.0, 1.0, 0.0)) { 4 | list.add(new BinaryNumericConstantColumnInfoV1( 5 | operation, SparkIntegrationTestRuleSets.column("x"), d, Optional.empty())); 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-1.output: -------------------------------------------------------------------------------- 1 | class Palantir1 { 2 | void foo() { 3 | for (Double d : Lists.newArrayList(5.0, 10.0, 1.0, 0.0)) { 4 | list.add(new BinaryNumericConstantColumnInfoV1( 5 | operation, SparkIntegrationTestRuleSets.column("x"), d, Optional.empty())); 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-1.input: -------------------------------------------------------------------------------- 1 | class PalantirExpressionLambda1 { 2 | void foo() { 3 | return createInternal(client, config, userAgent, hostEventsSink, serviceClass, RANDOMIZE, reshuffle, () -> 4 | new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize())); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-safearg.input: -------------------------------------------------------------------------------- 1 | class PalantirLongSafeArg { 2 | public static void foo() { 3 | Preconditions.checkArgument( 4 | hostPortString.charAt(0) == '[', "Bracketed host-port string must start with a bracket", SafeArg.of( 5 | "port", hostPortString)); 6 | } 7 | } -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/12.input: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = 3 | "one long incredibly unbroken sentence" 4 | // comment 5 | + " moving from topic to topic" 6 | // comment 7 | + " so that no-one had a chance to" 8 | // comment 9 | + " interrupt"; 10 | } 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22610221.input: -------------------------------------------------------------------------------- 1 | class B22610221 { 2 | { 3 | for (Map.Entry, Object> entry : 4 | FOO 5 | .bar() 6 | .bazs() 7 | .thing(someThing) 8 | .entrySet()) { 9 | output.put(entry.getKey(), entry.getValue()); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26928842.input: -------------------------------------------------------------------------------- 1 | class B26928842 { 2 | { 3 | curr.setData(curr.getData().toBuilder() 4 | .setPushCertificate( // New 5 | curr.getData().getPushCertficate()) // Old, misspelled 6 | .clearPushCertficate() // Old, misspelled 7 | .build()); 8 | } 9 | } -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30764810.output: -------------------------------------------------------------------------------- 1 | class B30764810 { 2 | @Foo( 3 | x = {0}, 4 | y = 0 5 | // comment 6 | ) 7 | int a; 8 | 9 | @Foo( 10 | x = {0}, 11 | y = 0 12 | /* comment 13 | */ 14 | ) 15 | int b; 16 | } 17 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/V.input: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** 4 | * Tests for VariableDeclarationExpressions, VariableDeclarationFragments, and 5 | * VariableDeclarationStatements. 6 | */ 7 | class V { 8 | int x = 0, y = 1; 9 | 10 | void f() { 11 | for (int a = 0, b = 1; a < b;) {} 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i59.output: -------------------------------------------------------------------------------- 1 | import org.checkerframework.checker.tainting.qual.*; 2 | 3 | class Outer { 4 | class Nested { 5 | class InnerMost { 6 | @A 7 | Outer context(@B Outer.@C Nested.@D InnerMost this) { 8 | return Outer.this; 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-6.output: -------------------------------------------------------------------------------- 1 | class Palantir6 { 2 | void foo() { 3 | Optional> maybeCached = OptionalUtils.orElseGetOptional( 4 | Optional.ofNullable(localRowsCache.getIfPresent(setDescription)), 5 | () -> Optional.ofNullable(datasetCache.getIfPresent(setDescription))); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-8.output: -------------------------------------------------------------------------------- 1 | class Palantir8 { 2 | void foo() { 3 | assertThatServiceExceptionThrownBy(new Aggregation.Builder() 4 | .max(max) 5 | .aggregations(ImmutableMap.of("bountiful", bountifulAggregation))::build) 6 | .hasType(MY_ERROR_TYPE); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-dangling-method-reference.input: -------------------------------------------------------------------------------- 1 | class PalantirDanglingMethodReference { 2 | void foo() { 3 | return engageNicely( 4 | staleForksFigureBark, staleForksFigureConsecutiveFailedExecutions, isStaleForksFigureInProgress, this 5 | ::engageStaleForksUnsafely); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-chain-arg.output: -------------------------------------------------------------------------------- 1 | class PalantirLongMethodChainArg { 2 | void foo() { 3 | return cache.get(ImmutableRequest.builder() 4 | .group(group) 5 | .name(artifact) 6 | .addRepositories("release-jar") 7 | .build()); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-4.input: -------------------------------------------------------------------------------- 1 | class Palantir4 { 2 | void foo() { 3 | if (useAddedColumnsSetDesription) { 4 | resultSet = spark.sparkSetCreator().resolve(initialSetResolver, new LoremIpsumLongClassNameWithDescription( 5 | initialSet, list, Optional.empty())); 6 | } 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-6.input: -------------------------------------------------------------------------------- 1 | class Palantir6 { 2 | void foo() { 3 | Optional> maybeCached = OptionalUtils.orElseGetOptional( 4 | Optional.ofNullable(localRowsCache.getIfPresent(setDescription)), 5 | () -> Optional.ofNullable(datasetCache.getIfPresent(setDescription))); 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-safearg.output: -------------------------------------------------------------------------------- 1 | class PalantirLongSafeArg { 2 | public static void foo() { 3 | Preconditions.checkArgument( 4 | hostPortString.charAt(0) == '[', 5 | "Bracketed host-port string must start with a bracket", 6 | SafeArg.of("port", hostPortString)); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20915776.input: -------------------------------------------------------------------------------- 1 | class B20915776 { 2 | @Inject 3 | void ChunkAnalysis( 4 | // TODO(user) ... 5 | @Parent DatasetSource supporters, 6 | @Child DatasetSource children, 7 | @Parent Provider parentSupportsDecider, 8 | @Child Provider childSupportsDecider) { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24988078.input: -------------------------------------------------------------------------------- 1 | class B24988078 { 2 | public static Optional fromNullable(@Nullable T nullableReference) {} 3 | 4 | public static Optional fromNullable(@Nullable T nullableReference) {} 5 | 6 | Table< /*@Nullable*/ Object, /*@Nullable*/ Object, /*@Nullable*/ Object > foo; 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26275739.input: -------------------------------------------------------------------------------- 1 | public class B26275739 { 2 | { 3 | f( 4 | /* x */ 1, 5 | /* xx */ 2, 6 | /* x */ 3, 7 | /* xx */ 4); 8 | f( 9 | 1, 10 | 2, 11 | 3, 12 | 4); 13 | f( 14 | /* asd */ 15 | 1, 2, 16 | 3, 4); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/V.output: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** 4 | * Tests for VariableDeclarationExpressions, VariableDeclarationFragments, and 5 | * VariableDeclarationStatements. 6 | */ 7 | class V { 8 | int x = 0, y = 1; 9 | 10 | void f() { 11 | for (int a = 0, b = 1; a < b; ) {} 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21329312.output: -------------------------------------------------------------------------------- 1 | public class B21329312 { 2 | boolean test() { 3 | return wasEdited 4 | || didContactsChange 5 | || medicalInfoManager.getTemporaryProfilePicture() != null 6 | || inMemoryAccessMedicalProfileAboveKeyguard != originalAccessMedicalProfileAboveKeyguard; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B24988078.output: -------------------------------------------------------------------------------- 1 | class B24988078 { 2 | public static Optional fromNullable(@Nullable T nullableReference) {} 3 | 4 | public static Optional fromNullable(@Nullable T nullableReference) {} 5 | 6 | Table foo; 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B26928842.output: -------------------------------------------------------------------------------- 1 | class B26928842 { 2 | { 3 | curr.setData(curr.getData().toBuilder() 4 | .setPushCertificate( // New 5 | curr.getData().getPushCertficate()) // Old, misspelled 6 | .clearPushCertficate() // Old, misspelled 7 | .build()); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i71.input: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | class Test { 4 | Wrapper w = new Wrapper( 5 | Arrays.asList( 6 | "a", "b", 7 | "c", "d", 8 | "e" 9 | ), 2); 10 | Wrapper w = new Wrapper( 11 | Arrays.asList( 12 | "a", "b", 13 | "c", "d", 14 | "e" 15 | )); 16 | } 17 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-2.output: -------------------------------------------------------------------------------- 1 | class PalantirExpressionLambda2 { 2 | void foo() { 3 | this( 4 | txnManager, 5 | foundryResources, 6 | commitLogHandler, 7 | timestamp -> new UUID(timestamp, UUID.randomUUID().getLeastSignificantBits())); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chains-lambdas.output: -------------------------------------------------------------------------------- 1 | public class Foo { 2 | public static void main(String[] args) { 3 | foo.bar().baz(argargargargargargargargargargargargargargargargargargargargarg, param -> doStuff() 4 | .method1() 5 | .method2(arljhfaldjfhalfjhalfjahflahflahfaljfhadlfjhljsahljhfsaljfhlfajhfljh)); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas-2.input: -------------------------------------------------------------------------------- 1 | class PalantirExpressionLambdas { 2 | void foo() { 3 | this.sequentialTableFactory = SequentialTableFactory.create( 4 | ObjectMappers.newServerObjectMapper(), Event.class, txnManager::getTimestampService, () -> 5 | SequentialTableFactory.Strategy.V1); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465477.input: -------------------------------------------------------------------------------- 1 | class B21465477 { 2 | 3 | @Nullable private final String simpleFieldName; 4 | @Nullable private final String shortFlagName; 5 | private final String containerClassName; 6 | private final String type; 7 | private final String doc; 8 | private final DocLevel docLevel; 9 | @Nullable private final String altName; 10 | } 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22169269.input: -------------------------------------------------------------------------------- 1 | class B22169269 { 2 | { 3 | try { 4 | } catch ( 5 | ClassNotFoundException 6 | | NoSuchMethodException 7 | | InvocationTargetException 8 | | IllegalAccessException e) { 9 | } 10 | try { 11 | } catch (ClassNotFoundException | NoSuchMethodException e) { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30153869.input: -------------------------------------------------------------------------------- 1 | /** 2 | * one 3 | * 4 | *
    5 | *
  1. two 6 | *
7 | * 8 | *

9 | *

  • four 10 | */ 11 | class T { 12 | 13 | /** 14 | * One 15 | * 16 | *
      17 | *
    • a 18 | *
        19 | *
      • b 20 | *
      • c 21 | *
      22 | *
    • e 23 | *
    24 | */ 25 | int x; 26 | } 27 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I1309.input: -------------------------------------------------------------------------------- 1 | public class I1309 { 2 | void x(Object o) { 3 | if (o instanceof Record(Nested(var i), var j)) {} 4 | switch (o) { 5 | 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): 6 | default: 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/R.input: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** Tests for ReturnStatements. */ 4 | class R { 5 | void f() { 6 | return; 7 | } 8 | 9 | int f(int x) { 10 | return x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x 11 | + x + x + x + x + x + x + x + x + x; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/i282.output: -------------------------------------------------------------------------------- 1 | public class ArrayVsVarargs { 2 | 3 | void f(String[] arg) {} 4 | 5 | void g(String... arg) {} 6 | 7 | void h(String @A [] arg) {} 8 | 9 | void i(String @B ... arg) {} 10 | 11 | void j(String @C [] @D [] arg) {} 12 | 13 | void k(String @E [] @F ... arg) {} 14 | 15 | Class c = byte[].class; 16 | } 17 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-8.input: -------------------------------------------------------------------------------- 1 | class Palantir8 { 2 | void foo() { 3 | assertThatServiceExceptionThrownBy( 4 | new Aggregation.Builder() 5 | .max(max) 6 | .aggregations(ImmutableMap.of("bountiful", bountifulAggregation))::build) 7 | .hasType(MY_ERROR_TYPE); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg.input: -------------------------------------------------------------------------------- 1 | class PalantirLambdaBreakChain { 2 | void foo() { 3 | return hello.read(txn -> { 4 | doSomeWork(); 5 | doSomeMoreWork(); 6 | }) 7 | .chainedCall(() -> { 8 | doSomeWork(); 9 | }); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-break-lambda-arg.output: -------------------------------------------------------------------------------- 1 | class PalantirLambdaBreakChain { 2 | void foo() { 3 | return hello.read(txn -> { 4 | doSomeWork(); 5 | doSomeMoreWork(); 6 | }) 7 | .chainedCall(() -> { 8 | doSomeWork(); 9 | }); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas.output: -------------------------------------------------------------------------------- 1 | class PalantirExpressionLambdas { 2 | void foo() { 3 | publisher = new ThisThatEventPublisher( 4 | txnManager, 5 | () -> Events.encoder(keyPair, new TestClock()), 6 | EventSeries.THING, 7 | () -> DEFAULT_EVENT_BATCH_SIZE); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /eclipse_plugin/src/main/resources/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B124394008.output: -------------------------------------------------------------------------------- 1 | class B124394008 { 2 | { 3 | LocalReviewProto.Builder newReview = readProfileResponse 4 | .flatMap(authorExtractor::extract) 5 | .map(luReviewsExtractor::toLocalReviewProto) 6 | .orElse(LocalReviewProto.getDefaultInstance()) 7 | .toBuilder(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19996259.output: -------------------------------------------------------------------------------- 1 | class B19996259 { 2 | void g( // line comment 3 | int x) {} 4 | 5 | void // 6 | g // 7 | ( // 8 | int // 9 | x // 10 | , // 11 | int // 12 | y // 13 | ) // 14 | { // 15 | } // 16 | } 17 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22488373.input: -------------------------------------------------------------------------------- 1 | class B22488373 { 2 | { 3 | if (enumBindingKeys.contains(bindingKey) 4 | && (bindingKey 5 | .key() 6 | .type() 7 | .getKind() 8 | .equals(DECLARED) 9 | && !((DeclaredType) bindingKey.key().type()).getTypeArguments().isEmpty())) {} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-fqn.input: -------------------------------------------------------------------------------- 1 | class PalantirLongFqn { 2 | public PalantirLongFqn() { 3 | org.gradle.api.internal.artifacts.configurations.ConflictResolution conflictResolution = 4 | ((org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) conf 5 | .getResolutionStrategy()).getConflictResolution(); 6 | } 7 | } -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37895033.output: -------------------------------------------------------------------------------- 1 | class B37895033 { 2 | String[][] xs = new String[][] { 3 | {"B3", "C3", "D3"}, 4 | {"B4", "C4", "D4"}, 5 | {"B5", "C5", "D5"} 6 | }; 7 | String[] ys = new String[] { 8 | "B3", "B4", "B5", 9 | }; 10 | String[][] zs = new String[][] { 11 | {"B3"}, {"B4"}, {"B5"}, 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-dangling-method-reference.output: -------------------------------------------------------------------------------- 1 | class PalantirDanglingMethodReference { 2 | void foo() { 3 | return engageNicely( 4 | staleForksFigureBark, 5 | staleForksFigureConsecutiveFailedExecutions, 6 | isStaleForksFigureInProgress, 7 | this::engageStaleForksUnsafely); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /changelog/2.22.0/pr-708.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: |- 4 | Only apply line break to lambdas with statements 5 | 6 | ## Before this PR 7 | Previous PR #707 was a little aggressive and inserted line breaks for non-statement lambdas. 8 | 9 | ## After this PR 10 | Only multi-line lambdas cause a line-break in the method chain. 11 | links: 12 | - https://github.com/palantir/palantir-java-format/pull/708 13 | -------------------------------------------------------------------------------- /debugger/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20915776.output: -------------------------------------------------------------------------------- 1 | class B20915776 { 2 | @Inject 3 | void ChunkAnalysis( 4 | // TODO(user) ... 5 | @Parent DatasetSource supporters, 6 | @Child DatasetSource children, 7 | @Parent Provider parentSupportsDecider, 8 | @Child Provider childSupportsDecider) {} 9 | } 10 | -------------------------------------------------------------------------------- /changelog/0.3.1/pr-70.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: |- 4 | Limit how far dots may appear in long method chains to 80 chars. 5 | 6 | Note that this doesn't currently apply to prefixes (such as `foo.bar().baz().stream()`) because prefixes are also used to group together fully qualified class names and it's a bit trickier to handle that case. 7 | links: 8 | - https://github.com/palantir/palantir-java-format/pull/70 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22488373.output: -------------------------------------------------------------------------------- 1 | class B22488373 { 2 | { 3 | if (enumBindingKeys.contains(bindingKey) 4 | && (bindingKey.key().type().getKind().equals(DECLARED) 5 | && !((DeclaredType) bindingKey.key().type()) 6 | .getTypeArguments() 7 | .isEmpty())) {} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /changelog/0.3.14/pr-138.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: 'Method chains in initializers may once again be laid onto a single 4 | next line, if they are short enough. This fixes a regression from #123 (0.3.11) 5 | where the column limit for method chains would prevent us from attempting to put 6 | the initializer on the 2nd line first and see if that works.' 7 | links: 8 | - https://github.com/palantir/palantir-java-format/pull/138 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Q.input: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** Tests for QualifiedNames and QualifiedTypes. */ 4 | class Q { 5 | static final int zero = 0; 6 | 7 | class T {} 8 | 9 | static void f() { 10 | Q. /* @MarkerAnnotation */T t; 11 | int zero = Q.zero; 12 | java.lang. /* @MarkerAnnotation */String s = null; 13 | Q.f(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/R.output: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** Tests for ReturnStatements. */ 4 | class R { 5 | void f() { 6 | return; 7 | } 8 | 9 | int f(int x) { 10 | 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 11 | + x + x + x + x + x; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/main/resources/META-INF/native-image/resource-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "resources":{ 3 | "includes":[{ 4 | "pattern":"\\QMETA-INF/services/java.lang.System$LoggerFinder\\E" 5 | }, { 6 | "pattern":"\\QMETA-INF/services/java.time.zone.ZoneRulesProvider\\E" 7 | }]}, 8 | "bundles":[{ 9 | "name":"com.sun.tools.javac.resources.compiler", 10 | "classNames":["com.sun.tools.javac.resources.compiler"] 11 | }] 12 | } 13 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B30153869.output: -------------------------------------------------------------------------------- 1 | /** 2 | * one 3 | * 4 | *
      5 | *
    1. two 6 | *
    7 | * 8 | *

    9 | *

  • four 10 | */ 11 | class T { 12 | 13 | /** 14 | * One 15 | * 16 | *
      17 | *
    • a 18 | *
        19 | *
      • b 20 | *
      • c 21 | *
      22 | *
    • e 23 | *
    24 | */ 25 | int x; 26 | } 27 | -------------------------------------------------------------------------------- /.bulldozer.yml: -------------------------------------------------------------------------------- 1 | # Excavator auto-updates this file. Please contribute improvements to the central template. 2 | 3 | version: 1 4 | merge: 5 | trigger: 6 | labels: ["merge when ready"] 7 | ignore: 8 | labels: ["do not merge"] 9 | method: squash 10 | options: 11 | squash: 12 | body: pull_request_body 13 | message_delimiter: ==COMMIT_MSG== 14 | delete_after_merge: true 15 | update: 16 | trigger: 17 | labels: ["update me"] 18 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B112853497.output: -------------------------------------------------------------------------------- 1 | class B112853497 { 2 | { 3 | XxxxxxxxxxXxxx xxxXxxxx = xxxXxxxx.xxxxXxXxxxx(xxxxXxxx, XXXXXX_XXXX_XXXXXXXX_XX_XXXXXXXX).toBuilder() 4 | .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) 5 | .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) 6 | .xxxXxxxxx(xxxxxx.xxxXxxxxxXxxx()) 7 | .xxxxx(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-4.output: -------------------------------------------------------------------------------- 1 | class Palantir4 { 2 | void foo() { 3 | if (useAddedColumnsSetDesription) { 4 | resultSet = spark.sparkSetCreator() 5 | .resolve( 6 | initialSetResolver, 7 | new LoremIpsumLongClassNameWithDescription(initialSet, list, Optional.empty())); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22169269.output: -------------------------------------------------------------------------------- 1 | class B22169269 { 2 | { 3 | try { 4 | } catch (ClassNotFoundException 5 | | NoSuchMethodException 6 | | InvocationTargetException 7 | | IllegalAccessException e) { 8 | } 9 | try { 10 | } catch (ClassNotFoundException | NoSuchMethodException e) { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambdas-2.output: -------------------------------------------------------------------------------- 1 | class PalantirExpressionLambdas { 2 | void foo() { 3 | this.sequentialTableFactory = SequentialTableFactory.create( 4 | ObjectMappers.newServerObjectMapper(), 5 | Event.class, 6 | txnManager::getTimestampService, 7 | () -> SequentialTableFactory.Strategy.V1); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /changelog/0.3.9/pr-107.v2.yml: -------------------------------------------------------------------------------- 1 | type: improvement 2 | improvement: 3 | description: |- 4 | A new plugin `com.palantir.java-format-spotless` configures [gradle-spotless](https://plugins.gradle.org/plugin/com.diffplug.gradle.spotless) (if applied) to format java files using palantir-java-format. 5 | The main `com.palantir.java-format` plugin now applies both the spotless and idea plugins too. 6 | links: 7 | - https://github.com/palantir/palantir-java-format/pull/107 8 | -------------------------------------------------------------------------------- /changelog/2.71.0/pr-1367.v2.yml: -------------------------------------------------------------------------------- 1 | type: fix 2 | fix: 3 | description: |- 4 | Fix the following error when running under JDK 25 EA: 5 | 6 | ``` 7 | 'java.util.Queue com.sun.tools.javac.util.Log$DeferredDiagnosticHandler.getDiagnostics()' 8 | java.lang.NoSuchMethodError: 'java.util.Queue com.sun.tools.javac.util.Log$DeferredDiagnosticHandler.getDiagnostics()' 9 | ``` 10 | links: 11 | - https://github.com/palantir/palantir-java-format/pull/1367 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I684.input: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | import example.model.SealedInterface; 4 | import example.model.TypeA; 5 | import example.model.TypeB; 6 | 7 | public class Main { 8 | public void apply(SealedInterface sealedInterface) { 9 | switch(sealedInterface) { 10 | case TypeA a -> System.out.println("A!"); 11 | case TypeB b -> System.out.println("B!"); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Q.output: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** Tests for QualifiedNames and QualifiedTypes. */ 4 | class Q { 5 | static final int zero = 0; 6 | 7 | class T {} 8 | 9 | static void f() { 10 | Q./* @MarkerAnnotation */ T t; 11 | int zero = Q.zero; 12 | java.lang./* @MarkerAnnotation */ String s = null; 13 | Q.f(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-chains-lambdas.input: -------------------------------------------------------------------------------- 1 | public class Foo { 2 | public static void main(String[] args) { 3 | foo 4 | .bar() 5 | .baz(argargargargargargargargargargargargargargargargargargargargarg, param -> doStuff() 6 | .method1() 7 | .method2(arljhfaldjfhalfjhalfjahflahflahfaljfhadlfjhljsahljhfsaljfhlfajhfljh)); 8 | } 9 | } -------------------------------------------------------------------------------- /debugger/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | yarn.lock 8 | package-lock.json 9 | 10 | # testing 11 | /coverage 12 | 13 | # production 14 | /build 15 | 16 | # misc 17 | .DS_Store 18 | .env.local 19 | .env.development.local 20 | .env.test.local 21 | .env.production.local 22 | 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | public/*.js 27 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B112853497.input: -------------------------------------------------------------------------------- 1 | class B112853497 { 2 | { 3 | XxxxxxxxxxXxxx xxxXxxxx = 4 | xxxXxxxx 5 | .xxxxXxXxxxx(xxxxXxxx, XXXXXX_XXXX_XXXXXXXX_XX_XXXXXXXX) 6 | .toBuilder() 7 | .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) 8 | .xxxXxxxxXxxxXx(xxxxxXx.xxxXxxxxXxxxXx()) 9 | .xxxXxxxxx(xxxxxx.xxxXxxxxxXxxx()) 10 | .xxxxx(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465477.output: -------------------------------------------------------------------------------- 1 | class B21465477 { 2 | 3 | @Nullable 4 | private final String simpleFieldName; 5 | 6 | @Nullable 7 | private final String shortFlagName; 8 | 9 | private final String containerClassName; 10 | private final String type; 11 | private final String doc; 12 | private final DocLevel docLevel; 13 | 14 | @Nullable 15 | private final String altName; 16 | } 17 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I683.input: -------------------------------------------------------------------------------- 1 | interface Test { 2 | 3 | static class Test1 implements Test{} 4 | static class Test2 implements Test{} 5 | 6 | public static void main(String[] args) { 7 | Test test = new Test1(); 8 | switch (test) { 9 | case Test1 test1 -> {} 10 | case Test2 test2 -> {} 11 | default -> throw new IllegalStateException("Unexpected value: " + test); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-fqn.output: -------------------------------------------------------------------------------- 1 | class PalantirLongFqn { 2 | public PalantirLongFqn() { 3 | org.gradle.api.internal.artifacts.configurations.ConflictResolution conflictResolution = 4 | ((org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) 5 | conf.getResolutionStrategy()) 6 | .getConflictResolution(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B.input: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** Tests for Blocks, BodyDeclarations, BooleanLiterals, and BreakStatements. */ 4 | class B { 5 | int x; 6 | private int y; 7 | public int z; 8 | 9 | void f() { 10 | LABEL: 11 | while (true != false) { 12 | if (false == true) 13 | break; 14 | if (false == false) 15 | break LABEL; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20128174.output: -------------------------------------------------------------------------------- 1 | class B20128174 { 2 | 3 | enum Suit { 4 | DIAMONDS, 5 | HEARTS, 6 | CLUBS, 7 | SPADES 8 | }; 9 | 10 | enum Suit { 11 | DIAMONDS, 12 | HEARTS, 13 | CLUBS, 14 | SPADES; 15 | }; 16 | 17 | enum Suit { 18 | DIAMONDS, 19 | HEARTS, 20 | CLUBS, 21 | SPADES, 22 | ; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I684.output: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | import example.model.SealedInterface; 4 | import example.model.TypeA; 5 | import example.model.TypeB; 6 | 7 | public class Main { 8 | public void apply(SealedInterface sealedInterface) { 9 | switch (sealedInterface) { 10 | case TypeA a -> System.out.println("A!"); 11 | case TypeB b -> System.out.println("B!"); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B.output: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** Tests for Blocks, BodyDeclarations, BooleanLiterals, and BreakStatements. */ 4 | class B { 5 | int x; 6 | private int y; 7 | public int z; 8 | 9 | void f() { 10 | LABEL: 11 | while (true != false) { 12 | if (false == true) break; 13 | if (false == false) break LABEL; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.baseline/checkstyle/custom-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23708487.input: -------------------------------------------------------------------------------- 1 | class B23708487 { 2 | static { 3 | TASK_AS_OWNER = 4 | com.google.security.acl.proto2api.ACL.Entry.newBuilder() 5 | .setRole(com.google.security.acl.proto2api.ACL.Entry.ROLE.OWNER.getNumber()) 6 | .setScope(com.google.security.acl.proto2api.ACL.Scope.newBuilder() 7 | .setMdbUser(BorgTaskInfo.getMdbUser().getMdbUserName())) 8 | .build(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950815.input: -------------------------------------------------------------------------------- 1 | class B19950815 { 2 | void m() { 3 | checkArgument( 4 | truncationLength >= 0, "maxLength (%s) must be >= length of the truncation indicator (%s)", 5 | maxLength, truncationIndicator.length()); 6 | } 7 | 8 | private String finishCollapseFrom( 9 | CharSequence sequence, int start, int end, char replacement, StringBuilder builder, 10 | boolean inMatchingGroup) { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /.excavator.yml: -------------------------------------------------------------------------------- 1 | # Excavator auto-updates this file. Please contribute improvements to the central template. 2 | 3 | auto-label: 4 | names: 5 | versions-props/upgrade-all: [ "merge when ready" ] 6 | circleci/manage-circleci: [ "merge when ready" ] 7 | tags: 8 | donotmerge: [ "do not merge" ] 9 | roomba: [ "merge when ready", "🤖 fix nits" ] 10 | automerge: [ "merge when ready", "🤖 fix nits" ] 11 | standards: [ "merge when ready", "🤖 fix nits" ] 12 | autorelease: [ "autorelease" ] 13 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20531711.output: -------------------------------------------------------------------------------- 1 | class B20531711 { 2 | void m() { 3 | when(mLoginHelper.getAllAccounts()).thenReturn(new Account[] { 4 | new Account("test1", "test1"), new Account("test2", "test2"), 5 | }); 6 | 7 | when(mLoginHelper.getAllAccounts()).thenReturn(new Account[] { 8 | new Account("test1", "test1"), new Account("test2", "test2"), 9 | // asd 10 | }); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B37895033.input: -------------------------------------------------------------------------------- 1 | class B37895033 { 2 | String[][] xs = 3 | new String[][] { 4 | {"B3", "C3", "D3"}, 5 | {"B4", "C4", "D4"}, 6 | {"B5", "C5", "D5"} 7 | }; 8 | String[] ys = 9 | new String[] { 10 | "B3", 11 | "B4", 12 | "B5", 13 | }; 14 | String[][] zs = 15 | new String[][] { 16 | {"B3"}, 17 | {"B4"}, 18 | {"B5"}, 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B23708487.output: -------------------------------------------------------------------------------- 1 | class B23708487 { 2 | static { 3 | TASK_AS_OWNER = com.google.security.acl.proto2api.ACL.Entry.newBuilder() 4 | .setRole(com.google.security.acl.proto2api.ACL.Entry.ROLE.OWNER.getNumber()) 5 | .setScope(com.google.security.acl.proto2api.ACL.Scope.newBuilder() 6 | .setMdbUser(BorgTaskInfo.getMdbUser().getMdbUserName())) 7 | .build(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B33358723.input: -------------------------------------------------------------------------------- 1 | class B33358723 { 2 | { 3 | f( 4 | // 5 | x -> 6 | System.err.println( 7 | // 8 | "hello")); 9 | f( 10 | // 11 | ( // 12 | x) -> 13 | System.err.println( 14 | // 15 | "hello")); 16 | f( 17 | // 18 | (int // 19 | x) -> 20 | System.err.println( 21 | // 22 | "hello")); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20578077.input: -------------------------------------------------------------------------------- 1 | class B20578077 { 2 | { 3 | new IteratorTester( 4 | 4, MODIFIABLE, newArrayList(1, 2), IteratorTester.KnownOrder.KNOWN_ORDER) { 5 | @Override 6 | protected Iterator newTargetIterator() { 7 | Iterator iterator = Lists.newArrayList(1, 2).iterator(); 8 | return new IteratorWithSunJavaBug6529795(iterator); 9 | } 10 | } 11 | .test(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I683.output: -------------------------------------------------------------------------------- 1 | interface Test { 2 | 3 | static class Test1 implements Test {} 4 | 5 | static class Test2 implements Test {} 6 | 7 | public static void main(String[] args) { 8 | Test test = new Test1(); 9 | switch (test) { 10 | case Test1 test1 -> {} 11 | case Test2 test2 -> {} 12 | default -> throw new IllegalStateException("Unexpected value: " + test); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20531711.input: -------------------------------------------------------------------------------- 1 | class B20531711 { 2 | void m() { 3 | when(mLoginHelper.getAllAccounts()).thenReturn( 4 | new Account[] { 5 | new Account("test1", "test1"), 6 | new Account("test2", "test2"), 7 | }); 8 | 9 | when(mLoginHelper.getAllAccounts()).thenReturn( 10 | new Account[] { 11 | new Account("test1", "test1"), 12 | new Account("test2", "test2"), 13 | // asd 14 | }); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-expression-lambda-1.output: -------------------------------------------------------------------------------- 1 | class PalantirExpressionLambda1 { 2 | void foo() { 3 | return createInternal( 4 | client, 5 | config, 6 | userAgent, 7 | hostEventsSink, 8 | serviceClass, 9 | RANDOMIZE, 10 | reshuffle, 11 | () -> new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize())); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27078833.input: -------------------------------------------------------------------------------- 1 | enum OpKind { 2 | 3 | POST_INCR(Precedence.POSTFIX), 4 | POST_DECR(Precedence.POSTFIX), 5 | 6 | PRE_INCR(Precedence.UNARY), 7 | PRE_DECR(Precedence.UNARY), 8 | PLUS(Precedence.UNARY), 9 | NEG(Precedence.UNARY), 10 | COMP(Precedence.UNARY), 11 | NOT(Precedence.UNARY), 12 | 13 | MULT(Precedence.MULTIPLICATIVE), 14 | DIVIDE(Precedence.MULTIPLICATIVE), 15 | MODULO(Precedence.MULTIPLICATIVE), 16 | ; 17 | 18 | // ... 19 | } 20 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-7.input: -------------------------------------------------------------------------------- 1 | class Palantir7 { 2 | void foo() { 3 | when(graphService.getPathFromRootToNode(any(GraphId.class), any(NodeId.class))) 4 | .thenAnswer(invocation -> invocation.getArguments().length == 2 5 | && invocation.getArguments()[1] != null 6 | ? ImmutableList.of(invocation.getArgument(1)) 7 | : ImmutableList.of(NodeId.create())); 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/6.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "\n\n" 3 | + "one\n" 4 | + "long\n" 5 | + "incredibly\n" 6 | + "unbroken\n" 7 | + "sentence\n" 8 | + "moving\n" 9 | + "from\n" 10 | + " topic\n" 11 | + "to\n" 12 | + " topic\n" 13 | + "so\n" 14 | + "that\n" 15 | + "no-one\n" 16 | + "had\n" 17 | + "a\n" 18 | + "chance\n" 19 | + "to\n" 20 | + "interrupt"; 21 | } 22 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465217.input: -------------------------------------------------------------------------------- 1 | class B21465217 { 2 | void m() { 3 | try (JimfsOutputStream out2 = newOutputStream(false); 4 | BufferedOutputStream bout = new BufferedOutputStream(out2); 5 | OutputStreamWriter writer = new OutputStreamWriter(bout, UTF_8___________________________)) { 6 | } 7 | 8 | try (Writer sourceWriter = env.getFiler().createSourceFile(qualifiedNamezzzzzzzz).openWriter()) { 9 | sourceWriter.append(fileContents); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-7.output: -------------------------------------------------------------------------------- 1 | class Palantir7 { 2 | void foo() { 3 | when(graphService.getPathFromRootToNode(any(GraphId.class), any(NodeId.class))) 4 | .thenAnswer(invocation -> 5 | invocation.getArguments().length == 2 && invocation.getArguments()[1] != null 6 | ? ImmutableList.of(invocation.getArgument(1)) 7 | : ImmutableList.of(NodeId.create())); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20578077.output: -------------------------------------------------------------------------------- 1 | class B20578077 { 2 | { 3 | new IteratorTester(4, MODIFIABLE, newArrayList(1, 2), IteratorTester.KnownOrder.KNOWN_ORDER) { 4 | @Override 5 | protected Iterator newTargetIterator() { 6 | Iterator iterator = Lists.newArrayList(1, 2).iterator(); 7 | return new IteratorWithSunJavaBug6529795(iterator); 8 | } 9 | }.test(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B27078833.output: -------------------------------------------------------------------------------- 1 | enum OpKind { 2 | POST_INCR(Precedence.POSTFIX), 3 | POST_DECR(Precedence.POSTFIX), 4 | 5 | PRE_INCR(Precedence.UNARY), 6 | PRE_DECR(Precedence.UNARY), 7 | PLUS(Precedence.UNARY), 8 | NEG(Precedence.UNARY), 9 | COMP(Precedence.UNARY), 10 | NOT(Precedence.UNARY), 11 | 12 | MULT(Precedence.MULTIPLICATIVE), 13 | DIVIDE(Precedence.MULTIPLICATIVE), 14 | MODULO(Precedence.MULTIPLICATIVE), 15 | ; 16 | 17 | // ... 18 | } 19 | -------------------------------------------------------------------------------- /eclipse_plugin/src/main/resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: palantir-java-format 4 | Bundle-SymbolicName: palantir-java-format-eclipse-plugin;singleton:=true 5 | Bundle-Version: 2.38.0 6 | Bundle-RequiredExecutionEnvironment: JavaSE-11 7 | Import-Package: org.eclipse.jdt.core.dom, 8 | org.eclipse.jdt.core.formatter, 9 | org.eclipse.jface.text, 10 | org.eclipse.text.edits 11 | Bundle-ClassPath: ., 12 | lib/functionaljava.jar, 13 | lib/guava.jar, 14 | lib/palantir-java-format.jar, 15 | lib/palantir-java-format-spi.jar 16 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/StringWrapperIntegrationTest/7.output: -------------------------------------------------------------------------------- 1 | class T { 2 | String s = "\n\n\n" 3 | + "one\n\n" 4 | + "long\n\n" 5 | + "incredibly\n\n" 6 | + "unbroken\n\n" 7 | + "sentence\n\n" 8 | + "moving\n\n" 9 | + "from\n\n" 10 | + " topic\n\n" 11 | + "to\n\n" 12 | + " topic\n\n" 13 | + "so\n\n" 14 | + "that\n\n" 15 | + "no-one\n\n" 16 | + "had\n\n" 17 | + "a\n\n" 18 | + "chance\n\n" 19 | + "to\n\n" 20 | + "interrupt\n\n"; 21 | } 22 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Multivariables.input: -------------------------------------------------------------------------------- 1 | class Multivariables { 2 | int xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 3 | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy, 4 | zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; 5 | 6 | // Horizontal and veritcal paddings used for most cells in the standings table. 7 | private final int hpad, vpad; 8 | 9 | { 10 | { 11 | for (c = cx.iterator(), m = mx.iterator(); 12 | c.hasNext() && m.hasNext(); ) { 13 | f(c, m); 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /changelog/2.0.0/pr-365.v2.yml: -------------------------------------------------------------------------------- 1 | type: break 2 | break: 3 | description: |- 4 | * Add support for java 14 language features. 5 | * **Break:** Increase minimum source compatibility from java 8 to java 11. 6 | * To use version 2.x of the formatter, you need to run on java 11 or higher. 7 | * If you require the formatter to run on java 8, you won't be able to upgrade past version 1.x. Note that you can still produce java 8 jars from your repo but need to use at least java 11 to run the formatter. 8 | links: 9 | - https://github.com/palantir/palantir-java-format/pull/365 10 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21331232.output: -------------------------------------------------------------------------------- 1 | class B21331232 { 2 | private S instantiate(Class wrapperType, Type t, FailureStrategy fs, SF factory, Iterable data) {} 3 | 4 | public > IterableSubject, T, C> that( 5 | @Nullable Iterable target) { 6 | return IterableSubject.create(getFailureStrategy(), target); 7 | } 8 | 9 | boolean mightContain(T object, Funnel funnels, int numHashFunctions, BitArray bits); 10 | } 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21331232.input: -------------------------------------------------------------------------------- 1 | class B21331232 { 2 | private 3 | S instantiate( 4 | Class wrapperType, Type t, FailureStrategy fs, SF factory, Iterable data) { 5 | } 6 | 7 | public > 8 | IterableSubject, T, C> that(@Nullable Iterable target) { 9 | return IterableSubject.create(getFailureStrategy(), target); 10 | } 11 | 12 | boolean mightContain(T object, Funnel funnels, int numHashFunctions, BitArray bits); 13 | } 14 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.parallel=true 2 | org.gradle.caching=true 3 | # Add jvm args to allow spotless and formatter gradle plugins to run with Java 16+ 4 | org.gradle.jvmargs=--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ 5 | --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ 6 | --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \ 7 | --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ 8 | --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED 9 | palantir.jdk.setup.enabled=true 10 | palantir.native.formatter=true 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21465217.output: -------------------------------------------------------------------------------- 1 | class B21465217 { 2 | void m() { 3 | try (JimfsOutputStream out2 = newOutputStream(false); 4 | BufferedOutputStream bout = new BufferedOutputStream(out2); 5 | OutputStreamWriter writer = new OutputStreamWriter(bout, UTF_8___________________________)) {} 6 | 7 | try (Writer sourceWriter = 8 | env.getFiler().createSourceFile(qualifiedNamezzzzzzzz).openWriter()) { 9 | sourceWriter.append(fileContents); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-5.output: -------------------------------------------------------------------------------- 1 | class Palantir5 { 2 | void foo() { 3 | ConfigurationBuilder configuration = new ConfigurationBuilder() 4 | .addUrls(apiUrls) 5 | .filterInputsBy(name -> name != null && !name.contains("Immutable")); 6 | } 7 | 8 | void bar() { 9 | TopologicallySortedList sortedNodes = TopologicallySortedList.create( 10 | parentIdByNodeId.keySet(), 11 | nodeId -> StreamEx.of(parentIdByNodeId.get(nodeId)).toSet()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20567842.input: -------------------------------------------------------------------------------- 1 | public class B20567842 { 2 | // don't try to wrap the rhs as '{1, 2, 3}', go to block-like initializer style: 3 | int[] xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = {1, 2, 3}; 4 | 5 | // force block style, but not one-per-line for trailing ',': 6 | int[] x = {a.b, true ? 1 : 2, CONST,}; 7 | 8 | // don't format one-per-line here: 9 | 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}; 10 | } 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-5.input: -------------------------------------------------------------------------------- 1 | class Palantir5 { 2 | void foo() { 3 | ConfigurationBuilder configuration = new ConfigurationBuilder() 4 | .addUrls(apiUrls) 5 | .filterInputsBy(name -> name != null && !name.contains("Immutable")); 6 | } 7 | 8 | void bar() { 9 | TopologicallySortedList sortedNodes = TopologicallySortedList.create( 10 | parentIdByNodeId.keySet(), 11 | nodeId -> StreamEx.of(parentIdByNodeId.get(nodeId)).toSet()); 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /debugger/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "noEmit": true, 20 | "jsx": "react" 21 | }, 22 | "include": [ 23 | "src" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B21278211.output: -------------------------------------------------------------------------------- 1 | class B21278211 { 2 | void m() { 3 | return names.isEmpty() || names.size() == 1 && names.get(0).toString().isEmpty(); 4 | 5 | // use unified breaks for all chained dereferences 6 | 7 | x.f().g(); 8 | x.fzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz().gzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz(); 9 | 10 | x.f().g().h(); 11 | x.f().g().hzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz(); 12 | 13 | x.f().g().h().i(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Multivariables.output: -------------------------------------------------------------------------------- 1 | class Multivariables { 2 | int xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, 3 | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy, 4 | zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; 5 | 6 | // Horizontal and veritcal paddings used for most cells in the standings table. 7 | private final int hpad, vpad; 8 | 9 | { 10 | { 11 | for (c = cx.iterator(), m = mx.iterator(); c.hasNext() && m.hasNext(); ) { 12 | f(c, m); 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B20580212.input: -------------------------------------------------------------------------------- 1 | class B20580212 { 2 | void m() { 3 | GroupExpansionReply mockIsgReply = 4 | buildRecipientListSubGroupReply( 5 | RECIPIENT1, 6 | alternatives /* isgExpansions */, 7 | alternativesDeltas /* isgExpansionsScoreDeltas */, 8 | false /* withRecipient */, 9 | 0 /* recipientScoreDelta */); 10 | 11 | try { 12 | } catch (IllegalStateException e) { /* expected */ } 13 | } 14 | 15 | static class ThrowsAtEndException extends RuntimeException { /* nothing */ } 16 | } 17 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-long-method-reference.input: -------------------------------------------------------------------------------- 1 | class PalantirLongArrayInit { 2 | private static FormatterService createFormatter(Optional> implementationClassPath) { 3 | URL[] implementationUrls = implementationClassPath 4 | .map(implementationUris -> { 5 | log.debug("Using palantir-java-format implementation defined by URIs: {}", implementationUris); 6 | return implementationUris.stream().map(PalantirCodeStyleManager::toUrlUnchecked).toArray(URL[]::new); 7 | }).orElse(null); 8 | } 9 | } -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B65214682.input: -------------------------------------------------------------------------------- 1 | @BugPattern( 2 | name = "AsyncFunctionReturnsImmediate", 3 | summary = SIMPLIFY, 4 | category = GUAVA, 5 | severity = NOT_A_PROBLEM, 6 | maturity = EXPERIMENTAL 7 | ) 8 | @BugPattern( 9 | name = "AsyncFunctionReturnsImmediate", 10 | summary = SIMPLIFY, 11 | explanation = 12 | "If an AsyncFunction always returns immediateFuture() and never throws, it can " 13 | + "be replaced with a Function.", 14 | category = GUAVA, 15 | severity = NOT_A_PROBLEM, 16 | maturity = EXPERIMENTAL) 17 | class Test {} 18 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/Records.input: -------------------------------------------------------------------------------- 1 | class Records { 2 | record R1() {} 3 | 4 | private record R2() {} 5 | 6 | @Deprecated 7 | private record R3() {} 8 | 9 | record R4() {} 10 | 11 | record R5(int x) {} 12 | 13 | record R6(@Deprecated int x) {} 14 | 15 | record R7(@Deprecated int x, int... y) {} 16 | 17 | record R8() implements Comparable> { 18 | @Override 19 | public int compareTo(R8 other) { 20 | return 0; 21 | } 22 | } 23 | 24 | record R9(int x) { 25 | R9(int x) { 26 | this.x = x; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /.baseline/copyright/000_google-apache-2.0-2.txt: -------------------------------------------------------------------------------- 1 | Copyright ${today.year} Google Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 4 | in compliance with the License. You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software distributed under the License 9 | is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 10 | or implied. See the License for the specific language governing permissions and limitations under 11 | the License. 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B19950815.output: -------------------------------------------------------------------------------- 1 | class B19950815 { 2 | void m() { 3 | checkArgument( 4 | truncationLength >= 0, 5 | "maxLength (%s) must be >= length of the truncation indicator (%s)", 6 | maxLength, 7 | truncationIndicator.length()); 8 | } 9 | 10 | private String finishCollapseFrom( 11 | CharSequence sequence, 12 | int start, 13 | int end, 14 | char replacement, 15 | StringBuilder builder, 16 | boolean inMatchingGroup) {} 17 | } 18 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B64493529.input: -------------------------------------------------------------------------------- 1 | /** Copies from {@link Foo} to {@link Bar}. */ 2 | // XXXX.XxXxxxxx() 3 | class B64493529 { 4 | // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ 5 | // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) 6 | // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ 7 | // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) 8 | } 9 | // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ 10 | // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) 11 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B64493529.output: -------------------------------------------------------------------------------- 1 | /** Copies from {@link Foo} to {@link Bar}. */ 2 | // XXXX.XxXxxxxx() 3 | class B64493529 { 4 | // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ 5 | // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) 6 | // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ 7 | // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) 8 | } 9 | // XXXX.XxxxXxxxxx(//xxxxx/xxxxxxx/xxxx/xxx/xxxxxx/xxx/xxxxxxx/xxxx/xxx/xxxxxxx/xxxxxxx/\ 10 | // XxxxxxXxxxxxXXxxxxxxXxxxxx.java) 11 | -------------------------------------------------------------------------------- /.baseline/copyright/000_google-apache-2.0-5.txt: -------------------------------------------------------------------------------- 1 | Copyright ${today.year} Google Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 | use this file except in compliance with the License. You may obtain a copy 5 | of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | License for the specific language governing permissions and limitations 13 | under the License. 14 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/B22873322.input: -------------------------------------------------------------------------------- 1 | class B22873322 { 2 | { 3 | f(param -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); 4 | f((param1, param2) -> veryLooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param1, param2)); 5 | f((int param) -> veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongExpr(param)); 6 | f((param1, param2) -> { 7 | return expr(param1, param2); 8 | }); 9 | f((param1, param2) -> { 10 | Object foo = expr(param1, param2); 11 | return foo; 12 | }); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/palantir-lamda-cast.output: -------------------------------------------------------------------------------- 1 | public class Foo { 2 | static String foo(Optional optional) { 3 | return optional.orElseGet((String) () -> { 4 | throw new NotFoundException(); 5 | }); 6 | } 7 | 8 | static String bar(Optional optional) { 9 | return optional.orElseGet((String) () -> ""); 10 | } 11 | 12 | static String baz(Optional optional) { 13 | return optional.orElseGet((String) () -> 14 | bar(Optional.of("some thing that is very very very looooooong")).get()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/NON-NLS.output: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | class MultilineStringConstant { 4 | 5 | // NON-NLS comments are required for i18n, it's important they are kept with their strings. 6 | private static final String MULTIPLE_LINE_NON_NLS = "field_0," //$NON-NLS-1$ 7 | + "field_1," //$NON-NLS-1$ 8 | + "field_2," //$NON-NLS-1$ 9 | + "field_3," //$NON-NLS-1$ 10 | + "field_4"; //$NON-NLS-1$ 11 | 12 | private static final String MULTIPLE_LINE_NO_COMMENT = 13 | "field_0," + "field_1," + "field_2," + "field_3," + "field_4"; 14 | } 15 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/T.input: -------------------------------------------------------------------------------- 1 | package com.google.googlejavaformat.java.test; 2 | 3 | /** 4 | * Tests for ThisExpressions, ThrowStatements, TryStatements, TypeDeclarationStatements, 5 | * TypeDeclarations, TypeLiterals, TypeMethodReferences, TypeParameters, and Types. 6 | */ 7 | class T { 8 | // TODO(jdd): Add tests for higher language levels. 9 | 10 | T f(int x) throws Exception { 11 | class TT {} 12 | if (x == 0 || T.class == null) { 13 | return this; 14 | } 15 | try (AutoCloseable y = null) { 16 | throw new RuntimeException(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.baseline/copyright/000_google-apache-2.0-4.txt: -------------------------------------------------------------------------------- 1 | Copyright ${today.year} Google Inc. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 4 | in compliance with the License. You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software distributed under the License 9 | is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 10 | or implied. See the License for the specific language governing permissions and limitations under 11 | the License. 12 | -------------------------------------------------------------------------------- /palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/I643.input: -------------------------------------------------------------------------------- 1 | public class Foo { 2 | static final int VERBOSE_WORDY_AND_LENGTHY_ONE = 1; 3 | static final int VERBOSE_WORDY_AND_LENGTHY_TWO = 2; 4 | static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 4; 5 | static final int VERBOSE_WORDY_AND_LENGTHY_FOUR = 5; 6 | 7 | public static int fn(int x) { 8 | switch (x) { 9 | case VERBOSE_WORDY_AND_LENGTHY_ONE | VERBOSE_WORDY_AND_LENGTHY_TWO | VERBOSE_WORDY_AND_LENGTHY_FOUR | VERBOSE_WORDY_AND_LENGTHY_FIVE: 10 | return 0; 11 | default: 12 | return 1; 13 | } 14 | } 15 | } 16 | --------------------------------------------------------------------------------