public class FieldAnnotation extends PackageMemberAnnotation
BugAnnotation
,
Serialized FormModifier and Type | Field and Description |
---|---|
static java.lang.String |
ARGUMENT_ROLE |
static java.lang.String |
DEFAULT_ROLE |
static java.lang.String |
DID_YOU_MEAN_ROLE |
static java.lang.String |
INVOKED_ON_ROLE |
static java.lang.String |
LOADED_FROM_ROLE |
static java.lang.String |
STORED_ROLE |
static java.lang.String |
VALUE_OF_ROLE |
className, description
sourceFileName, sourceLines
MESSAGE_TAG
Constructor and Description |
---|
FieldAnnotation(java.lang.String className,
java.lang.String fieldName,
java.lang.String fieldSig,
boolean isStatic)
Constructor.
|
FieldAnnotation(java.lang.String className,
java.lang.String fieldName,
java.lang.String fieldSig,
int accessFlags)
Constructor.
|
FieldAnnotation(java.lang.String className,
java.lang.String fieldName,
java.lang.String fieldSig,
java.lang.String fieldSourceSig,
boolean isStatic) |
Modifier and Type | Method and Description |
---|---|
void |
accept(BugAnnotationVisitor visitor)
Accept a BugAnnotationVisitor.
|
int |
compareTo(BugAnnotation o) |
boolean |
equals(java.lang.Object o) |
protected java.lang.String |
formatPackageMember(java.lang.String key,
ClassAnnotation primaryClass)
Do default and subclass-specific formatting.
|
static FieldAnnotation |
fromBCELField(org.apache.bcel.classfile.JavaClass jClass,
org.apache.bcel.classfile.Field field)
Factory method.
|
static FieldAnnotation |
fromBCELField(java.lang.String className,
org.apache.bcel.classfile.Field field)
Factory method.
|
static FieldAnnotation |
fromFieldDescriptor(FieldDescriptor fieldDescriptor)
Factory method.
|
static FieldAnnotation |
fromReferencedField(DismantleBytecode visitor)
Factory method.
|
static FieldAnnotation |
fromVisitedField(PreorderVisitor visitor)
Factory method.
|
static FieldAnnotation |
fromXField(XField fieldDescriptor) |
java.lang.String |
getFieldName()
Get the field name.
|
java.lang.String |
getFieldSignature()
Get the type signature of the field.
|
SourceLineAnnotation |
getSourceLines()
Get the SourceLineAnnotation describing the source lines where the method
is defined.
|
int |
hashCode() |
static FieldAnnotation |
isRead(org.apache.bcel.generic.Instruction ins,
org.apache.bcel.generic.ConstantPoolGen cpg)
Is the given instruction a read of a field?
|
boolean |
isStatic()
Return whether or not the field is static.
|
static FieldAnnotation |
isWrite(org.apache.bcel.generic.Instruction ins,
org.apache.bcel.generic.ConstantPoolGen cpg)
Is the instruction a write of a field?
|
FieldDescriptor |
toFieldDescriptor() |
XField |
toXField() |
void |
writeXML(XMLOutput xmlOutput)
Write this object to given XMLOutput.
|
void |
writeXML(XMLOutput xmlOutput,
boolean addMessages,
boolean isPrimary) |
format, getClassDescriptor, getClassName, getDescription, getPackageName, getSimpleClassName, getSlashedClassName, isSignificant, removePackage, removePackageName, setDescription, shorten, toString, toString
clone, getSourceFileName, setSourceLines
public static final java.lang.String DEFAULT_ROLE
public static final java.lang.String DID_YOU_MEAN_ROLE
public static final java.lang.String VALUE_OF_ROLE
public static final java.lang.String LOADED_FROM_ROLE
public static final java.lang.String STORED_ROLE
public static final java.lang.String INVOKED_ON_ROLE
public static final java.lang.String ARGUMENT_ROLE
public FieldAnnotation(@DottedClassName java.lang.String className, java.lang.String fieldName, java.lang.String fieldSig, boolean isStatic)
className
- the name of the class containing the fieldfieldName
- the name of the fieldfieldSig
- the type signature of the fieldpublic FieldAnnotation(@DottedClassName java.lang.String className, java.lang.String fieldName, java.lang.String fieldSig, java.lang.String fieldSourceSig, boolean isStatic)
public FieldAnnotation(@DottedClassName java.lang.String className, java.lang.String fieldName, java.lang.String fieldSig, int accessFlags)
className
- the name of the class containing the fieldfieldName
- the name of the fieldfieldSig
- the type signature of the fieldaccessFlags
- accessFlags for the fieldpublic static FieldAnnotation fromVisitedField(PreorderVisitor visitor)
visitor
- the visitor which is visiting the fieldpublic static FieldAnnotation fromReferencedField(DismantleBytecode visitor)
visitor
- the visitor which is visiting the field referencepublic static FieldAnnotation fromBCELField(@DottedClassName java.lang.String className, org.apache.bcel.classfile.Field field)
className
- the name of the class which defines the fieldfield
- the BCEL Field objectpublic static FieldAnnotation fromBCELField(org.apache.bcel.classfile.JavaClass jClass, org.apache.bcel.classfile.Field field)
jClass
- the class which defines the fieldfield
- the BCEL Field objectpublic static FieldAnnotation fromFieldDescriptor(FieldDescriptor fieldDescriptor)
fieldDescriptor
- the FieldDescriptorpublic static FieldAnnotation fromXField(XField fieldDescriptor)
public XField toXField()
public FieldDescriptor toFieldDescriptor()
public java.lang.String getFieldName()
public java.lang.String getFieldSignature()
public boolean isStatic()
public static FieldAnnotation isRead(org.apache.bcel.generic.Instruction ins, org.apache.bcel.generic.ConstantPoolGen cpg)
ins
- the Instruction to checkcpg
- ConstantPoolGen of the method containing the instructionpublic static FieldAnnotation isWrite(org.apache.bcel.generic.Instruction ins, org.apache.bcel.generic.ConstantPoolGen cpg)
ins
- the Instruction to checkcpg
- ConstantPoolGen of the method containing the instructionpublic void accept(BugAnnotationVisitor visitor)
BugAnnotation
visitor
- the visitor to acceptprotected java.lang.String formatPackageMember(java.lang.String key, ClassAnnotation primaryClass)
PackageMemberAnnotation
formatPackageMember
in class PackageMemberAnnotation
key
- the key specifying how to do the formattingprimaryClass
- TODOpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int compareTo(BugAnnotation o)
public SourceLineAnnotation getSourceLines()
BugAnnotationWithSourceLines
getSourceLines
in class BugAnnotationWithSourceLines
public void writeXML(XMLOutput xmlOutput) throws java.io.IOException
XMLWriteable
xmlOutput
- the XMLOutput for the documentjava.io.IOException
public void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary) throws java.io.IOException
java.io.IOException
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.