--- old/src/jdk.jdi/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java 2019-10-11 16:12:12.000000000 -0400 +++ new/src/jdk.jdi/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java 2019-10-11 16:12:12.000000000 -0400 @@ -76,6 +76,10 @@ } } + private boolean isInlineType() { + return referenceType().signature().startsWith("Q"); + } + // Override in subclasses protected Cache newCache() { return new Cache(); @@ -145,11 +149,32 @@ } } + private boolean isSubtituable(ObjectReferenceImpl other) { + if (referenceType() != other.referenceType()) return false; + List fields = referenceType().fields(); + for (Field f : fields) { + if (f.isStatic()) { + fields.remove(f); + } + } + Map thisFields = getValues(fields); + Map 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; - return (ref() == other.ref()) && - super.equals(obj); + ObjectReferenceImpl other = (ObjectReferenceImpl) obj; + if (isInlineType()) { + return isSubtituable(other); + + } else { + return (ref() == other.ref()) && + super.equals(obj); + } } else { return false; } @@ -470,6 +495,9 @@ } public long uniqueID() { + if (isInlineType()) { + throw new UnsupportedOperationException("Inline types cannot have unique IDs"); + } return ref(); } @@ -611,7 +639,11 @@ } public String toString() { - return "instance of " + referenceType().name() + "(id=" + uniqueID() + ")"; + if (isInlineType()) { + return "instance of " + referenceType().name(); + } else { + return "instance of " + referenceType().name() + "(id=" + uniqueID() + ")"; + } } byte typeValueKey() {