JetBrains / JetBrains/java-annotations

Remove redundant targets from Nullability-annotations

未关闭
#37 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Kotlin
星标
463
派生
72
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。