jakarta-bcel-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurent Martelli <laur...@aopsys.com>
Subject Re: How to determine index of local variable if don't know name
Date Tue, 20 Jan 2004 15:23:44 GMT
>>>>> "Rodney" == Rodney Mach <rmach@umich.edu> writes:

  Rodney> Hi, I have a question regarding getting the index of a local
  Rodney> variable when I don't know the name of the variable apriori.

  Rodney>  I am going through looking for certain pattern, in this
  Rodney> case every time the "add" method is called on any ArrayList,
  Rodney> what I want to do is after that line insert some code that
  Rodney> modifies the referenced arraylist.

  Rodney> The problem I am having is I don't know how to get the index
  Rodney> to the arraylist being modified if I don't know the variable
  Rodney> name apriori (if I know it then I look through the local
  Rodney> variable table, find the index, and can call ALOAD with that
  Rodney> index and everything works fine I did figure out that much).

Maybe you'd better insert a DUP before the call to add so that you can
get a reference to the list. And it will work even if the list is't
referenced by a local variable.

Laurent Martelli
laurent@aopsys.com                                Java Aspect Components
http://www.aopsys.com/                             http://jac.aopsys.com

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

View raw message