Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Language should be applicable as a type-annotation. #43

Open
JarvisCraft opened this issue Feb 21, 2021 · 1 comment · May be fixed by #77 or #98
Open

@Language should be applicable as a type-annotation. #43

JarvisCraft opened this issue Feb 21, 2021 · 1 comment · May be fixed by #77 or #98

Comments

@JarvisCraft
Copy link
Contributor

JarvisCraft commented Feb 21, 2021

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:

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:

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.

BartvHelvert added a commit to BartvHelvert/java-annotations that referenced this issue Aug 14, 2022
@BartvHelvert BartvHelvert linked a pull request Aug 14, 2022 that will close this issue
@Sparky983
Copy link
Contributor

Sparky983 commented Nov 5, 2022

This would be nice for other annotations like @MagicConstant, @Pattern, @RegExp, and @Subst as well, but I think it's intentional since all these annotations are in the org.intellij.annotations package (or maybe because they're old annotations).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment