Hello
I want to generator to the following class :
class ReferencedClass {
// some ops, fields etc here
}
class MyClass {
// static reference to the other class <------ I need this
static final Class<?> refClass = ReferencedClass.class;
}
The BCELifier generates the following code:
private void createMethod_0() {
InstructionList il = new InstructionList();
MethodGen method = new MethodGen(ACC_STATIC, Type.VOID,
Type.NO_ARGS, new String[] { }, "<clinit>", "ReferencedClass", il, _cp);
il.append(new PUSH(_cp, CONSTANT_Class[7](name_index = 18)));
il.append(_factory.createFieldAccess("MyClass", "cls", new
ObjectType("java.lang.Class"), Constants.PUTSTATIC));
il.append(_factory.createReturn(Type.VOID));
method.setMaxStack();
method.setMaxLocals();
_cg.addMethod(method.getMethod());
il.dispose();
}
Apparently this doesn't work for code generation. Any ideas how to solve
the issue?
-valeri
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]