Support JEP 512: Compact Source Files and Instance Main Methods
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện lỗi của v1.25.1 với ví dụ learn/jbang/hello.java được báo cáo và xem xét các JEP 445, 463, 477 và 495. Xác định những thay đổi cần thiết cho formatter đối với các tệp mã nguồn dạng compact và các phương thức main của instance, sau đó xác minh rằng ví dụ được format thành công mà không có lỗi “did not generate token”.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
In https://github.com/enola-dev/enola/pull/974 for https://github.com/enola-dev/enola/issues/971 with https://github.com/enola-dev/enola/issues/970, I am using "Java's fancy modern main style", AKA the JEP 445 & 463 & 477 & 495 stuff:
- https://openjdk.org/jeps/445
- https://openjdk.org/jeps/463
- https://openjdk.org/jeps/477
- https://openjdk.org/jeps/495
So I have e.g. a hello.java which looks e.g. like this, which is actually valid (with --enable-preview) Java 21 syntax:
import static java.lang.System.out;
void main() {
out.println("Hello World: " + dev.enola.common.Version.get());
}
google-java-format chokes on this with:
stderr: learn/jbang/hello.java:26:6: error: did not generate token "void"
void main() {
This is on v1.25.1, which is the 2nd most recent release today; looking at the 1.25.2 Release Notes, I have no reason to believe that this (just) got fixed there; ergo reporting this here.
Stating that google-java-format does not support --enable-preview would be valid. But from what little I figured (so far) this feature, contrary to e.g. those preview String Templates which then got removed again, this syntax appears to be here to stay, so probably should be supported, sooner or later.
- Ngôn ngữ chính
- Java
- Star
- 6.2k
- Fork
- 936
- Merge trung bình
- 6 phút
- Pull request đã merge (30 ngày)
- 3
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của google/google-java-format
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
google/google-java-format#1094 · 1 bình luận ·
-
Complementary Teamups Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
google/google-java-format#1450 · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
google/google-java-format#1439 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
google/google-java-format#1436 · 2 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
google/google-java-format#1428 · 3 bình luận ·
Tất cả issue của google/google-java-format
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
elastic/gradle-plugins#157 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
cryptomator/hub#497 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
johanhaleby/occurrent#1120 ·