Skip to content

Add support for prince-of-space Java formatter#2991

Draft
agustafson wants to merge 3 commits into
diffplug:mainfrom
agustafson:princeofspace-support
Draft

Add support for prince-of-space Java formatter#2991
agustafson wants to merge 3 commits into
diffplug:mainfrom
agustafson:princeofspace-support

Conversation

@agustafson

@agustafson agustafson commented Jun 30, 2026

Copy link
Copy Markdown

Summary

Adds prince-of-space as a supported Java formatter, following the same JarState + reflection glue pattern used for palantir-java-format and google-java-format.

  • lib: new PrinceOfSpaceStep (lib/src/main/java/com/diffplug/spotless/java/PrinceOfSpaceStep.java) and glue class (lib/src/princeOfSpace/java/com/diffplug/spotless/glue/pos/PrinceOfSpaceFormatterFunc.java), wired into a new princeOfSpace source set in lib/build.gradle, with prince-of-space-core added to gradle/libs.versions.toml
  • plugin-gradle: princeOfSpace() / princeOfSpace(version) DSL on the java {} extension (JavaExtension.java), with all of prince-of-space's FormatterConfig knobs exposed as fluent setters (indentStyle, indentSize, lineLength, wrapStyle, closingParenOnNewLine, trailingCommas, javaLanguageLevel)
  • plugin-maven: matching <princeOfSpace> step (PrinceOfSpace.java, wired into Java.java)
  • Tests: PrinceOfSpaceStepTest covering formatting behavior, option overrides, and serialization equality
  • README and CHANGES.md updates in lib, plugin-gradle, and plugin-maven

Closes #2990

Test plan

  • :lib:compileJava and the new princeOfSpace glue source set compile cleanly, resolving prince-of-space-core:2.1.2 from Maven Central
  • Full ./gradlew test (couldn't run testlib/plugin-gradle/plugin-maven in my sandbox — lib-extra's p2/Eclipse dependency resolution was blocked by my environment's network policy, unrelated to this change; should run clean in CI)
  • ./gradlew spotlessApply / ./gradlew spotbugsMain

Checklist

  • Follow-up commit adding the [Unreleased] CHANGES.md entries' link to this PR (per PULL_REQUEST_TEMPLATE.md) once it's opened
  • "Allow edits from maintainers" enabled on this PR

Adds io.princeofspace prince-of-space as a Java FormatterStep, following
the same JarState + reflection glue pattern used for palantir-java-format
and google-java-format. Wires it into the Gradle (princeOfSpace()) and
Maven (<princeOfSpace>) plugins with all of prince-of-space's
FormatterConfig knobs exposed (indentStyle, indentSize, lineLength,
wrapStyle, closingParenOnNewLine, trailingCommas, javaLanguageLevel).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for the prince-of-space Java formatter

1 participant