public <T> Collection<? extends T> instantiateSubclasses(
     Class<T> parentType,
     String packagePath,
     Class[] constructorParams,
     Object[] constructorArgs) {
   Collection<T> result = new HashSet<T>();
   for (Class<? extends T> clazz : getDescendants(parentType, packagePath)) {
     if (Utils.isInstantiable(clazz)) {
       result.add(newInstance(constructorParams, constructorArgs, clazz));
     }
   }
   return result;
 }
 private String errorMessage(Method method, Object[] javaArgs) {
   StringBuilder m =
       new StringBuilder("Couldn't invoke ")
           .append(method.toGenericString())
           .append(" with ")
           .append(Utils.join(javaArgs, ","))
           .append(" (");
   boolean comma = false;
   for (Object javaArg : javaArgs) {
     if (comma) m.append(",");
     m.append(javaArg.getClass());
     comma = true;
   }
   m.append(")");
   return m.toString();
 }
 @Override
 public void loadGlue(Glue glue, List<String> gluePaths) {
   super.loadGlue(glue, gluePaths);
   // add 'test' source folder in Application Classloader
   if (!Play.javaPath.contains("test")) {
     Play.javaPath.add(Play.getVirtualFile("test"));
     // Restart Applications
     Play.stop();
     Play.start();
   }
   for (Class glueCodeClass : Play.classloader.getAllClasses()) {
     while (glueCodeClass != Object.class
         && !glueCodeClass.isInterface()
         && !Utils.isInstantiable(glueCodeClass)) {
       // those can't be instantiated without container class present.
       glueCodeClass = glueCodeClass.getSuperclass();
     }
     for (Method method : glueCodeClass.getMethods()) {
       loadGlue(glue, method);
     }
   }
 }