/** * Get the constructor of the definition * and invoke it. * @return the instantiated <code>Object</code>, will never be null. */ private Object createAndSet(Project project, Class<?> c) { try { return innerCreateAndSet(c, project); } catch (InvocationTargetException ex) { Throwable t = ex.getTargetException(); throw new BuildException( "Could not create type " + name + " due to " + t, t); } catch (NoClassDefFoundError ncdfe) { String msg = "Type " + name + ": A class needed by class " + c + " cannot be found: " + ncdfe.getMessage(); throw new BuildException(msg, ncdfe); } catch (NoSuchMethodException nsme) { throw new BuildException("Could not create type " + name + " as the class " + c + " has no compatible constructor"); } catch (InstantiationException nsme) { throw new BuildException("Could not create type " + name + " as the class " + c + " is abstract"); } catch (IllegalAccessException e) { throw new BuildException("Could not create type " + name + " as the constructor " + c + " is not accessible"); } catch (Throwable t) { throw new BuildException( "Could not create type " + name + " due to " + t, t); } }
def.innerCreateAndSet(clazz, project);