jakarta-bcel-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zagiatakrapo...@gmx.ch
Subject Polymorphism and BCEL
Date Tue, 21 Oct 2008 16:47:48 GMT
Hi,

Getting the code of a method that is called through the invokevirtual instruction means lots
of work. Due to polymorphism the dynamic type of the caller reference may be any type in the
transitive closure of the static type.
Therefore you have to build up the a tree with all possible descendants of the static type
and look into all the methods that match the signature. I'm curious  if there is any support
for this in BCEL or if just everybody builds his own tree and traverse it.

zagi


here an example:

class A
  m1()

class B extends A
  m1()

used:
 A inst = new A();
 inst.m1(); // m1 of A
 inst = new B();
 inst.m1(); // m1 of B

in both cases the bytecode looks like:
invokevirtual A/m1()V

now you want to get hand on the instructionlist of any matching method i.e. m1 of A and m1
of B

-- 
"Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
Jetzt GMX ProMail testen: http://www.gmx.net/de/go/promail

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


Mime
View raw message