package org.k13n.swtstubber.matcher;

import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.Method;

public class JavaMethod extends Method {
  private final int opcode;

  public JavaMethod(String name, String typeDescriptor, int opcode) {
    super(name, typeDescriptor);
    this.opcode = opcode;
  }

  public int getOpcode() {
    return opcode;
  }

  public boolean isStatic() {
    return opcode == Opcodes.INVOKESTATIC;
  }

  public boolean isConstructor() {
    return getName().equals("<init>");
  }

  @Override
  public boolean equals(Object other) {
    if (other != null && other instanceof JavaMethod)
      return ((JavaMethod) other).opcode == opcode;
    return false;
  }

  @Override
  public int hashCode() {
    int result = 3489;
    result = 31 * result + super.hashCode();
    result = 31 * result + opcode;
    return result;
  }

}

@@ -638,16 +638,22 @@
  return 
+equals
 ((JavaMe
@@ -668,25 +668,8 @@
 her)
-.opcode == opcode
 ;%0A  
@@ -682,16 +682,187 @@
 rn false
+;%0A  %7D%0A%0A  public boolean equals(JavaMethod other) %7B%0A    return super.equals(other) &&%0A      isStatic() == other.isStatic() &&%0A      isConstructor() == other.isConstructor()
 ;%0A  %7D%0A%0A 
@@ -993,22 +993,90 @@
 esult + 
-opcode
+(isStatic() ? 1 : 0);%0A    result = 31 * result + (isConstructor() ? 1 : 0)
 ;%0A    re

Fix equals and hashCode in JavaMethod