Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Printer: no brace placement option, and moved code loses literal spelling, spacing and comment positions

Open
#49 0 comments 0 reactions 0 assignees View on GitHub

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
Tech stack
java, kotlin

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

bug

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 if body 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: 0xFFFF is printed as 65535, 50_000 as 50000

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

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.

More from CodeLaser/maddi

All issues in CodeLaser/maddi

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.