This behaviour is observed when using spotless-plugin-gradle:6.25.0. It is also observed for the develop branch (as of 17 October 2024) in this repo, when trying it as input in a unit test (FormatterTest). It occurs for style 'palantir':
This input
class ClassB extends ClassA {
@Test
void shouldDoThisAndThat() {
instance.shouldDoSomething(Set.of(
"abcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijk", // prio (yet to go live)
"abcdefghijkabcdefghijkabcdefghijkabjkghijkabcdefghij", // prio low, not exposed yet only for manual use
"abcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkghijkabcdefghij" // prio low, not exposed yet only for manual use
));
}
}
results in the following formatted output. The second and third line of the comment are not indented correctly:
class ClassB extends ClassA {
@Test
void shouldDoThisAndThat() {
instance.shouldDoSomething(Set.of(
"abcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijk", // prio
// (yet to
// go live)
"abcdefghijkabcdefghijkabcdefghijkabjkghijkabcdefghij", // prio low, not exposed yet only
// for manual use
"abcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkghijkabcdefghij" // prio low, not exposed yet only for manual use
));
}
}
What did you want to happen?
After the line wrap, the comment should start in the same column as the comment in the first line.
This is how the indentation should look like:
class ClassB extends ClassA {
@Test
void shouldDoThisAndThat() {
instance.shouldDoSomething(Set.of(
"abcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijk", // prio
// (yet to
// go live)
"abcdefghijkabcdefghijkabcdefghijkabjkghijkabcdefghij" // prio low, not exposed yet only for
// manual use
));
...
}
}
Interestingly, it works correctly if I remove the last long line:
"abcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkabcdefghijkghijkabcdefghij" // prio low, not exposed yet only for manual use:
What happened?
This behaviour is observed when using spotless-plugin-gradle:6.25.0. It is also observed for the develop branch (as of 17 October 2024) in this repo, when trying it as input in a unit test (FormatterTest). It occurs for style 'palantir':
This input
results in the following formatted output. The second and third line of the comment are not indented correctly:
What did you want to happen?
After the line wrap, the comment should start in the same column as the comment in the first line.
This is how the indentation should look like:
Interestingly, it works correctly if I remove the last long line: