Class DefaultAnnotationFormatter

java.lang.Object
org.checkerframework.javacutil.DefaultAnnotationFormatter
All Implemented Interfaces:
AnnotationFormatter
Direct Known Subclasses:
UnitsAnnotatedTypeFormatter.UnitsAnnotationFormatter

public class DefaultAnnotationFormatter extends Object implements AnnotationFormatter
A utility for converting AnnotationMirrors to Strings. It omits full package names.
  • Constructor Details

    • DefaultAnnotationFormatter

      public DefaultAnnotationFormatter()
  • Method Details

    • isInvisibleQualified

      public static boolean isInvisibleQualified(AnnotationMirror anno)
      Returns true if, by default, anno should not be printed.
      Parameters:
      anno - an annotation to check for printability/invisibility
      Returns:
      true if anno's declaration was qualified by InvisibleQualifier
      See Also:
    • formatAnnotationString

      @SideEffectFree public String formatAnnotationString(Collection<? extends AnnotationMirror> annos, boolean printInvisible)
      Creates a String of each annotation in annos separated by a single space character and terminated by a space character, obeying the printInvisible parameter.
      Specified by:
      formatAnnotationString in interface AnnotationFormatter
      Parameters:
      annos - a collection of annotations to print
      printInvisible - whether or not to print "invisible" annotation mirrors
      Returns:
      the list of annotations converted to a String
      See Also:
    • formatAnnotationMirror

      @SideEffectFree public String formatAnnotationMirror(AnnotationMirror anno)
      Returns the string representation of a single AnnotationMirror, without showing full package names.
      Specified by:
      formatAnnotationMirror in interface AnnotationFormatter
      Parameters:
      anno - the annotation mirror to convert
      Returns:
      the string representation of a single AnnotationMirror, without showing full package names
    • formatAnnotationMirror

      protected void formatAnnotationMirror(AnnotationMirror am, StringBuilder sb)
      A helper method to output a single AnnotationMirror, without showing full package names.
    • formatAnnotationMirrorArg

      protected void formatAnnotationMirrorArg(AnnotationValue av, StringBuilder sb)