JetBrains / JetBrains/java-annotations

@Language should be applicable as a type-annotation.

Ouverte
#43 2 commentaires 7 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

# Description

`@Target` `ElementType.TYPE_USE` may be added to `@Language` annotation to allow its usage in applicablecontexts.

# Example

Currently the following example won't compile although it is logical:
```java
private final @NotNull Map<@NotNull NamespacedKey, @Language("json") @NotNull String> addedAdvancements;
```

Another positive side is that while currently IntelliJ warns on incorrect order in the following case:
```java
public void addAdvancement(final @NotNull NamespacedKey key,
final @Language("json") @NotNull String advancementJson) { /* ... */ }
```
suggesting swapping of `final` and `@Language("json")`, this wouldn't be true if `TYPE_USE` was present on the annotation.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Start by locating the @Language annotation declaration and reviewing its existing @Target configuration. Verify the two Java examples, then confirm that adding TYPE_USE allows the type-annotation usage and avoids the reported annotation-order warning without breaking current uses.

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

Évaluation

Stack technique
java
Domaine
developer-experience
Type d'issue
Fonctionnalité
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

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