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.String
CLOSEIT_ROLE
static java.lang.String
DEFAULT_ROLE
static java.lang.String
EXPECTED_ROLE
static java.lang.String
FOUND_ROLE
static java.lang.String
UNHASHABLE_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 void
accept(BugAnnotationVisitor visitor)
Accept a BugAnnotationVisitor.int
compareTo(BugAnnotation o)
boolean
equals(java.lang.Object o)
java.lang.String
format(java.lang.String key, ClassAnnotation primaryClass)
Format the annotation as a String.java.lang.String
getDescription()
Get a description of this bug annotation.java.lang.String
getTypeDescriptor()
Get the type descriptor.java.lang.String
getTypeParameters()
int
hashCode()
boolean
isSignificant()
Is this annotation used to compute instance hashes or match bug instances across versionsvoid
setDescription(java.lang.String roleDescription)
Set a description of this bug annotation.void
setTypeParameters(java.lang.String typeParameters)
java.lang.String
toString()
void
writeXML(XMLOutput xmlOutput)
Write this object to given XMLOutput.void
writeXML(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:BugAnnotation
Accept a BugAnnotationVisitor.- Parameters:
visitor
- the visitor to accept
-
format
public java.lang.String format(java.lang.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 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:BugAnnotation
Set 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:BugAnnotation
Get 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:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
compareTo
public int compareTo(BugAnnotation o)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
writeXML
public void writeXML(XMLOutput xmlOutput) throws java.io.IOException
Description copied from interface:XMLWriteable
Write 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:BugAnnotation
Is this annotation used to compute instance hashes or match bug instances across versions- Returns:
- true if significant
-
-