You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2015/08/10 20:13:53 UTC

svn commit: r1695148 - /commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapType.java

Author: sebb
Date: Mon Aug 10 18:13:52 2015
New Revision: 1695148

URL: http://svn.apache.org/r1695148
Log:
Don't call overrideable methods from a constructor

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

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapType.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapType.java?rev=1695148&r1=1695147&r2=1695148&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapType.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/StackMapType.java Mon Aug 10 18:13:52 2015
@@ -51,9 +51,9 @@ public final class StackMapType implemen
     StackMapType(DataInput file, ConstantPool constant_pool) throws IOException {
         this(file.readByte(), -1, constant_pool);
         if (hasIndex()) {
-            setIndex(file.readShort());
+            this.index = (int) file.readShort();
         }
-        setConstantPool(constant_pool);
+        this.constant_pool = constant_pool;
     }
 
 
@@ -62,13 +62,16 @@ public final class StackMapType implemen
      * @param index index to constant pool, or byte code offset
      */
     public StackMapType(byte type, int index, ConstantPool constant_pool) {
-        setType(type);
-        setIndex(index);
-        setConstantPool(constant_pool);
+        if ((type < Constants.ITEM_Bogus) || (type > Constants.ITEM_NewObject)) {
+            throw new RuntimeException("Illegal type for StackMapType: " + type);
+        }
+        this.type = type;
+        this.index = index;
+        this.constant_pool = constant_pool;
     }
 
 
-    public void setType( byte t ) {
+    public void setType( byte t ) { // TODO unused
         if ((t < Constants.ITEM_Bogus) || (t > Constants.ITEM_NewObject)) {
             throw new RuntimeException("Illegal type for StackMapType: " + t);
         }
@@ -81,7 +84,7 @@ public final class StackMapType implemen
     }
 
 
-    public void setIndex( int t ) {
+    public void setIndex( int t ) { // TODO unused
         index = t;
     }
 
@@ -161,7 +164,7 @@ public final class StackMapType implemen
     /**
      * @param constant_pool Constant pool to be used for this object.
      */
-    public final void setConstantPool( ConstantPool constant_pool ) {
+    public final void setConstantPool( ConstantPool constant_pool ) { // TODO unused
         this.constant_pool = constant_pool;
     }
 }