Class MustCallChecker

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

@StubFiles({"IOUtils.astub","JavaEE.astub","JdkCompiler.astub","Reflection.astub","SocketCreatesMustCallFor.astub"}) @SupportedOptions({"noCreatesMustCallFor","noLightweightOwnership","noResourceAliases","resourceLeakIgnoredExceptions"}) public class MustCallChecker extends BaseTypeChecker
This typechecker ensures that @MustCall annotations are consistent with one another. The Resource Leak Checker verifies that the given methods are actually called.
  • Field Details

    • NO_CREATES_MUSTCALLFOR

      public static final String NO_CREATES_MUSTCALLFOR
      Disables @CreatesMustCallFor support. Not of interest to most users. Not documented in the manual.
      See Also:
    • NO_LIGHTWEIGHT_OWNERSHIP

      public static final String NO_LIGHTWEIGHT_OWNERSHIP
      Disables @Owning/@NotOwning support. Not of interest to most users. Not documented in the manual.
      See Also:
    • NO_RESOURCE_ALIASES

      public static final String NO_RESOURCE_ALIASES
      Disables @MustCallAlias support. Not of interest to most users. Not documented in the manual.
      See Also:
    • IGNORED_EXCEPTIONS

      public static final String IGNORED_EXCEPTIONS
      Command-line option for controlling which exceptions are ignored.
      See Also:
  • Constructor Details

    • MustCallChecker

      public MustCallChecker()
      Creates a MustCallChecker.
  • Method Details

    • getIgnoredExceptions

      public SetOfTypes getIgnoredExceptions()
      Returns the set of exceptions that should be ignored. This set comes from the IGNORED_EXCEPTIONS option if it was provided, or DEFAULT_IGNORED_EXCEPTIONS if not.
      Returns:
      the set of exceptions to ignore
    • parseIgnoredExceptions

      protected SetOfTypes parseIgnoredExceptions(String ignoredExceptionsOptionValue)
      Parse the argument given for the IGNORED_EXCEPTIONS option. Warnings will be issued for any problems in the argument, for instance if any of the named exceptions cannot be found.
      Parameters:
      ignoredExceptionsOptionValue - the value given for IGNORED_EXCEPTIONS
      Returns:
      the set of ignored exceptions
    • parseExceptionSpecifier

      protected @Nullable SetOfTypes parseExceptionSpecifier(String exceptionSpecifier, String ignoredExceptionsOptionValue)
      Parse a single exception specifier from the IGNORED_EXCEPTIONS option and issue warnings if it does not parse. See EXCEPTION_SPECIFIER for a description of the syntax.
      Parameters:
      exceptionSpecifier - the exception specifier to parse
      ignoredExceptionsOptionValue - the whole value of the IGNORED_EXCEPTIONS option; only used for error reporting
      Returns:
      the parsed set of types, or null if the value does not parse
    • checkCanonicalName

      protected @Nullable TypeMirror checkCanonicalName(String s)
      Check if the given String refers to an actual type.
      Parameters:
      s - any string
      Returns:
      the referenced type, or null if it does not exist