aboutsummaryrefslogtreecommitdiffstats
path: root/bcel-builder/src
diff options
context:
space:
mode:
authoraclement <aclement>2008-06-23 02:05:52 +0000
committeraclement <aclement>2008-06-23 02:05:52 +0000
commit109e942934c1192c433736cd03392a9f2023f4c6 (patch)
tree492e4296781f6f289714901aece877cd77164a04 /bcel-builder/src
parent78e7815193e6d7c8a1a6a644c66e98a3e1a6843b (diff)
downloadaspectj-109e942934c1192c433736cd03392a9f2023f4c6.tar.gz
aspectj-109e942934c1192c433736cd03392a9f2023f4c6.zip
MEMORY: Don't create unnecessary empty CodeException arrays
Diffstat (limited to 'bcel-builder/src')
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/Code.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/Code.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/Code.java
index dc0c9c839..ec5405c67 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/Code.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/Code.java
@@ -69,7 +69,7 @@ import java.io.*;
* is used for debugging purposes and <em>LocalVariableTable</em> which
* contains information about the local variables.
*
- * @version $Id: Code.java,v 1.4 2008/05/28 23:53:02 aclement Exp $
+ * @version $Id: Code.java,v 1.5 2008/06/23 02:05:52 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Attribute
* @see CodeException
@@ -82,6 +82,7 @@ public final class Code extends Attribute {
private byte[] code; // Actual byte code
private CodeException[] exceptionTable;
private Attribute[] attributes;
+ private static final CodeException[] NO_EXCEPTIONS = new CodeException[]{};
/**
* Initialize from another object. Note that both objects use the same
@@ -109,9 +110,13 @@ public final class Code extends Attribute {
* handler is active, i.e., a try { ... } catch() block.
*/
len = file.readUnsignedShort();
- exceptionTable = new CodeException[len];
- for(int i=0; i < len; i++)
- exceptionTable[i] = new CodeException(file);
+ if (len==0) {
+ exceptionTable = NO_EXCEPTIONS;
+ } else {
+ exceptionTable = new CodeException[len];
+ for(int i=0; i < len; i++)
+ exceptionTable[i] = new CodeException(file);
+ }
// Read all attributes, eg: LineNumberTable, LocalVariableTable
attributes = AttributeUtils.readAttributes(file,constant_pool);