Class InitializationChecker

All Implemented Interfaces:
Processor, OptionConfiguration
Direct Known Subclasses:
NullnessChecker

public abstract class InitializationChecker extends BaseTypeChecker
Tracks whether a value is initialized (all its fields are set), and checks that values are initialized before being used. Implements the freedom-before-commitment scheme for initialization, augmented by type frames.
See the Checker Framework Manual:
Initialization Checker
  • Constructor Details

    • InitializationChecker

      protected InitializationChecker()
      Create a new InitializationChecker.
  • Method Details

    • getSuppressWarningsPrefixes

      public NavigableSet<String> getSuppressWarningsPrefixes()
      Description copied from class: SourceChecker
      Returns a modifiable set of lower-case strings that are prefixes for SuppressWarnings strings.

      The collection must not be empty and must not contain only SourceChecker.SUPPRESS_ALL_PREFIX.

      Overrides:
      getSuppressWarningsPrefixes in class SourceChecker
      Returns:
      non-empty modifiable set of lower-case prefixes for SuppressWarnings strings
    • getAllFields

      public static List<VariableTree> getAllFields(ClassTree clazz)
      Returns a list of all fields of the given class.
    • messageKeyMatches

      protected boolean messageKeyMatches(String messageKey, String messageKeyInSuppressWarningsString)
      Description copied from class: SourceChecker
      Does the given messageKey match a messageKey that appears in a SuppressWarnings? Subclasses should override this method if they need additional logic to compare message keys.
      Overrides:
      messageKeyMatches in class SourceChecker
      Parameters:
      messageKey - the message key of the error that is being emitted, without any "checker:" prefix
      messageKeyInSuppressWarningsString - the message key in a @SuppressWarnings annotation
      Returns:
      true if the arguments match