I'm using a framework (Minecraft Forge) that injects specific objects into public static final fields with null values (through the @CapabilityInject and @ObjectHolder annotations). Unfortunately whenever I reference one of these fields in a context that doesn't allow null values, the "Constant conditions & exceptions" inspection in IntelliJ IDEA warns me that the field may be null (because it doesn't know about the injection).
I know that these fields won't be null when they're accessed, so I'd like to disable the warning for them.
Is there a way to disable the warning for a specific field or all fields in a class? Adding @SuppressWarnings("ConstantConditions") or //noinspection ConstantConditions to the field doesn't remove the warning on the field access and adding the annotation to the field's class only removes the warning in that class.
I'd like to avoid adding //noinspection ConstantConditions or null-checks to every location I access the fields from.