@Test public void testInstantiate() throws Exception { Reflection.instantiateClass(A.class); }
public static <T> T instantiate(Class<T> clazz) throws BeanInstantiationException { if (clazz.isInterface()) { throw new BeanInstantiationException(clazz, "specified class is an interface"); } try { return clazz.newInstance(); } catch (InstantiationException e) { throw new BeanInstantiationException(clazz, "Is it an abstract class?", e); } catch (IllegalAccessException e) { throw new BeanInstantiationException(clazz, "Is the constructor accessible?", e); } }
Reflection { public static <T> T instantiate(Class<T> clazz) throws BeanInstantiationException { if (clazz.isInterface()) { throw new BeanInstantiationException(clazz, "specified class is an interface"); } try { return clazz.newInstance(); } catch (InstantiationException e) { throw new BeanInstantiationException(clazz, "Is it an abstract class?", e); } catch (IllegalAccessException e) { throw new BeanInstantiationException(clazz, "Is the constructor accessible?", e); } } }
Reflection { public static <T> T instantiate(Class<T> clazz) throws BeanInstantiationException { if (clazz.isInterface()) { throw new BeanInstantiationException(clazz, "specified class is an interface"); } try { return clazz.newInstance(); } catch (InstantiationException e) { throw new BeanInstantiationException(clazz, "Is it an abstract class?", e); } catch (IllegalAccessException e) { throw new BeanInstantiationException(clazz, "Is the constructor accessible?", e); } }  }
Reflection { public static <T> T instantiate(Class<T> clazz) throws BeanInstantiationException { if (clazz.isInterface()) { throw new BeanInstantiationException(clazz, "specified class is an interface"); } try { return clazz.newInstance(); } catch (InstantiationException e) { throw new BeanInstantiationException(clazz, "Is it an abstract class?", e); } catch (IllegalAccessException e) { throw new BeanInstantiationException(clazz, "Is the constructor accessible?", e); } }  static T instantiate(Class<T> clazz); static T instantiateClass(Class<T> clazz); static T instantiateClass(Constructor<T> ctor, Object... args); static T newProxy(
      Class<T> interfaceType, InvocationHandler handler); static void makeAccessible(Constructor<?> ctor); static Set<Annotation> getAnnotations(Class<?> clazz); }
Reflection { public static <T> T instantiate(Class<T> clazz) throws BeanInstantiationException { if (clazz.isInterface()) { throw new BeanInstantiationException(clazz, "specified class is an interface"); } try { return clazz.newInstance(); } catch (InstantiationException e) { throw new BeanInstantiationException(clazz, "Is it an abstract class?", e); } catch (IllegalAccessException e) { throw new BeanInstantiationException(clazz, "Is the constructor accessible?", e); } }  static T instantiate(Class<T> clazz); static T instantiateClass(Class<T> clazz); static T instantiateClass(Constructor<T> ctor, Object... args); static T newProxy(
      Class<T> interfaceType, InvocationHandler handler); static void makeAccessible(Constructor<?> ctor); static Set<Annotation> getAnnotations(Class<?> clazz);  }