harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r651206 - in /harmony/enhanced/classlib/trunk/modules/pack200/src: main/java/org/apache/harmony/unpack200/ test/java/org/apache/harmony/unpack200/tests/ test/resources/org/apache/harmony/pack200/tests/
Date Thu, 24 Apr 2008 09:30:13 GMT
Author: sjanuary
Date: Thu Apr 24 02:30:07 2008
New Revision: 651206

URL: http://svn.apache.org/viewvc?rev=651206&view=rev
Log:
Pack200 - code and a test to ensure inner class attributes are added to the constant pool

Added:
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/sqlJavap.out
Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/IcTuple.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ArchiveTest.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/IcTuple.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/IcTuple.java?rev=651206&r1=651205&r2=651206&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/IcTuple.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/IcTuple.java
Thu Apr 24 02:30:07 2008
@@ -76,8 +76,8 @@
     private boolean initialized = false;
     private boolean anonymous = false;
     private boolean member = true;
-    private int cachedOuterClassIndex;
-    private int cachedSimpleClassNameIndex;
+    private int cachedOuterClassIndex = -1;
+    private int cachedSimpleClassNameIndex = -1;
 
     /**
      * Answer true if the receiver is predicted; answer false if the receiver is

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java?rev=651206&r1=651205&r2=651206&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java
Thu Apr 24 02:30:07 2008
@@ -292,6 +292,7 @@
             classFile.attributes = newAttrs;
             cp.add(innerClassesAttribute);
         }
+        cp.addNestedEntries();
         // sort CP according to cp_All
         cp.resolve(this);
         // NOTE the indexOf is only valid after the cp.resolve()

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ArchiveTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ArchiveTest.java?rev=651206&r1=651205&r2=651206&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ArchiveTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ArchiveTest.java
Thu Apr 24 02:30:07 2008
@@ -16,10 +16,14 @@
  */
 package org.apache.harmony.unpack200.tests;
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
 import java.util.jar.JarOutputStream;
 
 import junit.framework.TestCase;
@@ -63,6 +67,35 @@
         out = new JarOutputStream(new FileOutputStream(file));
         Archive archive = new Archive(in, out);
         archive.unpack();
+        JarFile jarFile = new JarFile(file);
+        file.deleteOnExit();
+        JarEntry entry = jarFile
+                .getJarEntry("bin/test/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest$BaseRowSetImpl.class");
+        assertNotNull(entry);
+        Process process2 = Runtime
+                .getRuntime()
+                .exec(
+                        "javap -c -verbose -classpath "
+                                + file.getName()
+                                + " bin/test/org.apache.harmony.sql.tests.javax.sql.rowset.BaseRowSetTest$BaseRowSetImpl",
+                        new String[] {}, file.getParentFile());
+        BufferedReader reader1 = new BufferedReader(new InputStreamReader(
+                process2.getInputStream()));
+        InputStream javapCompareFile = Archive.class
+                .getResourceAsStream("/org/apache/harmony/pack200/tests/sqlJavap.out");
+        BufferedReader reader2 = new BufferedReader(new InputStreamReader(
+                javapCompareFile));
+        String line1 = reader1.readLine();
+        String line2 = reader2.readLine();
+        int i = 1;
+        while (line1 != null || line2 != null) {
+            assertEquals(line2, line1);
+            line1 = reader1.readLine();
+            line2 = reader2.readLine();
+            i++;
+        }
+        reader1.close();
+        reader2.close();
     }
 
     // Test with an archive containing Harmony's Pack200 module, packed with -E1

Added: harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/sqlJavap.out
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/sqlJavap.out?rev=651206&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/sqlJavap.out
(added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/sqlJavap.out
Thu Apr 24 02:30:07 2008
@@ -0,0 +1,64 @@
+Compiled from "BaseRowSetTest.java"
+final class org.apache.harmony.sql.tests.javax.sql.rowset.BaseRowSetTest$BaseRowSetImpl extends
javax.sql.rowset.BaseRowSet
+  SourceFile: "BaseRowSetTest.java"
+  InnerClass: 
+   final #23= #15 of #14; //BaseRowSetImpl=class org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest$BaseRowSetImpl
of class org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest
+  minor version: 0
+  major version: 48
+  Constant pool:
+const #1 = Asciz	()V;
+const #2 = Asciz	<init>;
+const #3 = Asciz	J;
+const #4 = Asciz	Synthetic;
+const #5 = Asciz	initParams;
+const #6 = Asciz	javax/sql/rowset/BaseRowSet;
+const #7 = Asciz	org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest;
+const #8 = Asciz	org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest$BaseRowSetImpl;
+const #9 = Asciz	serialVersionUID;
+const #10 = Asciz	this;
+const #11 = long	1l;
+const #13 = class	#6;	//  javax/sql/rowset/BaseRowSet
+const #14 = class	#7;	//  org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest
+const #15 = class	#8;	//  org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest$BaseRowSetImpl
+const #16 = Asciz	Lorg/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest$BaseRowSetImpl;;
+const #17 = Asciz	(Lorg/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest$BaseRowSetImpl;)V;
+const #18 = NameAndType	#2:#1;//  "<init>":()V
+const #19 = NameAndType	#5:#1;//  initParams:()V
+const #20 = Method	#13.#18;	//  javax/sql/rowset/BaseRowSet."<init>":()V
+const #21 = Method	#13.#19;	//  javax/sql/rowset/BaseRowSet.initParams:()V
+const #22 = Method	#15.#18;	//  org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest$BaseRowSetImpl."<init>":()V
+const #23 = Asciz	BaseRowSetImpl;
+const #24 = Asciz	BaseRowSetTest.java;
+const #25 = Asciz	Code;
+const #26 = Asciz	ConstantValue;
+const #27 = Asciz	InnerClasses;
+const #28 = Asciz	LineNumberTable;
+const #29 = Asciz	LocalVariableTable;
+const #30 = Asciz	SourceFile;
+
+{
+protected void initParams();
+  Code:
+   Stack=1, Locals=1, Args_size=1
+   0:	aload_0
+   1:	invokespecial	#21; //Method javax/sql/rowset/BaseRowSet.initParams:()V
+   4:	return
+  LineNumberTable: 
+   line 275: 0
+   line 276: 4
+  LocalVariableTable: 
+   Start  Length  Slot  Name   Signature
+   0      5      0    this       Lorg/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest$BaseRowSetImpl;
+
+org.apache.harmony.sql.tests.javax.sql.rowset.BaseRowSetTest$BaseRowSetImpl(org.apache.harmony.sql.tests.javax.sql.rowset.BaseRowSetTest$BaseRowSetImpl);
+  Synthetic: true
+  Code:
+   Stack=1, Locals=2, Args_size=2
+   0:	aload_0
+   1:	invokespecial	#22; //Method "<init>":()V
+   4:	return
+  LineNumberTable: 
+   line 270: 0
+
+}
+



Mime
View raw message