palantir / palantir/palantir-java-format
Two-column argument layout breaks with different AST shapes
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 907
- Forks
- 101
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 19
Description
We've hit an obscure edge case for the two-column argList logic, where it doesn't end up keeping the pairs together.
The logic tries to assert that N/2+1 rows have the same "kind" of tree in the AST.
However, the values in the example seem to be
- Kind.PLUS (BinaryTree of
+operations) - Kind.VARIABLE
- Kind.METHOD_INVOCATION
I honestly don't see much reason for this kind of heuristic (at least for values), so it might make sense to remove it.
Originally posted by @dansanduleac in https://github.com/palantir/conjure-verification/pull/311#discussion_r377215499
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in JavaInputAstVisitor.java around lines 3222-3226 and trace the two-column argList handling that compares AST kinds. Reproduce the reported case with mixed PLUS, VARIABLE, and METHOD_INVOCATION values, then verify that the resulting pairs remain together. Done means the mixed AST shapes no longer trigger the layout failure, with formatter behavior checked for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100