Package edu.umd.cs.findbugs
Class ClassAnnotation
- java.lang.Object
-
- edu.umd.cs.findbugs.BugAnnotationWithSourceLines
-
- edu.umd.cs.findbugs.PackageMemberAnnotation
-
- edu.umd.cs.findbugs.ClassAnnotation
-
- All Implemented Interfaces:
BugAnnotation
,XMLWriteable
,XMLWriteableWithMessages
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<BugAnnotation>
public class ClassAnnotation extends PackageMemberAnnotation
A BugAnnotation object specifying a Java class involved in the bug.- Author:
- David Hovemeyer
- See Also:
BugAnnotation
,BugInstance
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ANNOTATION_ROLE
static java.lang.String
ANONYMOUS_ROLE
static java.lang.String
IMPLEMENTED_INTERFACE_ROLE
static java.lang.String
INTERFACE_ROLE
static java.lang.String
RECOMMENDED_SUPERCLASS_ROLE
static java.lang.String
SUBCLASS_ROLE
static java.lang.String
SUPERCLASS_ROLE
static java.lang.String
TYPE_QUALIFIER_ROLE
-
Fields inherited from class edu.umd.cs.findbugs.PackageMemberAnnotation
className, description
-
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 ClassAnnotation(java.lang.String className)
Constructor.ClassAnnotation(java.lang.String className, java.lang.String sourceFileName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(BugAnnotationVisitor visitor)
Accept a BugAnnotationVisitor.int
compareTo(BugAnnotation o)
boolean
contains(ClassAnnotation other)
boolean
equals(java.lang.Object o)
protected java.lang.String
formatPackageMember(java.lang.String key, ClassAnnotation primaryClass)
Do default and subclass-specific formatting.static ClassAnnotation
fromClassDescriptor(ClassDescriptor classDescriptor)
Factory method to create a ClassAnnotation from a ClassDescriptor.SourceLineAnnotation
getSourceLines()
Get the SourceLineAnnotation describing the source lines where the method is defined.static SourceLineAnnotation
getSourceLinesForClass(java.lang.String className, java.lang.String sourceFileName)
ClassAnnotation
getTopLevelClass()
int
hashCode()
boolean
isSignificant()
Is this annotation used to compute instance hashes or match bug instances across versionsvoid
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.PackageMemberAnnotation
format, getClassDescriptor, getClassName, getDescription, getPackageName, getSimpleClassName, getSlashedClassName, removePackage, removePackageName, setDescription, shorten, toString, toString
-
Methods inherited from class edu.umd.cs.findbugs.BugAnnotationWithSourceLines
clone, getSourceFileName, setSourceLines
-
-
-
-
Field Detail
-
SUBCLASS_ROLE
public static final java.lang.String SUBCLASS_ROLE
- See Also:
- Constant Field Values
-
SUPERCLASS_ROLE
public static final java.lang.String SUPERCLASS_ROLE
- See Also:
- Constant Field Values
-
ANONYMOUS_ROLE
public static final java.lang.String ANONYMOUS_ROLE
- See Also:
- Constant Field Values
-
RECOMMENDED_SUPERCLASS_ROLE
public static final java.lang.String RECOMMENDED_SUPERCLASS_ROLE
- See Also:
- Constant Field Values
-
IMPLEMENTED_INTERFACE_ROLE
public static final java.lang.String IMPLEMENTED_INTERFACE_ROLE
- See Also:
- Constant Field Values
-
INTERFACE_ROLE
public static final java.lang.String INTERFACE_ROLE
- See Also:
- Constant Field Values
-
ANNOTATION_ROLE
public static final java.lang.String ANNOTATION_ROLE
- See Also:
- Constant Field Values
-
TYPE_QUALIFIER_ROLE
public static final java.lang.String TYPE_QUALIFIER_ROLE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ClassAnnotation
public ClassAnnotation(@DottedClassName java.lang.String className)
Constructor.- Parameters:
className
- the name of the class
-
ClassAnnotation
public ClassAnnotation(@DottedClassName java.lang.String className, java.lang.String sourceFileName)
-
-
Method Detail
-
isSignificant
public boolean isSignificant()
Description copied from interface:BugAnnotation
Is this annotation used to compute instance hashes or match bug instances across versions- Specified by:
isSignificant
in interfaceBugAnnotation
- Overrides:
isSignificant
in classPackageMemberAnnotation
- Returns:
- true if significant
-
fromClassDescriptor
public static ClassAnnotation fromClassDescriptor(ClassDescriptor classDescriptor)
Factory method to create a ClassAnnotation from a ClassDescriptor.- Parameters:
classDescriptor
- the ClassDescriptor- Returns:
- the ClassAnnotation
-
accept
public void accept(BugAnnotationVisitor visitor)
Description copied from interface:BugAnnotation
Accept a BugAnnotationVisitor.- Parameters:
visitor
- the visitor to accept
-
formatPackageMember
protected java.lang.String formatPackageMember(java.lang.String key, ClassAnnotation primaryClass)
Description copied from class:PackageMemberAnnotation
Do default and subclass-specific formatting.- Specified by:
formatPackageMember
in classPackageMemberAnnotation
- Parameters:
key
- the key specifying how to do the formattingprimaryClass
- TODO
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
contains
public boolean contains(ClassAnnotation other)
-
getTopLevelClass
public ClassAnnotation getTopLevelClass()
-
compareTo
public int compareTo(BugAnnotation o)
-
getSourceLines
public SourceLineAnnotation getSourceLines()
Description copied from class:BugAnnotationWithSourceLines
Get the SourceLineAnnotation describing the source lines where the method is defined.- Overrides:
getSourceLines
in classBugAnnotationWithSourceLines
- Returns:
- the SourceLineAnnotation, or null if there is no source information for this package element
-
getSourceLinesForClass
public static SourceLineAnnotation getSourceLinesForClass(@DottedClassName java.lang.String className, java.lang.String sourceFileName)
-
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
-
-