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

Java printer: a text block's escape sequences are lost (\\ prints as \, \t as a tab)

Aperta
#177 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java
Ambito
tooling

Direzione di ricerca

Start at javaInspector.print2 and trace how it prints Java text block literals, comparing the original source with the printed output in the examples. Check the shared literal escaping mentioned in the issue and add coverage for backslashes and tabs in text blocks. Done means printed sources preserve the string value and compile; the payload names no test file.

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

Descrizione

bug

A text block's escape sequences are lost on print: \\ prints as \, \t as a raw tab. The printed text block holds a different string, or does not compile (\/ is an illegal escape).

package a.b;
public @interface Ann { String value(); }
package a.b;
public class T {
    static final String F = """
            name\\/name, false
            tab\tx
            """;
    @Ann("""
            name\\/name
            """)
    void m() { }
}

javaInspector.print2(cu, null, javaInspector.importComputer(4, cu.sourceSet())) prints

    static final String F = """
            name\/name, false
            tab	x
            """;

    @Ann("""
            name\/name
            """)

javac: illegal escape character. It seems the text block is printed from its value rather than re-escaped (#124's shared literal escaping does not reach it).

Found re-parsing printed sources of timefold-solver: AbstractConstraintBuilderTest's @CsvSource text block (name\\/name, false); the unit is dropped.

maddi 0.9.6-alpha.4.

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

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.