commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1695594 - in /commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6: ./ generic/
Date Wed, 12 Aug 2015 18:34:19 GMT
Author: sebb
Date: Wed Aug 12 18:34:18 2015
New Revision: 1695594

URL: http://svn.apache.org/r1695594
Log:
BCEL-237 non-empty final arrays should be private as they are mutable

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/ExceptionConstants.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ANEWARRAY.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ArrayInstruction.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/CHECKCAST.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/GETFIELD.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/GETSTATIC.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INSTANCEOF.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEDYNAMIC.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEINTERFACE.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKESPECIAL.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKESTATIC.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEVIRTUAL.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LDC.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/MULTIANEWARRAY.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/NEW.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUTFIELD.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUTSTATIC.java

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/ExceptionConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/ExceptionConstants.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/ExceptionConstants.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/ExceptionConstants.java
Wed Aug 12 18:34:18 2015
@@ -57,20 +57,68 @@ public class ExceptionConstants {
     public static final Class<NegativeArraySizeException> NEGATIVE_ARRAY_SIZE_EXCEPTION
= NegativeArraySizeException.class;
     public static final Class<ClassCastException> CLASS_CAST_EXCEPTION = ClassCastException.class;
     public static final Class<IllegalMonitorStateException> ILLEGAL_MONITOR_STATE =
IllegalMonitorStateException.class;
-    /** Pre-defined exception arrays according to chapters 5.1-5.4 of the Java Virtual
+
+    /**
+     * Pre-defined exception arrays according to chapters 5.1-5.4 of the Java Virtual
      * Machine Specification 
      */
-    public static final Class<?>[] EXCS_CLASS_AND_INTERFACE_RESOLUTION = {
+    private static final Class<?>[] EXCS_CLASS_AND_INTERFACE_RESOLUTION = {
             NO_CLASS_DEF_FOUND_ERROR, CLASS_FORMAT_ERROR, VERIFY_ERROR, ABSTRACT_METHOD_ERROR,
             EXCEPTION_IN_INITIALIZER_ERROR, ILLEGAL_ACCESS_ERROR
     }; // Chapter 5.1
-    public static final Class<?>[] EXCS_FIELD_AND_METHOD_RESOLUTION = {
+    private static final Class<?>[] EXCS_FIELD_AND_METHOD_RESOLUTION = {
             NO_SUCH_FIELD_ERROR, ILLEGAL_ACCESS_ERROR, NO_SUCH_METHOD_ERROR
     }; // Chapter 5.2
-    public static final Class<?>[] EXCS_INTERFACE_METHOD_RESOLUTION = new Class[0];
// Chapter 5.3 (as below)
-    public static final Class<?>[] EXCS_STRING_RESOLUTION = new Class[0];
+    private static final Class<?>[] EXCS_INTERFACE_METHOD_RESOLUTION = new Class[0];
// Chapter 5.3 (as below)
+    private static final Class<?>[] EXCS_STRING_RESOLUTION = new Class[0];
     // Chapter 5.4 (no errors but the ones that _always_ could happen! How stupid.)
-    public static final Class<?>[] EXCS_ARRAY_EXCEPTION = {
+    private static final Class<?>[] EXCS_ARRAY_EXCEPTION = {
             NULL_POINTER_EXCEPTION, ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION
     };
+
+    /** 
+     * Enum corresponding to the various Exception Class arrays, 
+     * used by {@link ExceptionConstants#createExceptions(EXCS, Class...)}
+     */
+    public enum EXCS {
+        EXCS_CLASS_AND_INTERFACE_RESOLUTION,
+        EXCS_FIELD_AND_METHOD_RESOLUTION,
+        EXCS_INTERFACE_METHOD_RESOLUTION,
+        EXCS_STRING_RESOLUTION,
+        EXCS_ARRAY_EXCEPTION,
+    };
+
+    // helper method to merge exception class arrays
+    private static Class<?>[] mergeExceptions(Class<?>[] input, Class<?>
... extraClasses) {
+        int extraLen = extraClasses == null ? 0 : extraClasses.length;
+        Class<?> excs[] = new Class<?>[input.length + extraLen];
+        System.arraycopy(input, 0, excs, 0, input.length);
+        if (extraLen > 0) {
+            System.arraycopy(extraClasses, 0, excs, input.length, extraLen);            
+        }
+        return excs;
+    }
+
+    /**
+     * Creates a copy of the specified Exception Class array combined with any additional
Exception classes.
+     * @param type the basic array type
+     * @param extraClasses additional classes, if any
+     * @return the merged array
+     */
+    public static Class<?>[] createExceptions(EXCS type, Class<?> ... extraClasses)
{
+        switch (type) {
+        case EXCS_CLASS_AND_INTERFACE_RESOLUTION:
+            return mergeExceptions(EXCS_CLASS_AND_INTERFACE_RESOLUTION, extraClasses);
+        case EXCS_ARRAY_EXCEPTION:
+            return mergeExceptions(EXCS_ARRAY_EXCEPTION, extraClasses);
+        case EXCS_FIELD_AND_METHOD_RESOLUTION:
+            return mergeExceptions(EXCS_FIELD_AND_METHOD_RESOLUTION, extraClasses);
+        case EXCS_INTERFACE_METHOD_RESOLUTION:
+            return mergeExceptions(EXCS_INTERFACE_METHOD_RESOLUTION, extraClasses);
+        case EXCS_STRING_RESOLUTION:
+            return mergeExceptions(EXCS_STRING_RESOLUTION, extraClasses);
+        default:
+            throw new AssertionError("Cannot happen; unexpected enum value: " + type);
+        }
+    }
 }

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ANEWARRAY.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ANEWARRAY.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ANEWARRAY.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ANEWARRAY.java
Wed Aug 12 18:34:18 2015
@@ -45,11 +45,8 @@ public class ANEWARRAY extends CPInstruc
 
 
     public Class<?>[] getExceptions() {
-        Class<?>[] cs = new Class[1 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] = ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION;
-        return cs;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_CLASS_AND_INTERFACE_RESOLUTION,
+            ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ArrayInstruction.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ArrayInstruction.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ArrayInstruction.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ArrayInstruction.java
Wed Aug 12 18:34:18 2015
@@ -17,6 +17,8 @@
  */
 package org.apache.commons.bcel6.generic;
 
+import org.apache.commons.bcel6.ExceptionConstants;
+
 /**
  * Super class for instructions dealing with array access such as IALOAD.
  *
@@ -45,7 +47,7 @@ public abstract class ArrayInstruction e
 
 
     public Class<?>[] getExceptions() {
-        return org.apache.commons.bcel6.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_ARRAY_EXCEPTION);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/CHECKCAST.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/CHECKCAST.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/CHECKCAST.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/CHECKCAST.java
Wed Aug 12 18:34:18 2015
@@ -50,11 +50,8 @@ public class CHECKCAST extends CPInstruc
     /** @return exceptions this instruction may cause
      */
     public Class<?>[] getExceptions() {
-        Class<?>[] cs = new Class[1 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] = ExceptionConstants.CLASS_CAST_EXCEPTION;
-        return cs;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_CLASS_AND_INTERFACE_RESOLUTION,
+            ExceptionConstants.CLASS_CAST_EXCEPTION);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/GETFIELD.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/GETFIELD.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/GETFIELD.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/GETFIELD.java
Wed Aug 12 18:34:18 2015
@@ -54,12 +54,9 @@ public class GETFIELD extends FieldInstr
 
 
     public Class<?>[] getExceptions() {
-        Class<?>[] cs = new Class[2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.NULL_POINTER_EXCEPTION;
-        return cs;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_FIELD_AND_METHOD_RESOLUTION,
+            ExceptionConstants.NULL_POINTER_EXCEPTION,
+            ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/GETSTATIC.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/GETSTATIC.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/GETSTATIC.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/GETSTATIC.java
Wed Aug 12 18:34:18 2015
@@ -53,11 +53,8 @@ public class GETSTATIC extends FieldInst
 
 
     public Class<?>[] getExceptions() {
-        Class<?>[] cs = new Class[1 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;
-        return cs;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_FIELD_AND_METHOD_RESOLUTION,
+            ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INSTANCEOF.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INSTANCEOF.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INSTANCEOF.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INSTANCEOF.java
Wed Aug 12 18:34:18 2015
@@ -17,6 +17,8 @@
  */
 package org.apache.commons.bcel6.generic;
 
+import org.apache.commons.bcel6.ExceptionConstants;
+
 /** 
  * INSTANCEOF - Determine if object is of given type
  * <PRE>Stack: ..., objectref -&gt; ..., result</PRE>
@@ -43,7 +45,7 @@ public class INSTANCEOF extends CPInstru
 
 
     public Class<?>[] getExceptions() {
-        return org.apache.commons.bcel6.ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_CLASS_AND_INTERFACE_RESOLUTION);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEDYNAMIC.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEDYNAMIC.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEDYNAMIC.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEDYNAMIC.java
Wed Aug 12 18:34:18 2015
@@ -86,14 +86,11 @@ public class INVOKEDYNAMIC extends Invok
 
 
     public Class<?>[] getExceptions() {
-        Class<?>[] cs = new Class[4 + ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length + 3] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;
-        cs[ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length + 2] = ExceptionConstants.ILLEGAL_ACCESS_ERROR;
-        cs[ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length + 1] = ExceptionConstants.ABSTRACT_METHOD_ERROR;
-        cs[ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length] = ExceptionConstants.UNSATISFIED_LINK_ERROR;
-        return cs;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_INTERFACE_METHOD_RESOLUTION,
+            ExceptionConstants.UNSATISFIED_LINK_ERROR,
+            ExceptionConstants.ABSTRACT_METHOD_ERROR,
+            ExceptionConstants.ILLEGAL_ACCESS_ERROR,
+            ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEINTERFACE.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEINTERFACE.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEINTERFACE.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEINTERFACE.java
Wed Aug 12 18:34:18 2015
@@ -105,14 +105,11 @@ public final class INVOKEINTERFACE exten
 
 
     public Class<?>[] getExceptions() {
-        Class<?>[] cs = new Class[4 + ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length + 3] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;
-        cs[ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length + 2] = ExceptionConstants.ILLEGAL_ACCESS_ERROR;
-        cs[ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length + 1] = ExceptionConstants.ABSTRACT_METHOD_ERROR;
-        cs[ExceptionConstants.EXCS_INTERFACE_METHOD_RESOLUTION.length] = ExceptionConstants.UNSATISFIED_LINK_ERROR;
-        return cs;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_INTERFACE_METHOD_RESOLUTION,
+            ExceptionConstants.UNSATISFIED_LINK_ERROR,
+            ExceptionConstants.ABSTRACT_METHOD_ERROR,
+            ExceptionConstants.ILLEGAL_ACCESS_ERROR,
+            ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKESPECIAL.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKESPECIAL.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKESPECIAL.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKESPECIAL.java
Wed Aug 12 18:34:18 2015
@@ -47,14 +47,11 @@ public class INVOKESPECIAL extends Invok
 
 
     public Class<?>[] getExceptions() {
-        Class<?>[] cs = new Class[4 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 3] = ExceptionConstants.UNSATISFIED_LINK_ERROR;
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 2] = ExceptionConstants.ABSTRACT_METHOD_ERROR;
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.NULL_POINTER_EXCEPTION;
-        return cs;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_FIELD_AND_METHOD_RESOLUTION,
+            ExceptionConstants.NULL_POINTER_EXCEPTION, 
+            ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR,
+            ExceptionConstants.ABSTRACT_METHOD_ERROR,
+            ExceptionConstants.UNSATISFIED_LINK_ERROR);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKESTATIC.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKESTATIC.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKESTATIC.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKESTATIC.java
Wed Aug 12 18:34:18 2015
@@ -46,12 +46,9 @@ public class INVOKESTATIC extends Invoke
 
 
     public Class<?>[] getExceptions() {
-        Class<?>[] cs = new Class[2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.UNSATISFIED_LINK_ERROR;
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;
-        return cs;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_FIELD_AND_METHOD_RESOLUTION,
+            ExceptionConstants.UNSATISFIED_LINK_ERROR,
+            ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEVIRTUAL.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEVIRTUAL.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEVIRTUAL.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/INVOKEVIRTUAL.java
Wed Aug 12 18:34:18 2015
@@ -46,14 +46,11 @@ public class INVOKEVIRTUAL extends Invok
 
 
     public Class<?>[] getExceptions() {
-        Class<?>[] cs = new Class[4 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 3] = ExceptionConstants.UNSATISFIED_LINK_ERROR;
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 2] = ExceptionConstants.ABSTRACT_METHOD_ERROR;
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.NULL_POINTER_EXCEPTION;
-        return cs;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_FIELD_AND_METHOD_RESOLUTION,
+            ExceptionConstants.NULL_POINTER_EXCEPTION,
+            ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR,
+            ExceptionConstants.ABSTRACT_METHOD_ERROR,
+            ExceptionConstants.UNSATISFIED_LINK_ERROR);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LDC.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LDC.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LDC.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LDC.java Wed
Aug 12 18:34:18 2015
@@ -20,6 +20,7 @@ package org.apache.commons.bcel6.generic
 import java.io.DataOutputStream;
 import java.io.IOException;
 
+import org.apache.commons.bcel6.ExceptionConstants;
 import org.apache.commons.bcel6.util.ByteSequence;
 
 /** 
@@ -134,7 +135,7 @@ public class LDC extends CPInstruction i
 
 
     public Class<?>[] getExceptions() {
-        return org.apache.commons.bcel6.ExceptionConstants.EXCS_STRING_RESOLUTION;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_STRING_RESOLUTION);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/MULTIANEWARRAY.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/MULTIANEWARRAY.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/MULTIANEWARRAY.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/MULTIANEWARRAY.java
Wed Aug 12 18:34:18 2015
@@ -116,12 +116,9 @@ public class MULTIANEWARRAY extends CPIn
 
 
     public Class<?>[] getExceptions() {
-        Class<?>[] cs = new Class[2 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length + 1] = ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION;
-        cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] = ExceptionConstants.ILLEGAL_ACCESS_ERROR;
-        return cs;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_CLASS_AND_INTERFACE_RESOLUTION,
+            ExceptionConstants.ILLEGAL_ACCESS_ERROR,
+            ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/NEW.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/NEW.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/NEW.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/NEW.java Wed
Aug 12 18:34:18 2015
@@ -45,12 +45,9 @@ public class NEW extends CPInstruction i
 
 
     public Class<?>[] getExceptions() {
-        Class<?>[] cs = new Class[2 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length + 1] = ExceptionConstants.INSTANTIATION_ERROR;
-        cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] = ExceptionConstants.ILLEGAL_ACCESS_ERROR;
-        return cs;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_CLASS_AND_INTERFACE_RESOLUTION,
+            ExceptionConstants.ILLEGAL_ACCESS_ERROR,
+            ExceptionConstants.INSTANTIATION_ERROR);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUTFIELD.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUTFIELD.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUTFIELD.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUTFIELD.java
Wed Aug 12 18:34:18 2015
@@ -53,12 +53,9 @@ public class PUTFIELD extends FieldInstr
 
 
     public Class<?>[] getExceptions() {
-        Class<?>[] cs = new Class[2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length + 1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.NULL_POINTER_EXCEPTION;
-        return cs;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_FIELD_AND_METHOD_RESOLUTION,
+            ExceptionConstants.NULL_POINTER_EXCEPTION,
+            ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR);
     }
 
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUTSTATIC.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUTSTATIC.java?rev=1695594&r1=1695593&r2=1695594&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUTSTATIC.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/PUTSTATIC.java
Wed Aug 12 18:34:18 2015
@@ -53,11 +53,8 @@ public class PUTSTATIC extends FieldInst
 
 
     public Class<?>[] getExceptions() {
-        Class<?>[] cs = new Class[1 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length];
-        System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, cs, 0,
-                ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length);
-        cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR;
-        return cs;
+        return ExceptionConstants.createExceptions(ExceptionConstants.EXCS.EXCS_FIELD_AND_METHOD_RESOLUTION,
+            ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR);
     }
 
 



Mime
View raw message