1 7 34 35 package com.sun.tools.example.debug.tty; 36 37 import com.sun.jdi.*; 38 39 abstract class WatchpointSpec extends EventRequestSpec { 40 final String fieldId; 41 42 WatchpointSpec(ReferenceTypeSpec refSpec, String fieldId) 43 throws MalformedMemberNameException { 44 super(refSpec); 45 this.fieldId = fieldId; 46 if (!isJavaIdentifier(fieldId)) { 47 throw new MalformedMemberNameException(fieldId); 48 } 49 } 50 51 public int hashCode() { 52 return refSpec.hashCode() + fieldId.hashCode() + 53 getClass().hashCode(); 54 } 55 56 public boolean equals(Object obj) { 57 if (obj instanceof WatchpointSpec) { 58 WatchpointSpec watchpoint = (WatchpointSpec)obj; 59 60 return fieldId.equals(watchpoint.fieldId) && 61 refSpec.equals(watchpoint.refSpec) && 62 getClass().equals(watchpoint.getClass()); 63 } else { 64 return false; 65 } 66 } 67 68 String errorMessageFor(Exception e) { 69 if (e instanceof NoSuchFieldException ) { 70 return (MessageOutput.format("No field in", 71 new Object [] {fieldId, refSpec.toString()})); 72 } else { 73 return super.errorMessageFor(e); 74 } 75 } 76 } 77 78 79 | Popular Tags |