You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sj...@apache.org on 2008/01/29 16:09:33 UTC

svn commit: r616368 - in /harmony/enhanced/classlib/trunk/modules/pack200/src: main/java/org/apache/harmony/pack200/ main/java/org/apache/harmony/pack200/bytecode/ test/java/org/apache/harmony/pack200/tests/

Author: sjanuary
Date: Tue Jan 29 07:09:31 2008
New Revision: 616368

URL: http://svn.apache.org/viewvc?rev=616368&view=rev
Log:
Setting svn:eol-style property to native 

Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcTuple.java   (contents, props changed)
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java   (contents, props changed)
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ICTupleTest.java   (contents, props changed)

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcTuple.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcTuple.java?rev=616368&r1=616367&r2=616368&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcTuple.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcTuple.java Tue Jan 29 07:09:31 2008
@@ -1,195 +1,195 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.harmony.pack200;
-
-import java.util.ArrayList;
-
-public class IcTuple {
-
-    public static int NESTED_CLASS_FLAG = 0x00010000;
-    public String C; // this class
-    public int F; // flags
-    public String C2; // outer class
-    public String N; // name
-
-    private String cachedOuterClassString = null;
-    private String cachedSimpleClassName = null;
-    private boolean initialized = false;
-    private boolean anonymous = false;
-    private boolean member = true;
-    
-    /**
-     * Answer true if the receiver is predicted;
-     * answer false if the receiver is specified
-     * explicitly in the outer and name fields.
-     * @return
-     */
-    public boolean predicted() {
-        return ((F & NESTED_CLASS_FLAG) == 0);
-    }
-
-    /**
-     * Break the receiver into components at $ boundaries.
-     * 
-     * @return
-     */
-    public String[] innerBreakAtDollar(String className) {
-        ArrayList resultList = new ArrayList();
-        int start = 0;
-        int index = 0;
-        while(index < className.length()) {
-            if(className.charAt(index) <= '$') {
-                resultList.add(className.substring(start, index));
-                start = index + 1;
-            }
-            index++;
-            if(index >= className.length()) {
-                // Add the last element
-                resultList.add(className.substring(start, className.length()));
-            }
-        }
-        String[] result = new String[resultList.size()];
-        for(int i=0; i < resultList.size(); i++) {
-            result[i] = (String)resultList.get(i);
-        }
-        return result;
-    }
-    
-    /**
-     * Answer the outer class name for the receiver.
-     * This may either be specified or inferred from
-     * inner class name.
-     * @return String name of outer class
-     */
-    public String outerClassString() {
-        if(!initialized) {
-            initializeClassStrings();
-        }
-        return cachedOuterClassString;
-    }
-    
-    /**
-     * Answer the inner class name for the receiver.
-     * @return String name of inner class
-     */
-    public String simpleClassName() {
-        if(!initialized) {
-            initializeClassStrings();
-        }
-        return cachedSimpleClassName;
-    }
-    
-    /**
-     * Answer the full name of the inner class represented
-     * by this tuple (including its outer component)
-     * @return String full name of inner class
-     */
-    public String thisClassString() {
-        if(predicted()) {
-            return C;
-        } else {
-            // TODO: this may not be right.
-            return C2 + "$" + N;
-        }
-    }
-    
-    public boolean isMember() {
-        initializeClassStrings();
-        return member;
-    }
-    
-    public boolean isAnonymous() {
-        initializeClassStrings();
-        return anonymous;
-    }
-    
-    private void initializeClassStrings() {
-        if(initialized) {
-            return;
-        }
-        initialized = true;
-        if(!predicted()) {
-            cachedOuterClassString = C2;
-            cachedSimpleClassName = N;
-            return;
-        }
-        // Class names must be calculated from
-        // this class name.
-        String nameComponents[] = innerBreakAtDollar(C);
-        if(nameComponents.length == 0) {
-            throw new Error("Unable to predict outer class name: " + C);
-        }
-        if(nameComponents.length == 1) {
-            throw new Error("Unable to predict inner class name: " + C);
-        }
-        // If we get to this point, nameComponents.length must be >=2
-        int lastPosition = nameComponents.length - 1;
-        cachedSimpleClassName = nameComponents[lastPosition];
-        cachedOuterClassString = new String();
-        for(int index=0; index < lastPosition; index++) {
-            cachedOuterClassString += nameComponents[index];
-            if(isAllDigits(nameComponents[index])) {
-                member = false;
-            }
-            if(index + 1 != lastPosition) {
-                cachedOuterClassString += '$';
-            }
-        }
-        // Now special-case: if the last part of the outer
-        // class name is all digits, then the cachedOuterClassString
-        // is null (an anonymous outer class). If the cachedInnerClassString
-        // is all digits, then the cachedInnerClassString is null (an
-        // anonymous inner class).
-        // TODO: Don't know about this - we might need to
-        // do this later on (after we've determined what's
-        // anonymous and what isn't) so we point to the right
-        // class file entries.
-//        if(isAllDigits(nameComponents[lastPosition - 1])) {
-//            cachedOuterClassString = null;
-//            anonymous = false;
-//        }
-        if(isAllDigits(cachedSimpleClassName)) {
-            anonymous = true;
-            member = false;
-//            cachedSimpleClassName = C;
-        }
-    }
-
-    private boolean isAllDigits(String nameString) {
-        // Answer true if the receiver is all digits; otherwise answer false.
-        if(null == nameString) {
-            return false;
-        }
-        for(int index = 0; index < nameString.length(); index++) {
-            if(!Character.isDigit(nameString.charAt(index))) {
-                return false;
-            }
-        }
-        return true;
-    }
-    
-    public String toString() {
-        StringBuffer result = new StringBuffer();
-        result.append(this.getClass().getName());
-        result.append('(');
-        result.append(simpleClassName());
-        result.append(" in ");
-        result.append(outerClassString());
-        result.append(')');
-        return result.toString();
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.harmony.pack200;
+
+import java.util.ArrayList;
+
+public class IcTuple {
+
+    public static int NESTED_CLASS_FLAG = 0x00010000;
+    public String C; // this class
+    public int F; // flags
+    public String C2; // outer class
+    public String N; // name
+
+    private String cachedOuterClassString = null;
+    private String cachedSimpleClassName = null;
+    private boolean initialized = false;
+    private boolean anonymous = false;
+    private boolean member = true;
+    
+    /**
+     * Answer true if the receiver is predicted;
+     * answer false if the receiver is specified
+     * explicitly in the outer and name fields.
+     * @return
+     */
+    public boolean predicted() {
+        return ((F & NESTED_CLASS_FLAG) == 0);
+    }
+
+    /**
+     * Break the receiver into components at $ boundaries.
+     * 
+     * @return
+     */
+    public String[] innerBreakAtDollar(String className) {
+        ArrayList resultList = new ArrayList();
+        int start = 0;
+        int index = 0;
+        while(index < className.length()) {
+            if(className.charAt(index) <= '$') {
+                resultList.add(className.substring(start, index));
+                start = index + 1;
+            }
+            index++;
+            if(index >= className.length()) {
+                // Add the last element
+                resultList.add(className.substring(start, className.length()));
+            }
+        }
+        String[] result = new String[resultList.size()];
+        for(int i=0; i < resultList.size(); i++) {
+            result[i] = (String)resultList.get(i);
+        }
+        return result;
+    }
+    
+    /**
+     * Answer the outer class name for the receiver.
+     * This may either be specified or inferred from
+     * inner class name.
+     * @return String name of outer class
+     */
+    public String outerClassString() {
+        if(!initialized) {
+            initializeClassStrings();
+        }
+        return cachedOuterClassString;
+    }
+    
+    /**
+     * Answer the inner class name for the receiver.
+     * @return String name of inner class
+     */
+    public String simpleClassName() {
+        if(!initialized) {
+            initializeClassStrings();
+        }
+        return cachedSimpleClassName;
+    }
+    
+    /**
+     * Answer the full name of the inner class represented
+     * by this tuple (including its outer component)
+     * @return String full name of inner class
+     */
+    public String thisClassString() {
+        if(predicted()) {
+            return C;
+        } else {
+            // TODO: this may not be right.
+            return C2 + "$" + N;
+        }
+    }
+    
+    public boolean isMember() {
+        initializeClassStrings();
+        return member;
+    }
+    
+    public boolean isAnonymous() {
+        initializeClassStrings();
+        return anonymous;
+    }
+    
+    private void initializeClassStrings() {
+        if(initialized) {
+            return;
+        }
+        initialized = true;
+        if(!predicted()) {
+            cachedOuterClassString = C2;
+            cachedSimpleClassName = N;
+            return;
+        }
+        // Class names must be calculated from
+        // this class name.
+        String nameComponents[] = innerBreakAtDollar(C);
+        if(nameComponents.length == 0) {
+            throw new Error("Unable to predict outer class name: " + C);
+        }
+        if(nameComponents.length == 1) {
+            throw new Error("Unable to predict inner class name: " + C);
+        }
+        // If we get to this point, nameComponents.length must be >=2
+        int lastPosition = nameComponents.length - 1;
+        cachedSimpleClassName = nameComponents[lastPosition];
+        cachedOuterClassString = new String();
+        for(int index=0; index < lastPosition; index++) {
+            cachedOuterClassString += nameComponents[index];
+            if(isAllDigits(nameComponents[index])) {
+                member = false;
+            }
+            if(index + 1 != lastPosition) {
+                cachedOuterClassString += '$';
+            }
+        }
+        // Now special-case: if the last part of the outer
+        // class name is all digits, then the cachedOuterClassString
+        // is null (an anonymous outer class). If the cachedInnerClassString
+        // is all digits, then the cachedInnerClassString is null (an
+        // anonymous inner class).
+        // TODO: Don't know about this - we might need to
+        // do this later on (after we've determined what's
+        // anonymous and what isn't) so we point to the right
+        // class file entries.
+//        if(isAllDigits(nameComponents[lastPosition - 1])) {
+//            cachedOuterClassString = null;
+//            anonymous = false;
+//        }
+        if(isAllDigits(cachedSimpleClassName)) {
+            anonymous = true;
+            member = false;
+//            cachedSimpleClassName = C;
+        }
+    }
+
+    private boolean isAllDigits(String nameString) {
+        // Answer true if the receiver is all digits; otherwise answer false.
+        if(null == nameString) {
+            return false;
+        }
+        for(int index = 0; index < nameString.length(); index++) {
+            if(!Character.isDigit(nameString.charAt(index))) {
+                return false;
+            }
+        }
+        return true;
+    }
+    
+    public String toString() {
+        StringBuffer result = new StringBuffer();
+        result.append(this.getClass().getName());
+        result.append('(');
+        result.append(simpleClassName());
+        result.append(" in ");
+        result.append(outerClassString());
+        result.append(')');
+        return result.toString();
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcTuple.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java?rev=616368&r1=616367&r2=616368&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java Tue Jan 29 07:09:31 2008
@@ -1,184 +1,184 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.harmony.pack200.bytecode;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.harmony.pack200.IcTuple;
-import org.apache.harmony.pack200.SegmentUtils;
-
-
-public class InnerClassesAttribute extends Attribute {
-    
-    class InnerClassesEntry {
-        CPClass inner_class_info;
-        CPClass outer_class_info;
-        CPUTF8 inner_class_name;
-        
-        int inner_class_info_index = -1;
-        int outer_class_info_index = -1;
-        int inner_name_index = -1;
-        int inner_class_access_flags = -1;
-        
-        public InnerClassesEntry(IcTuple icTuple) {
-            this(icTuple.C, icTuple.C2, icTuple.N, icTuple.F);
-        }
-        
-        public InnerClassesEntry(String innerString, String outerString, String nameString, int flags) {
-            
-        }
-        public InnerClassesEntry(CPClass innerClass, CPClass outerClass, CPUTF8 innerName, int flags) {
-            this.inner_class_info = innerClass;
-            this.outer_class_info = outerClass;
-            this.inner_class_name = innerName;
-            this.inner_class_access_flags = flags;
-        }
-        
-        /**
-         * Determine the indices of the things in the receiver
-         * which point to elements of the ClassConstantPool 
-         * @param pool ClassConstantPool which holds the
-         *      CPClass and CPUTF8 objects.
-         */
-        public void resolve(ClassConstantPool pool) {
-            SegmentUtils.debug("----");
-            SegmentUtils.debug("inner_class_info: " + inner_class_info);
-            SegmentUtils.debug("inner_class_name: " + inner_class_name);
-            SegmentUtils.debug("outer_class_info: " + outer_class_info);
-
-            if(inner_class_info != null) {
-                inner_class_info.resolve(pool);
-                inner_class_info_index = pool.indexOf(inner_class_info);
-            } else {
-                inner_class_info_index = 0;
-            }
-
-            if(inner_class_name != null) {
-                inner_class_name.resolve(pool);
-                inner_name_index = pool.indexOf(inner_class_name);
-            } else {
-                inner_name_index = 0;
-            }
-
-            if(outer_class_info != null) {
-                outer_class_info.resolve(pool);
-                outer_class_info_index = pool.indexOf(outer_class_info);
-            } else {
-                outer_class_info_index = 0;
-            }
-        }
-        
-        public void write(DataOutputStream dos) throws IOException {
-            dos.writeShort(inner_class_info_index);
-            dos.writeShort(outer_class_info_index);
-            dos.writeShort(inner_name_index);
-            dos.writeShort(inner_class_access_flags);
-        }
-        
-    }
-    
-    private List innerClasses = new ArrayList();
-    private List nestedClassFileEntries = new ArrayList();
-    
-    public InnerClassesAttribute(String name) {
-        super("InnerClasses"); //$NON-NLS-1$
-        nestedClassFileEntries.add(getAttributeName());
-    }
-
-    public boolean equals(Object obj) {
-        if (this == obj)
-            return true;
-        if (!super.equals(obj))
-            return false;
-        if (this.getClass() != obj.getClass())
-            return false;
-        final InnerClassesAttribute other = (InnerClassesAttribute) obj;
-        if (getAttributeName() == null) {
-            if (other.getAttributeName() != null)
-                return false;
-        } else if (!getAttributeName().equals(other.getAttributeName()))
-            return false;
-        return true;
-    }
-
-    protected int getLength() {
-        return 2 + ((2 + 2 + 2 + 2) * innerClasses.size());
-    }
-
-    protected ClassFileEntry[] getNestedClassFileEntries() {
-        ClassFileEntry[] result = new ClassFileEntry[nestedClassFileEntries.size()];
-        for(int index=0; index < result.length; index++) {
-            result[index] = (ClassFileEntry)nestedClassFileEntries.get(index);
-        }
-        return result;
-    }
-
-    public int hashCode() {
-        final int PRIME = 31;
-        int result = super.hashCode();
-        result = PRIME * result + ((getAttributeName() == null) ? 0 : getAttributeName().hashCode());
-        return result;
-    }
-
-    protected void resolve(ClassConstantPool pool) {
-        super.resolve(pool);
-        Iterator it = innerClasses.iterator();
-        while(it.hasNext()) {
-            InnerClassesEntry entry = (InnerClassesEntry)it.next();
-            entry.resolve(pool);
-        }
-    }
-
-    public String toString() {
-        return "InnerClasses: " + getAttributeName();
-    }
-
-    protected void doWrite(DataOutputStream dos) throws IOException {
-        // Hack so I can see what's being written.
-        super.doWrite(dos);
-    }
-    
-    protected void writeBody(DataOutputStream dos) throws IOException {
-        dos.writeShort(innerClasses.size());
-        Iterator it = innerClasses.iterator();
-        while(it.hasNext()) {
-            InnerClassesEntry entry = (InnerClassesEntry)it.next();
-            entry.write(dos);
-        }
-    }
-    
-    public void addInnerClassesEntry(CPClass innerClass, CPClass outerClass, CPUTF8 innerName, int flags) {
-        if(innerClass != null) {
-            nestedClassFileEntries.add(innerClass);
-        }
-        if(outerClass != null) {
-            nestedClassFileEntries.add(outerClass);
-        }
-        if(innerName != null) {
-            nestedClassFileEntries.add(innerName);
-        }
-        addInnerClassesEntry(new InnerClassesEntry(innerClass, outerClass, innerName, flags));
-    }
-    
-    private void addInnerClassesEntry(InnerClassesEntry innerClassesEntry) {
-        innerClasses.add(innerClassesEntry);
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.harmony.pack200.IcTuple;
+import org.apache.harmony.pack200.SegmentUtils;
+
+
+public class InnerClassesAttribute extends Attribute {
+    
+    class InnerClassesEntry {
+        CPClass inner_class_info;
+        CPClass outer_class_info;
+        CPUTF8 inner_class_name;
+        
+        int inner_class_info_index = -1;
+        int outer_class_info_index = -1;
+        int inner_name_index = -1;
+        int inner_class_access_flags = -1;
+        
+        public InnerClassesEntry(IcTuple icTuple) {
+            this(icTuple.C, icTuple.C2, icTuple.N, icTuple.F);
+        }
+        
+        public InnerClassesEntry(String innerString, String outerString, String nameString, int flags) {
+            
+        }
+        public InnerClassesEntry(CPClass innerClass, CPClass outerClass, CPUTF8 innerName, int flags) {
+            this.inner_class_info = innerClass;
+            this.outer_class_info = outerClass;
+            this.inner_class_name = innerName;
+            this.inner_class_access_flags = flags;
+        }
+        
+        /**
+         * Determine the indices of the things in the receiver
+         * which point to elements of the ClassConstantPool 
+         * @param pool ClassConstantPool which holds the
+         *      CPClass and CPUTF8 objects.
+         */
+        public void resolve(ClassConstantPool pool) {
+            SegmentUtils.debug("----");
+            SegmentUtils.debug("inner_class_info: " + inner_class_info);
+            SegmentUtils.debug("inner_class_name: " + inner_class_name);
+            SegmentUtils.debug("outer_class_info: " + outer_class_info);
+
+            if(inner_class_info != null) {
+                inner_class_info.resolve(pool);
+                inner_class_info_index = pool.indexOf(inner_class_info);
+            } else {
+                inner_class_info_index = 0;
+            }
+
+            if(inner_class_name != null) {
+                inner_class_name.resolve(pool);
+                inner_name_index = pool.indexOf(inner_class_name);
+            } else {
+                inner_name_index = 0;
+            }
+
+            if(outer_class_info != null) {
+                outer_class_info.resolve(pool);
+                outer_class_info_index = pool.indexOf(outer_class_info);
+            } else {
+                outer_class_info_index = 0;
+            }
+        }
+        
+        public void write(DataOutputStream dos) throws IOException {
+            dos.writeShort(inner_class_info_index);
+            dos.writeShort(outer_class_info_index);
+            dos.writeShort(inner_name_index);
+            dos.writeShort(inner_class_access_flags);
+        }
+        
+    }
+    
+    private List innerClasses = new ArrayList();
+    private List nestedClassFileEntries = new ArrayList();
+    
+    public InnerClassesAttribute(String name) {
+        super("InnerClasses"); //$NON-NLS-1$
+        nestedClassFileEntries.add(getAttributeName());
+    }
+
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (!super.equals(obj))
+            return false;
+        if (this.getClass() != obj.getClass())
+            return false;
+        final InnerClassesAttribute other = (InnerClassesAttribute) obj;
+        if (getAttributeName() == null) {
+            if (other.getAttributeName() != null)
+                return false;
+        } else if (!getAttributeName().equals(other.getAttributeName()))
+            return false;
+        return true;
+    }
+
+    protected int getLength() {
+        return 2 + ((2 + 2 + 2 + 2) * innerClasses.size());
+    }
+
+    protected ClassFileEntry[] getNestedClassFileEntries() {
+        ClassFileEntry[] result = new ClassFileEntry[nestedClassFileEntries.size()];
+        for(int index=0; index < result.length; index++) {
+            result[index] = (ClassFileEntry)nestedClassFileEntries.get(index);
+        }
+        return result;
+    }
+
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = super.hashCode();
+        result = PRIME * result + ((getAttributeName() == null) ? 0 : getAttributeName().hashCode());
+        return result;
+    }
+
+    protected void resolve(ClassConstantPool pool) {
+        super.resolve(pool);
+        Iterator it = innerClasses.iterator();
+        while(it.hasNext()) {
+            InnerClassesEntry entry = (InnerClassesEntry)it.next();
+            entry.resolve(pool);
+        }
+    }
+
+    public String toString() {
+        return "InnerClasses: " + getAttributeName();
+    }
+
+    protected void doWrite(DataOutputStream dos) throws IOException {
+        // Hack so I can see what's being written.
+        super.doWrite(dos);
+    }
+    
+    protected void writeBody(DataOutputStream dos) throws IOException {
+        dos.writeShort(innerClasses.size());
+        Iterator it = innerClasses.iterator();
+        while(it.hasNext()) {
+            InnerClassesEntry entry = (InnerClassesEntry)it.next();
+            entry.write(dos);
+        }
+    }
+    
+    public void addInnerClassesEntry(CPClass innerClass, CPClass outerClass, CPUTF8 innerName, int flags) {
+        if(innerClass != null) {
+            nestedClassFileEntries.add(innerClass);
+        }
+        if(outerClass != null) {
+            nestedClassFileEntries.add(outerClass);
+        }
+        if(innerName != null) {
+            nestedClassFileEntries.add(innerName);
+        }
+        addInnerClassesEntry(new InnerClassesEntry(innerClass, outerClass, innerName, flags));
+    }
+    
+    private void addInnerClassesEntry(InnerClassesEntry innerClassesEntry) {
+        innerClasses.add(innerClassesEntry);
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/InnerClassesAttribute.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ICTupleTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ICTupleTest.java?rev=616368&r1=616367&r2=616368&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ICTupleTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ICTupleTest.java Tue Jan 29 07:09:31 2008
@@ -1,83 +1,83 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.harmony.pack200.tests;
-
-import junit.framework.TestCase;
-import org.apache.harmony.pack200.IcTuple;
-
-public class ICTupleTest extends TestCase {
-    
-    public void testPredictedClassTupleParsing() {
-        IcTuple tuple = new IcTuple();
-        tuple.C = "orw/SimpleHelloWorld$SimpleHelloWorldInner";
-        tuple.C2 = null;
-        tuple.F = 0;
-        tuple.N = null;
-        assertEquals("SimpleHelloWorldInner", tuple.simpleClassName());
-        assertEquals("orw/SimpleHelloWorld", tuple.outerClassString());
-
-        tuple = new IcTuple();
-        tuple.C = "java/util/AbstractList$2$Local";
-        tuple.C2 = null;
-        tuple.F = 0;
-        tuple.N = null;
-        assertEquals("Local", tuple.simpleClassName());
-        assertEquals("java/util/AbstractList$2", tuple.outerClassString());
-
-        tuple = new IcTuple();
-        tuple.C = "java/util/AbstractList#2#Local";
-        tuple.C2 = null;
-        tuple.F = 0;
-        tuple.N = null;
-        assertEquals("Local", tuple.simpleClassName());
-        assertEquals("java/util/AbstractList$2", tuple.outerClassString());
-
-        tuple = new IcTuple();
-        tuple.C = "java/util/AbstractList$1";
-        tuple.C2 = null;
-        tuple.F = 0;
-        tuple.N = null;
-        assertEquals("1", tuple.simpleClassName());
-        assertEquals("java/util/AbstractList", tuple.outerClassString());
-    }
-    
-    public void testExplicitClassTupleParsing() {
-        IcTuple tuple = new IcTuple();
-        tuple.C = "Foo$$2$Local";
-        tuple.C2 = null;
-        tuple.F = IcTuple.NESTED_CLASS_FLAG;
-        tuple.N = "$2$Local";
-        assertEquals("$2$Local", tuple.simpleClassName());
-        assertEquals(null, tuple.outerClassString());
-
-        tuple = new IcTuple();
-        tuple.C = "Red$Herring";
-        tuple.C2 = "Red$Herring";
-        tuple.F = IcTuple.NESTED_CLASS_FLAG;
-        tuple.N = null;
-        assertEquals(null, tuple.simpleClassName());
-        assertEquals("Red$Herring", tuple.outerClassString());
-
-        tuple = new IcTuple();
-        tuple.C = "X$1$Q";
-        tuple.C2 = "X$1";
-        tuple.F = IcTuple.NESTED_CLASS_FLAG;
-        tuple.N = "Q";
-        assertEquals("Q", tuple.simpleClassName());
-        assertEquals("X$1", tuple.outerClassString());
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.harmony.pack200.tests;
+
+import junit.framework.TestCase;
+import org.apache.harmony.pack200.IcTuple;
+
+public class ICTupleTest extends TestCase {
+    
+    public void testPredictedClassTupleParsing() {
+        IcTuple tuple = new IcTuple();
+        tuple.C = "orw/SimpleHelloWorld$SimpleHelloWorldInner";
+        tuple.C2 = null;
+        tuple.F = 0;
+        tuple.N = null;
+        assertEquals("SimpleHelloWorldInner", tuple.simpleClassName());
+        assertEquals("orw/SimpleHelloWorld", tuple.outerClassString());
+
+        tuple = new IcTuple();
+        tuple.C = "java/util/AbstractList$2$Local";
+        tuple.C2 = null;
+        tuple.F = 0;
+        tuple.N = null;
+        assertEquals("Local", tuple.simpleClassName());
+        assertEquals("java/util/AbstractList$2", tuple.outerClassString());
+
+        tuple = new IcTuple();
+        tuple.C = "java/util/AbstractList#2#Local";
+        tuple.C2 = null;
+        tuple.F = 0;
+        tuple.N = null;
+        assertEquals("Local", tuple.simpleClassName());
+        assertEquals("java/util/AbstractList$2", tuple.outerClassString());
+
+        tuple = new IcTuple();
+        tuple.C = "java/util/AbstractList$1";
+        tuple.C2 = null;
+        tuple.F = 0;
+        tuple.N = null;
+        assertEquals("1", tuple.simpleClassName());
+        assertEquals("java/util/AbstractList", tuple.outerClassString());
+    }
+    
+    public void testExplicitClassTupleParsing() {
+        IcTuple tuple = new IcTuple();
+        tuple.C = "Foo$$2$Local";
+        tuple.C2 = null;
+        tuple.F = IcTuple.NESTED_CLASS_FLAG;
+        tuple.N = "$2$Local";
+        assertEquals("$2$Local", tuple.simpleClassName());
+        assertEquals(null, tuple.outerClassString());
+
+        tuple = new IcTuple();
+        tuple.C = "Red$Herring";
+        tuple.C2 = "Red$Herring";
+        tuple.F = IcTuple.NESTED_CLASS_FLAG;
+        tuple.N = null;
+        assertEquals(null, tuple.simpleClassName());
+        assertEquals("Red$Herring", tuple.outerClassString());
+
+        tuple = new IcTuple();
+        tuple.C = "X$1$Q";
+        tuple.C2 = "X$1";
+        tuple.F = IcTuple.NESTED_CLASS_FLAG;
+        tuple.N = "Q";
+        assertEquals("Q", tuple.simpleClassName());
+        assertEquals("X$1", tuple.outerClassString());
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ICTupleTest.java
------------------------------------------------------------------------------
    svn:eol-style = native