47 * value. Such a description is the <em>nominal form</em> of the constant value; |
47 * value. Such a description is the <em>nominal form</em> of the constant value; |
48 * it is not the value itself, but rather a "recipe" for describing the value, |
48 * it is not the value itself, but rather a "recipe" for describing the value, |
49 * storing the value in a constant pool entry, or reconstituting the value given |
49 * storing the value in a constant pool entry, or reconstituting the value given |
50 * a class loading context. Every {@link java.lang.constant.ConstantDesc} |
50 * a class loading context. Every {@link java.lang.constant.ConstantDesc} |
51 * knows how to <em>resolve</em> itself -- compute the value that it describes -- |
51 * knows how to <em>resolve</em> itself -- compute the value that it describes -- |
52 * via {@link java.lang.constant.ConstantDesc#resolveConstantDesc(java.lang.invoke.MethodHandles.Lookup)}. |
52 * via {@link java.lang.constant.ConstantDesc#resolveConstantDesc(java.lang.invoke.MethodHandles.Lookup) ConstantDesc.resolveConstantDesc}. |
53 * This allows an API which accepts {@link java.lang.constant.ConstantDesc} |
53 * This allows an API which accepts {@link java.lang.constant.ConstantDesc} |
54 * objects to evaluate them reflectively, provided that the classes and methods |
54 * objects to evaluate them reflectively, provided that the classes and methods |
55 * referenced in their nominal description are present and accessible. |
55 * referenced in their nominal description are present and accessible. |
56 * |
56 * |
57 * <p>The subtypes of {@link java.lang.constant.ConstantDesc} describe various kinds |
57 * <p>The subtypes of {@link java.lang.constant.ConstantDesc} describe various kinds |
66 * it should examine it to see which of these types it is, cast it, extract |
66 * it should examine it to see which of these types it is, cast it, extract |
67 * its nominal information, and generate the corresponding entry to the constant pool. |
67 * its nominal information, and generate the corresponding entry to the constant pool. |
68 * When a bytecode-reading API encounters a constant pool entry, it can |
68 * When a bytecode-reading API encounters a constant pool entry, it can |
69 * convert it to the appropriate type of nominal descriptor. For dynamic |
69 * convert it to the appropriate type of nominal descriptor. For dynamic |
70 * constants, bytecode-reading APIs may wish to use the factory |
70 * constants, bytecode-reading APIs may wish to use the factory |
71 * {@link java.lang.constant.DynamicConstantDesc#ofCanonical(DirectMethodHandleDesc, java.lang.String, ClassDesc, ConstantDesc[])}, |
71 * {@link java.lang.constant.DynamicConstantDesc#ofCanonical(DirectMethodHandleDesc, java.lang.String, ClassDesc, ConstantDesc[]) DynamicConstantDesc.ofCanonical}, |
72 * which will inspect the bootstrap and, for well-known bootstraps, return |
72 * which will inspect the bootstrap and, for well-known bootstraps, return |
73 * a more specific subtype of {@link java.lang.constant.DynamicConstantDesc}, such as |
73 * a more specific subtype of {@link java.lang.constant.DynamicConstantDesc}, such as |
74 * {@link java.lang.Enum.EnumDesc}. |
74 * {@link java.lang.Enum.EnumDesc}. |
75 * |
75 * |
76 * <p>Another way to obtain the nominal description of a value is to ask the value |
76 * <p>Another way to obtain the nominal description of a value is to ask the value |