Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Chiusa
#49 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java, kotlin

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Java
Stelle
1
Fork
1
Merge medio
1h 58m
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di CodeLaser/maddi

Tutte le issue di CodeLaser/maddi

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.