Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

In BCEL how to know if method is calling super method or any non super meth

807580Dec 23 2009 — edited Jan 8 2010
Class constructor can call super or this in it. Both are INVOKESPECIAL. Is there any way i can know if instrcution is calling super class method or any other method.

Class B extends A
class B(int i)
{
super(i);
}

or
class B(int i)
{
this(i,null);
}
class B(int i,String desc)
{
super(i);
}

I tried getting class name, but it is same for both super and this.

int h = cp.addMethodref( oldClass.getClassName(), m.getName(), signature);
IVOKESPECIAL newinst1 = new INVOKESPECIAL(h);
System.out.println("************************ "+newinst1.getClassName(cp));

Both cases above reutns class B for first constructor with integer parameter. How do i know that method is calling super or non-super in BCEL?

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 5 2010
Added on Dec 23 2009
6 comments
286 views