< prev index next >

src/java.base/share/classes/java/lang/invoke/MethodHandles.java

Print this page

        

@@ -1260,18 +1260,14 @@
             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);
         }
 

@@ -1424,15 +1420,11 @@
          * @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);
             }
         }

@@ -2608,15 +2600,11 @@
 
     @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;
         }
     }
 

@@ -3382,15 +3370,11 @@
     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);
         }
     }
 

@@ -3424,15 +3408,11 @@
         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();
< prev index next >