FindBugs™ 1.3.9

edu.umd.cs.findbugs.ba
Class MethodHash

java.lang.Object
  extended by edu.umd.cs.findbugs.ba.MethodHash
All Implemented Interfaces:
java.lang.Comparable<MethodHash>

public class MethodHash
extends java.lang.Object
implements java.lang.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 java.lang.String METHOD_HASH_ELEMENT_NAME
           
 
Constructor Summary
MethodHash()
          Constructor.
MethodHash(java.lang.String methodName, java.lang.String methodSig, boolean isStatic, byte[] hash)
          Constructor.
 
Method Summary
static int compareHashes(byte[] a, byte[] b)
           
 int compareTo(MethodHash other)
           
 MethodHash computeHash(org.apache.bcel.classfile.Method method)
          Compute hash on given method.
 boolean equals(java.lang.Object o)
           
 byte[] getMethodHash()
          Get the computed method hash.
 java.lang.String getMethodName()
           
 java.lang.String getMethodSig()
           
 int hashCode()
           
 boolean isSameHash(MethodHash other)
          Return whether or not this method hash has the same value as the one given.
 boolean isStatic()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

METHOD_HASH_ELEMENT_NAME

public static final java.lang.String METHOD_HASH_ELEMENT_NAME
See Also:
Constant Field Values
Constructor Detail

MethodHash

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


MethodHash

public MethodHash(java.lang.String methodName,
                  java.lang.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

getMethodName

public java.lang.String getMethodName()
Returns:
Returns the method name.

getMethodSig

public java.lang.String 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

public MethodHash computeHash(org.apache.bcel.classfile.Method method)
Compute hash on given method.

Parameters:
method - the method
Returns:
this object

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

compareTo

public int compareTo(MethodHash other)
Specified by:
compareTo in interface java.lang.Comparable<MethodHash>

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compareHashes

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

FindBugs™ 1.3.9

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