< prev index next >

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

Print this page

        

@@ -22,10 +22,12 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 package java.lang.constant;
 
+import jdk.internal.lang.annotation.Foldable;
+
 import java.lang.Enum.EnumDesc;
 import java.lang.invoke.CallSite;
 import java.lang.invoke.ConstantBootstraps;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;

@@ -62,118 +64,155 @@
     public static final String DEFAULT_NAME = "_";
 
     // Don't change the order of these declarations!
 
     /** {@link ClassDesc} representing {@link Object} */
+    @Foldable
     public static final ClassDesc CD_Object = ClassDesc.of("java.lang.Object");
 
     /** {@link ClassDesc} representing {@link String} */
+    @Foldable
     public static final ClassDesc CD_String = ClassDesc.of("java.lang.String");
 
     /** {@link ClassDesc} representing {@link Class} */
+    @Foldable
     public static final ClassDesc CD_Class = ClassDesc.of("java.lang.Class");
 
     /** {@link ClassDesc} representing {@link Number} */
+    @Foldable
     public static final ClassDesc CD_Number = ClassDesc.of("java.lang.Number");
 
     /** {@link ClassDesc} representing {@link Integer} */
+    @Foldable
     public static final ClassDesc CD_Integer = ClassDesc.of("java.lang.Integer");
 
     /** {@link ClassDesc} representing {@link Long} */
+    @Foldable
     public static final ClassDesc CD_Long = ClassDesc.of("java.lang.Long");
 
     /** {@link ClassDesc} representing {@link Float} */
+    @Foldable
     public static final ClassDesc CD_Float = ClassDesc.of("java.lang.Float");
 
     /** {@link ClassDesc} representing {@link Double} */
+    @Foldable
     public static final ClassDesc CD_Double = ClassDesc.of("java.lang.Double");
 
     /** {@link ClassDesc} representing {@link Short} */
+    @Foldable
     public static final ClassDesc CD_Short = ClassDesc.of("java.lang.Short");
 
     /** {@link ClassDesc} representing {@link Byte} */
+    @Foldable
     public static final ClassDesc CD_Byte = ClassDesc.of("java.lang.Byte");
 
     /** {@link ClassDesc} representing {@link Character} */
+    @Foldable
     public static final ClassDesc CD_Character = ClassDesc.of("java.lang.Character");
 
     /** {@link ClassDesc} representing {@link Boolean} */
+    @Foldable
     public static final ClassDesc CD_Boolean = ClassDesc.of("java.lang.Boolean");
 
     /** {@link ClassDesc} representing {@link Void} */
+    @Foldable
     public static final ClassDesc CD_Void = ClassDesc.of("java.lang.Void");
 
     /** {@link ClassDesc} representing {@link Throwable} */
+    @Foldable
     public static final ClassDesc CD_Throwable = ClassDesc.of("java.lang.Throwable");
 
     /** {@link ClassDesc} representing {@link Exception} */
+    @Foldable
     public static final ClassDesc CD_Exception = ClassDesc.of("java.lang.Exception");
 
     /** {@link ClassDesc} representing {@link Enum} */
+    @Foldable
     public static final ClassDesc CD_Enum = ClassDesc.of("java.lang.Enum");
 
     /** {@link ClassDesc} representing {@link VarHandle} */
+    @Foldable
     public static final ClassDesc CD_VarHandle = ClassDesc.of("java.lang.invoke.VarHandle");
 
     /** {@link ClassDesc} representing {@link MethodHandles} */
+    @Foldable
     public static final ClassDesc CD_MethodHandles = ClassDesc.of("java.lang.invoke.MethodHandles");
 
     /** {@link ClassDesc} representing {@link MethodHandles.Lookup} */
+    @Foldable
     public static final ClassDesc CD_MethodHandles_Lookup = CD_MethodHandles.nested("Lookup");
 
     /** {@link ClassDesc} representing {@link MethodHandle} */
+    @Foldable
     public static final ClassDesc CD_MethodHandle = ClassDesc.of("java.lang.invoke.MethodHandle");
 
     /** {@link ClassDesc} representing {@link MethodType} */
+    @Foldable
     public static final ClassDesc CD_MethodType = ClassDesc.of("java.lang.invoke.MethodType");
 
     /** {@link ClassDesc} representing {@link CallSite} */
+    @Foldable
     public static final ClassDesc CD_CallSite = ClassDesc.of("java.lang.invoke.CallSite");
 
     /** {@link ClassDesc} representing {@link Collection} */
+    @Foldable
     public static final ClassDesc CD_Collection = ClassDesc.of("java.util.Collection");
 
     /** {@link ClassDesc} representing {@link List} */
