< prev index next >

test/java/lang/invoke/LFCaching/TestMethods.java

Print this page

        

@@ -608,30 +608,11 @@
      *
      * @param arity Arity of returned method type.
      * @return MethodType generated randomly.
      */
     private static MethodType randomMethodTypeGenerator(int arity) {
-        final Class<?>[] CLASSES = {
-            Object.class,
-            int.class,
-            boolean.class,
-            byte.class,
-            short.class,
-            char.class,
-            long.class,
-            float.class,
-            double.class
-        };
-        if (arity > Helper.MAX_ARITY) {
-            throw new IllegalArgumentException(
-                    String.format("Arity should not exceed %d!", Helper.MAX_ARITY));
-        }
-        List<Class<?>> list = Helper.randomClasses(CLASSES, arity);
-        list = Helper.getParams(list, false, arity);
-        int i = Helper.RNG.nextInt(CLASSES.length + 1);
-        Class<?> rtype = i == CLASSES.length ? void.class : CLASSES[i];
-        return MethodType.methodType(rtype, list);
+        return Helper.randomMethodTypeGenerator(arity);
     }
 
     /**
      * Routine used to obtain a method handles of a given type an kind (return
      * value).
< prev index next >