Clean up Java 27 compatibility hack

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

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
52/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
java
Lĩnh vực
compilers

Hướng nghiên cứu

Bắt đầu trong src/main/java/software/coley/sourcesolver/util/compat và kiểm tra commit tương thích 05b54eb0fabf4b57702d875d808d9ea219c4283d, tập trung vào lời gọi factory của JavacParser và contract Java 27 của nó. Xem xét các thay đổi OpenJDK được tham chiếu trước khi quyết định nên xử lý việc tạo parser như thế nào; hoàn thành có nghĩa là logic tương thích được dọn dẹp mà không làm hỏng việc phân giải phạm vi AST.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement

Compatibility commit: 05b54eb0fabf4b57702d875d808d9ea219c4283d

Compatibility logic: https://github.com/Col-E/SourceSolver/tree/master/src/main/java/software/coley/sourcesolver/util/compat

Somehow the parser factory call didn't totally break.

// Build parser for source and extract the end-pos table so that we can resolve AST ranges
JavacParser parser = factory.newParser(source,
		false /* keepJavadoc */,
		true  /* keepEndPos */,
		false /* keepLineMap */
);

The contract is different now, but doesn't immediately cause problems.

// Build parser for source and extract the end-pos table so that we can resolve AST ranges
JavacParser parser = factory.newParser(source,
		false /* keepJavadoc */,
		true  /* keepLineMap */,
		false /* parseModuleInfo */
);

We may want to also have some compat logic for building the parser instances...


Rant

This dogshit compatibility hack exists because we don't have maven/gradle support for Java 27 yet, but people already noticed because they try and run consuming projects on bleeding edge releases... yay.

I would have liked to use multi-release jars, but oh my god this is impossible. Because we use --add-exports we cannot use --release. And guess what mutli-release support in Maven/Gradle loves to use? Yeah.

I'm sure there's a way around it but I wasted 2.5 hours on this already...


Most javac internal changes can be found here:

  • https://github.com/openjdk/jdk/pulls?q=is%3Apr+author%3Acushon
    • 31058: Clean up calls to deprecated getStartPosition and getEndPosition methods
    • 29994: Don't require a CompilationUnit for end position APIs
    • 29463: Store end positions on more trees
    • 28610: Store end positions directly in JCTree
Ngôn ngữ chính
Java
Star
12
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 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.