commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1746381 - in /commons/proper/bcel/trunk/src: main/java/org/apache/commons/bcel6/classfile/StackMap.java main/java/org/apache/commons/bcel6/classfile/StackMapEntry.java test/java/org/apache/commons/bcel6/generic/JDKGenericDumpTestCase.java
Date Wed, 01 Jun 2016 04:33:06 GMT
Author: ggregory
Date: Wed Jun  1 04:33:06 2016
New Revision: 1746381

URL: http://svn.apache.org/viewvc?rev=1746381&view=rev
Log:
Convert for loops to enhanced for loops.

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMap.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapEntry.java
    commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/JDKGenericDumpTestCase.java

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMap.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMap.java?rev=1746381&r1=1746380&r2=1746381&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMap.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMap.java
Wed Jun  1 04:33:06 2016
@@ -103,8 +103,8 @@ public final class StackMap extends Attr
     public final void setStackMap( final StackMapEntry[] map ) {
         this.map = map;
         int len = 2; // Length of 'number_of_entries' field prior to the array of stack maps
-        for (int i = 0; i < map.length; i++) {
-            len += map[i].getMapEntrySize();
+        for (StackMapEntry element : map) {
+            len += element.getMapEntrySize();
         }
         setLength(len);
     }

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapEntry.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapEntry.java?rev=1746381&r1=1746380&r2=1746381&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapEntry.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapEntry.java
Wed Jun  1 04:33:06 2016
@@ -242,17 +242,17 @@ public final class StackMapEntry impleme
             return 3;
         } else if (frame_type >= Const.APPEND_FRAME && frame_type <= Const.APPEND_FRAME_MAX)
{
             int len = 3;
-            for (int i = 0; i < types_of_locals.length; i++) {
-                len += types_of_locals[i].hasIndex() ? 3 : 1;
+            for (StackMapType types_of_local : types_of_locals) {
+                len += types_of_local.hasIndex() ? 3 : 1;
             }            
             return len;
         } else if (frame_type == Const.FULL_FRAME) {        
             int len = 7;
-            for (int i = 0; i < types_of_locals.length; i++) {
-                len += types_of_locals[i].hasIndex() ? 3 : 1;
+            for (StackMapType types_of_local : types_of_locals) {
+                len += types_of_local.hasIndex() ? 3 : 1;
             }
-            for (int i = 0; i < types_of_stack_items.length; i++) {
-                len += types_of_stack_items[i].hasIndex() ? 3 : 1;
+            for (StackMapType types_of_stack_item : types_of_stack_items) {
+                len += types_of_stack_item.hasIndex() ? 3 : 1;
             }
             return len;
         } else {

Modified: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/JDKGenericDumpTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/JDKGenericDumpTestCase.java?rev=1746381&r1=1746380&r2=1746381&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/JDKGenericDumpTestCase.java
(original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/generic/JDKGenericDumpTestCase.java
Wed Jun  1 04:33:06 2016
@@ -105,8 +105,8 @@ public class JDKGenericDumpTestCase {
     private static String bytesToHex(final byte[] bytes) {
         char[] hexChars = new char[bytes.length * 3];
         int i=0;
-        for ( int j = 0; j < bytes.length; j++ ) {
-            int v = bytes[j] & 0xFF;
+        for (byte b : bytes) {
+            int v = b & 0xFF;
             hexChars[i++] = hexArray[v >>> 4];
             hexChars[i++] = hexArray[v & 0x0F];
             hexChars[i++] = ' ';



Mime
View raw message