/** * @param pool The AOPClassPool to create the optimized invocation class in * @param makeInnerClass If true creates the new class as an inner class of className * @param outerClass The class to create the invocation class as an inner class of if * makeInnerClass==true * @param className The full class name (including package info) of the invocation class to be * created * @param superInvocation The super class of this invocation * @return The created invocation class */ public static CtClass makeInvocationClass( AOPClassPool pool, boolean makeInnerClass, CtClass outerClass, String className, CtClass superInvocation) throws CannotCompileException, NotFoundException { CtClass invocation = makeInvocationClassNoCtors(pool, makeInnerClass, outerClass, className, superInvocation); // Add the invocation constructor CtConstructor[] cons = superInvocation.getDeclaredConstructors(); for (int i = 0; i < cons.length; i++) { CtConstructor conTemplate = superInvocation.getDeclaredConstructors()[i]; CtConstructor icon = CtNewConstructor.make( conTemplate.getParameterTypes(), conTemplate.getExceptionTypes(), invocation); invocation.addConstructor(icon); } return invocation; }