JetBrains / JetBrains/java-annotations

Remove redundant targets from Nullability-annotations

Ouverte
#37 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Kotlin
Étoiles
463
Forks
72
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.