Search in sources :

Example 11 with MethodInfo

use of org.hotswap.agent.javassist.bytecode.MethodInfo in project HotswapAgent by HotswapProjects.

the class FieldInitLink method makeBehaviorCache.

private void makeBehaviorCache(CtMember.Cache cache) {
    List list = getClassFile3(false).getMethods();
    int n = list.size();
    for (int i = 0; i < n; ++i) {
        MethodInfo minfo = (MethodInfo) list.get(i);
        if (minfo.isMethod()) {
            CtMethod newMethod = new CtMethod(minfo, this);
            cache.addMethod(newMethod);
        } else {
            CtConstructor newCons = new CtConstructor(minfo, this);
            cache.addConstructor(newCons);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) MethodInfo(org.hotswap.agent.javassist.bytecode.MethodInfo)

Example 12 with MethodInfo

use of org.hotswap.agent.javassist.bytecode.MethodInfo in project HotswapAgent by HotswapProjects.

the class FieldInitLink method removeConstructor.

public void removeConstructor(CtConstructor m) throws NotFoundException {
    checkModify();
    MethodInfo mi = m.getMethodInfo2();
    ClassFile cf = getClassFile2();
    if (cf.getMethods().remove(mi)) {
        getMembers().remove(m);
        gcConstPool = true;
    } else
        throw new NotFoundException(m.toString());
}
Also used : ClassFile(org.hotswap.agent.javassist.bytecode.ClassFile) MethodInfo(org.hotswap.agent.javassist.bytecode.MethodInfo)

Aggregations

MethodInfo (org.hotswap.agent.javassist.bytecode.MethodInfo)12 ArrayList (java.util.ArrayList)5 List (java.util.List)5 ClassFile (org.hotswap.agent.javassist.bytecode.ClassFile)5 BadBytecode (org.hotswap.agent.javassist.bytecode.BadBytecode)3 CodeAttribute (org.hotswap.agent.javassist.bytecode.CodeAttribute)3 ConstPool (org.hotswap.agent.javassist.bytecode.ConstPool)3 CodeIterator (org.hotswap.agent.javassist.bytecode.CodeIterator)2 Iterator (java.util.Iterator)1 CtBehavior (org.hotswap.agent.javassist.CtBehavior)1 CtClass (org.hotswap.agent.javassist.CtClass)1 CtConstructor (org.hotswap.agent.javassist.CtConstructor)1 NotFoundException (org.hotswap.agent.javassist.NotFoundException)1 AnnotationDefaultAttribute (org.hotswap.agent.javassist.bytecode.AnnotationDefaultAttribute)1 Bytecode (org.hotswap.agent.javassist.bytecode.Bytecode)1 FieldInfo (org.hotswap.agent.javassist.bytecode.FieldInfo)1