106 * {@linkplain #readConstantFieldValue(ResolvedJavaField, JavaConstant) constant} by the 107 * runtime. 108 * 109 * @param receiver object from which this field's value is to be read. This value is ignored if 110 * this field is static. 111 * @param isDefaultStable if {@code true}, default values are considered stable 112 * @return the value of this field or {@code null} if the value is not available (e.g., because 113 * the field holder is not yet initialized). 114 */ 115 JavaConstant readStableFieldValue(ResolvedJavaField field, JavaConstant receiver, boolean isDefaultStable); 116 117 /** 118 * Converts the given {@link JavaKind#isPrimitive() primitive} constant to a boxed 119 * {@link JavaKind#Object object} constant, according to the Java boxing rules. Returns 120 * {@code null} if the source is is not a primitive constant, or the boxed value is not 121 * available at this point. 122 */ 123 JavaConstant boxPrimitive(JavaConstant source); 124 125 /** 126 * Converts the given {@link JavaKind#Object object} constant to a 127 * {@link JavaKind#isPrimitive() primitive} constant, according to the Java unboxing rules. 128 * Returns {@code null} if the source is is not an object constant that can be unboxed, or the 129 * unboxed value is not available at this point. 130 */ 131 JavaConstant unboxPrimitive(JavaConstant source); 132 133 /** 134 * Gets a string as a {@link JavaConstant}. 135 */ 136 JavaConstant forString(String value); 137 138 /** 139 * Returns the {@link ResolvedJavaType} for a {@link Class} object (or any other object regarded 140 * as a class by the VM) encapsulated in the given constant. Returns {@code null} if the 141 * constant does not encapsulate a class, or if the type is not available at this point. 142 */ 143 ResolvedJavaType asJavaType(Constant constant); 144 145 /** 146 * Check if the constant is embeddable in the code. 147 * 148 * @param constant the constant to test 149 */ | 106 * {@linkplain #readConstantFieldValue(ResolvedJavaField, JavaConstant) constant} by the 107 * runtime. 108 * 109 * @param receiver object from which this field's value is to be read. This value is ignored if 110 * this field is static. 111 * @param isDefaultStable if {@code true}, default values are considered stable 112 * @return the value of this field or {@code null} if the value is not available (e.g., because 113 * the field holder is not yet initialized). 114 */ 115 JavaConstant readStableFieldValue(ResolvedJavaField field, JavaConstant receiver, boolean isDefaultStable); 116 117 /** 118 * Converts the given {@link JavaKind#isPrimitive() primitive} constant to a boxed 119 * {@link JavaKind#Object object} constant, according to the Java boxing rules. Returns 120 * {@code null} if the source is is not a primitive constant, or the boxed value is not 121 * available at this point. 122 */ 123 JavaConstant boxPrimitive(JavaConstant source); 124 125 /** 126 * Converts the given {@link JavaKind#Object object} constant to a {@link JavaKind#isPrimitive() 127 * primitive} constant, according to the Java unboxing rules. Returns {@code null} if the source 128 * is is not an object constant that can be unboxed, or the unboxed value is not available at 129 * this point. 130 */ 131 JavaConstant unboxPrimitive(JavaConstant source); 132 133 /** 134 * Gets a string as a {@link JavaConstant}. 135 */ 136 JavaConstant forString(String value); 137 138 /** 139 * Returns the {@link ResolvedJavaType} for a {@link Class} object (or any other object regarded 140 * as a class by the VM) encapsulated in the given constant. Returns {@code null} if the 141 * constant does not encapsulate a class, or if the type is not available at this point. 142 */ 143 ResolvedJavaType asJavaType(Constant constant); 144 145 /** 146 * Check if the constant is embeddable in the code. 147 * 148 * @param constant the constant to test 149 */ |