changeset 48630:5051a76817c6 condy-folding

SymbolicRef <: Constable
author briangoetz
date Thu, 11 Jan 2018 13:05:19 -0500
parents d41afc5e283e
children 27785de496e3
files src/java.base/share/classes/java/lang/invoke/Intrinsics.java src/java.base/share/classes/java/lang/sym/BootstrapSpecifier.java src/java.base/share/classes/java/lang/sym/SymbolicRef.java src/java.base/share/classes/java/lang/sym/SymbolicRefs.java
diffstat 4 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/invoke/Intrinsics.java	Mon Jan 08 13:50:59 2018 +0100
+++ b/src/java.base/share/classes/java/lang/invoke/Intrinsics.java	Thu Jan 11 13:05:19 2018 -0500
@@ -32,7 +32,7 @@
  *
  * @author Brian Goetz
  */
-public class Intrinsics {
+public final class Intrinsics {
     /**
      * Instructs the compiler to generate an {@code ldc} instruction for the given
      * {@code Constable} instance. A compiler error will be issued if it cannot
--- a/src/java.base/share/classes/java/lang/sym/BootstrapSpecifier.java	Mon Jan 08 13:50:59 2018 +0100
+++ b/src/java.base/share/classes/java/lang/sym/BootstrapSpecifier.java	Thu Jan 11 13:05:19 2018 -0500
@@ -40,6 +40,13 @@
         this.bootstrapArgs = Objects.requireNonNull(bootstrapArgs.clone());
     }
 
+    // of(mh, name, type)
+    // of(mh, type)
+    // withArgs(args...)
+    // withNameAndType
+    // resolve: BCI?
+    // similar canonicalzing factories as DCR
+
     /**
      * Create a descriptor for an {@code invokedynamic} invocation.
      * @param bootstrapMethod the bootstrap method for the {@code invokedynamic}
--- a/src/java.base/share/classes/java/lang/sym/SymbolicRef.java	Mon Jan 08 13:50:59 2018 +0100
+++ b/src/java.base/share/classes/java/lang/sym/SymbolicRef.java	Thu Jan 11 13:05:19 2018 -0500
@@ -41,8 +41,8 @@
  * {@linkplain SymbolicRef.OfSelf}, indicating that they serve as their own
  * symbolic reference. Native linkable constant types ({@link
  * Class}, {@link MethodType}, and {@link MethodHandle}) have counterpart
- * {@linkplain SymbolicRef} types, such as {@link ClassRef},
- * {@link MethodTypeRef}, and {@link MethodHandleRef}.  Dynamic constants are
+ * {@linkplain SymbolicRef} types, ({@link ClassRef}, {@link MethodTypeRef},
+ * and {@link MethodHandleRef}.)  Dynamic constants are
  * represented by the symbolic reference type {@link DynamicConstantRef}.
  *
  * <p>APIs that deal in generation or parsing of bytecode are encouraged to use
@@ -68,6 +68,9 @@
  * <p>Non-platform classes should not implement {@linkplain SymbolicRef} directly.
  * Instead, they should extend {@link DynamicConstantRef}.
  *
+ * <p>Symbolic references are <a href="../doc-files/ValueBased.html">value-based</a>
+ * classes.
+ *
  * @apiNote In the future, if the Java language permits, {@linkplain SymbolicRef}
  * may become a {@code sealed} interface, which would prohibit subclassing except by
  * explicitly permitted types.
@@ -77,7 +80,7 @@
  * @see Intrinsics
  * @see SymbolicRefs
  */
-public interface SymbolicRef<T> {
+public interface SymbolicRef<T> extends Constable<T> {
 
     /**
      * Resolve this symbolic reference reflectively.
--- a/src/java.base/share/classes/java/lang/sym/SymbolicRefs.java	Mon Jan 08 13:50:59 2018 +0100
+++ b/src/java.base/share/classes/java/lang/sym/SymbolicRefs.java	Thu Jan 11 13:05:19 2018 -0500
@@ -167,27 +167,27 @@
             = MethodHandleRef.ofCondyBootstrap(CR_ConstantBootstraps, "primitiveClass", CR_Class);
 
     @Foldable
-    static final MethodHandleRef BSM_ENUM_CONSTANT
+    public static final MethodHandleRef BSM_ENUM_CONSTANT
             = MethodHandleRef.ofCondyBootstrap(CR_ConstantBootstraps, "enumConstant", CR_Enum);
 
     @Foldable
-    static final MethodHandleRef BSM_NULL_CONSTANT
+    public static final MethodHandleRef BSM_NULL_CONSTANT
             = MethodHandleRef.ofCondyBootstrap(CR_ConstantBootstraps, "nullConstant", SymbolicRefs.CR_Object);
 
     @Foldable
-    static final MethodHandleRef BSM_VARHANDLE_FIELD
+    public static final MethodHandleRef BSM_VARHANDLE_FIELD
             = MethodHandleRef.ofCondyBootstrap(CR_ConstantBootstraps, "fieldVarHandle", CR_VarHandle, CR_Class, CR_Class);
 
     @Foldable
-    static final MethodHandleRef BSM_VARHANDLE_STATIC_FIELD
+    public static final MethodHandleRef BSM_VARHANDLE_STATIC_FIELD
             = MethodHandleRef.ofCondyBootstrap(CR_ConstantBootstraps, "staticFieldVarHandle", CR_VarHandle, CR_Class, CR_Class);
 
     @Foldable
-    static final MethodHandleRef BSM_VARHANDLE_ARRAY
+    public static final MethodHandleRef BSM_VARHANDLE_ARRAY
             = MethodHandleRef.ofCondyBootstrap(CR_ConstantBootstraps, "arrayVarHandle", CR_VarHandle, CR_Class);
 
     @Foldable
-    static final MethodHandleRef BSM_INVOKE
+    public static final MethodHandleRef BSM_INVOKE
             = MethodHandleRef.ofCondyBootstrap(CR_ConstantBootstraps, "invoke", CR_Object, CR_MethodHandle, CR_Object.array());
 
     /**  ClassRef representing the primitive type int */