JetBrains / JetBrains/java-annotations

@Language should be applicable as a type-annotation.

Offen
#43 2 Kommentare 7 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Kotlin
Sterne
463
Forks
72
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

# 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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.