Package edu.umd.cs.findbugs
Class TypeAnnotation
- java.lang.Object
-
- edu.umd.cs.findbugs.BugAnnotationWithSourceLines
-
- edu.umd.cs.findbugs.TypeAnnotation
-
- All Implemented Interfaces:
BugAnnotation,XMLWriteable,XMLWriteableWithMessages,java.io.Serializable,java.lang.Cloneable,java.lang.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:
ClassAnnotation, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCLOSEIT_ROLEstatic java.lang.StringDEFAULT_ROLEstatic java.lang.StringEXPECTED_ROLEstatic java.lang.StringFOUND_ROLEstatic java.lang.StringUNHASHABLE_ROLE-
Fields inherited from class edu.umd.cs.findbugs.BugAnnotationWithSourceLines
sourceFileName, sourceLines
-
Fields inherited from interface edu.umd.cs.findbugs.BugAnnotation
MESSAGE_TAG
-
-
Constructor Summary
Constructors Constructor Description TypeAnnotation(java.lang.String typeDescriptor)constructor.TypeAnnotation(java.lang.String typeDescriptor, java.lang.String roleDescription)TypeAnnotation(org.apache.bcel.generic.Type objectType)TypeAnnotation(org.apache.bcel.generic.Type objectType, java.lang.String roleDescription)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(BugAnnotationVisitor visitor)Accept a BugAnnotationVisitor.intcompareTo(BugAnnotation o)booleanequals(java.lang.Object o)java.lang.Stringformat(java.lang.String key, ClassAnnotation primaryClass)Format the annotation as a String.java.lang.StringgetDescription()Get a description of this bug annotation.java.lang.StringgetTypeDescriptor()Get the type descriptor.java.lang.StringgetTypeParameters()inthashCode()booleanisSignificant()Is this annotation used to compute instance hashes or match bug instances across versionsvoidsetDescription(java.lang.String roleDescription)Set a description of this bug annotation.voidsetTypeParameters(java.lang.String typeParameters)java.lang.StringtoString()voidwriteXML(XMLOutput xmlOutput)Write this object to given XMLOutput.voidwriteXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary)-
Methods inherited from class edu.umd.cs.findbugs.BugAnnotationWithSourceLines
clone, getSourceFileName, getSourceLines, setSourceLines, toString
-
-
-
-
Field Detail
-
DEFAULT_ROLE
public static final java.lang.String DEFAULT_ROLE
- See Also:
- Constant Field Values
-
EXPECTED_ROLE
public static final java.lang.String EXPECTED_ROLE
- See Also:
- Constant Field Values
-
FOUND_ROLE
public static final java.lang.String FOUND_ROLE
- See Also:
- Constant Field Values
-
CLOSEIT_ROLE
public static final java.lang.String CLOSEIT_ROLE
- See Also:
- Constant Field Values
-
UNHASHABLE_ROLE
public static final java.lang.String UNHASHABLE_ROLE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TypeAnnotation
public TypeAnnotation(java.lang.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, java.lang.String roleDescription)
-
TypeAnnotation
public TypeAnnotation(java.lang.String typeDescriptor, java.lang.String roleDescription)
-
-
Method Detail
-
getTypeDescriptor
public java.lang.String getTypeDescriptor()
Get the type descriptor.- Returns:
- the jvm type descriptor, such as "[I"
-
accept
public void accept(BugAnnotationVisitor visitor)
Description copied from interface:BugAnnotationAccept a BugAnnotationVisitor.- Parameters:
visitor- the visitor to accept
-
format
public java.lang.String format(java.lang.String key, ClassAnnotation primaryClass)Description copied from interface:BugAnnotationFormat 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 formattedprimaryClass- The primary class for the bug; some bug annotation format msgs are simplified in relation to that class.
-
setDescription
public void setDescription(java.lang.String roleDescription)
Description copied from interface:BugAnnotationSet a description of this bug annotation. The description is a key for the FindBugsAnnotationDescriptions resource bundle.
-
getDescription
public java.lang.String getDescription()
Description copied from interface:BugAnnotationGet a description of this bug annotation. The description is a key for the FindBugsAnnotationDescriptions resource bundle.
-
setTypeParameters
public void setTypeParameters(java.lang.String typeParameters)
-
getTypeParameters
public java.lang.String getTypeParameters()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
compareTo
public int compareTo(BugAnnotation o)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
writeXML
public void writeXML(XMLOutput xmlOutput) throws java.io.IOException
Description copied from interface:XMLWriteableWrite this object to given XMLOutput.- Parameters:
xmlOutput- the XMLOutput for the document- Throws:
java.io.IOException
-
writeXML
public void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary) throws java.io.IOException
- Throws:
java.io.IOException
-
isSignificant
public boolean isSignificant()
Description copied from interface:BugAnnotationIs this annotation used to compute instance hashes or match bug instances across versions- Returns:
- true if significant
-
-