1 import java.lang.reflect.*;
   2 
   3 public class Test {
   4 
   5     public boolean m1(A a, Boolean early_return) {
   6         if (early_return.booleanValue()) return true;
   7         boolean res =  m2(a);
   8         return res;
   9     }
  10 
  11     public boolean m2(A a) {
  12         boolean res = false;
  13         if (a.getClass() == B.class) {
  14             a.m();
  15         } else {
  16             res = true;
  17         }
  18         return res;
  19     }
  20 
  21     public void m3(ClassLoader loader) throws Exception {
  22         Class Test_class = loader.loadClass("Test");
  23         Object test = Test_class.newInstance();
  24         Class A_class = loader.loadClass("A");
  25         Object a = A_class.newInstance();
  26         Class B_class = loader.loadClass("B");
  27         Object b = B_class.newInstance();
  28         Method m1 = Test_class.getMethod("m1", A_class, Boolean.class);
  29 
  30         // So we don't hit uncommon trap in the next loop
  31         for (int i = 0; i < 4000; i++) {
  32             m4(m1, test, a, Boolean.TRUE);
  33             m4(m1, test, b, Boolean.TRUE);
  34         }
  35         for (int i = 0; i < 20000; i++) {
  36             m4(m1, test, a, Boolean.FALSE);
  37         }
  38         for (int i = 0; i < 4; i++) {
  39             m4(m1, test, b, Boolean.FALSE);
  40         }
  41     }
  42 
  43     public Object m4(Method m, Object test, Object a, Object early_return) throws Exception {
  44         return m.invoke(test, a, early_return);
  45     }
  46 
  47     static public A a = new A();
  48     static public B b = new B();
  49 }
  50