JetBrains / JetBrains/java-annotations

Remove redundant targets from Nullability-annotations

Đang mở
#37 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Kotlin
Star
463
Fork
72
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

At current both `@NotNull` and `@Nullable` have quite broad scopes which commonly overlap:
https://github.com/JetBrains/java-annotations/blob/d7c469b3b53c2135ba1c8863fc5eb2f5d5ccb36c/common/src/main/java/org/jetbrains/annotations/Nullable.java#L39
https://github.com/JetBrains/java-annotations/blob/d7c469b3b53c2135ba1c8863fc5eb2f5d5ccb36c/common/src/main/java/org/jetbrains/annotations/NotNull.java#L29
While this is required for java5 (which obviously does not have `ElementType.TYPE_USE`) it is more of an issue rather than a feature on java 8+. I.e. overlapping scopes lead to tools such as Javadoc recognizing both targets as matched thus leading to issues such as duplication of the annotation in documentation in case of the latter.

Thus I suggest keeping only `ElementType.TYPE_USE` on these annotations in java8 version of the project, and keeping only `{ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE}` on java5 version.

If this gets approved I am ready to create the corresponding PR.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

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

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.