rendered paste body ClassGen addMethodToReturnField(ClassGen cg, String methodname, Type methodtype, String classname, String fieldname, Type fieldtype, short type) {
ConstantPoolGen cpg = cg.getConstantPool();
InstructionList il = new InstructionList();
InstructionFactory factory = new InstructionFactory(cg, cpg);
MethodGen mg = new MethodGen(Constants.ACC_PUBLIC, methodtype, Type.NO_ARGS, new String[]{}, methodname, cg.getClassName(), il, cpg);
il.append(new ALOAD(0));
il.append(factory.createFieldAccess(classname, fieldname, fieldtype, type));
il.append(InstructionFactory.createReturn(fieldtype));
mg.setMaxLocals();
mg.setMaxStack();
cg.addMethod(mg.getMethod());
Update.hookCounter++;
System.out.println(methodname + " injected -> " + classname + "." + fieldname + " to class "+ cg.getClassName());
return cg;
}