palantir / palantir/palantir-java-format

Allow Inlined Annotations for Mocks

Open
#215 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
907
Forks
101
Avg merge
1d 3h
Merged PRs (30d)
19

Description

What happened?

 @Mock(answer = Answers.RETURNS_DEEP_STUBS) private Job job;

gets reformatted as

@Mock(answer = Answers.RETURNS_DEEP_STUBS) 
private Job job;

Which is not very space-efficient if you have a bunch of mocks

What did you want to happen?

I'd like the code to stay with the inlined annotation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the formatter behavior with the inline @Mock annotation and compare it with the requested output. Locate the formatting logic and its regression tests for annotations and variable declarations; done means an inline annotation remains on the same line without changing other formatting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.