Class TypeAnnotation

All Implemented Interfaces:
BugAnnotation, XMLWriteable, XMLWriteableWithMessages, Serializable, Cloneable, Comparable<BugAnnotation>

public class TypeAnnotation extends BugAnnotationWithSourceLines
Bug annotation class for java types. This is of lighter weight than ClassAnnotation, and can be used for things like array types.
See Also:
  • Field Details

  • Constructor Details

    • TypeAnnotation

      public TypeAnnotation(String typeDescriptor)
      constructor.

      For information on type descriptors,
      see http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc. html#14152
      or http://www.murrayc.com/learning/java/java_classfileformat.shtml# TypeDescriptors

      Parameters:
      typeDescriptor - a jvm type descriptor, such as "[I"
    • TypeAnnotation

      public TypeAnnotation(org.apache.bcel.generic.Type objectType)
    • TypeAnnotation

      public TypeAnnotation(org.apache.bcel.generic.Type objectType, String roleDescription)
    • TypeAnnotation

      public TypeAnnotation(String typeDescriptor, String roleDescription)
  • Method Details

    • getTypeDescriptor

      public String getTypeDescriptor()
      Get the type descriptor.
      Returns:
      the jvm type descriptor, such as "[I"
    • accept

      public void accept(BugAnnotationVisitor visitor)
      Description copied from interface: BugAnnotation
      Accept a BugAnnotationVisitor.
      Parameters:
      visitor - the visitor to accept
    • format

      public String format(String key, ClassAnnotation primaryClass)
      Description copied from interface: BugAnnotation
      Format the annotation as a String. The given key specifies additional information about how the annotation should be formatted. If the key is empty, then the "default" format will be used.
      Parameters:
      key - how the annotation should be formatted
      primaryClass - The primary class for the bug; some bug annotation format msgs are simplified in relation to that class.
    • setDescription

      public void setDescription(String roleDescription)
      Description copied from interface: BugAnnotation
      Set a description of this bug annotation. The description is a key for the FindBugsAnnotationDescriptions resource bundle.
    • getDescription

      public String getDescription()
      Description copied from interface: BugAnnotation
      Get a description of this bug annotation. The description is a key for the FindBugsAnnotationDescriptions resource bundle.
    • setTypeParameters

      public void setTypeParameters(String typeParameters)
    • getTypeParameters

      public String getTypeParameters()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(BugAnnotation o)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • writeXML

      public void writeXML(XMLOutput xmlOutput) throws IOException
      Description copied from interface: XMLWriteable
      Write this object to given XMLOutput.
      Parameters:
      xmlOutput - the XMLOutput for the document
      Throws:
      IOException
    • writeXML

      public void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary) throws IOException
      Throws:
      IOException
    • isSignificant

      public boolean isSignificant()
      Description copied from interface: BugAnnotation
      Is this annotation used to compute instance hashes or match bug instances across versions
      Returns:
      true if significant