112 private static void runMethod(Random random, String name) { |
112 private static void runMethod(Random random, String name) { |
113 while (stresser.continueExecution()) { |
113 while (stresser.continueExecution()) { |
114 try { |
114 try { |
115 // Just for fun we transfer parameters to method |
115 // Just for fun we transfer parameters to method |
116 Object res = myClass.getMethod(name, double.class, int.class, Object.class) |
116 Object res = myClass.getMethod(name, double.class, int.class, Object.class) |
117 .invoke(null, random.nextDouble(), random.nextInt(), new Object()); |
117 .invoke(myClass.newInstance(), random.nextDouble(), random.nextInt(), new Object()); |
118 } catch (IllegalArgumentException | InvocationTargetException |
118 } catch (IllegalArgumentException | InvocationTargetException | InstantiationException |
119 | IllegalAccessException | NoSuchMethodException e) { |
119 | IllegalAccessException | NoSuchMethodException e) { |
120 // It's okay to get exception here since we are corrupting bytecode and can't expect |
120 // It's okay to get exception here since we are corrupting bytecode and can't expect |
121 // class to work properly. |
121 // class to work properly. |
122 System.out.println("Got expected exception: " + e.toString()); |
122 System.out.println("Got expected exception: " + e.toString()); |
123 } |
123 } |