Search in sources :

Example 76 with CtMethod

use of javassist.CtMethod in project leopard by tanhaichao.

the class CtClassUtil method getParameterNames.

public static String[] getParameterNames(Class<?> clazz, Method method) {
    CtMethod ctMethod;
    try {
        ctMethod = CtClassUtil.getMethod(clazz, method);
    } catch (NotFoundException e) {
        Throwable error = e.getCause();
        if (error instanceof RuntimeException) {
            throw (RuntimeException) error;
        }
        if (error instanceof Exception) {
            throw new RuntimeException(error.getMessage(), error);
        }
        throw new RuntimeException(e.getMessage(), e);
    }
    String[] names;
    try {
        names = getParameterNames(ctMethod);
    } catch (NotFoundException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
    // System.err.println("getParameterNames methodName:" + method.toGenericString() + " names:" + StringUtils.join(names, ", "));
    return names;
}
Also used : NotFoundException(javassist.NotFoundException) CtMethod(javassist.CtMethod) NotFoundException(javassist.NotFoundException)

Aggregations

CtMethod (javassist.CtMethod)76 CtClass (javassist.CtClass)46 NotFoundException (javassist.NotFoundException)23 CannotCompileException (javassist.CannotCompileException)20 ClassPool (javassist.ClassPool)18 CtField (javassist.CtField)14 Test (org.junit.Test)12 IOException (java.io.IOException)10 InitMethod (com.googlecode.gwt.test.patchers.InitMethod)6 Method (java.lang.reflect.Method)5 CtConstructor (javassist.CtConstructor)5 EnhancementException (org.hibernate.bytecode.enhance.spi.EnhancementException)4 GwtTestPatchException (com.googlecode.gwt.test.exceptions.GwtTestPatchException)3 PinpointException (com.navercorp.pinpoint.exception.PinpointException)3 File (java.io.File)3 FileNotFoundException (java.io.FileNotFoundException)3 ArrayList (java.util.ArrayList)3 PatchMethod (com.googlecode.gwt.test.patchers.PatchMethod)2 FileFilter (java.io.FileFilter)2 IllegalClassFormatException (java.lang.instrument.IllegalClassFormatException)2