Class I18nFormatterVisitor

java.lang.Object
com.sun.source.util.TreeScanner<R,P>
com.sun.source.util.TreePathScanner<R,P>
All Implemented Interfaces:
com.sun.source.tree.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(com.sun.source.tree.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 com.sun.source.tree.TreeVisitor<Void,Void>
      Overrides:
      visitMethodInvocation in class BaseTypeVisitor<I18nFormatterAnnotatedTypeFactory>
    • commonAssignmentCheck

      protected void commonAssignmentCheck(AnnotatedTypeMirror varType, AnnotatedTypeMirror valueType, com.sun.source.tree.Tree valueTree, @CompilerMessageKey String errorKey, Object... extraArgs)
      Description copied from class: BaseTypeVisitor
      Checks the validity of an assignment (or pseudo-assignment) from a value to a variable and emits an error message (through the compiler's messaging interface) if it is not valid.
      Overrides:
      commonAssignmentCheck in class BaseTypeVisitor<I18nFormatterAnnotatedTypeFactory>
      Parameters:
      varType - the annotated type of the variable
      valueType - the annotated type of the value
      valueTree - the location to use when reporting the error message
      errorKey - the error message key to use if the check fails
      extraArgs - arguments to the error message key, before "found" and "expected" types