Java Code Examples for org.objectweb.asm.Type#getConstructorDescriptor()

The following examples show how to use org.objectweb.asm.Type#getConstructorDescriptor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CallableMethodPool.java    From botsing with Apache License 2.0 6 votes vote down vote up
private GenericAccessibleObject<?> getGenericObject(String method) {
    for(GenericAccessibleObject obj: allMethods){
        if(obj.isMethod()){
            String objMethodName = obj.getName()+Type.getMethodDescriptor(((GenericMethod) obj).getMethod());
            if(objMethodName.equals(method)){
                return obj;
            }
        }else if (obj.isConstructor()){
            String objConstructorNameName = "<init>"+Type.getConstructorDescriptor(((GenericConstructor) obj).getConstructor());
            if(objConstructorNameName.equals(method)){
                return obj;
            }
        }else{
            throw new IllegalStateException();
        }

    }
    LOG.info("method "+method+" is not detected!");
    return null;
}
 
Example 2
Source File: StackTraceChromosomeFactory.java    From botsing with Apache License 2.0 5 votes vote down vote up
private void fillPublicCalls(){

        BytecodeInstruction publicCallInStackTrace =  utility.collectPublicCalls(targetTrace);
        Class targetClass = null;
        try {
            targetClass = Class.forName(publicCallInStackTrace.getClassName(),false,TestGenerationContextUtility.getTestGenerationContextClassLoader(false));
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        Set<Method> methods = TestClusterUtils.getMethods(targetClass);
        for(Method method: methods){
            GenericAccessibleObject methodObj = new GenericMethod(method,targetClass);
            allMethods.add(methodObj);
            String methodName = method.getName()+Type.getMethodDescriptor(method);
            if(methodName.equals(publicCallInStackTrace.getMethodName())){
                publicParentCalls.add(methodObj);
            }
        }

        Set<Constructor<?>> constructors = TestClusterUtils.getConstructors(targetClass);
        for (Constructor constructor : constructors){
            GenericAccessibleObject constructorObj = new GenericConstructor(constructor,targetClass);
            allMethods.add(constructorObj);
            String constructorName = "<init>"+Type.getConstructorDescriptor(constructor);
            if(constructorName.equals(publicCallInStackTrace.getMethodName())){
                publicParentCalls.add(constructorObj);
            }
        }
    }
 
Example 3
Source File: BytecodeGenerator.java    From slab with MIT License 5 votes vote down vote up
public BytecodeGenerator(TypeInspector inspector, Class<T> representingKlass, SlabOptions options) {
    this.inspector = inspector;
    this.options = options;
    implementationName = "DirectMemory" + representingKlass.getSimpleName();
    if (representingKlass.isInterface()) {
    	classExtended =  DIRECT_CLASS_NAME;
    	constructorExtended = DIRECT_CLASS_CONSTRUCTOR;
    	interfacesImplemented = new String[] { Type.getInternalName(representingKlass) };
    } else {
    	classExtended = Type.getInternalName(representingKlass);
    	constructorExtended = Type.getConstructorDescriptor(representingKlass.getConstructors()[0]);
    	interfacesImplemented = null;
    }
}
 
Example 4
Source File: RuntimeClassMirrors.java    From Concurnas with MIT License 4 votes vote down vote up
@Override
public String getMethodDescriptor() {
       return Type.getConstructorDescriptor(con);
}
 
Example 5
Source File: MethodDescription.java    From byte-buddy with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public String getDescriptor() {
    return Type.getConstructorDescriptor(constructor);
}
 
Example 6
Source File: Method.java    From Concurnas with MIT License 2 votes vote down vote up
/**
 * Creates a new {@link Method}.
 *
 * @param constructor a java.lang.reflect constructor descriptor
 * @return a {@link Method} corresponding to the given Java constructor declaration.
 */
public static Method getMethod(final java.lang.reflect.Constructor<?> constructor) {
  return new Method("<init>", Type.getConstructorDescriptor(constructor));
}
 
Example 7
Source File: Method.java    From JByteMod-Beta with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new {@link Method}.
 *
 * @param constructor a java.lang.reflect constructor descriptor
 * @return a {@link Method} corresponding to the given Java constructor declaration.
 */
public static Method getMethod(final java.lang.reflect.Constructor<?> constructor) {
  return new Method("<init>", Type.getConstructorDescriptor(constructor));
}
 
Example 8
Source File: Method.java    From JReFrameworker with MIT License 2 votes vote down vote up
/**
 * Creates a new {@link Method}.
 *
 * @param constructor a java.lang.reflect constructor descriptor
 * @return a {@link Method} corresponding to the given Java constructor declaration.
 */
public static Method getMethod(final java.lang.reflect.Constructor<?> constructor) {
  return new Method("<init>", Type.getConstructorDescriptor(constructor));
}
 
Example 9
Source File: Method.java    From JReFrameworker with MIT License 2 votes vote down vote up
/**
 * Creates a new {@link Method}.
 *
 * @param constructor a java.lang.reflect constructor descriptor
 * @return a {@link Method} corresponding to the given Java constructor declaration.
 */
public static Method getMethod(final java.lang.reflect.Constructor<?> constructor) {
  return new Method("<init>", Type.getConstructorDescriptor(constructor));
}