< prev index next >

src/jdk.jdi/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java

Print this page

        

*** 74,83 **** --- 74,87 ---- synchronized (vm.state()) { cache = markerCache; } } + private boolean isInlineType() { + return referenceType().signature().startsWith("Q"); + } + // Override in subclasses protected Cache newCache() { return new Cache(); }
*** 143,157 **** return true; } } } public boolean equals(Object obj) { if ((obj != null) && (obj instanceof ObjectReferenceImpl)) { ! ObjectReferenceImpl other = (ObjectReferenceImpl)obj; return (ref() == other.ref()) && super.equals(obj); } else { return false; } } --- 147,182 ---- return true; } } } + private boolean isSubtituable(ObjectReferenceImpl other) { + if (referenceType() != other.referenceType()) return false; + List<Field> fields = referenceType().fields(); + for (Field f : fields) { + if (f.isStatic()) { + fields.remove(f); + } + } + Map<Field,Value> thisFields = getValues(fields); + Map<Field,Value> otherFields = other.getValues(fields); + for (Field f : fields) { + if (!thisFields.get(f).equals(otherFields.get(f))) return false; + } + return true; + } + public boolean equals(Object obj) { if ((obj != null) && (obj instanceof ObjectReferenceImpl)) { ! ObjectReferenceImpl other = (ObjectReferenceImpl) obj; ! if (isInlineType()) { ! return isSubtituable(other); ! ! } else { return (ref() == other.ref()) && super.equals(obj); + } } else { return false; } }
*** 468,477 **** --- 493,505 ---- throw exc.toJDIException(); } } public long uniqueID() { + if (isInlineType()) { + throw new UnsupportedOperationException("Inline types cannot have unique IDs"); + } return ref(); } JDWP.ObjectReference.MonitorInfo jdwpMonitorInfo() throws IncompatibleThreadStateException {
*** 609,620 **** --- 637,652 ---- " to " + destTypeName); } } public String toString() { + if (isInlineType()) { + return "instance of " + referenceType().name(); + } else { return "instance of " + referenceType().name() + "(id=" + uniqueID() + ")"; } + } byte typeValueKey() { return JDWP.Tag.OBJECT; }
< prev index next >