JetBrains / JetBrains/java-annotations

Add @Covariant and @Contravariant annotations

Ouverte
#20 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

As a library developer, I want to be able to add some annotations to mark the variance of the type parameters of a class. IDE can give the following hint based on this annotation:
- Report a warning when contravariant type parameter T is used as a function parameter type
- Report a warning when covariant type parameter T is used as a function return type
- For function parameter types, prompt user to use `Function` (take `java.util.function.Function` as an example) instead of `Function`

And the jvm-based language can choose to understand this annotation (e.g. kotlin can understand `class C<@Covariant T>` as `class C`. This is convenient for developers to provide Kotlin-friendly APIs using pure Java.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Start by reviewing the requested @Covariant and @Contravariant annotations, including the function-type examples and Kotlin interpretation described in the issue. Identify the project entry points and tests needed to validate the annotation declarations and their intended variance behavior; done means the requested annotations and documented behavior are covered.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java, kotlin
Domaine
tooling
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

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