Search in sources :

Example 1 with FieldInfo

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

the class FieldInitLink method makeFieldCache.

private void makeFieldCache(CtMember.Cache cache) {
    List list = getClassFile3(false).getFields();
    int n = list.size();
    for (int i = 0; i < n; ++i) {
        FieldInfo finfo = (FieldInfo) list.get(i);
        CtField newField = new CtField(finfo, this);
        cache.addField(newField);
    }
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) FieldInfo(org.hotswap.agent.javassist.bytecode.FieldInfo)

Example 2 with FieldInfo

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

the class FieldInitLink method removeField.

public void removeField(CtField f) throws NotFoundException {
    checkModify();
    FieldInfo fi = f.getFieldInfo2();
    ClassFile cf = getClassFile2();
    if (cf.getFields().remove(fi)) {
        getMembers().remove(f);
        gcConstPool = true;
    } else
        throw new NotFoundException(f.toString());
}
Also used : ClassFile(org.hotswap.agent.javassist.bytecode.ClassFile) FieldInfo(org.hotswap.agent.javassist.bytecode.FieldInfo)

Example 3 with FieldInfo

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

the class FieldInitLink method makeMemberList.

private void makeMemberList(HashMap table) {
    int mod = getModifiers();
    if (Modifier.isAbstract(mod) || Modifier.isInterface(mod))
        try {
            CtClass[] ifs = getInterfaces();
            int size = ifs.length;
            for (int i = 0; i < size; i++) {
                CtClass ic = ifs[i];
                if (ic != null && ic instanceof CtClassType)
                    ((CtClassType) ic).makeMemberList(table);
            }
        } catch (NotFoundException e) {
        }
    try {
        CtClass s = getSuperclass();
        if (s != null && s instanceof CtClassType)
            ((CtClassType) s).makeMemberList(table);
    } catch (NotFoundException e) {
    }
    List list = getClassFile2().getMethods();
    int n = list.size();
    for (int i = 0; i < n; i++) {
        MethodInfo minfo = (MethodInfo) list.get(i);
        table.put(minfo.getName(), this);
    }
    list = getClassFile2().getFields();
    n = list.size();
    for (int i = 0; i < n; i++) {
        FieldInfo finfo = (FieldInfo) list.get(i);
        table.put(finfo.getName(), this);
    }
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) MethodInfo(org.hotswap.agent.javassist.bytecode.MethodInfo) FieldInfo(org.hotswap.agent.javassist.bytecode.FieldInfo)

Aggregations

FieldInfo (org.hotswap.agent.javassist.bytecode.FieldInfo)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ClassFile (org.hotswap.agent.javassist.bytecode.ClassFile)1 MethodInfo (org.hotswap.agent.javassist.bytecode.MethodInfo)1