You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Option to keep a single marker annotation on the field's line #159
palantir-java-format#1782 (closed unmerged on 2026-10-17) lets a field with exactly one argument-less annotation keep it on the same line (@Mock private Foo foo;), reusing the predicate that locals and parameters already use. Fields with annotation arguments, several annotations, or lines that would overflow stay one-per-line. The author themselves flags it as a maintainer taste call, because the existing rule ("field annotations are always vertical") was a deliberate choice.
Why it matters to us: our JavaInputAstVisitor still hard-codes vertical annotations for fields (near line 3807), so this would be a deliberate style divergence from palantir, only worth it if our users ask for it (Mockito and injection annotations are the typical case). Upstream gave no reason beyond taste, and our recent lambda-parameter change (#103) shows we are open to inline annotations where they are clearly short.
Affected files: open-java-format/src/main/java/com/palantir/javaformat/java/JavaInputAstVisitor.java, field-annotation test data.
Before (how it is formatted today; the field rule is hard-coded vertical in our code):
Activity