John, Do we agree that this API can also replace the constant pool patching done by unsafe.defineAnonymousClass, i.e. that the Object can be any live Object?
Rémi > De: "John Rose" <john.r.r...@oracle.com> > À: "Daniel Heidinga" <daniel_heidi...@ca.ibm.com> > Cc: valhalla-spec-experts@openjdk.java.net > Envoyé: Mercredi 21 Juin 2017 17:51:11 > Objet: Re: minutes Valhalla EG June 07, 2017 > On Jun 21, 2017, at 6:55 AM, Daniel Heidinga < daniel_heidi...@ca.ibm.com > > wrote: >> > AI: John - send out javadoc to EG >>> derived class := Class.derivedClassFactory(Class mainClass, T userData, >>> String >> > name) >> In the spirit of the usual "5 min before the meeting" ritual action item >> panic, >> I'm trying to review the javadoc for this and can't seem to find it. Can it >> be >> sent again? > Apologies; here it is, 10 min before the meeting. > diff --git a/src/java.base/share/classes/java/lang/Class.java > b/src/java.base/share/classes/java/lang/Class.java > --- a/src/java.base/share/classes/java/lang/Class.java > +++ b/src/java.base/share/classes/java/lang/Class.java > @@ -681,6 +681,65 @@ > public native boolean isPrimitive(); > /** > + * Determines if the specified {@code Class} object is the > + * primary representative of an underlying class file. > + * Array and primitive classes are never primaries. > + * Other reference type constants of the form {@code X.class} > + * are always primaries. > + * Value type mirrors are never primaries; their corresponding > + * box reference types are primaries. > + * > + * @return true if and only if this class is the primary > + * representative of its underlying class file > + */ > + @HotSpotIntrinsicCandidate > + public native boolean isPrimary(); > + > + /** > + * Obtains the primary class corresponding to the specified > + * {@code Class} object, if this class is a secondary class > + * derived from a primary class > + * If this class object is a primary class, it returns the > + * same class object. > + * <em>TBD:</em>An array type returns the primary class > + * of its component type. A primitive type returns the > + * corresponding wrapper type. A value type returns the > + * primary class of its box type. A specialized generic > + * returns the primary class of its template type. > + * <em>OR, an non-total version:</em>Primitive and array classes > + * do not have associated primary classes; they return > + * {@code null} for this query. > + * > + * @return the primary representative of the underlying class file > + */ > + @HotSpotIntrinsicCandidate > + public native Class<?> getPrimaryClass(); > + > + /** > + * Creates a new non-primary class for the given primary. > + * This is an internal factory for non-primary classes. > + * The user is expected to perform relevant interning, > + * and manage the type of the user-data component. > + * @param primary the primary class for the new secondary > + * @param name arbitrary name string, to be the name of the new secondary > + * @param userData arbitrary reference to associate with the new secondary > + * @return a fresh secondary class > + * @throws IllegalArgumentException if the first argument is not a primary > class > + */ > + /*non-public*/ > + @HotSpotIntrinsicCandidate > + static native Class<?> makeSecondaryClass(Class<?> primary, String name, > Object userData); > + > + /** > + * Extract the user-data provided when the given secondary class > + * was created by the {@code makeSecondaryClass} factory. > + * Returns {@code null} if it was not created by that factory. > + */ > + /*non-public*/ > + @HotSpotIntrinsicCandidate > + native Object getSecondaryUserData(); > + > + /** > * Returns true if this {@code Class} object represents an annotation > * type. Note that if this method returns true, {@link #isInterface()} > * would also return true, as all annotation types are also interfaces.