< prev index next >
src/java.base/share/classes/java/lang/invoke/MethodHandles.java
Print this page
*** 1260,1277 ****
if (refc.isArray()) {
throw new NoSuchMethodException("no constructor for array class: " + refc.getName());
}
String name = "<init>";
if (MinimalValueTypes_1_0.isValueType(refc)) {
- try {
//shady: The findConstructor method of Lookup will expose all accessible constructors of the original
//value-capable class, for both the Q-type and the legacy L-type. The return type of a method handle produced
//by findConstructor will be identical with the lookup class, even if it is a Q-type.
refc = MinimalValueTypes_1_0.getValueCapableClass(refc);
- } catch (ClassNotFoundException ex) {
- throw new NoSuchElementException(ex.getMessage());
- }
}
MemberName ctor = resolveOrFail(REF_newInvokeSpecial, refc, name, type);
return getDirectConstructor(refc, ctor);
}
--- 1260,1273 ----
*** 1424,1438 ****
* @throws NullPointerException if any argument is null
* @see #findVarHandle(Class, String, Class)
*/
public MethodHandle findGetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
if (MinimalValueTypes_1_0.isValueType(refc)) {
- try {
return ValueType.forClass(MinimalValueTypes_1_0.getValueCapableClass(refc)).findGetter(this, name, type);
- } catch (ReflectiveOperationException ex) {
- throw new IllegalStateException(ex);
- }
} else {
MemberName field = resolveOrFail(REF_getField, refc, name, type);
return getDirectField(REF_getField, refc, field);
}
}
--- 1420,1430 ----
*** 2608,2622 ****
@SuppressWarnings("unchecked")
private static <Z> ValueType<Z> valueComponent(Class<Z> clazz) {
Class<?> comp = clazz.getComponentType();
if (MinimalValueTypes_1_0.isValueType(comp)) {
- try {
return (ValueType<Z>)ValueType.forClass(MinimalValueTypes_1_0.getValueCapableClass(comp));
- } catch (ClassNotFoundException ex) {
- throw new IllegalStateException(ex);
- }
} else {
return null;
}
}
--- 2600,2610 ----
*** 3382,3396 ****
public static MethodHandle zero(Class<?> type) {
Objects.requireNonNull(type);
if (type.isPrimitive()) {
return zero(Wrapper.forPrimitiveType(type), type);
} else if (MinimalValueTypes_1_0.isValueType(type)) {
- try {
return ValueType.forClass(MinimalValueTypes_1_0.getValueCapableClass(type)).defaultValueConstant();
- } catch (ClassNotFoundException ex) {
- throw new IllegalStateException(ex);
- }
} else {
return zero(Wrapper.OBJECT, type);
}
}
--- 3370,3380 ----
*** 3424,3438 ****
if (!MinimalValueTypes_1_0.isValueType(ptype)) {
MethodType mtype = MethodType.methodType(ptype, ptype);
LambdaForm lform = LambdaForm.identityForm(BasicType.basicType(ptype));
return MethodHandleImpl.makeIntrinsic(mtype, lform, Intrinsic.IDENTITY);
} else {
- try {
return ValueType.forClass(MinimalValueTypes_1_0.getValueCapableClass(ptype)).identity();
- } catch (ReflectiveOperationException ex) {
- throw new IllegalStateException(ex);
- }
}
}
private static MethodHandle zero(Wrapper btw, Class<?> rtype) {
int pos = btw.ordinal();
--- 3408,3418 ----
< prev index next >