Class SignaturePrinter

All Implemented Interfaces:
Processor

Outputs the method signatures of a class with fully annotated types.

The class determines the effective annotations for a checker in source or the classfile. Finding the effective annotations is useful for the following purposes:

  1. Debugging annotations in classfile
  2. Debugging the default annotations that are implicitly added by the checker

The class can be used in two possible ways, depending on the type file:

  1. From source: the class is to be used as an annotation processor when reading annotations from source. It can be invoked via the command:

    javac -processor SignaturePrinter <java files> ...

  2. From classfile: the class is to be used as an independent app when reading annotations from classfile. It can be invoked via the command:

    java SignaturePrinter <class name>

By default, only the annotations explicitly written by the user are emitted. To view the default and effective annotations in a class that are associated with a checker, the fully qualified name of the checker needs to be passed as -Achecker= argument, e.g.

 javac -processor SignaturePrinter
       -Achecker=org.checkerframework.checker.nullness.NullnessChecker JavaFile.java
 
  • Constructor Details

    • SignaturePrinter

      public SignaturePrinter()
  • Method Details

    • typeProcessingStart

      public void typeProcessingStart()
      Description copied from class: AbstractTypeProcessor
      A method to be called once before the first call to typeProcess.

      Subclasses may override this method to do any initialization work.

      Overrides:
      typeProcessingStart in class AbstractTypeProcessor
    • typeProcess

      public void typeProcess(TypeElement element, com.sun.source.util.TreePath p)
      Description copied from class: AbstractTypeProcessor
      Processes a fully-analyzed class that contains a supported annotation (see AbstractProcessor.getSupportedAnnotationTypes()).

      The passed class is always valid type-checked Java code.

      Specified by:
      typeProcess in class AbstractTypeProcessor
      Parameters:
      element - element of the analyzed class
      p - the tree path to the element, with the leaf being a ClassTree
    • printUsage

      public static void printUsage()
    • main

      public static void main(String[] args)