#IntelliJ position of annotations

1 messages · Page 1 of 1 (latest)

proper breach
#

Hey... Does someone here knows where I can change the standard position of the "NotNull" annotation? In default (when implementing the override-methods) it gets placed right before the "ItemStack". But I want it below (or above as long as it's consistent) the "Override" annotation.

And also is there a possibility to setup a warning/inspection when no "NotNull" or "Nullable" annotation was found?

How it is:

@Override
public @NotNull ItemStack getItemStack(@NotNull Player player) {
   // Do something
}```

How I want it to be:
```Java
@Override
@NotNull
public ItemStack getItemStack(@NotNull Player player) {
   // Do something
}```

The parent method is annotated (manually when created):
```Java
@NotNull
public abstract ItemStack getItemStack(@NotNull Player player);```
bleak lintelBOT
#

<@&987246527741304832> please have a look, thanks.

north bolt
#

So

#

unfortunately, these 2 positions have different meanings

#

rather than explain deeply, i'll make a demo

#
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import java.util.Arrays;

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE_USE})
@interface Red {}

public class Main {
    @Red
    static String a() {
        return "";
    }

    static @Red String b() {
        return "";
    }

    public static void main(String[] args) throws Exception {
        var m1 = Main.class.getDeclaredMethod("a");
        System.out.println(m1.getAnnotatedReturnType());
        System.out.println(Arrays.asList(m1.getAnnotations()));
        var m2 = Main.class.getDeclaredMethod("b");

        System.out.println(m2.getAnnotatedReturnType());
        System.out.println(Arrays.asList(m2.getAnnotations()));
    }
}
#

orr....not

#

i was wrong

proper breach
#

IntelliJ position of annotations

#

It's probably just a small checkbox I can't find, but... I can't find it. D:
And I did not find anything useful on Google.