Package edu.umd.cs.findbugs
Class LocalVariableAnnotation
- java.lang.Object
-
- edu.umd.cs.findbugs.LocalVariableAnnotation
-
- All Implemented Interfaces:
BugAnnotation,XMLWriteable,XMLWriteableWithMessages,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable<BugAnnotation>
public class LocalVariableAnnotation extends java.lang.Object implements BugAnnotation
Bug annotation class for local variable names- Author:
- William Pugh
- See Also:
BugAnnotation, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringARGUMENT_ROLEstatic java.lang.StringDEFAULT_ROLEstatic java.lang.StringDID_YOU_MEAN_ROLEstatic java.lang.StringINVOKED_ON_ROLEstatic java.lang.StringNAMED_ROLEstatic java.lang.StringPARAMETER_NAMED_ROLEstatic java.lang.StringPARAMETER_ROLEstatic java.lang.StringPARAMETER_VALUE_SOURCE_NAMED_ROLEstatic java.lang.StringPARAMETER_VALUE_SOURCE_ROLEstatic java.lang.StringUNKNOWN_ROLEstatic java.lang.StringVALUE_DOOMED_NAMED_ROLEstatic java.lang.StringVALUE_DOOMED_ROLEstatic java.lang.StringVALUE_OF_ROLE-
Fields inherited from interface edu.umd.cs.findbugs.BugAnnotation
MESSAGE_TAG
-
-
Constructor Summary
Constructors Constructor Description LocalVariableAnnotation(java.lang.String name, int register, int pc)Constructor.LocalVariableAnnotation(java.lang.String name, int register, int pc, int line)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(BugAnnotationVisitor visitor)Accept a BugAnnotationVisitor.java.lang.Objectclone()intcompareTo(BugAnnotation o)booleanequals(java.lang.Object o)static LocalVariableAnnotationfindMatchingIgnoredParameter(ClassContext classContext, org.apache.bcel.classfile.Method method, java.lang.String name, java.lang.String signature)static LocalVariableAnnotationfindUniqueBestMatchingParameter(ClassContext classContext, org.apache.bcel.classfile.Method method, java.lang.String name, java.lang.String signature)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.static LocalVariableAnnotationgetLocalVariableAnnotation(DismantleBytecode visitor, OpcodeStack.Item item)static LocalVariableAnnotationgetLocalVariableAnnotation(org.apache.bcel.classfile.Method method, int local, int position1, int position2)static LocalVariableAnnotationgetLocalVariableAnnotation(org.apache.bcel.classfile.Method method, Location location, org.apache.bcel.generic.IndexedInstruction ins)static LocalVariableAnnotationgetLocalVariableAnnotation(org.apache.bcel.classfile.Method method, OpcodeStack.Item item, int pc)java.lang.StringgetName()static LocalVariableAnnotationgetParameterLocalVariableAnnotation(org.apache.bcel.classfile.Method method, int local)Get a local variable annotation describing a parameter.intgetPC()intgetRegister()inthashCode()booleanisNamed()booleanisSignificant()Is this annotation used to compute instance hashes or match bug instances across versionsvoidsetDescription(java.lang.String description)Set a description of this bug annotation.java.lang.StringtoString()java.lang.StringtoString(ClassAnnotation primaryClass)voidwriteXML(XMLOutput xmlOutput)Write this object to given XMLOutput.voidwriteXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary)
-
-
-
Field Detail
-
DEFAULT_ROLE
public static final java.lang.String DEFAULT_ROLE
- See Also:
- Constant Field Values
-
NAMED_ROLE
public static final java.lang.String NAMED_ROLE
- See Also:
- Constant Field Values
-
UNKNOWN_ROLE
public static final java.lang.String UNKNOWN_ROLE
- See Also:
- Constant Field Values
-
PARAMETER_ROLE
public static final java.lang.String PARAMETER_ROLE
- See Also:
- Constant Field Values
-
PARAMETER_NAMED_ROLE
public static final java.lang.String PARAMETER_NAMED_ROLE
- See Also:
- Constant Field Values
-
PARAMETER_VALUE_SOURCE_ROLE
public static final java.lang.String PARAMETER_VALUE_SOURCE_ROLE
- See Also:
- Constant Field Values
-
PARAMETER_VALUE_SOURCE_NAMED_ROLE
public static final java.lang.String PARAMETER_VALUE_SOURCE_NAMED_ROLE
- See Also:
- Constant Field Values
-
VALUE_DOOMED_ROLE
public static final java.lang.String VALUE_DOOMED_ROLE
- See Also:
- Constant Field Values
-
VALUE_DOOMED_NAMED_ROLE
public static final java.lang.String VALUE_DOOMED_NAMED_ROLE
- See Also:
- Constant Field Values
-
DID_YOU_MEAN_ROLE
public static final java.lang.String DID_YOU_MEAN_ROLE
- See Also:
- Constant Field Values
-
INVOKED_ON_ROLE
public static final java.lang.String INVOKED_ON_ROLE
- See Also:
- Constant Field Values
-
ARGUMENT_ROLE
public static final java.lang.String ARGUMENT_ROLE
- See Also:
- Constant Field Values
-
VALUE_OF_ROLE
public static final java.lang.String VALUE_OF_ROLE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LocalVariableAnnotation
public LocalVariableAnnotation(java.lang.String name, int register, int pc)Constructor.- Parameters:
name- the name of the local variableregister- the local variable indexpc- the bytecode offset of the instruction that mentions this local variable
-
LocalVariableAnnotation
public LocalVariableAnnotation(java.lang.String name, int register, int pc, int line)Constructor.- Parameters:
name- the name of the local variableregister- the local variable indexpc- the bytecode offset of the instruction that mentions this local variable
-
-
Method Detail
-
getLocalVariableAnnotation
public static LocalVariableAnnotation getLocalVariableAnnotation(org.apache.bcel.classfile.Method method, Location location, org.apache.bcel.generic.IndexedInstruction ins)
-
getLocalVariableAnnotation
public static LocalVariableAnnotation getLocalVariableAnnotation(org.apache.bcel.classfile.Method method, int local, int position1, int position2)
-
getParameterLocalVariableAnnotation
public static LocalVariableAnnotation getParameterLocalVariableAnnotation(org.apache.bcel.classfile.Method method, int local)
Get a local variable annotation describing a parameter.- Parameters:
method- a Methodlocal- the local variable containing the parameter- Returns:
- LocalVariableAnnotation describing the parameter
-
clone
public java.lang.Object clone()
- Specified by:
clonein interfaceBugAnnotation- Overrides:
clonein classjava.lang.Object
-
accept
public void accept(BugAnnotationVisitor visitor)
Description copied from interface:BugAnnotationAccept a BugAnnotationVisitor.- Specified by:
acceptin interfaceBugAnnotation- 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.- Specified by:
formatin interfaceBugAnnotation- 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 description)
Description copied from interface:BugAnnotationSet a description of this bug annotation. The description is a key for the FindBugsAnnotationDescriptions resource bundle.- Specified by:
setDescriptionin interfaceBugAnnotation
-
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.- Specified by:
getDescriptionin interfaceBugAnnotation
-
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)
- Specified by:
compareToin interfacejava.lang.Comparable<BugAnnotation>
-
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.- Specified by:
writeXMLin interfaceXMLWriteable- 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
- Specified by:
writeXMLin interfaceXMLWriteableWithMessages- Throws:
java.io.IOException
-
isNamed
public boolean isNamed()
-
getName
public java.lang.String getName()
- Returns:
- name of local variable
-
getPC
public int getPC()
-
getRegister
public int getRegister()
-
isSignificant
public boolean isSignificant()
Description copied from interface:BugAnnotationIs this annotation used to compute instance hashes or match bug instances across versions- Specified by:
isSignificantin interfaceBugAnnotation- Returns:
- true if significant
-
getLocalVariableAnnotation
@CheckForNull public static LocalVariableAnnotation getLocalVariableAnnotation(org.apache.bcel.classfile.Method method, OpcodeStack.Item item, int pc)
-
getLocalVariableAnnotation
@CheckForNull public static LocalVariableAnnotation getLocalVariableAnnotation(DismantleBytecode visitor, OpcodeStack.Item item)
-
findMatchingIgnoredParameter
@CheckForNull public static LocalVariableAnnotation findMatchingIgnoredParameter(ClassContext classContext, org.apache.bcel.classfile.Method method, java.lang.String name, java.lang.String signature)
-
findUniqueBestMatchingParameter
@CheckForNull public static LocalVariableAnnotation findUniqueBestMatchingParameter(ClassContext classContext, org.apache.bcel.classfile.Method method, java.lang.String name, java.lang.String signature)
-
toString
public java.lang.String toString(ClassAnnotation primaryClass)
- Specified by:
toStringin interfaceBugAnnotation
-
-