harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r675164 - /harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java
Date Wed, 09 Jul 2008 13:26:31 GMT
Author: sjanuary
Date: Wed Jul  9 06:26:31 2008
New Revision: 675164

URL: http://svn.apache.org/viewvc?rev=675164&view=rev
Log:
Apply patch for HARMONY-5902 ([classlib][pack200] ClassConstantPool overuses ArrayLists)

Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java?rev=675164&r1=675163&r2=675164&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java
Wed Jul  9 06:26:31 2008
@@ -114,14 +114,24 @@
 
     private void addNested(List classFileEntries) {
         List newEntries = new ArrayList();
-        for (Iterator iterator = classFileEntries.iterator(); iterator
-                .hasNext();) {
-            ClassFileEntry entry = (ClassFileEntry) iterator.next();
+
+        for (int classFileIndex = 0; classFileIndex < classFileEntries.size(); classFileIndex++)
{
+            ClassFileEntry entry = (ClassFileEntry) classFileEntries.get(classFileIndex);
             ClassFileEntry[] nestedEntries = entry.getNestedClassFileEntries();
-            newEntries.addAll(Arrays.asList(nestedEntries));
+
+            // Add all nestedEntries to the newEntries list
+            for(int nestedEntriesIndex = 0; nestedEntriesIndex < nestedEntries.length;
nestedEntriesIndex++) {
+                newEntries.add(nestedEntries[nestedEntriesIndex]);
+            }
+
+            // If the entry is a bytecode that needs to start the
+            // class pool, add all the nestedEntries to the
+            // mustStartClassPool as well.
             if(entry instanceof ByteCode) {
                 if(((ByteCode)entry).nestedMustStartClassPool()) {
-                    mustStartClassPool.addAll(Arrays.asList(nestedEntries));
+                    for(int nestedEntriesIndex = 0; nestedEntriesIndex < nestedEntries.length;
nestedEntriesIndex++) {
+                        mustStartClassPool.add(nestedEntries[nestedEntriesIndex]);
+                    }
                 }
             }
         }



Mime
View raw message