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 Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields 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 TypeMethodDescriptionvoidaccept(BugAnnotationVisitor visitor) Accept a BugAnnotationVisitor.clone()intbooleanstatic LocalVariableAnnotationfindMatchingIgnoredParameter(ClassContext classContext, org.apache.bcel.classfile.Method method, String name, String signature) static LocalVariableAnnotationfindUniqueBestMatchingParameter(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 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) getName()static LocalVariableAnnotationgetParameterLocalVariableAnnotation(org.apache.bcel.classfile.Method method, int local) Get a local variable annotation describing a parameter.intgetPC()intinthashCode()booleanisNamed()booleanIs this annotation used to compute instance hashes or match bug instances across versionsvoidsetDescription(String description) Set a description of this bug annotation.toString()toString(ClassAnnotation primaryClass) voidWrite this object to given XMLOutput.void
-
Field Details
-
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:
clonein interfaceBugAnnotation- Overrides:
clonein classObject
-
accept
Description copied from interface:BugAnnotationAccept a BugAnnotationVisitor.- Specified by:
acceptin interfaceBugAnnotation- Parameters:
visitor- the visitor to accept
-
format
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
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
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() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<BugAnnotation>
-
toString
-
writeXML
Description copied from interface:XMLWriteableWrite this object to given XMLOutput.- Specified by:
writeXMLin interfaceXMLWriteable- Parameters:
xmlOutput- the XMLOutput for the document- Throws:
IOException
-
writeXML
public void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary) throws IOException - Specified by:
writeXMLin 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: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, 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:
toStringin interfaceBugAnnotation
-