< prev index next >

src/java.base/share/classes/java/lang/constant/DirectMethodHandleDesc.java

Print this page

        

@@ -29,10 +29,12 @@
 import java.util.OptionalInt;
 import java.util.stream.Stream;
 
 import jdk.internal.vm.annotation.Stable;
 
+import jdk.internal.lang.annotation.Foldable;
+
 import static java.lang.invoke.MethodHandleInfo.REF_getField;
 import static java.lang.invoke.MethodHandleInfo.REF_getStatic;
 import static java.lang.invoke.MethodHandleInfo.REF_invokeInterface;
 import static java.lang.invoke.MethodHandleInfo.REF_invokeSpecial;
 import static java.lang.invoke.MethodHandleInfo.REF_invokeStatic;

@@ -59,31 +61,31 @@
      *
      * @since 12
      */
     enum Kind {
         /** A method handle for a method invoked as with {@code invokestatic} */
-        STATIC(REF_invokeStatic),
+        @Foldable STATIC(REF_invokeStatic),
         /** A method handle for a method invoked as with {@code invokestatic} */
-        INTERFACE_STATIC(REF_invokeStatic, true),
+        @Foldable INTERFACE_STATIC(REF_invokeStatic, true),
         /** A method handle for a method invoked as with {@code invokevirtual} */
-        VIRTUAL(REF_invokeVirtual),
+        @Foldable VIRTUAL(REF_invokeVirtual),
         /** A method handle for a method invoked as with {@code invokeinterface} */
-        INTERFACE_VIRTUAL(REF_invokeInterface, true),
+        @Foldable INTERFACE_VIRTUAL(REF_invokeInterface, true),
         /** A method handle for a method invoked as with {@code invokespecial} */
-        SPECIAL(REF_invokeSpecial),
+        @Foldable SPECIAL(REF_invokeSpecial),
         /** A method handle for an interface method invoked as with {@code invokespecial} */
-        INTERFACE_SPECIAL(REF_invokeSpecial, true),
+        @Foldable INTERFACE_SPECIAL(REF_invokeSpecial, true),
         /** A method handle for a constructor */
-        CONSTRUCTOR(REF_newInvokeSpecial),
+        @Foldable CONSTRUCTOR(REF_newInvokeSpecial),
         /** A method handle for a read accessor for an instance field  */
-        GETTER(REF_getField),
+        @Foldable GETTER(REF_getField),
         /** A method handle for a write accessor for an instance field  */
-        SETTER(REF_putField),
+        @Foldable SETTER(REF_putField),
         /** A method handle for a read accessor for a static field  */
-        STATIC_GETTER(REF_getStatic),
+        @Foldable STATIC_GETTER(REF_getStatic),
         /** A method handle for a write accessor for a static field  */
-        STATIC_SETTER(REF_putStatic);
+        @Foldable STATIC_SETTER(REF_putStatic);
 
         /** The corresponding {@code refKind} value for this kind of method handle,
          * as defined by {@link MethodHandleInfo}
          */
         public final int refKind;

@@ -213,18 +215,20 @@
      * Returns the {@code kind} of the method handle described by this nominal
      * descriptor.
      *
      * @return the {@link Kind}
      */
+    @Foldable
     Kind kind();
 
     /**
      * Returns the {@code refKind} of the method handle described by this nominal
      * reference, as defined by {@link MethodHandleInfo}.
      *
      * @return the reference kind
      */
+    @Foldable
     int refKind();
 
     /**
      * Indicates if the method is declared by an interface
      *

@@ -236,18 +240,20 @@
      * Returns a {@link ClassDesc} describing the class declaring the
      * method or field described by this nominal descriptor.
      *
      * @return the class declaring the method or field
      */
+    @Foldable
     ClassDesc owner();
 
     /**
      * Returns the name of the method or field described by this nominal descriptor.
      * For constructors, returns the reserved name {@code "<init>"}.
      *
      * @return the name of the method or field
      */
+    @Foldable
     String methodName();
 
     /**
      * Returns the lookup descriptor of the method handle described by this descriptor,
      * after adjusting for the invocation mode.  This will correspond to either

@@ -255,7 +261,8 @@
      * descriptor string (for field access method handles).  The lookup descriptor
      * string is in the same format as accepted by {@link MethodHandleDesc#of(Kind, ClassDesc, String, String)}.
      *
      * @return the lookup descriptor string
      */
+    @Foldable
     String lookupDescriptor();
 }
< prev index next >