Question on static class references

Валерий Атаманюк <[email protected]> Sat, 18 Nov 2006 13:05:48 +0200
Newsgroups gmane.comp.jakarta.bcel.user
Message-ID <[email protected]>
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