}
static Object[][] toAnnotationType(ClassPool cp, ParameterAnnotationsAttribute a1,
- ParameterAnnotationsAttribute a2) throws ClassNotFoundException {
+ ParameterAnnotationsAttribute a2)
+ throws ClassNotFoundException
+ {
int numParameters = 0;
if (a1 != null)
numParameters = a1.numParameters();
anno2 = a2.getAnnotations()[i];
size2 = anno2.length;
}
+
result[i] = new Object[size1 + size2];
for (int j = 0; j < size1; ++j)
result[i][j] = anno1[j].toAnnotationType(cl, cp);
*
* @return the signature
*/
- public String getSignature()
- {
+ public String getSignature() {
ConstPool constPool = getConstPool();
int methodIndex = iterator.u16bitAt(currentPos + 1); // constructor
return constPool.getMethodrefType(methodIndex);
throw new CannotCompileException(
"sorry, cannot edit NEW followed by no DUP");
}
-
+
/**
* Replaces the <tt>new</tt> expression with the bytecode derived from
* the given source text.
package javassist.util.proxy;
import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Constructor;
import java.lang.reflect.Member;
// return Thread.currentThread().getContextClassLoader();
}
+ /**
+ * Creates a proxy class and returns an instance of that class.
+ *
+ * @param paramTypes parameter types for a constructor.
+ * @param args arguments passed to a constructor.
+ */
+ public Object create(Class[] paramTypes, Object[] args)
+ throws NoSuchMethodException, IllegalArgumentException,
+ InstantiationException, IllegalAccessException, InvocationTargetException
+ {
+ Class c = createClass();
+ Constructor cons = c.getConstructor(paramTypes);
+ return cons.newInstance(args);
+ }
+
/**
* Sets the default invocation handler. This invocation handler is shared
* among all the instances of a proxy class unless another is explicitly