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().