use of org.hotswap.agent.javassist.bytecode.ClassFile in project HotswapAgent by HotswapProjects.
the class FieldInitLink method makeClassInitializer.
public CtConstructor makeClassInitializer() throws CannotCompileException {
CtConstructor clinit = getClassInitializer();
if (clinit != null)
return clinit;
checkModify();
ClassFile cf = getClassFile2();
Bytecode code = new Bytecode(cf.getConstPool(), 0, 0);
modifyClassConstructor(cf, code, 0, 0);
return getClassInitializer();
}
use of org.hotswap.agent.javassist.bytecode.ClassFile in project HotswapAgent by HotswapProjects.
the class FieldInitLink method getAnnotations.
private Object[] getAnnotations(boolean ignoreNotFound) throws ClassNotFoundException {
ClassFile cf = getClassFile2();
AnnotationsAttribute ainfo = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag);
AnnotationsAttribute ainfo2 = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
return toAnnotationType(ignoreNotFound, getClassPool(), ainfo, ainfo2);
}
use of org.hotswap.agent.javassist.bytecode.ClassFile in project HotswapAgent by HotswapProjects.
the class FieldInitLink method toBytecode.
public void toBytecode(DataOutputStream out) throws CannotCompileException, IOException {
try {
if (isModified()) {
checkPruned("toBytecode");
ClassFile cf = getClassFile2();
if (gcConstPool) {
cf.compact();
gcConstPool = false;
}
modifyClassConstructor(cf);
modifyConstructors(cf);
if (debugDump != null)
dumpClassFile(cf);
cf.write(out);
out.flush();
fieldInitializers = null;
if (doPruning) {
// to save memory
cf.prune();
wasPruned = true;
}
} else {
classPool.writeClassfile(getName(), out);
// to save memory
// classfile = null;
}
getCount = 0;
wasFrozen = true;
} catch (NotFoundException e) {
throw new CannotCompileException(e);
} catch (IOException e) {
throw new CannotCompileException(e);
}
}
Aggregations