From 6f319cdbcdfcd73967c506402cad169b8cd3e8ed Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 28 Aug 2008 01:49:18 +0000 Subject: [PATCH] use new targeter set rather than array --- weaver/src/org/aspectj/weaver/bcel/Range.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/Range.java b/weaver/src/org/aspectj/weaver/bcel/Range.java index c6fd1aa3c..c0d46d8f0 100644 --- a/weaver/src/org/aspectj/weaver/bcel/Range.java +++ b/weaver/src/org/aspectj/weaver/bcel/Range.java @@ -13,6 +13,7 @@ package org.aspectj.weaver.bcel; +import java.util.Iterator; import java.util.Map; import org.aspectj.apache.bcel.generic.Instruction; @@ -196,16 +197,15 @@ abstract class Range implements InstructionTargeter { protected static final Range getRange(InstructionHandle ih) { // assert isRangeHandle(ih) Range ret = null; - InstructionTargeter[] targeters = ih.getTargeters(); - if (targeters!=null) { - for (int i = targeters.length - 1; i >= 0; i--) { - if (targeters[i] instanceof Range) { - Range r = (Range) targeters[i]; + Iterator tIter = ih.getTargeters().iterator(); + while (tIter.hasNext()) { + InstructionTargeter targeter = (InstructionTargeter)tIter.next(); + if (targeter instanceof Range) { + Range r = (Range) targeter; if (r.getStart() != ih && r.getEnd() != ih) continue; - if (ret != null) throw new BCException("multiple ranges on same range handle: " + ret + ", " + targeters[i]); - ret = (Range) targeters[i]; + if (ret != null) throw new BCException("multiple ranges on same range handle: " + ret + ", " + targeter); + ret = r; } - } } if (ret == null) { throw new BCException("shouldn't happen"); -- 2.39.5