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

Recipe UseTextBlocks: Textblock not constructed AFTER it encounters a variable in a string.

Aperta
#261 12 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@kunli2 ci sta già lavorando.

Dal 3/4/2023.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

enhancement

Was testing with the UseTextBlocks recipe. Wanted to use it for our SQL statements. Noticed that it works partially. Our SQL statement consists out of + variable or constant + . It appears that after encountering a variable a textblock is no longer created. Also reran mvn rewrite:run again just to see if it would be picked up in a second run. It doesn't. During the test the ONLY active recipe was UseTextBlocks

Question: Is there a minimum number of string concats needed before a textblock is used??

Gonna check all the converted files, should I find more 'interesting things' I can enter it here in this thread.

Before

        int thisVariableStopsTextBlocks = 1; 

        String stringWithVariableInIt =
                "This " +
                "is  " +
                "text " +
                "BEFORE the variable " +
                thisVariableStopsTextBlocks +
                "This " +
                "is  " +
                "text " +
                "AFTER the variable. " +
                "As is visible a TextBlock is no longer constructed";

After org.openrewrite.java.migrate.lang.UseTextBlocks: {convertStringsWithoutNewlines=true}

        int thisVariableStopsTextBlocks = 1;

        String stringWithVariableInIt =
                """
                This \
                is  \
                text \
                BEFORE the variable \
                """ +
                thisVariableStopsTextBlocks +
                "This " +
                "is  " +
                "text " +
                "AFTER the variable. " +
                "As is visible a TextBlock is no longer constructed";
Lingua principale
Java
Stelle
156
Fork
129
Merge medio
3g 8h
PR unite (30g)
14

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 openrewrite/rewrite-migrate-java

Tutte le issue di openrewrite/rewrite-migrate-java

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.