1 19 20 package edu.umd.cs.findbugs; 21 22 import org.apache.bcel.classfile.Method; 23 import org.apache.bcel.generic.InstructionHandle; 24 25 import edu.umd.cs.findbugs.ba.BasicBlock; 26 import edu.umd.cs.findbugs.ba.Location; 27 28 31 public class CallSite { 32 private final Method method; 33 private final Location location; 34 35 42 public CallSite(Method method, BasicBlock basicBlock, InstructionHandle handle) { 43 this.method = method; 44 this.location = new Location(handle, basicBlock); 45 } 46 47 50 public Method getMethod() { 51 return method; 52 } 53 54 57 public Location getLocation() { 58 return location; 59 } 60 61 64 public BasicBlock getBasicBlock() { 65 return location.getBasicBlock(); 66 } 67 68 71 public InstructionHandle getHandle() { 72 return location.getHandle(); 73 } 74 75 @Override 76 public int hashCode() { 77 return System.identityHashCode(method) 78 ^ getBasicBlock().getId() 79 ^ System.identityHashCode(location.getHandle()); 80 } 81 82 @Override 83 public boolean equals(Object o) { 84 if (!(o instanceof CallSite)) 85 return false; 86 CallSite other = (CallSite) o; 87 return method == other.method 88 && getBasicBlock() == other.getBasicBlock() 89 && getHandle() == other.getHandle(); 90 } 91 } 92 93 | Popular Tags |