public class MethodAnnotation extends PackageMemberAnnotation
BugAnnotation
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ROLE |
static String |
METHOD_ALTERNATIVE_TARGET |
static String |
METHOD_CALLED |
static String |
METHOD_COMPUTED_IN |
static String |
METHOD_CONSTRUCTOR |
static String |
METHOD_DANGEROUS_TARGET |
static String |
METHOD_DANGEROUS_TARGET_ACTUAL_GUARANTEED_NULL |
static String |
METHOD_DID_YOU_MEAN_TO_OVERRIDE |
static String |
METHOD_EQUALS_USED |
static String |
METHOD_OVERRIDDEN |
static String |
METHOD_RETURN_VALUE_OF |
static String |
METHOD_SAFE_TARGET |
static String |
METHOD_SUPERCLASS_CONSTRUCTOR |
static String |
SHOULD_CALL |
className, description
sourceFileName, sourceLines
MESSAGE_TAG
Constructor and Description |
---|
MethodAnnotation(String className,
String methodName,
String methodSig,
boolean isStatic)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(BugAnnotationVisitor visitor)
Accept a BugAnnotationVisitor.
|
int |
compareTo(BugAnnotation o) |
boolean |
equals(Object o) |
protected String |
formatPackageMember(String key,
ClassAnnotation primaryClass)
Do default and subclass-specific formatting.
|
static MethodAnnotation |
fromCalledMethod(DismantleBytecode visitor)
Factory method to create a MethodAnnotation from a method called by the
instruction the given visitor is currently visiting.
|
static MethodAnnotation |
fromCalledMethod(String className,
String methodName,
String methodSig,
boolean isStatic)
Create a MethodAnnotation from a method that is not directly accessible.
|
static MethodAnnotation |
fromForeignMethod(String className,
String methodName,
String methodSig,
boolean isStatic)
Factory method to create the MethodAnnotation from the classname, method
name, signature, etc.
|
static MethodAnnotation |
fromForeignMethod(String className,
String methodName,
String methodSig,
int accessFlags)
Factory method to create the MethodAnnotation from the classname, method
name, signature, etc.
|
static MethodAnnotation |
fromMethodDescriptor(MethodDescriptor methodDescriptor)
Create a MethodAnnotation from a MethodDescriptor.
|
static MethodAnnotation |
fromVisitedMethod(PreorderVisitor visitor)
Factory method to create a MethodAnnotation from the method the given
visitor is currently visiting.
|
static MethodAnnotation |
fromXMethod(XMethod xmethod)
Create a MethodAnnotation from an XMethod.
|
String |
getFullMethod(ClassAnnotation primaryClass)
Get the "full" method name.
|
String |
getJavaSourceMethodName() |
String |
getMethodName()
Get the method name.
|
String |
getMethodSignature()
Get the method type signature.
|
String |
getNameInClass(boolean shortenPackages,
boolean useJVMMethodName,
boolean hash) |
String |
getNameInClass(boolean shortenPackages,
boolean useJVMMethodName,
boolean hash,
boolean omitMethodName)
Get the "full" method name.
|
String |
getNameInClass(ClassAnnotation primaryClass)
Get the "full" method name.
|
String |
getSignatureInClass(ClassAnnotation primaryClass) |
int |
hashCode() |
boolean |
isSignificant()
Is this annotation used to compute instance hashes or match bug instances
across versions
|
boolean |
isStatic()
Return whether or not the method is static.
|
String |
stripJavaLang(String className) |
MethodDescriptor |
toMethodDescriptor() |
XMethod |
toXMethod()
Convert to an XMethod.
|
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, removePackage, removePackageName, setDescription, shorten, toString, toString
clone, getSourceFileName, getSourceLines, setSourceLines
public static final String DEFAULT_ROLE
public static final String METHOD_DANGEROUS_TARGET_ACTUAL_GUARANTEED_NULL
public static final String METHOD_DANGEROUS_TARGET
public static final String METHOD_RETURN_VALUE_OF
public static final String METHOD_SAFE_TARGET
public static final String METHOD_EQUALS_USED
public static final String METHOD_CALLED
public static final String METHOD_SUPERCLASS_CONSTRUCTOR
public static final String METHOD_CONSTRUCTOR
public static final String METHOD_OVERRIDDEN
public static final String METHOD_DID_YOU_MEAN_TO_OVERRIDE
public static final String METHOD_COMPUTED_IN
public static final String METHOD_ALTERNATIVE_TARGET
public static final String SHOULD_CALL
public MethodAnnotation(@DottedClassName String className, String methodName, String methodSig, boolean isStatic)
className
- the name of the class containing the methodmethodName
- the name of the methodmethodSig
- the Java type signature of the methodisStatic
- true if the method is static, false if notpublic static MethodAnnotation fromVisitedMethod(PreorderVisitor visitor)
visitor
- the BetterVisitor currently visiting the methodpublic static MethodAnnotation fromCalledMethod(DismantleBytecode visitor)
visitor
- the visitorpublic static MethodAnnotation fromForeignMethod(@SlashedClassName String className, String methodName, String methodSig, int accessFlags)
className
- name of the class containing the methodmethodName
- name of the methodmethodSig
- signature of the methodaccessFlags
- the access flags of the methodpublic static MethodAnnotation fromForeignMethod(String className, String methodName, String methodSig, boolean isStatic)
className
- name of the class containing the methodmethodName
- name of the methodmethodSig
- signature of the methodisStatic
- true if the method is static, false otherwisepublic static MethodAnnotation fromCalledMethod(String className, String methodName, String methodSig, boolean isStatic)
className
- class containing called methodmethodName
- name of called methodmethodSig
- signature of called methodisStatic
- true if called method is staticpublic static MethodAnnotation fromXMethod(XMethod xmethod)
xmethod
- the XMethodpublic static MethodAnnotation fromMethodDescriptor(MethodDescriptor methodDescriptor)
methodDescriptor
- the MethodDescriptorpublic String getMethodName()
public String getJavaSourceMethodName()
public String getMethodSignature()
public boolean isStatic()
public XMethod toXMethod()
public MethodDescriptor toMethodDescriptor()
public void accept(BugAnnotationVisitor visitor)
BugAnnotation
visitor
- the visitor to acceptprotected String formatPackageMember(String key, ClassAnnotation primaryClass)
PackageMemberAnnotation
formatPackageMember
in class PackageMemberAnnotation
key
- the key specifying how to do the formattingprimaryClass
- TODOpublic String getNameInClass(ClassAnnotation primaryClass)
public String getSignatureInClass(ClassAnnotation primaryClass)
public String getNameInClass(boolean shortenPackages, boolean useJVMMethodName, boolean hash)
public String getNameInClass(boolean shortenPackages, boolean useJVMMethodName, boolean hash, boolean omitMethodName)
shortenPackages
- whether to shorten package names if they are in java or in the
same package as this method.public String getFullMethod(ClassAnnotation primaryClass)
public String stripJavaLang(@DottedClassName String className)
public int compareTo(BugAnnotation o)
public void writeXML(XMLOutput xmlOutput) throws IOException
XMLWriteable
xmlOutput
- the XMLOutput for the documentIOException
public void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary) throws IOException
IOException
public boolean isSignificant()
BugAnnotation
isSignificant
in interface BugAnnotation
isSignificant
in class PackageMemberAnnotation
Copyright © 2003–2015. All rights reserved.