Class NullUsageProcessor

java.lang.Object
javax.annotation.processing.AbstractProcessor
org.antlr.v4.runtime.misc.NullUsageProcessor
All Implemented Interfaces:
Processor

@SupportedAnnotationTypes({"org.antlr.v4.runtime.misc.NotNull","org.antlr.v4.runtime.misc.Nullable"}) public class NullUsageProcessor extends AbstractProcessor
A compile-time validator for correct usage of the NotNull and Nullable annotations.

The validation process checks the following items.

  • Error: an element is annotated with both NotNull and Nullable.
  • Error: an method which returns void is annotated with NotNull or Nullable.
  • Error: an element with a primitive type is annotated with Nullable.
  • Error: a parameter is annotated with NotNull, but the method overrides or implements a method where the parameter is annotated Nullable.
  • Error: a method is annotated with Nullable, but the method overrides or implements a method that is annotated with NotNull.
  • Warning: an element with a primitive type is annotated with NotNull.
  • Warning: a parameter is annotated with NotNull, but the method overrides or implements a method where the parameter is not annotated.
  • Warning: a method is annotated with Nullable, but the method overrides or implements a method that is not annotated.

In the future, the validation process may be updated to check the following additional items.

  • Warning: a parameter is not annotated, but the method overrides or implements a method where the parameter is annotated with NotNull or Nullable.
  • Warning: a method is not annotated, but the method overrides or implements a method that is annotated with with NotNull or Nullable.