edu.umd.cs.findbugs.ba

Class MethodHash

public class MethodHash extends Object implements 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
static StringMETHOD_HASH_ELEMENT_NAME
Constructor Summary
MethodHash()
Constructor. computeHash(Method) must be used to initialize the contents.
MethodHash(String methodName, String methodSig, boolean isStatic, byte[] hash)
Constructor.
Method Summary
static intcompareHashes(byte[] a, byte[] b)
intcompareTo(MethodHash other)
MethodHashcomputeHash(Method method)
Compute hash on given method.
byte[]getMethodHash()
Get the computed method hash.
StringgetMethodName()
StringgetMethodSig()
booleanisSameHash(MethodHash other)
Return whether or not this method hash has the same value as the one given.
booleanisStatic()

Field Detail

METHOD_HASH_ELEMENT_NAME

public static final String METHOD_HASH_ELEMENT_NAME

Constructor Detail

MethodHash

public MethodHash()
Constructor. computeHash(Method) must be used to initialize the contents.

MethodHash

public MethodHash(String methodName, String methodSig, boolean isStatic, byte[] hash)
Constructor.

Parameters: methodName method name methodSig method signature isStatic true if the method is static, false if not hash the pre-computed hash

Method Detail

compareHashes

public static int compareHashes(byte[] a, byte[] b)

compareTo

public int compareTo(MethodHash other)

computeHash

public MethodHash computeHash(Method method)
Compute hash on given method.

Parameters: method the method

Returns: this object

getMethodHash

public byte[] getMethodHash()
Get the computed method hash.

Returns: the method hash

getMethodName

public String getMethodName()

Returns: Returns the method name.

getMethodSig

public String getMethodSig()

Returns: Returns the method signature.

isSameHash

public boolean isSameHash(MethodHash other)
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

isStatic

public boolean isStatic()

Returns: Returns whether the method is static.

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.