You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-user@jakarta.apache.org by paul burrows <pa...@yahoo.com> on 2004/12/05 13:19:42 UTC

java.lang.IncompatibleClassChangeError

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: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org


Re: java.lang.IncompatibleClassChangeError

Posted by paul burrows <pa...@yahoo.com>.
Never mind. I just found BCELifier, and it answers all
of my questions :-)

Thanks



		
__________________________________ 
Do you Yahoo!? 
All your favorites on one personal page � Try My Yahoo!
http://my.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org