+    @Foldable
     public static final ClassDesc CD_List = ClassDesc.of("java.util.List");
 
     /** {@link ClassDesc} representing {@link Set} */
+    @Foldable
     public static final ClassDesc CD_Set = ClassDesc.of("java.util.Set");
 
     /** {@link ClassDesc} representing {@link Map} */
+    @Foldable
     public static final ClassDesc CD_Map = ClassDesc.of("java.util.Map");
 
     /** {@link ClassDesc} representing {@link ConstantDesc} */
+    @Foldable
     public static final ClassDesc CD_ConstantDesc = ClassDesc.of("java.lang.constant.ConstantDesc");
 
     /** {@link ClassDesc} representing {@link ClassDesc} */
+    @Foldable
     public static final ClassDesc CD_ClassDesc = ClassDesc.of("java.lang.constant.ClassDesc");
 
     /** {@link ClassDesc} representing {@link EnumDesc} */
+    @Foldable
     public static final ClassDesc CD_EnumDesc = CD_Enum.nested("EnumDesc");
 
     /** {@link ClassDesc} representing {@link MethodTypeDesc} */
+    @Foldable
     public static final ClassDesc CD_MethodTypeDesc = ClassDesc.of("java.lang.constant.MethodTypeDesc");
 
     /** {@link ClassDesc} representing {@link MethodHandleDesc} */
+    @Foldable
     public static final ClassDesc CD_MethodHandleDesc = ClassDesc.of("java.lang.constant.MethodHandleDesc");
 
     /** {@link ClassDesc} representing {@link DirectMethodHandleDesc} */
+    @Foldable
     public static final ClassDesc CD_DirectMethodHandleDesc = ClassDesc.of("java.lang.constant.DirectMethodHandleDesc");
 
     /** {@link ClassDesc} representing {@link VarHandleDesc} */
+    @Foldable
     public static final ClassDesc CD_VarHandleDesc = CD_VarHandle.nested("VarHandleDesc");
 
     /** {@link ClassDesc} representing {@link DirectMethodHandleDesc.Kind} */
+    @Foldable
     public static final ClassDesc CD_MethodHandleDesc_Kind = CD_DirectMethodHandleDesc.nested("Kind");
 
     /** {@link ClassDesc} representing {@link DynamicConstantDesc} */
+    @Foldable
     public static final ClassDesc CD_DynamicConstantDesc = ClassDesc.of("java.lang.constant.DynamicConstantDesc");
 
     /** {@link ClassDesc} representing {@link DynamicCallSiteDesc} */
+    @Foldable
     public static final ClassDesc CD_DynamicCallSiteDesc = ClassDesc.of("java.lang.constant.DynamicCallSiteDesc");
 
     /** {@link ClassDesc} representing {@link ConstantBootstraps} */
+    @Foldable
     public static final ClassDesc CD_ConstantBootstraps = ClassDesc.of("java.lang.invoke.ConstantBootstraps");
 
     private static final ClassDesc[] INDY_BOOTSTRAP_ARGS = {
             ConstantDescs.CD_MethodHandles_Lookup,
             ConstantDescs.CD_String,

@@ -183,72 +222,89 @@
             ConstantDescs.CD_MethodHandles_Lookup,
             ConstantDescs.CD_String,
             ConstantDescs.CD_Class};
 
     /** {@link MethodHandleDesc} representing {@link ConstantBootstraps#primitiveClass(Lookup, String, Class) ConstantBootstraps.primitiveClass} */
+    @Foldable
     public static final DirectMethodHandleDesc BSM_PRIMITIVE_CLASS
             = ofConstantBootstrap(CD_ConstantBootstraps, "primitiveClass",
             CD_Class);
 
     /** {@link MethodHandleDesc} representing {@link ConstantBootstraps#enumConstant(Lookup, String, Class) ConstantBootstraps.enumConstant} */
+    @Foldable
     public static final DirectMethodHandleDesc BSM_ENUM_CONSTANT
             = ofConstantBootstrap(CD_ConstantBootstraps, "enumConstant",
             CD_Enum);
 
     /** {@link MethodHandleDesc} representing {@link ConstantBootstraps#nullConstant(Lookup, String, Class) ConstantBootstraps.nullConstant} */
+    @Foldable
     public static final DirectMethodHandleDesc BSM_NULL_CONSTANT
             = ofConstantBootstrap(CD_ConstantBootstraps, "nullConstant",
                                   ConstantDescs.CD_Object);
 
     /** {@link MethodHandleDesc} representing {@link ConstantBootstraps#fieldVarHandle(Lookup, String, Class, Class, Class) ConstantBootstraps.fieldVarHandle} */
