public class BugInstance extends java.lang.Object implements java.lang.Comparable<BugInstance>, XMLWriteable, java.io.Serializable, java.lang.Cloneable
BugInstance objects are built up by calling a string of add
methods. (These methods all "return this", so they can be chained). Some of
the add methods are specialized to get information automatically from a
BetterVisitor or DismantleBytecode object.
BugAnnotation
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
BugInstance.NoSuchBugPattern |
static class |
BugInstance.XmlProps
These are properties read from an analysis XML file.
|
Constructor and Description |
---|
BugInstance(Detector2 detector,
java.lang.String type,
int priority)
Create a new BugInstance.
|
BugInstance(Detector detector,
java.lang.String type,
int priority)
Create a new BugInstance.
|
BugInstance(java.lang.String type,
int priority)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
BugInstance |
add(BugAnnotation annotation) |
BugInstance |
addAnnotations(java.util.Collection<? extends BugAnnotation> annotationCollection)
Add a Collection of BugAnnotations.
|
BugInstance |
addCalledMethod(org.apache.bcel.generic.ConstantPoolGen cpg,
org.apache.bcel.generic.InvokeInstruction inv)
Add a method annotation for the method which is called by given
instruction.
|
BugInstance |
addCalledMethod(DismantleBytecode visitor)
Add a method annotation for the method which has been called by the
method currently being visited by given visitor.
|
BugInstance |
addCalledMethod(org.apache.bcel.generic.MethodGen methodGen,
org.apache.bcel.generic.InvokeInstruction inv)
Add a method annotation for the method which is called by given
instruction.
|
BugInstance |
addCalledMethod(java.lang.String className,
java.lang.String methodName,
java.lang.String methodSig,
boolean isStatic)
Add a method annotation.
|
BugInstance |
addCalledMethod(XMethod m) |
BugInstance |
addClass(ClassDescriptor classDescriptor)
Add a class annotation.
|
BugInstance |
addClass(org.objectweb.asm.tree.ClassNode classNode)
Add a class annotation for the classNode.
|
BugInstance |
addClass(org.apache.bcel.classfile.JavaClass jclass)
Add a class annotation.
|
BugInstance |
addClass(PreorderVisitor visitor)
Add a class annotation for the class that the visitor is currently
visiting.
|
BugInstance |
addClass(java.lang.String className)
Add a class annotation.
|
BugInstance |
addClass(java.lang.String className,
java.lang.String sourceFileName)
Add a class annotation.
|
BugInstance |
addClassAndMethod(org.apache.bcel.classfile.JavaClass javaClass,
org.apache.bcel.classfile.Method method)
Add class and method annotations for given class and method.
|
BugInstance |
addClassAndMethod(MethodAnnotation methodAnnotation)
Add class and method annotations for given method.
|
BugInstance |
addClassAndMethod(MethodDescriptor methodDescriptor) |
BugInstance |
addClassAndMethod(org.apache.bcel.generic.MethodGen methodGen,
java.lang.String sourceFile)
Add class and method annotations for given method.
|
BugInstance |
addClassAndMethod(PreorderVisitor visitor)
Add a class annotation and a method annotation for the class and method
which the given visitor is currently visiting.
|
BugInstance |
addClassAndMethod(XMethod xMethod) |
BugInstance |
addEqualsMethodUsed(ClassDescriptor expectedClass) |
BugInstance |
addEqualsMethodUsed(java.util.Collection<XMethod> equalsMethods) |
BugInstance |
addField(FieldAnnotation fieldAnnotation)
Add a field annotation
|
BugInstance |
addField(FieldDescriptor fieldDescriptor)
Add a field annotation for a FieldDescriptor.
|
BugInstance |
addField(FieldVariable field)
Add a field annotation for a FieldVariable matched in a ByteCodePattern.
|
BugInstance |
addField(PreorderVisitor visitor) |
BugInstance |
addField(java.lang.String className,
java.lang.String fieldName,
java.lang.String fieldSig,
boolean isStatic)
Add a field annotation.
|
BugInstance |
addField(java.lang.String className,
java.lang.String fieldName,
java.lang.String fieldSig,
int accessFlags)
Add a field annotation.
|
BugInstance |
addField(XField xfield)
Add a field annotation for an XField.
|
BugInstance |
addFieldOrMethodValueSource(OpcodeStack.Item item) |
BugInstance |
addFoundAndExpectedType(java.lang.String foundType,
java.lang.String expectedType) |
BugInstance |
addFoundAndExpectedType(org.apache.bcel.generic.Type foundType,
org.apache.bcel.generic.Type expectedType) |
BugInstance |
addInt(int value)
Add an integer annotation.
|
BugInstance |
addMethod(JavaClassAndMethod classAndMethod)
Add a method annotation.
|
BugInstance |
addMethod(org.apache.bcel.classfile.JavaClass javaClass,
org.apache.bcel.classfile.Method method)
Add a method annotation.
|
BugInstance |
addMethod(MethodAnnotation methodAnnotation)
Add a method annotation.
|
BugInstance |
addMethod(MethodDescriptor method)
Add a MethodAnnotation from an MethodDescriptor.
|
BugInstance |
addMethod(org.apache.bcel.generic.MethodGen methodGen,
java.lang.String sourceFile)
Add a method annotation.
|
BugInstance |
addMethod(PreorderVisitor visitor)
Add a method annotation for the method which the given visitor is
currently visiting.
|
BugInstance |
addMethod(java.lang.String className,
java.lang.String methodName,
java.lang.String methodSig,
boolean isStatic)
Add a method annotation.
|
BugInstance |
addMethod(java.lang.String className,
java.lang.String methodName,
java.lang.String methodSig,
int accessFlags)
Add a method annotation.
|
BugInstance |
addMethod(XMethod xmethod)
Add a MethodAnnotation from an XMethod.
|
BugInstance |
addOptionalAnnotation(BugAnnotation annotation) |
BugInstance |
addOptionalAnnotation(BugAnnotation annotation,
java.lang.String role) |
BugInstance |
addOptionalField(XField xfield)
Add a field annotation for an XField.
|
BugInstance |
addOptionalLocalVariable(DismantleBytecode dbc,
OpcodeStack.Item item)
Local variable adders
|
BugInstance |
addOptionalUniqueAnnotations(BugAnnotation... annotations) |
BugInstance |
addOptionalUniqueAnnotationsWithFallback(BugAnnotation fallback,
BugAnnotation... annotations) |
BugInstance |
addParameterAnnotation(int index,
java.lang.String role)
Add an annotation about a parameter
|
BugInstance |
addReferencedField(DismantleBytecode visitor)
Add a field annotation for the field which has just been accessed by the
method currently being visited by given visitor.
|
BugInstance |
addReferencedField(FieldAnnotation fa)
Add a field annotation for the field referenced by the FieldAnnotation
parameter
|
BugInstance |
addSomeSourceForTopTwoStackValues(ClassContext classContext,
org.apache.bcel.classfile.Method method,
Location location) |
BugInstance |
addSourceForTopStackValue(ClassContext classContext,
org.apache.bcel.classfile.Method method,
Location location) |
BugInstance |
addSourceLine(BytecodeScanningDetector visitor)
Add a source line annotation for instruction currently being visited by
given visitor.
|
BugInstance |
addSourceLine(BytecodeScanningDetector visitor,
int pc)
Add a source line annotation for instruction whose PC is given in the
method that the given visitor is currently visiting.
|
BugInstance |
addSourceLine(ClassContext classContext,
org.apache.bcel.generic.MethodGen methodGen,
java.lang.String sourceFile,
org.apache.bcel.generic.InstructionHandle handle)
Add a source line annotation for the given instruction in the given
method.
|
BugInstance |
addSourceLine(ClassContext classContext,
org.apache.bcel.generic.MethodGen methodGen,
java.lang.String sourceFile,
org.apache.bcel.generic.InstructionHandle start,
org.apache.bcel.generic.InstructionHandle end)
Add a source line annotation describing a range of instructions.
|
BugInstance |
addSourceLine(ClassContext classContext,
org.apache.bcel.classfile.Method method,
org.apache.bcel.generic.InstructionHandle handle)
Add source line annotation for given Location in a method.
|
BugInstance |
addSourceLine(ClassContext classContext,
org.apache.bcel.classfile.Method method,
Location location)
Add source line annotation for given Location in a method.
|
BugInstance |
addSourceLine(ClassContext classContext,
PreorderVisitor visitor,
int pc)
Add a source line annotation for instruction whose PC is given in the
method that the given visitor is currently visiting.
|
BugInstance |
addSourceLine(MethodDescriptor methodDescriptor,
Location location)
Add source line annotation for given Location in a method.
|
BugInstance |
addSourceLine(SourceLineAnnotation sourceLine)
Add a source line annotation.
|
BugInstance |
addSourceLineRange(BytecodeScanningDetector visitor,
int startPC,
int endPC)
Add a source line annotation describing the source line numbers for a
range of instructions in the method being visited by the given visitor.
|
BugInstance |
addSourceLineRange(ClassContext classContext,
PreorderVisitor visitor,
int startPC,
int endPC)
Add a source line annotation describing the source line numbers for a
range of instructions in the method being visited by the given visitor.
|
BugInstance |
addString(char c)
Add a String annotation.
|
BugInstance |
addString(java.lang.String value)
Add a String annotation.
|
BugInstance |
addSuperclass(PreorderVisitor visitor)
Add a class annotation for the superclass of the class the visitor is
currently visiting.
|
BugInstance |
addType(ClassDescriptor c) |
BugInstance |
addType(java.lang.String typeDescriptor)
Add a type annotation.
|
BugInstance |
addType(org.apache.bcel.generic.Type type) |
BugInstance |
addTypeOfNamedClass(java.lang.String typeName) |
BugInstance |
addUnknownSourceLine(java.lang.String className,
java.lang.String sourceFile)
Add a non-specific source line annotation.
|
BugInstance |
addValueSource(OpcodeStack.Item item,
DismantleBytecode dbc) |
BugInstance |
addValueSource(OpcodeStack.Item item,
org.apache.bcel.classfile.Method method,
int pc) |
BugInstance |
addVisitedField(PreorderVisitor visitor)
Add a field annotation for the field which is being visited by given
visitor.
|
void |
adjustForDetector(java.lang.String detectorName) |
java.util.Iterator<BugAnnotation> |
annotationIterator()
Get an Iterator over all bug annotations.
|
boolean |
annotationTextContainsWord(java.lang.String word)
Determine whether or not the annotation text contains the given word.
|
void |
clearHistory() |
void |
clearUserDesignation()
clear the user designation.
|
java.lang.Object |
clone() |
int |
compareTo(BugInstance other) |
boolean |
deleteProperty(java.lang.String name)
Delete property with given name.
|
BugInstance |
describe(java.lang.String description)
Add a description to the most recently added bug annotation.
|
boolean |
equals(java.lang.Object o) |
static java.text.DateFormat |
firstSeenXMLFormat() |
void |
foundInSyntheticMethod() |
java.lang.String |
getAbbrev()
Get the abbreviation of this bug instance's BugPattern.
|
java.lang.String |
getAbridgedMessage() |
java.util.List<? extends BugAnnotation> |
getAnnotations()
Get an Iterator over all bug annotations.
|
java.util.List<BugAnnotation> |
getAnnotationsForMessage(boolean showContext) |
java.lang.String |
getAnnotationText()
Get the user annotation text.
|
<A extends BugAnnotation> |
getAnnotationWithRole(java.lang.Class<A> c,
java.lang.String role)
Get the first bug annotation with the specified class and role; return null if no
such annotation exists;
|
java.util.Collection<? extends SourceLineAnnotation> |
getAnotherInstanceSourceLineAnnotations() |
BugPattern |
getBugPattern()
Get the BugPattern.
|
int |
getBugRank() |
BugRankCategory |
getBugRankCategory() |
java.lang.String |
getCategoryAbbrev() |
int |
getCWEid() |
DetectorFactory |
getDetectorFactory() |
static BugAnnotation |
getFieldOrMethodValueSource(OpcodeStack.Item item) |
long |
getFirstVersion() |
java.lang.String |
getInstanceHash() |
java.lang.String |
getInstanceKey() |
int |
getInstanceOccurrenceMax() |
int |
getInstanceOccurrenceNum() |
long |
getLastVersion() |
java.lang.String |
getMessage()
Format a string describing this bug instance.
|
java.lang.String |
getMessageWithoutPrefix()
Format a string describing this bug instance.
|
java.lang.String |
getMessageWithPriorityType()
Format a string describing this bug pattern, with the priority and type
at the beginning.
|
java.lang.String |
getMessageWithPriorityTypeAbbreviation() |
BugDesignation |
getNonnullUserDesignation()
Deprecated.
|
ClassAnnotation |
getPrimaryClass()
Get the primary class annotation, which indicates where the bug occurs.
|
FieldAnnotation |
getPrimaryField()
Get the primary method annotation, which indicates where the bug occurs.
|
LocalVariableAnnotation |
getPrimaryLocalVariableAnnotation() |
MethodAnnotation |
getPrimaryMethod()
Get the primary method annotation, which indicates where the bug occurs.
|
SourceLineAnnotation |
getPrimarySourceLineAnnotation()
Get the primary source line annotation.
|
TypeAnnotation |
getPrimaryType()
Get the primary type annotation, which indicates where the bug occurs.
|
int |
getPriority()
Get the bug priority.
|
java.lang.String |
getPriorityAbbreviation() |
java.lang.String |
getPriorityString() |
java.lang.String |
getPriorityTypeAbbreviation() |
java.lang.String |
getPriorityTypeString()
Get a string describing the bug priority and type.
|
java.lang.String |
getProperty(java.lang.String name)
Get value of given property.
|
java.lang.String |
getProperty(java.lang.String name,
java.lang.String defaultValue)
Get value of given property, returning given default value if the
property has not been set.
|
static BugAnnotation |
getSomeSource(ClassContext classContext,
org.apache.bcel.classfile.Method method,
Location location,
OpcodeStack stack,
int stackPos) |
static BugAnnotation |
getSourceForStackValue(ClassContext classContext,
org.apache.bcel.classfile.Method method,
Location location,
int depth) |
static BugAnnotation |
getSourceForTopStackValue(ClassContext classContext,
org.apache.bcel.classfile.Method method,
Location location) |
java.util.Set<java.lang.String> |
getTextAnnotationWords()
Get set of words in the text annotation.
|
java.lang.String |
getType()
Get the bug pattern name (e.g., IL_INFINITE_RECURSIVE_LOOP)
|
BugDesignation |
getUserDesignation()
Deprecated.
|
java.lang.String |
getUserDesignationKey()
Get the user designation key.
|
int |
getUserDesignationKeyIndex() |
java.lang.String |
getUserName() |
long |
getUserTimestamp() |
static BugAnnotation |
getValueSource(OpcodeStack.Item item,
org.apache.bcel.classfile.Method method,
int pc) |
BugInstance.XmlProps |
getXmlProps() |
int |
hashCode() |
boolean |
hasSomeUserAnnotation() |
boolean |
hasXmlProps() |
boolean |
isDead() |
boolean |
isExperimental()
Is this bug instance the result of an experimental detector?
|
boolean |
isInstanceHashConsistent() |
boolean |
isIntroducedByChangeOfExistingClass() |
boolean |
isRemovedByChangeOfPersistingClass() |
boolean |
isUserAnnotationDirty() |
BugProperty |
lookupProperty(java.lang.String name)
Look up a property by name.
|
void |
lowerPriority() |
void |
lowerPriorityALot() |
BugInstance |
lowerPriorityIfDeprecated() |
java.util.Iterator<BugProperty> |
propertyIterator()
Get an Iterator over the properties defined in this BugInstance.
|
void |
raisePriority() |
static void |
setAdjustExperimental(boolean adjust) |
void |
setAnnotationText(java.lang.String annotationText,
BugCollection bugCollection)
Set the user annotation text.
|
void |
setFirstVersion(long firstVersion) |
void |
setHistory(BugInstance from) |
void |
setInstanceHash(java.lang.String instanceHash) |
void |
setInstanceOccurrenceMax(int instanceOccurrenceMax) |
void |
setInstanceOccurrenceNum(int instanceOccurrenceNum) |
void |
setIntroducedByChangeOfExistingClass(boolean introducedByChangeOfExistingClass) |
void |
setLastVersion(long lastVersion) |
void |
setLive()
Mark the bug instance is being alive (still present in the last version)
|
void |
setOldInstanceHash(java.lang.String oldInstanceHash) |
void |
setPriority(int p)
Set the bug priority.
|
BugInstance |
setProperty(java.lang.String name,
java.lang.String value)
Set value of given property.
|
void |
setRemovedByChangeOfPersistingClass(boolean removedByChangeOfPersistingClass) |
void |
setUser(java.lang.String user) |
void |
setUserAnnotationDirty(boolean dirty) |
void |
setUserAnnotationTimestamp(long timestamp) |
void |
setUserDesignation(BugDesignation bd)
Deprecated.
|
void |
setUserDesignationKey(java.lang.String key,
BugCollection bugCollection) |
void |
setUserDesignationKeyIndex(int index,
BugCollection bugCollection) |
java.lang.String |
toString()
Convert to String.
|
boolean |
tryAddingOptionalUniqueAnnotations(BugAnnotation... annotations) |
void |
writeXML(XMLOutput xmlOutput)
Write this object to given XMLOutput.
|
void |
writeXML(XMLOutput xmlOutput,
BugCollection bugCollection,
boolean addMessages) |
public BugInstance(java.lang.String type, int priority)
type
- the bug typepriority
- the bug prioritypublic BugInstance(Detector detector, java.lang.String type, int priority)
detector
- the Detector that is reporting the BugInstancetype
- the bug typepriority
- the bug prioritypublic BugInstance(Detector2 detector, java.lang.String type, int priority)
detector
- the Detector2 that is reporting the BugInstancetype
- the bug typepriority
- the bug prioritypublic static java.text.DateFormat firstSeenXMLFormat()
public java.lang.Object clone()
clone
in class java.lang.Object
public void adjustForDetector(java.lang.String detectorName)
detectorName
- public static void setAdjustExperimental(boolean adjust)
public java.lang.String getType()
@Nonnull public BugPattern getBugPattern()
public int getPriority()
public int getBugRank()
public BugRankCategory getBugRankCategory()
public java.lang.String getPriorityTypeString()
public java.lang.String getPriorityTypeAbbreviation()
public java.lang.String getCategoryAbbrev()
public java.lang.String getPriorityString()
public java.lang.String getPriorityAbbreviation()
public void setPriority(int p)
public void raisePriority()
public void lowerPriority()
public void lowerPriorityALot()
public boolean isExperimental()
public ClassAnnotation getPrimaryClass()
@CheckForNull public TypeAnnotation getPrimaryType()
@CheckForNull public MethodAnnotation getPrimaryMethod()
@CheckForNull public FieldAnnotation getPrimaryField()
@Nonnull public BugInstance lowerPriorityIfDeprecated()
public LocalVariableAnnotation getPrimaryLocalVariableAnnotation()
@Nonnull public SourceLineAnnotation getPrimarySourceLineAnnotation()
public java.util.Collection<? extends SourceLineAnnotation> getAnotherInstanceSourceLineAnnotations()
public java.lang.String getInstanceKey()
public java.util.Iterator<BugAnnotation> annotationIterator()
public java.util.List<? extends BugAnnotation> getAnnotations()
@CheckForNull public <A extends BugAnnotation> A getAnnotationWithRole(java.lang.Class<A> c, java.lang.String role)
public java.lang.String getAbbrev()
public void clearUserDesignation()
@Deprecated public void setUserDesignation(BugDesignation bd)
@Deprecated @Nullable public BugDesignation getUserDesignation()
getNonnullUserDesignation()
@Deprecated @Nonnull public BugDesignation getNonnullUserDesignation()
getSafeUserDesignation().setDesignation("HARMLESS")
will
always work without the possibility of a NullPointerException.getUserDesignation()
@Nonnull public java.lang.String getUserDesignationKey()
getSafeUserDesignation().setDesignation("HARMLESS")
.I18N.getUserDesignation(String key)
@CheckForNull public java.lang.String getUserName()
public long getUserTimestamp()
public int getUserDesignationKeyIndex()
public void setUserDesignationKey(java.lang.String key, @CheckForNull BugCollection bugCollection)
public void setUserDesignationKeyIndex(int index, @CheckForNull BugCollection bugCollection)
public void setAnnotationText(java.lang.String annotationText, @CheckForNull BugCollection bugCollection)
annotationText
- the user annotation text@Nonnull public java.lang.String getAnnotationText()
public void setUser(java.lang.String user)
public void setUserAnnotationTimestamp(long timestamp)
public void setUserAnnotationDirty(boolean dirty)
public boolean isUserAnnotationDirty()
public boolean annotationTextContainsWord(java.lang.String word)
word
- the wordpublic java.util.Set<java.lang.String> getTextAnnotationWords()
public boolean hasXmlProps()
public BugInstance.XmlProps getXmlProps()
public boolean hasSomeUserAnnotation()
public java.lang.String getProperty(java.lang.String name)
name
- name of the property to getpublic java.lang.String getProperty(java.lang.String name, java.lang.String defaultValue)
name
- name of the property to getdefaultValue
- default value to return if propery is not setpublic java.util.Iterator<BugProperty> propertyIterator()
@Nonnull public BugInstance setProperty(java.lang.String name, java.lang.String value)
name
- name of the property to setvalue
- the value of the propertypublic BugProperty lookupProperty(java.lang.String name)
name
- name of the property to look forpublic boolean deleteProperty(java.lang.String name)
name
- name of the property to delete@Nonnull public BugInstance addAnnotations(java.util.Collection<? extends BugAnnotation> annotationCollection)
annotationCollection
- Collection of BugAnnotations@Nonnull public BugInstance addClassAndMethod(MethodDescriptor methodDescriptor)
public BugInstance addClassAndMethod(XMethod xMethod)
@Nonnull public BugInstance addClassAndMethod(PreorderVisitor visitor)
visitor
- the BetterVisitorpublic void foundInSyntheticMethod()
@Nonnull public BugInstance addClassAndMethod(MethodAnnotation methodAnnotation)
methodAnnotation
- the method@Nonnull public BugInstance addClassAndMethod(org.apache.bcel.generic.MethodGen methodGen, java.lang.String sourceFile)
methodGen
- the methodsourceFile
- source file the method is defined in@Nonnull public BugInstance addClassAndMethod(org.apache.bcel.classfile.JavaClass javaClass, org.apache.bcel.classfile.Method method)
javaClass
- the classmethod
- the method@Nonnull public BugInstance addClass(java.lang.String className, java.lang.String sourceFileName)
className
- the name of the classsourceFileName
- the source file of the class@Nonnull public BugInstance addClass(@SlashedClassName(when=UNKNOWN) java.lang.String className)
className
- the name of the class@Nonnull public BugInstance addClass(org.objectweb.asm.tree.ClassNode classNode)
classNode
- the ASM visitor@Nonnull public BugInstance addClass(ClassDescriptor classDescriptor)
classDescriptor
- the class to add@Nonnull public BugInstance addClass(org.apache.bcel.classfile.JavaClass jclass)
jclass
- the JavaClass object for the class@Nonnull public BugInstance addClass(PreorderVisitor visitor)
visitor
- the BetterVisitor@Nonnull public BugInstance addSuperclass(PreorderVisitor visitor)
visitor
- the BetterVisitor@Nonnull public BugInstance addType(java.lang.String typeDescriptor)
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
typeDescriptor
- a jvm type descriptor, such as "[I"@Nonnull public BugInstance addType(org.apache.bcel.generic.Type type)
@Nonnull public BugInstance addFoundAndExpectedType(org.apache.bcel.generic.Type foundType, org.apache.bcel.generic.Type expectedType)
@Nonnull public BugInstance addFoundAndExpectedType(java.lang.String foundType, java.lang.String expectedType)
@Nonnull public BugInstance addEqualsMethodUsed(ClassDescriptor expectedClass)
@Nonnull public BugInstance addEqualsMethodUsed(@CheckForNull java.util.Collection<XMethod> equalsMethods)
@Nonnull public BugInstance addTypeOfNamedClass(@DottedClassName java.lang.String typeName)
@Nonnull public BugInstance addType(ClassDescriptor c)
@Nonnull public BugInstance addField(java.lang.String className, java.lang.String fieldName, java.lang.String fieldSig, boolean isStatic)
className
- name of the class containing the fieldfieldName
- the name of the fieldfieldSig
- type signature of the fieldisStatic
- whether or not the field is static@Nonnull public BugInstance addField(java.lang.String className, java.lang.String fieldName, java.lang.String fieldSig, int accessFlags)
className
- name of the class containing the fieldfieldName
- the name of the fieldfieldSig
- type signature of the fieldaccessFlags
- access flags for the field@Nonnull public BugInstance addField(PreorderVisitor visitor)
@Nonnull public BugInstance addField(FieldAnnotation fieldAnnotation)
fieldAnnotation
- the field annotation@Nonnull public BugInstance addField(FieldVariable field)
field
- the FieldVariable@Nonnull public BugInstance addOptionalField(@CheckForNull XField xfield)
xfield
- the XField@Nonnull public BugInstance addField(XField xfield)
xfield
- the XField@Nonnull public BugInstance addField(FieldDescriptor fieldDescriptor)
fieldDescriptor
- the FieldDescriptor@Nonnull public BugInstance addReferencedField(DismantleBytecode visitor)
visitor
- the DismantleBytecode object@Nonnull public BugInstance addReferencedField(FieldAnnotation fa)
@Nonnull public BugInstance addVisitedField(PreorderVisitor visitor)
visitor
- the visitor@Nonnull public BugInstance addOptionalLocalVariable(DismantleBytecode dbc, OpcodeStack.Item item)
@Nonnull public BugInstance addMethod(java.lang.String className, java.lang.String methodName, java.lang.String methodSig, boolean isStatic)
className
- name of the class containing the methodmethodName
- name of the methodmethodSig
- type signature of the methodisStatic
- true if the method is static, false otherwise@Nonnull public BugInstance addMethod(@SlashedClassName java.lang.String className, java.lang.String methodName, java.lang.String methodSig, int accessFlags)
className
- name of the class containing the methodmethodName
- name of the methodmethodSig
- type signature of the methodaccessFlags
- accessFlags for the method@Nonnull public BugInstance addMethod(org.apache.bcel.generic.MethodGen methodGen, java.lang.String sourceFile)
methodGen
- the MethodGen object for the methodsourceFile
- source file method is defined in@Nonnull public BugInstance addMethod(org.apache.bcel.classfile.JavaClass javaClass, org.apache.bcel.classfile.Method method)
javaClass
- the class the method is defined inmethod
- the method@Nonnull public BugInstance addMethod(JavaClassAndMethod classAndMethod)
classAndMethod
- JavaClassAndMethod identifying the method to add@Nonnull public BugInstance addMethod(PreorderVisitor visitor)
visitor
- the BetterVisitor@Nonnull public BugInstance addCalledMethod(DismantleBytecode visitor)
visitor
- the DismantleBytecode object@Nonnull public BugInstance addCalledMethod(XMethod m)
@Nonnull public BugInstance addCalledMethod(java.lang.String className, java.lang.String methodName, java.lang.String methodSig, boolean isStatic)
className
- name of class containing called methodmethodName
- name of called methodmethodSig
- signature of called methodisStatic
- true if called method is static, false if not@Nonnull public BugInstance addCalledMethod(org.apache.bcel.generic.ConstantPoolGen cpg, org.apache.bcel.generic.InvokeInstruction inv)
cpg
- the constant pool for the method containing the callinv
- the InvokeInstruction@Nonnull public BugInstance addCalledMethod(org.apache.bcel.generic.MethodGen methodGen, org.apache.bcel.generic.InvokeInstruction inv)
methodGen
- the method containing the callinv
- the InvokeInstruction@Nonnull public BugInstance addMethod(XMethod xmethod)
xmethod
- the XMethod@Nonnull public BugInstance addMethod(MethodDescriptor method)
method
- the method@Nonnull public BugInstance addMethod(MethodAnnotation methodAnnotation)
methodAnnotation
- the method annotation@Nonnull public BugInstance addInt(int value)
value
- the integer value@Nonnull public BugInstance addParameterAnnotation(int index, java.lang.String role)
index
- parameter index, starting from 0role
- the role used to describe the parameter@Nonnull public BugInstance addString(java.lang.String value)
value
- the String value@Nonnull public BugInstance addString(char c)
c
- the char value@Nonnull public BugInstance addSourceLine(SourceLineAnnotation sourceLine)
sourceLine
- the source line annotation@Nonnull public BugInstance addSourceLine(BytecodeScanningDetector visitor, int pc)
visitor
- a BytecodeScanningDetector that is currently visiting the
methodpc
- bytecode offset of the instruction@Nonnull public BugInstance addSourceLine(ClassContext classContext, PreorderVisitor visitor, int pc)
classContext
- the ClassContextvisitor
- a PreorderVisitor that is currently visiting the methodpc
- bytecode offset of the instruction@Nonnull public BugInstance addSourceLine(ClassContext classContext, org.apache.bcel.generic.MethodGen methodGen, java.lang.String sourceFile, @Nonnull org.apache.bcel.generic.InstructionHandle handle)
classContext
- the ClassContextmethodGen
- the method being visitedsourceFile
- source file the method is defined inhandle
- the InstructionHandle containing the visited instruction@Nonnull public BugInstance addSourceLine(ClassContext classContext, org.apache.bcel.generic.MethodGen methodGen, java.lang.String sourceFile, org.apache.bcel.generic.InstructionHandle start, org.apache.bcel.generic.InstructionHandle end)
classContext
- the ClassContextmethodGen
- the methodsourceFile
- source file the method is defined instart
- the start instruction in the rangeend
- the end instruction in the range (inclusive)@Nonnull public BugInstance addSourceLine(ClassContext classContext, org.apache.bcel.classfile.Method method, Location location)
classContext
- the ClassContextmethod
- the Methodlocation
- the Location in the method@Nonnull public BugInstance addSourceLine(MethodDescriptor methodDescriptor, Location location)
methodDescriptor
- the methodlocation
- the Location in the method@Nonnull public BugInstance addSourceLine(ClassContext classContext, org.apache.bcel.classfile.Method method, org.apache.bcel.generic.InstructionHandle handle)
classContext
- the ClassContextmethod
- the Methodhandle
- InstructionHandle of an instruction in the method@Nonnull public BugInstance addSourceLineRange(BytecodeScanningDetector visitor, int startPC, int endPC)
visitor
- a BetterVisitor which is visiting the methodstartPC
- the bytecode offset of the start instruction in the rangeendPC
- the bytecode offset of the end instruction in the range@Nonnull public BugInstance addSourceLineRange(ClassContext classContext, PreorderVisitor visitor, int startPC, int endPC)
classContext
- the ClassContextvisitor
- a BetterVisitor which is visiting the methodstartPC
- the bytecode offset of the start instruction in the rangeendPC
- the bytecode offset of the end instruction in the range@Nonnull public BugInstance addSourceLine(BytecodeScanningDetector visitor)
visitor
- a BytecodeScanningDetector visitor that is currently visiting
the instruction@Nonnull public BugInstance addUnknownSourceLine(java.lang.String className, java.lang.String sourceFile)
className
- the class namesourceFile
- the source file name@Nonnull public java.lang.String getMessageWithoutPrefix()
public java.lang.String getAbridgedMessage()
public java.lang.String getMessage()
public java.lang.String getMessageWithPriorityType()
public java.lang.String getMessageWithPriorityTypeAbbreviation()
@Nonnull public BugInstance describe(java.lang.String description)
description
- the description to addpublic java.lang.String toString()
toString
in class java.lang.Object
public void writeXML(XMLOutput xmlOutput) throws java.io.IOException
XMLWriteable
writeXML
in interface XMLWriteable
xmlOutput
- the XMLOutput for the documentjava.io.IOException
public int getCWEid()
public void writeXML(XMLOutput xmlOutput, BugCollection bugCollection, boolean addMessages) throws java.io.IOException
java.io.IOException
public BugInstance addOptionalAnnotation(@CheckForNull BugAnnotation annotation)
public BugInstance addOptionalAnnotation(@CheckForNull BugAnnotation annotation, java.lang.String role)
public BugInstance add(@Nonnull BugAnnotation annotation)
public BugInstance addSomeSourceForTopTwoStackValues(ClassContext classContext, org.apache.bcel.classfile.Method method, Location location)
public BugInstance addSourceForTopStackValue(ClassContext classContext, org.apache.bcel.classfile.Method method, Location location)
@CheckForNull public static BugAnnotation getSourceForTopStackValue(ClassContext classContext, org.apache.bcel.classfile.Method method, Location location)
@CheckForNull public static BugAnnotation getSourceForStackValue(ClassContext classContext, org.apache.bcel.classfile.Method method, Location location, int depth)
@CheckForNull public static BugAnnotation getSomeSource(ClassContext classContext, org.apache.bcel.classfile.Method method, Location location, OpcodeStack stack, int stackPos)
@CheckForNull public static BugAnnotation getValueSource(OpcodeStack.Item item, org.apache.bcel.classfile.Method method, int pc)
public BugInstance addValueSource(@CheckForNull OpcodeStack.Item item, DismantleBytecode dbc)
public BugInstance addValueSource(OpcodeStack.Item item, org.apache.bcel.classfile.Method method, int pc)
public BugInstance addFieldOrMethodValueSource(OpcodeStack.Item item)
public BugInstance addOptionalUniqueAnnotations(BugAnnotation... annotations)
public boolean tryAddingOptionalUniqueAnnotations(BugAnnotation... annotations)
public BugInstance addOptionalUniqueAnnotationsWithFallback(BugAnnotation fallback, BugAnnotation... annotations)
@CheckForNull public static BugAnnotation getFieldOrMethodValueSource(@CheckForNull OpcodeStack.Item item)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int compareTo(BugInstance other)
compareTo
in interface java.lang.Comparable<BugInstance>
public void setFirstVersion(long firstVersion)
public void clearHistory()
public long getFirstVersion()
public void setHistory(BugInstance from)
public void setLastVersion(long lastVersion)
public void setLive()
public long getLastVersion()
public boolean isDead()
public void setIntroducedByChangeOfExistingClass(boolean introducedByChangeOfExistingClass)
public boolean isIntroducedByChangeOfExistingClass()
public void setRemovedByChangeOfPersistingClass(boolean removedByChangeOfPersistingClass)
public boolean isRemovedByChangeOfPersistingClass()
public void setInstanceHash(java.lang.String instanceHash)
public void setOldInstanceHash(java.lang.String oldInstanceHash)
public java.lang.String getInstanceHash()
public boolean isInstanceHashConsistent()
public void setInstanceOccurrenceNum(int instanceOccurrenceNum)
public int getInstanceOccurrenceNum()
public void setInstanceOccurrenceMax(int instanceOccurrenceMax)
public int getInstanceOccurrenceMax()
@CheckForNull public DetectorFactory getDetectorFactory()
public java.util.List<BugAnnotation> getAnnotationsForMessage(boolean showContext)
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.