Skip to content

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

Open

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:

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.

Activity

  1. added a commit that references this issue on Aug 14, 2022
    ca0aab2
  2. Sparky983 commented on Nov 5, 2022

    @Sparky983
    Contributor

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

  3. Tholian commented on May 7, 2025

    @Tholian

    I would love to have this ability for my Consumer<String> and Supplier<String> as well.
    It would be really nice to have those strings highlighted as well.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions