Printer: no brace placement option, and moved code loses literal spelling, spacing and comment positions
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- developer-experience, tooling
Research direction
Start from FormattingOptions and the printer that re-renders members after a move. Confirm there is no brace-placement setting and that alwaysBreakPriorityBlocks is not Allman. Trace how literals, comments, spacing, braceless ifs, javadoc, and the blank line after imports are taken from the AST versus source. Done when a brace-placement option exists and moved code keeps source spelling and comment positions so an Allman project would accept the diff.
Written by the indexing model from the issue text.
Description
Observed while refactoring Apache Cassandra (an Allman-style codebase) in September 2026: every member a refactoring moves is re-rendered through maddi's printer, and the output cannot follow the project's brace style, and changes code it should carry unchanged.
Brace placement. FormattingOptions has no brace-placement option. alwaysBreakPriorityBlocks breaks the line after {, which is not the same as putting the brace on its own line (Allman). A consumer that has inferred the project's style (bracesEndOfLine=false) has nothing to map it to, so moved code always comes out K&R.
Fidelity defects seen in the same output:
- spacing:
if ( !datum.endsWith(unit)), and a cast printed as(Class<T> ) - a braceless one-statement
ifbody gains braces and is collapsed onto one line:if (...) { throw ...; } - a line comment between a condition and its
{moves to the other side of the brace - javadoc lines are joined without a space ("the methods above.Understands both")
- the blank line after the imports is lost
- integer literals lose their source spelling:
0xFFFFis printed as65535,50_000as50000
Expected: a brace-placement option in FormattingOptions, and literals and comments carried from source. Code a tool moves should read as if the project's authors wrote it; a diff that restyles moved code won't be accepted upstream.
- Dominant language
- Java
- Stars
- 1
- Forks
- 1
- Avg merge
- 2h 51m
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from CodeLaser/maddi
-
build/ci good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 3/5 Half a day Newbie friendliness 62/100
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Java → C# translation: an idiomatic C# printer driven by the modification and nullability analysesOpenenhancement extension front-end:csharp
Difficulty 5/5 Over a week Newbie friendliness 8/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 40/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
utopia-rise/godot-jvm#1004 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
spring-projects/spring-grpc#442 ·
-
Expose numberOfPermits in RateLimiterEvent.toString() and the ratelimiterevents actuator DTOPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
resilience4j/resilience4j#2547 ·
Maintainers usually reply within 9 days
-
Clock.MakeDate continues execution and returns a rolled-over instant after dispatching error on invalid datePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 1/5 Under an hour Newbie friendliness 82/100
mit-cml/appinventor-sources#4155 ·
Maintainers usually reply within 1 day