+    @Foldable
     public static final DirectMethodHandleDesc BSM_VARHANDLE_FIELD
             = ofConstantBootstrap(CD_ConstantBootstraps, "fieldVarHandle",
             CD_VarHandle, CD_Class, CD_Class);
 
     /** {@link MethodHandleDesc} representing {@link ConstantBootstraps#staticFieldVarHandle(Lookup, String, Class, Class, Class) ConstantBootstraps.staticVarHandle} */
+    @Foldable    
     public static final DirectMethodHandleDesc BSM_VARHANDLE_STATIC_FIELD
             = ofConstantBootstrap(CD_ConstantBootstraps, "staticFieldVarHandle",
             CD_VarHandle, CD_Class, CD_Class);
 
     /** {@link MethodHandleDesc} representing {@link ConstantBootstraps#arrayVarHandle(Lookup, String, Class, Class) ConstantBootstraps.arrayVarHandle} */
+    @Foldable
     public static final DirectMethodHandleDesc BSM_VARHANDLE_ARRAY
             = ofConstantBootstrap(CD_ConstantBootstraps, "arrayVarHandle",
             CD_VarHandle, CD_Class);
 
     /** {@link MethodHandleDesc} representing {@link ConstantBootstraps#invoke(Lookup, String, Class, MethodHandle, Object...) ConstantBootstraps.invoke} */
+    @Foldable
     public static final DirectMethodHandleDesc BSM_INVOKE
             = ofConstantBootstrap(CD_ConstantBootstraps, "invoke",
             CD_Object, CD_MethodHandle, CD_Object.arrayType());
 
     /** {@link ClassDesc} representing the primitive type {@code int} */
+    @Foldable
     public static final ClassDesc CD_int = ClassDesc.ofDescriptor("I");
 
     /** {@link ClassDesc} representing the primitive type {@code long} */
+    @Foldable
     public static final ClassDesc CD_long = ClassDesc.ofDescriptor("J");
 
     /** {@link ClassDesc} representing the primitive type {@code float} */
+    @Foldable
     public static final ClassDesc CD_float = ClassDesc.ofDescriptor("F");
 
     /** {@link ClassDesc} representing the primitive type {@code double} */
+    @Foldable
     public static final ClassDesc CD_double = ClassDesc.ofDescriptor("D");
 
     /** {@link ClassDesc} representing the primitive type {@code short} */
+    @Foldable
     public static final ClassDesc CD_short = ClassDesc.ofDescriptor("S");
 
     /** {@link ClassDesc} representing the primitive type {@code byte} */
+    @Foldable
     public static final ClassDesc CD_byte = ClassDesc.ofDescriptor("B");
 
     /** {@link ClassDesc} representing the primitive type {@code char} */
+    @Foldable
     public static final ClassDesc CD_char = ClassDesc.ofDescriptor("C");
 
     /** {@link ClassDesc} representing the primitive type {@code boolean} */
+    @Foldable
     public static final ClassDesc CD_boolean = ClassDesc.ofDescriptor("Z");
 
     /** {@link ClassDesc} representing the primitive type {@code void} */
+    @Foldable
     public static final ClassDesc CD_void = ClassDesc.ofDescriptor("V");
 
     /** Nominal descriptor representing the constant {@code null} */
+    @Foldable
     public static final ConstantDesc NULL
             = DynamicConstantDesc.ofNamed(ConstantDescs.BSM_NULL_CONSTANT,
                                           DEFAULT_NAME, ConstantDescs.CD_Object);
 
     static final DirectMethodHandleDesc MHD_METHODHANDLE_ASTYPE

@@ -265,10 +321,11 @@
      * @param paramTypes the types of the static bootstrap arguments, if any
      * @return the {@link MethodHandleDesc}
      * @throws NullPointerException if any of the arguments are null
      * @jvms 4.2.2 Unqualified Names
      */
+    @Foldable
     public static DirectMethodHandleDesc ofCallsiteBootstrap(ClassDesc owner,
                                                              String name,
                                                              ClassDesc returnType,
                                                              ClassDesc... paramTypes) {
         return MethodHandleDesc.ofMethod(STATIC, owner, name, MethodTypeDesc.of(returnType, paramTypes)

@@ -286,10 +343,11 @@
      * @param paramTypes the types of the static bootstrap arguments, if any
      * @return the {@link MethodHandleDesc}
      * @throws NullPointerException if any of the arguments are null
      * @jvms 4.2.2 Unqualified Names
      */
+    @Foldable
     public static DirectMethodHandleDesc ofConstantBootstrap(ClassDesc owner,
                                                              String name,
                                                              ClassDesc returnType,
                                                              ClassDesc... paramTypes) {
         return MethodHandleDesc.ofMethod(STATIC, owner, name, MethodTypeDesc.of(returnType, paramTypes)
< prev index next >