Class MethodHash

java.lang.Object
edu.umd.cs.findbugs.ba.MethodHash
All Implemented Interfaces:
Comparable<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 Details

  • Constructor Details

    • 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 Details

    • getMethodName

      public String getMethodName()
      Returns:
      Returns the method name.
    • getMethodSig

      public 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 Comparable<MethodHash>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareHashes

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