`removeUnusedImports()` does not parse Markdown Javadoc
Maintainer thường phản hồi trong vòng 1 ngà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
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- java
- Lĩnh vực
- build-system, tooling
Hướng nghiên cứu
Start by tracing the Java removeUnusedImports() implementation and its formatter integration; the issue identifies Gradle classloading and javac's service loader as the suspected path. Reproduce with the provided Java snippet and default settings, then check whether ArrayList and Collection remain imported when referenced only in Markdown Javadoc. Done means those references are preserved during formatting.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
- Java version: 25.0.5.0.3
- Gradle version: 9.7.1
- Gradle plugin version: 8.11.0
When using removeUnusedImports() with the default settings, the formatter does not parse Markdown Javadoc comments, meaning classes only referenced within them will be stripped. For example, with the following config:
spotless {
java {
removeUnusedImports()
}
}
This file:
import java.util.ArrayList;
import java.util.Collection;
import java.util.function.Predicate;
/// [ArrayList#add] [Collection#removeIf(Predicate)]
class Test {}
Will be reformatted to:
/// [ArrayList#add] [Collection#removeIf(Predicate)]
class Test {}
Google's formatter uses javac to parse the classes, so this in theory should work. However, Markdown parsing is handled in a separate step — javac uses a service loader to load the class responsible for parsing/transforming markdown.
Due to Gradle's funky classloading, the service loader doesn't find the Markdown parser, and so Markdown doc comments are ignored. I'm not really sure there's a good way to fix this, short of running the formatter in a separate forked process.
- Ngôn ngữ chính
- Java
- Star
- 5.7k
- Fork
- 565
- Merge trung bình
- 3 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc 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 diffplug/spotless
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Spotless for DockerfileĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Support Ktlint 2.0Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 43/100
diffplug/spotless#3147 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của diffplug/spotless
Issue tương tự
-
bug web-ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
jenkinsci/jenkins#27705 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
googleads/googleads-mobile-flutter#1541 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Keyboard crashes Chrome tabsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Julow/Unexpected-Keyboard#1490 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Vakore/ZappierGames#275 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
unitycatalog/unitycatalog#2148 ·
Maintainer thường phản hồi trong vòng 2 ngày