From: aclement Date: Mon, 23 Jun 2008 02:06:22 +0000 (+0000) Subject: MEMORY: Don't create unnecessary empty string arrays for implemented interfaces X-Git-Tag: V1_6_1rc1~13 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=260bff8874f58878a70fe136157c520f013f1456;p=aspectj.git MEMORY: Don't create unnecessary empty string arrays for implemented interfaces --- diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java index 8083441f6..bf5ad504a 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java @@ -77,7 +77,7 @@ import java.util.StringTokenizer; * class file. Those interested in programatically generating classes * should see the ClassGen class. - * @version $Id: JavaClass.java,v 1.10 2008/05/28 23:53:02 aclement Exp $ + * @version $Id: JavaClass.java,v 1.11 2008/06/23 02:06:22 aclement Exp $ * @see org.aspectj.apache.bcel.generic.ClassGen * @author M. Dahm */ @@ -117,6 +117,8 @@ public class JavaClass extends Modifiers implements Cloneable, Node { private Signature signatureAttribute = null; private boolean searchedForSignatureAttribute = false; + private static final String[] NO_INTERFACE_NAMES = new String[]{}; + /** * In cases where we go ahead and create something, * use the default SyntheticRepository, because we @@ -202,10 +204,14 @@ public class JavaClass extends Modifiers implements Cloneable, Node { else superclass_name = "java.lang.Object"; - interface_names = new String[interfaces.length]; - for(int i=0; i < interfaces.length; i++) { - String str = constant_pool.getConstantString(interfaces[i], Constants.CONSTANT_Class); - interface_names[i] = Utility.compactClassName(str, false); + if (interfaces.length==0) { + interface_names = NO_INTERFACE_NAMES; + } else { + interface_names = new String[interfaces.length]; + for(int i=0; i < interfaces.length; i++) { + String str = constant_pool.getConstantString(interfaces[i], Constants.CONSTANT_Class); + interface_names[i] = Utility.compactClassName(str, false); + } } }