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

62 comments sorted by

View all comments

0

u/lazystone Oct 25 '26

https://github.com/palantir/palantir-java-format/

But why do you say that it's abandoned(no objections about the company itself though)?

There is also a fork of PJF: https://github.com/openjavaformat/open-java-format but I haven't looked who is behind it.

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.

2

u/a_abashev Oct 29 '26

Thank you so much for good words, but how do mean "behind it"? I'm just a java developer who can't accept 2 spaces for indentation and can't see how palantir-java-format is dying - I used it for long time but with new Java version it is not reliable 😁

1

u/lazystone Oct 29 '26

Oh, you're maintainer there ❤️

What I really mean by "who is behind it" is that there is somebody(or better a group) committed to maintain and evolve that fork.

Nowadays too much new projects are born in light of AI but owners loose interest and move to another shiny thing.

So, I guess only time can tell that "there are trusted people" behind that project and you can rely on it.

2

u/a_abashev Oct 29 '26

I'm not perfect and yes, I'm supporting projects that I'm using. For vfs-s3 it was for 15 years and now I'm thinking about something like micro-aws-s3 for serverless, but I hope this formatter will stay for me for long time. And as I mentioned in manifesto - current CI infrastructure is behind our eyes and if somebody will decide to push forward this project then he will have all infrastructure with jdk matrix, tests, jreleaser and even mise scripts to upload secrets

2

u/Cilph Oct 26 '26

Not touching Palantir in a million years. Not just moral and ethical concerns either.

1

u/lazystone Oct 26 '26

But you're OK with touching Google? Or Microsoft?

Why so? Google for example just illegally destroyed forests in Finland, so are you going to stop using all Google libraries now? Or should you avoid all websites built on top of React? That's Facebook/Meta. Or stop visiting GitHub - it's Microsoft after all. And you know what? The biggest contributor to Java itself is Oracle, would you name Oracle as ethical company?

But if you put your hypocrisy aside, there is https://github.com/openjavaformat/open-java-format after all.

3

u/Cilph Oct 26 '26 edited Oct 26 '26

"Everything is flawed so why even bother" levels of defeatism completely ignoring there are scales to everything. Everything is bad therefore everything is somehow equally bad.

1

u/lazystone Oct 26 '26

That is hypocrisy.

You're fine with one evil, but not with another.

You do meaningless things in order to calm you consciousness down, like avoiding some open source java formatters in question(how the hell it helps against Palantir is beyond my understanding), when what you should do instead is to vote out politicians who let corporations to thrive instead of regular people.

But at least you "did something", right?

3

u/Cilph Oct 26 '26 edited Oct 26 '26

As I already explained, its not hypocrisy if you dont rate stealing candy to be as evil as something clearly worse like murder. Yeah I draw lines somewhere.

Though, where the fuck did I pretend that I "did something" to help any cause? I never said it was part of some grand plan. And where the fuck did I say my conscience was calmed by any of it? I dont like them and using their work is counter to what my sector is trying to achieve. Its as simple as that.

Either way, Im still doing more than you for some imagined goal of there being no more Palantir. Because if thats your wish, attacking people like this is sure to help!

1

u/lazystone Oct 26 '26

Your answer just confirms it.