Class I18nFormatterVisitor

All Implemented Interfaces:
TreeVisitor<Void,Void>

public class I18nFormatterVisitor extends BaseTypeVisitor<I18nFormatterAnnotatedTypeFactory>
Whenever a method with I18nFormatFor annotation is invoked, it will perform the format string verification.
See the Checker Framework Manual:
Internationalization Format String Checker
  • Constructor Details

    • I18nFormatterVisitor

      public I18nFormatterVisitor(BaseTypeChecker checker)
  • Method Details

    • visitMethodInvocation

      public Void visitMethodInvocation(MethodInvocationTree tree, Void p)
      Description copied from class: BaseTypeVisitor
      Performs a method invocation check.

      An invocation of a method, m, on the receiver, r is valid only if:

      • passed arguments are subtypes of corresponding m parameters
      • r is a subtype of m receiver type
      • if m is generic, passed type arguments are subtypes of m type variables
      Specified by:
      visitMethodInvocation in interface TreeVisitor<Void,Void>
      Overrides:
      visitMethodInvocation in class BaseTypeVisitor<I18nFormatterAnnotatedTypeFactory>
    • commonAssignmentCheck

      protected boolean commonAssignmentCheck(AnnotatedTypeMirror varType, AnnotatedTypeMirror valueType, Tree errorLocation, @CompilerMessageKey String errorKey, Object... extraArgs)
      Description copied from class: BaseTypeVisitor
      Checks the validity of an assignment (or pseudo-assignment) from valueType to variableType and emits an error message (through the compiler's messaging interface) if it is not valid.

      Subclasses should override this method unless the tree for the varType or valueType are needed.

      Overrides:
      commonAssignmentCheck in class BaseTypeVisitor<I18nFormatterAnnotatedTypeFactory>
      Parameters:
      varType - the annotated type of the variable
      valueType - the annotated type of the value
      errorLocation - the location to use when reporting the error message; this is NOT the tree for valueType in all cases
      errorKey - the error message key to use if the check fails
      extraArgs - arguments to the error message key, before "found" and "expected" types
      Returns:
      true if the check succeeds, false if an error message was issued