*/
public int[] getAccessedLocalsIndices(){
//TODO: Implement caching.
Set acc = new HashSet();
if (theRET == null && this != TOPLEVEL){
throw new AssertionViolatedException("This subroutine object must be built up completely before calculating accessed locals.");
}
Iterator i = instructions.iterator();
while (i.hasNext()){
InstructionHandle ih = (InstructionHandle) i.next();
// RET is not a LocalVariableInstruction in the current version of BCEL.
if (ih.getInstruction() instanceof LocalVariableInstruction || ih.getInstruction() instanceof RET){
int idx = ((IndexedInstruction) (ih.getInstruction())).getIndex();
acc.add(new Integer(idx));
// LONG? DOUBLE?.
try{
// LocalVariableInstruction instances are typed without the need to look into
// the constant pool.
if (ih.getInstruction() instanceof LocalVariableInstruction){
int s = ((LocalVariableInstruction) ih.getInstruction()).getType(null).getSize();
if (s==2) {
acc.add(new Integer(idx+1));
}
}
}
catch(RuntimeException re){
throw new AssertionViolatedException("Oops. BCEL did not like NULL as a ConstantPoolGen object.");
}
}
}
int[] ret = new int[acc.size()];