diff a/src/java.base/share/classes/java/lang/IdentityObject.java b/src/java.base/share/classes/java/lang/IdentityObject.java --- a/src/java.base/share/classes/java/lang/IdentityObject.java +++ b/src/java.base/share/classes/java/lang/IdentityObject.java @@ -1,7 +1,7 @@ /* - * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * 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. Oracle designates this @@ -25,9 +25,22 @@ package java.lang; /** * A restricted interface implemented by all identity objects. - * @since 1.14 + * @since Valhalla */ public interface IdentityObject { + /** + * Returns a new Object implementing the {@code IdentityObject} interface. + * The object is a unique {@link IdentityObject} suitable for all purposes + * for which {@code new Object{}} was used including synchronization, + * mutexes and unique placeholders. + * + * @return a new Object implementing the IdentityObject interface + * @since Valhalla + */ + static IdentityObject newIdentity() { + // Return a new instance of an anonymous inner class. + return new IdentityObject() { }; + } }