* determine the end position (exclusive) of the final case by looking at
* the gotos at the ends of the other cases
*/
private static int getFinalTarget(CFG cfg, int myPos, Collection<InstructionHandle> prevs) {
int maxGoto = 0;
BasicBlock myBB = null;
// note: InstructionHandle doesn't override equals(), so use
// prevs.contains() with caution.
Iterator<BasicBlock> bbi = cfg.blockIterator();
while (bbi.hasNext()) {
BasicBlock bb = bbi.next();
InstructionHandle last = bb.getLastInstruction(); // may be null
if (prevs.contains(last)) { // danger will robinson
Iterator<Edge> iei = cfg.outgoingEdgeIterator(bb);
while (iei.hasNext()) {
Edge e = iei.next();
int eType = e.getType();
String aab = e.toString();
if (eType == EdgeTypes.GOTO_EDGE) {
BasicBlock target = e.getTarget();
InstructionHandle targetFirst = getDeepFirstInstruction(cfg, target);
if (targetFirst != null) {
int targetPos = targetFirst.getPosition();
if (targetPos > maxGoto) {
maxGoto = targetPos;