Class ClassFeatureSet
java.lang.Object
edu.umd.cs.findbugs.model.ClassFeatureSet
- All Implemented Interfaces:
XMLWriteable
Features of a class which may be used to identify it if it is renamed or
modified.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprivate Stringstatic final Stringstatic final Stringstatic final doubleSimilarity of classes which don't have enough features to match exactly, but whose class names match exactly.static final Stringstatic final Stringprivate booleanstatic final Stringstatic final intMinimum code length required to add a CodeLength feature.static final intMinimum number of features which must be present in order to declare two classes similar.static final doubleMinimum similarity required to declare two classes similar. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFeature(String feature) intbooleanhasFeature(String feature) initialize(org.apache.bcel.classfile.JavaClass javaClass) Initialize from given JavaClass.booleanprivate booleanisSynthetic(org.apache.bcel.classfile.FieldOrMethod member) Figure out if a class member (field or method) is synthetic.static booleanReturn true if classes in the given package is unlikely to be renamed: e.g., because they are part of a public API.static voidprivate booleanoverridesSuperclassMethod(org.apache.bcel.classfile.JavaClass javaClass, org.apache.bcel.classfile.Method method) Determine if given method overrides a superclass or superinterface method.voidsetClassName(String className) voidsetInterface(boolean isInterface) static doublebooleansimilarTo(ClassFeatureSet other) static StringtransformClassName(String className) Transform a class name by stripping its package name.static StringtransformMethodSignature(String signature) Transform a method signature to allow it to be compared even if any of its parameter types are moved to another package.static StringtransformSignature(String signature) Transform a field or method parameter signature to allow it to be compared even if it is moved to another package.voidWrite this object to given XMLOutput.
-
Field Details
-
CLASS_NAME_KEY
- See Also:
-
METHOD_NAME_KEY
- See Also:
-
CODE_LENGTH_KEY
- See Also:
-
FIELD_NAME_KEY
- See Also:
-
className
-
isInterface
private boolean isInterface -
featureSet
-
MIN_CODE_LENGTH
public static final int MIN_CODE_LENGTHMinimum code length required to add a CodeLength feature.- See Also:
-
MIN_FEATURES
public static final int MIN_FEATURESMinimum number of features which must be present in order to declare two classes similar.- See Also:
-
MIN_MATCH
public static final double MIN_MATCHMinimum similarity required to declare two classes similar.- See Also:
-
EXACT_CLASS_NAME_MATCH
public static final double EXACT_CLASS_NAME_MATCHSimilarity of classes which don't have enough features to match exactly, but whose class names match exactly.- See Also:
-
ELEMENT_NAME
- See Also:
-
FEATURE_ELEMENT_NAME
- See Also:
-
-
Constructor Details
-
ClassFeatureSet
public ClassFeatureSet()Constructor. Creates an empty feature set.
-
-
Method Details
-
initialize
Initialize from given JavaClass.- Parameters:
javaClass- the JavaClass- Returns:
- this object
-
overridesSuperclassMethod
private boolean overridesSuperclassMethod(org.apache.bcel.classfile.JavaClass javaClass, org.apache.bcel.classfile.Method method) Determine if given method overrides a superclass or superinterface method.- Parameters:
javaClass- class defining the methodmethod- the method- Returns:
- true if the method overrides a superclass/superinterface method, false if not
-
isSynthetic
private boolean isSynthetic(org.apache.bcel.classfile.FieldOrMethod member) Figure out if a class member (field or method) is synthetic.- Parameters:
member- a field or method- Returns:
- true if the member is synthetic
-
getClassName
- Returns:
- Returns the className.
-
setClassName
- Parameters:
className- The className to set.
-
isInterface
public boolean isInterface()- Returns:
- Returns the isInterface.
-
setInterface
public void setInterface(boolean isInterface) - Parameters:
isInterface- The isInterface to set.
-
getNumFeatures
public int getNumFeatures() -
addFeature
-
featureIterator
-
hasFeature
-
transformClassName
-
isUnlikelyToBeRenamed
Return true if classes in the given package is unlikely to be renamed: e.g., because they are part of a public API.- Parameters:
pkg- the package name- Returns:
- true if classes in the package is unlikely to be renamed
-
transformMethodSignature
-
transformSignature
-
similarity
-
similarTo
-
main
-
writeXML
Description copied from interface:XMLWriteableWrite this object to given XMLOutput.- Specified by:
writeXMLin interfaceXMLWriteable- Parameters:
xmlOutput- the XMLOutput for the document- Throws:
IOException
-