Package edu.umd.cs.findbugs
Class LocalVariableAnnotation
java.lang.Object
edu.umd.cs.findbugs.LocalVariableAnnotation
- All Implemented Interfaces:
BugAnnotation
,XMLWriteable
,XMLWriteableWithMessages
,Serializable
,Cloneable
,Comparable<BugAnnotation>
Bug annotation class for local variable names
- Author:
- William Pugh
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Default value for the "unknown" local variable namestatic final String
static final String
static final String
static final String
Fields inherited from interface edu.umd.cs.findbugs.BugAnnotation
MESSAGE_TAG
-
Constructor Summary
ConstructorsConstructorDescriptionLocalVariableAnnotation
(String name, int register, int pc) Constructor.LocalVariableAnnotation
(String name, int register, int pc, int line) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(BugAnnotationVisitor visitor) Accept a BugAnnotationVisitor.clone()
int
boolean
static LocalVariableAnnotation
findMatchingIgnoredParameter
(ClassContext classContext, org.apache.bcel.classfile.Method method, String name, String signature) static LocalVariableAnnotation
findUniqueBestMatchingParameter
(ClassContext classContext, org.apache.bcel.classfile.Method method, String name, String signature) format
(String key, ClassAnnotation primaryClass) Format the annotation as a String.Get a description of this bug annotation.static LocalVariableAnnotation
getLocalVariableAnnotation
(DismantleBytecode visitor, OpcodeStack.Item item) static LocalVariableAnnotation
getLocalVariableAnnotation
(org.apache.bcel.classfile.Method method, int local, int position1, int position2) static LocalVariableAnnotation
getLocalVariableAnnotation
(org.apache.bcel.classfile.Method method, Location location, org.apache.bcel.generic.IndexedInstruction ins) static LocalVariableAnnotation
getLocalVariableAnnotation
(org.apache.bcel.classfile.Method method, OpcodeStack.Item item, int pc) getName()
static LocalVariableAnnotation
getParameterLocalVariableAnnotation
(org.apache.bcel.classfile.Method method, int local) Get a local variable annotation describing a parameter.int
getPC()
int
int
hashCode()
boolean
isNamed()
boolean
Is this annotation used to compute instance hashes or match bug instances across versionsvoid
setDescription
(String description) Set a description of this bug annotation.toString()
toString
(ClassAnnotation primaryClass) void
Write this object to given XMLOutput.void
-
Field Details
-
UNKNOWN_NAME
Default value for the "unknown" local variable name- See Also:
-
DEFAULT_ROLE
- See Also:
-
NAMED_ROLE
- See Also:
-
UNKNOWN_ROLE
- See Also:
-
PARAMETER_ROLE
- See Also:
-
PARAMETER_NAMED_ROLE
- See Also:
-
PARAMETER_VALUE_SOURCE_ROLE
- See Also:
-
PARAMETER_VALUE_SOURCE_NAMED_ROLE
- See Also:
-
VALUE_DOOMED_ROLE
- See Also:
-
VALUE_DOOMED_NAMED_ROLE
- See Also:
-
DID_YOU_MEAN_ROLE
- See Also:
-
INVOKED_ON_ROLE
- See Also:
-
ARGUMENT_ROLE
- See Also:
-
VALUE_OF_ROLE
- See Also:
-
-
Constructor Details
-
LocalVariableAnnotation
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
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 Details
-
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
- Specified by:
clone
in interfaceBugAnnotation
- Overrides:
clone
in classObject
-
accept
Description copied from interface:BugAnnotation
Accept a BugAnnotationVisitor.- Specified by:
accept
in interfaceBugAnnotation
- Parameters:
visitor
- the visitor to accept
-
format
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.- Specified by:
format
in 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
Description copied from interface:BugAnnotation
Set a description of this bug annotation. The description is a key for the FindBugsAnnotationDescriptions resource bundle.- Specified by:
setDescription
in interfaceBugAnnotation
-
getDescription
Description copied from interface:BugAnnotation
Get a description of this bug annotation. The description is a key for the FindBugsAnnotationDescriptions resource bundle.- Specified by:
getDescription
in interfaceBugAnnotation
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<BugAnnotation>
-
toString
-
writeXML
Description copied from interface:XMLWriteable
Write this object to given XMLOutput.- Specified by:
writeXML
in interfaceXMLWriteable
- Parameters:
xmlOutput
- the XMLOutput for the document- Throws:
IOException
-
writeXML
public void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary) throws IOException - Specified by:
writeXML
in interfaceXMLWriteableWithMessages
- Throws:
IOException
-
isNamed
public boolean isNamed() -
getName
- Returns:
- name of local variable
-
getPC
public int getPC() -
getRegister
public int getRegister() -
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
- 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, String name, String signature) -
findUniqueBestMatchingParameter
@CheckForNull public static LocalVariableAnnotation findUniqueBestMatchingParameter(ClassContext classContext, org.apache.bcel.classfile.Method method, String name, String signature) -
toString
- Specified by:
toString
in interfaceBugAnnotation
-