diff options
author | aclement <aclement> | 2006-02-22 15:22:28 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-02-22 15:22:28 +0000 |
commit | c05b9bc9283a88cde811632980bc854858ab29fd (patch) | |
tree | f73d10a14c93065b0c0b21dbb47b2b580f3fd211 /weaver | |
parent | 5a11d89a94c19851b85e014041664b360aa6b1b0 (diff) | |
download | aspectj-c05b9bc9283a88cde811632980bc854858ab29fd.tar.gz aspectj-c05b9bc9283a88cde811632980bc854858ab29fd.zip |
optimization: less ArrayList garbage creation!
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelShadow.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java index b6b661154..b93d764df 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java @@ -16,6 +16,7 @@ package org.aspectj.weaver.bcel; import java.lang.reflect.Modifier; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -170,11 +171,14 @@ public class BcelShadow extends Shadow { public BcelShadow copyInto(LazyMethodGen recipient, BcelShadow enclosing) { BcelShadow s = new BcelShadow(world, getKind(), getSignature(), recipient, enclosing); - List src = mungers; - List dest = s.mungers; - - for (Iterator i = src.iterator(); i.hasNext(); ) { - dest.add(i.next()); + if (mungers.size()>0) { + List src = mungers; + if (s.mungers==Collections.EMPTY_LIST) s.mungers = new ArrayList(); + List dest = s.mungers; + + for (Iterator i = src.iterator(); i.hasNext(); ) { + dest.add(i.next()); + } } return s; } |