--- /dev/null 2016-10-25 08:46:44.038854975 +0200
+++ new/src/share/classes/sun/evtracing/processing/statistics/metadata/JavaObject.java 2016-10-25 10:41:00.266811352 +0200
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2014, 2015, Dynatrace and/or its affiliates. All rights reserved.
+ *
+ * This file is part of the Lock Contention Tracing Subsystem for the HotSpot
+ * Virtual Machine, which is developed at Christian Doppler Laboratory on
+ * Monitoring and Evolution of Very-Large-Scale Software Systems. Please
+ * contact us at if you need additional information
+ * or have any questions.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work. If not, see .
+ *
+ */
+package sun.evtracing.processing.statistics.metadata;
+
+import sun.evtracing.parser.metadata.JavaClass;
+
+public class JavaObject {
+
+ private static class SpecialJavaObject extends JavaObject {
+ static final int IDENTITY_HASH = 0;
+ public SpecialJavaObject(JavaClass clazz) {
+ super(IDENTITY_HASH, clazz);
+ }
+ @Override
+ public boolean equals(Object obj) {
+ return (this == obj);
+ }
+ };
+ public static final JavaObject UNKNOWN = new SpecialJavaObject(JavaClass.UNKNOWN);
+ public static final JavaObject UNCONTENDED = new SpecialJavaObject(JavaClass.UNCONTENDED);
+
+ public static JavaObject get(int object, JavaClass clazz) {
+ if (object == SpecialJavaObject.IDENTITY_HASH) {
+ if (clazz == JavaClass.UNKNOWN) {
+ return JavaObject.UNKNOWN;
+ }
+ if (clazz == JavaClass.UNCONTENDED) {
+ return JavaObject.UNCONTENDED;
+ }
+ }
+ return new JavaObject(object, clazz);
+ }
+
+ private final int object;
+ private final JavaClass clazz;
+
+ private JavaObject(int object, JavaClass clazz) {
+ assert clazz != null;
+ this.object = object;
+ this.clazz = clazz;
+ }
+
+ public int identityHash() {
+ return object;
+ }
+
+ public JavaClass clazz() {
+ return clazz;
+ }
+
+ @Override
+ public int hashCode() {
+ return object * 31 + clazz.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (obj instanceof JavaObject) {
+ JavaObject other = (JavaObject) obj;
+ return (object == other.object && clazz.equals(other.clazz));
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return clazz.prettyName(true) + " @" + Integer.toHexString(object);
+ }
+}