Hi,
I'm starting out with BCEL and am getting an error
that I don't understand. What i have are 2 classes
class MySuperclass
{
private String myField;
}
class MySubclass extends MySuperclass
{
private String myName;
}
I'm trying to add a method to MySuperclass as follows
public final Object getIdentity(String identity)
{
return new MyIdentity(getClass(), identity);
}
I'm struggling to work out how to get this right with
BCEL ... I've currently got to
il.append(factory.createNew(idType));
il.append(InstructionConstants.DUP);
il.append(factory.createInvoke(className, "getClass",
new ObjectType(Class.class.getName()), Type.NO_ARGS,
Constants.INVOKESPECIAL));
// new MyIdentity(getClass(), str);
il.append(factory.createInvoke(idType.getClassName(),
Constants.CONSTRUCTOR_NAME, Type.VOID, new
Type[]{Class.class.getName(), Type.STRING},
Constants.INVOKESPECIAL));
il.append(InstructionFactory.createReturn(idType));
and its complaining about "Expecting to find
object/array on stack", so I need to put the result of
getClass() on the stack ? How do I do this ?
Thanks
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]