commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r1661082 - in /commons/proper/bcel/trunk/src: main/java/org/apache/bcel/generic/MethodGen.java main/java/org/apache/bcel/generic/TargetLostException.java site/xdoc/manual.xml
Date Fri, 20 Feb 2015 10:21:53 GMT
Author: ebourg
Date: Fri Feb 20 10:21:53 2015
New Revision: 1661082

URL: http://svn.apache.org/r1661082
Log:
foreach loops in the blocks handling TargetLostException

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java
    commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/TargetLostException.java
    commons/proper/bcel/trunk/src/site/xdoc/manual.xml

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java?rev=1661082&r1=1661081&r2=1661082&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/MethodGen.java Fri Feb
20 10:21:53 2015
@@ -716,10 +716,8 @@ public class MethodGen extends FieldGenO
                     try {
                         il.delete(ih);
                     } catch (TargetLostException e) {
-                        InstructionHandle[] targets = e.getTargets();
-                        for (InstructionHandle target : targets) {
-                            InstructionTargeter[] targeters = target.getTargeters();
-                            for (InstructionTargeter targeter : targeters) {
+                        for (InstructionHandle target : e.getTargets()) {
+                            for (InstructionTargeter targeter : target.getTargeters()) {
                                 targeter.updateTarget(target, next);
                             }
                         }

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/TargetLostException.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/TargetLostException.java?rev=1661082&r1=1661081&r2=1661082&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/TargetLostException.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/generic/TargetLostException.java
Fri Feb 20 10:21:53 2015
@@ -18,8 +18,8 @@
 package org.apache.bcel.generic;
 
 /**
- * Thrown by InstructionList.remove() when one or multiple disposed instruction
- * are still being referenced by a InstructionTargeter object. I.e. the
+ * Thrown by InstructionList.remove() when one or multiple disposed instructions
+ * are still being referenced by an InstructionTargeter object. I.e. the
  * InstructionTargeter has to be notified that (one of) the InstructionHandle it
  * is referencing is being removed from the InstructionList and thus not valid anymore.
  *
@@ -30,15 +30,13 @@ package org.apache.bcel.generic;
  * <PRE>
  *     ...
  *     try {
- *    il.delete(start_ih, end_ih);
+ *         il.delete(start_ih, end_ih);
  *     } catch(TargetLostException e) {
- *       InstructionHandle[] targets = e.getTargets();
- *     for(int i=0; i &lt; targets.length; i++) {
- *       InstructionTargeter[] targeters = targets[i].getTargeters();
- *     
- *       for(int j=0; j &lt; targeters.length; j++)
- *         targeters[j].updateTarget(targets[i], new_target);
- *       }
+ *         for (InstructionHandle target : e.getTargets()) {
+ *             for (InstructionTargeter targeter : target.getTargeters()) {
+ *                 targeter.updateTarget(target, new_target);
+ *             }
+ *         }
  *     }
  * </PRE>
  *

Modified: commons/proper/bcel/trunk/src/site/xdoc/manual.xml
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/site/xdoc/manual.xml?rev=1661082&r1=1661081&r2=1661082&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/site/xdoc/manual.xml (original)
+++ commons/proper/bcel/trunk/src/site/xdoc/manual.xml Fri Feb 20 10:21:53 2015
@@ -958,11 +958,9 @@
   try {
       il.delete(first, last);
   } catch (TargetLostException e) {
-      InstructionHandle[] targets = e.getTargets();
-      for (int i = 0; i &lt; targets.length; i++) {
-          InstructionTargeter[] targeters = targets[i].getTargeters();
-          for (int j = 0; j &lt; targeters.length; j++) {
-             targeters[j].updateTarget(targets[i], new_target);
+      for (InstructionHandle target : e.getTargets()) {
+          for (InstructionTargeter targeter : target.getTargeters()) {
+             targeter.updateTarget(target, new_target);
           }
       }
   }
@@ -1636,12 +1634,9 @@ public class Peephole {
             try {
                 il.delete(first, last);
             } catch (TargetLostException e) {
-                InstructionHandle[] targets = e.getTargets();
-                for (int i = 0; i &lt; targets.length; i++) {
-                    InstructionTargeter[] targeters = targets[i].getTargeters();
-                    
-                    for (int j = 0; j &lt; targeters.length; j++) {
-                        targeters[j].updateTarget(targets[i], next);
+                for (InstructionHandle target : e.getTargets()) {
+                    for (InstructionTargeter targeter = target.getTargeters()) {
+                        targeter.updateTarget(target, next);
                     }
                 }
             }



Mime
View raw message