checkers.util.test
Class FactoryTestChecker
java.lang.Object
   javax.annotation.processing.AbstractProcessor
javax.annotation.processing.AbstractProcessor
       com.sun.source.util.AbstractTypeProcessor
com.sun.source.util.AbstractTypeProcessor
           checkers.source.SourceChecker
checkers.source.SourceChecker
               checkers.util.test.FactoryTestChecker
checkers.util.test.FactoryTestChecker
- All Implemented Interfaces:
- Processor
@SupportedSourceVersion(value=RELEASE_7)
@SupportedOptions(value="checker")
public class FactoryTestChecker
extends SourceChecker
A specialized checker for testing purposes.  It compares an expression's
 annotated type to an exprected type.
 The expected type is written in a stylized comment (starting with '///')
 in the same Java source file.  The comment appears either on the same
 line as the expression, or else by itself on the line preceeding the
 expression.
 The comments are of two forms:
 
  - /// <expected type>:
      to specify the type of the expression in the expression statement
- /// <subtree> -:- <expected type>:
      to specify the type of the given subexpression within the line.
The specified types are allowed to use simple names (e.g.,
 List<String>), instead of fully qualified names (e.g.,
 java.util.List<java.lang.String>).
 Example:
  void test() {
      // Comments in the same line
      Collections.<@NonNull String>emptyList();  /// List<@NonNull String>
      List<@NonNull String> l = Collections.emptyList(); /// Collections.emptyList() -:- List<@NonNull String>
      // Comments in the previous lines
      /// List<@NonNull String>
      Collections.<@NonNull String>emptyList();
      /// Collections.emptyList() -:- List<@NonNull String>
      List<@NonNull String> l = Collections.emptyList();
  }
 
  The fully qualified name of the custom AnnotatedTypeFactory is
  specified through an -Afactory argument (e.g.
  -Afactory=checkers.nullness.NullnessAnnotatedTypeFactory).  The factory needs
  to have a constractor of the form
  <init>(ProcessingEnvironment, CompilationUnitTree).
 
 
 
 
 
| Methods inherited from class checkers.source.SourceChecker | 
| fullMessageOf, getLintOption, getLintOption, getProcessingEnvironment, getShouldSkip, getSupportedAnnotationTypes, getSupportedLintOptions, getSupportedOptions, getSupportedSourceVersion, getSuppressWarningsKey, message, report, typeProcess | 
 
 
 
 
FactoryTestChecker
public FactoryTestChecker()
init
public void init(ProcessingEnvironment p)
- Description copied from class: SourceChecker
- 
 
- 
- Specified by:
- initin interface- Processor
- Overrides:
- initin class- SourceChecker
 
- 
- See Also:
- AbstractProcessor.init(ProcessingEnvironment)
 
createFactory
public AnnotatedTypeFactory createFactory(CompilationUnitTree root)
- 
- Overrides:
- createFactoryin class- SourceChecker
 
- 
- Parameters:
- root- the AST root for the factory
- Returns:
- an AnnotatedTypeFactoryfor use by typecheckers
 
getMessages
public Properties getMessages()
- Description copied from class: SourceChecker
- Provides a mapping of error keys to custom error messages.
 As a default, this implementation builds a Propertiesout of
 filemessages.properties.  It accumulates all the properties files
 in the Java class hierarchy from the checker up toSourceChecker.
 This permits subclasses to inherit default messages while being able to
 override them.
 
- 
- Overrides:
- getMessagesin class- SourceChecker
 
- 
- Returns:
- a Propertiesthat maps error keys to error message text
 
createSourceVisitor
protected SourceVisitor<Void,Void> createSourceVisitor(CompilationUnitTree root)
- Description copied from class: SourceChecker
- Provides the SourceVisitorthat the checker should use to scan
 input source trees.
 
- 
- Specified by:
- createSourceVisitorin class- SourceChecker
 
- 
- Parameters:
- root- the AST root
- Returns:
- a SourceVisitorto use to scan source trees