Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#261 12 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@kunli2 đang làm issue này rồi.

Từ ngày 3/4/2023.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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";
Ngôn ngữ chính
Java
Star
156
Fork
129
Merge trung bình
3 ngày 8 giờ
Pull request đã merge (30 ngày)
14

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của openrewrite/rewrite-migrate-java

Tất cả issue của openrewrite/rewrite-migrate-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.