Package edu.umd.cs.findbugs.ba
Class MethodHash
java.lang.Object
edu.umd.cs.findbugs.ba.MethodHash
- All Implemented Interfaces:
Comparable<MethodHash>
Compute a hash of the bytecode for given method. This can find methods which
have not been changed other than accessing different constant pool entries.
- Author:
- David Hovemeyer
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructor.MethodHash
(String methodName, String methodSig, boolean isStatic, byte[] hash) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic int
compareHashes
(byte[] a, byte[] b) int
compareTo
(MethodHash other) computeHash
(org.apache.bcel.classfile.Method method) Compute hash on given method.boolean
byte[]
Get the computed method hash.int
hashCode()
boolean
isSameHash
(MethodHash other) Return whether or not this method hash has the same value as the one given.boolean
isStatic()
-
Field Details
-
METHOD_HASH_ELEMENT_NAME
- See Also:
-
-
Constructor Details
-
MethodHash
public MethodHash()Constructor. computeHash(Method) must be used to initialize the contents. -
MethodHash
Constructor.- Parameters:
methodName
- method namemethodSig
- method signatureisStatic
- true if the method is static, false if nothash
- the pre-computed hash
-
-
Method Details
-
getMethodName
- Returns:
- Returns the method name.
-
getMethodSig
- Returns:
- Returns the method signature.
-
isStatic
public boolean isStatic()- Returns:
- Returns whether the method is static.
-
getMethodHash
public byte[] getMethodHash()Get the computed method hash.- Returns:
- the method hash
-
computeHash
Compute hash on given method.- Parameters:
method
- the method- Returns:
- this object
-
isSameHash
Return whether or not this method hash has the same value as the one given.- Parameters:
other
- another MethodHash- Returns:
- true if the hash values are the same, false if not
-
compareTo
- Specified by:
compareTo
in interfaceComparable<MethodHash>
-
equals
-
hashCode
public int hashCode() -
compareHashes
public static int compareHashes(byte[] a, byte[] b)
-