commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1697916 - /commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/BootstrapMethod.java
Date Wed, 26 Aug 2015 12:57:13 GMT
Author: sebb
Date: Wed Aug 26 12:57:13 2015
New Revision: 1697916

URL: http://svn.apache.org/r1697916
Log:
Follow-up to BCEL-209 Drop the field num_bootstrap_arguments
it is not necessary, and was not kept in sync if the arguments were updated

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/BootstrapMethod.java

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/BootstrapMethod.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/BootstrapMethod.java?rev=1697916&r1=1697915&r2=1697916&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/BootstrapMethod.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/BootstrapMethod.java
Wed Aug 26 12:57:13 2015
@@ -20,6 +20,7 @@ package org.apache.commons.bcel6.classfi
 import java.io.DataInput;
 import java.io.DataOutputStream;
 import java.io.IOException;
+import java.util.Arrays;
 
 import org.apache.commons.bcel6.Constants;
 
@@ -37,8 +38,6 @@ public class BootstrapMethod implements
     /** Index of the CONSTANT_MethodHandle_info structure in the constant_pool table */
     private int bootstrap_method_ref;
 
-    private final int num_bootstrap_arguments;
-
     /** Array of references to the constant_pool table */
     private int[] bootstrap_arguments;
 
@@ -59,8 +58,7 @@ public class BootstrapMethod implements
     BootstrapMethod(DataInput input) throws IOException {
         this(input.readUnsignedShort(), input.readUnsignedShort(), (int[]) null);
 
-        bootstrap_arguments = new int[num_bootstrap_arguments];
-        for (int i = 0; i < num_bootstrap_arguments; i++) {
+        for (int i = 0; i < bootstrap_arguments.length; i++) {
             bootstrap_arguments[i] = input.readUnsignedShort();
         }
     }
@@ -73,7 +71,7 @@ public class BootstrapMethod implements
      */
     public BootstrapMethod(int bootstrap_method_ref, int num_bootstrap_arguments, int[] bootstrap_arguments)
{
         this.bootstrap_method_ref = bootstrap_method_ref;
-        this.num_bootstrap_arguments = num_bootstrap_arguments;
+        this.bootstrap_arguments = new int[num_bootstrap_arguments];
         this.bootstrap_arguments = bootstrap_arguments;
     }
 
@@ -102,7 +100,7 @@ public class BootstrapMethod implements
      * @return count of number of boostrap arguments
      */
     public int getNumBootstrapArguments() {
-        return num_bootstrap_arguments;
+        return bootstrap_arguments.length;
     }
 
     /**
@@ -117,10 +115,8 @@ public class BootstrapMethod implements
      */
     @Override
     public final String toString() {
-        return "BootstrapMethod(" + bootstrap_method_ref + ", " + num_bootstrap_arguments
+ ", "
-               //UNDONE
-               //+ bootstrap_arguments + ")";
-               + "UNDONE)";
+        return "BootstrapMethod(" + bootstrap_method_ref + ", " + bootstrap_arguments.length
+ ", "
+               + Arrays.toString(bootstrap_arguments) + ")";
     }
 
     /**
@@ -132,6 +128,7 @@ public class BootstrapMethod implements
         bootstrap_method_name = constant_pool.constantToString(bootstrap_method_ref,
                 Constants.CONSTANT_MethodHandle);
         buf.append(Utility.compactClassName(bootstrap_method_name));
+        final int num_bootstrap_arguments = bootstrap_arguments.length;
         if (num_bootstrap_arguments > 0) {
             buf.append("\n     Method Arguments:");
             for (int i = 0; i < num_bootstrap_arguments; i++) {



Mime
View raw message