Skip to content

Commit 71e71fe

Browse files
andreweacottclaude
andcommitted
Add backward-compatible constructors to formatter services
Add overloaded constructors to BootstrappingFormatterService and NativeImageFormatterService that accept the old parameter lists without JavaFormatterOptions. These new constructors use default formatter options internally, maintaining backward compatibility while allowing new code to pass custom options. This eliminates the API/ABI break detected by revapi while keeping the feature support for configuring the skip-reflowing-long-strings option in the IntelliJ plugin. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 37a9da6 commit 71e71fe

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

palantir-java-format-jdk-bootstrap/src/main/java/com/palantir/javaformat/bootstrap/BootstrappingFormatterService.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,21 @@ public final class BootstrappingFormatterService implements FormatterService {
4747
private final List<Path> implementationClassPath;
4848
private final JavaFormatterOptions formatterOptions;
4949

50+
/**
51+
* Creates a BootstrappingFormatterService with default formatter options.
52+
* Provided for backward compatibility with code that does not pass JavaFormatterOptions.
53+
*
54+
* @deprecated Use {@link #BootstrappingFormatterService(Path, Integer, List, JavaFormatterOptions)} instead
55+
*/
56+
@Deprecated
57+
public BootstrappingFormatterService(Path jdkPath, Integer jdkMajorVersion, List<Path> implementationClassPath) {
58+
this(
59+
jdkPath,
60+
jdkMajorVersion,
61+
implementationClassPath,
62+
JavaFormatterOptions.builder().build());
63+
}
64+
5065
public BootstrappingFormatterService(
5166
Path jdkPath,
5267
Integer jdkMajorVersion,

palantir-java-format-jdk-bootstrap/src/main/java/com/palantir/javaformat/bootstrap/NativeImageFormatterService.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ public class NativeImageFormatterService implements FormatterService {
4141
private final Path nativeImagePath;
4242
private final JavaFormatterOptions formatterOptions;
4343

44+
/**
45+
* Creates a NativeImageFormatterService with default formatter options.
46+
* Provided for backward compatibility with code that does not pass JavaFormatterOptions.
47+
*
48+
* @deprecated Use {@link #NativeImageFormatterService(Path, JavaFormatterOptions)} instead
49+
*/
50+
@Deprecated
51+
public NativeImageFormatterService(Path nativeImagePath) {
52+
this(nativeImagePath, JavaFormatterOptions.builder().build());
53+
}
54+
4455
public NativeImageFormatterService(Path nativeImagePath, JavaFormatterOptions formatterOptions) {
4556
this.nativeImagePath = nativeImagePath;
4657
this.formatterOptions = formatterOptions;

0 commit comments

Comments
 (0)