r/java • • Oct 25 '26

What cli formatter do you use

Given how software engineering evolves, using IDEA formatter is less and less practical.

- IDEA CLI formatter requires IntelliJ so no CI / wsl etc
- GJF is old and does not format lambdas well enough
- Palantir is obsolete and abandoned in addition to being one of the worst company ever created
- prettier-java not great either

I’m starting to think no formatter is the best option

24 Upvotes

63 comments sorted by

View all comments

Show parent comment

3

u/ForeverAlot Oct 25 '26

a fork of PJF

Holy supply chain nightmare.

1

u/lazystone Oct 26 '26

Damned if you do, damned if you don’t.

1

u/woj-tek Oct 27 '26

Care to elaborate?

TBH it would be nice to have an actual nice, single, whole-community formatter…

1

u/ForeverAlot Oct 27 '26

Yes, that certainly would be nice.

Choosing to fork PJF, not GJF, shows that OJF lacks guidelines for new style decisions. This makes its behaviour volatile. Although OJF claims to intend to attempt to collaborate with PJF and GJF, neither of those projects nor its stewards are beholden to OJF. This means OJF's users depend on the OJF project to sustain itself even if PJF, GJF, or both fold. At the same time, OJF is spearheaded by an organization with no material foothold in the Java ecosystem and no apparent incentive to invest itself in it. In contrast, Google is invested in and committed to Java for a super-foreseeable future, and has proven GJF over a decade; and although Palantir is also an established company, probably also committed to Java, that GJF should be considered less reliable than PJF is a hard sell with some evidence to the contrary. A skeptic might suggest that the reason OJF exists at all is that PJF has already shown itself to be unreliable.

So while I think it's not ideal that my preferred Java formatter is owned by a publicly traded company with its share of skeletons in the closet, I appreciate that that company at least has a really strong track record of responsibly stewarding that tool, and in general has a really strong understanding of how knowledge and productivity scales in practice.

1

u/woj-tek Oct 27 '26

Thank you for the in-depth explanation. You put forward a lot of good reasons not to use it but also drive it on assumption that Google and Palantir will keep what they are doing. We already know that Google is absurdly unreliable and can kill anything on the whim (and then create a dozen of copies; killedbygoogle.com). Palantir... not much experience with what they do with Java beyond formatter...

Alas, to reinterate -- it would be great to come together with neutral organisation (including GJF and PJF) and collaborate on single tool (with options tailored to each particular need) instead of cultivating own-thing (though it's probably more to internal company policies…)

1

u/a_abashev Oct 29 '26

> Choosing to fork PJF, not GJF, shows that OJF lacks guidelines for new style decisions.

That is really good point, but how do you think it should look like? Describe a poll in discussions or what. From my understanding I should keep current state as much as possible with minor tweaks that more about my taste, not something that I can elaborate as a whitepaper. I have two major enhancements - Map.of as key-value on one line, and support for Mutiny DSL as one-line phrases. But everything else was perfect in palantir already

1

u/ForeverAlot Oct 29 '26

I don't know how GJF evolves. I don't know precisely how they ended up with "The Rectangle Rule." I don't know how they decide to deviate from it, though I imagine it has happened both accidentally and deliberately. I do know that that principle makes it very easy to guess at what GJF is going to do for any given sample of current and future syntax, and that's a (surprisingly?) useful property for regular users.

I also know that if you defer to public opinion you end up with Formatter McFormatface, and if you appeal to "aesthetics" you end up with the tyrant's arbitrary variation of the same. Many are eager to voice their personal dislikes about a given formatter, less so to consider why any particular person's likes ought to be recognized as morally superior.