You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ay...@apache.org on 2007/02/02 16:09:43 UTC

svn commit: r502621 - in /harmony/enhanced/classlib/trunk/modules/pack200: .classpath README.txt src/test/java/org/apache/harmony/pack200/tests/ClassVersionTest.java

Author: ayza
Date: Fri Feb  2 07:09:41 2007
New Revision: 502621

URL: http://svn.apache.org/viewvc?view=rev&rev=502621
Log:
Applying another patch for HARMONY-2957 ([classlib][pack200] Update pack200 project layout and ensure 1.4 compatibility)

Added:
    harmony/enhanced/classlib/trunk/modules/pack200/README.txt   (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/.classpath
    harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassVersionTest.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/.classpath
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/.classpath?view=diff&rev=502621&r1=502620&r2=502621
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/.classpath (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/.classpath Fri Feb  2 07:09:41 2007
@@ -6,6 +6,5 @@
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="var" path="JUNIT_HOME/junit.jar" sourcepath="JUNIT_SRC_HOME/junitsrc.zip"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
-	<classpathentry exported="true" kind="lib" path="pack200-java5.jar"/>
 	<classpathentry kind="output" path="bin/main"/>
 </classpath>

Added: harmony/enhanced/classlib/trunk/modules/pack200/README.txt
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/README.txt?view=auto&rev=502621
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/README.txt (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/README.txt Fri Feb  2 07:09:41 2007
@@ -0,0 +1,5 @@
+The java5 source directory are files that need to be compiled under Java 5. 
+Currently, they're not visible in the Eclipse project.
+At build time, the contents of the src/main/java5 project are be added to the 
+build (with a 1.5 target) and the src/main/java should be compiled with a 
+1.4 target.

Propchange: harmony/enhanced/classlib/trunk/modules/pack200/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassVersionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassVersionTest.java?view=diff&rev=502621&r1=502620&r2=502621
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassVersionTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassVersionTest.java Fri Feb  2 07:09:41 2007
@@ -25,38 +25,42 @@
 import org.apache.harmony.pack200.Segment;
 
 public class ClassVersionTest extends TestCase {
+	private static final int JAVA_15 = 49;
+
 	public void testCorrectVersionOfSegment() throws IOException {
-		InputStream in = Segment.class.getResourceAsStream(
-                "/org/apache/harmony/pack200/Segment.class");
+		InputStream in = Segment.class
+				.getResourceAsStream("/org/apache/harmony/pack200/Segment.class");
 		DataInputStream din = new DataInputStream(in);
 
-        assertEquals(0xCAFEBABE,din.readInt());
+		assertEquals(0xCAFEBABE, din.readInt());
 		din.readShort(); // MINOR -- don't care
-		assertTrue("Class file has been compiled with Java 1.5 compatibility" +
-                " instead of 1.4 or lower",din.readShort() < 49); // 49 = Java 1.5 
+		assertTrue("Class file has been compiled with Java 1.5 compatibility"
+				+ " instead of 1.4 or lower", din.readShort() < JAVA_15);
 	}
 
-    public void testCorrectVersionOfTest() throws IOException {
-		InputStream in = Segment.class.getResourceAsStream(
-                "/org/apache/harmony/pack200/tests/ClassVersionTest.class");
+	public void testCorrectVersionOfTest() throws IOException {
+		InputStream in = Segment.class
+				.getResourceAsStream("/org/apache/harmony/pack200/tests/ClassVersionTest.class");
 		DataInputStream din = new DataInputStream(in);
 
-        assertEquals(0xCAFEBABE,din.readInt());
+		assertEquals(0xCAFEBABE, din.readInt());
 		din.readShort(); // MINOR -- don't care
-		assertTrue("Class file has been compiled with Java 1.5 compatibility" +
-                " instead of 1.4 or lower",din.readShort() < 49); // 49 = Java 1.5 
+		assertTrue("Class file has been compiled with Java 1.5 compatibility"
+				+ " instead of 1.4 or lower", din.readShort() < JAVA_15);
 	}
 
-    public void testCorrectVersionOfAdapter() throws IOException {
+	public void testCorrectVersionOfAdapter() throws IOException {
 		// tests that both the file is on the classpath and that it's been
-        // compiled correctly, but without actually loading the class
-		InputStream in = Segment.class.getResourceAsStream(
-                "/org/apache/harmony/pack200/Pack200Adapter.class");
-		DataInputStream din = new DataInputStream(in);
+		// compiled correctly, but without actually loading the class
+		InputStream in = Segment.class
+				.getResourceAsStream("/org/apache/harmony/pack200/Pack200Adapter.class");
+		if (in != null) { // If running in Eclipse and Java5 stuff not built/available
+			DataInputStream din = new DataInputStream(in);
 
-        assertEquals(0xCAFEBABE,din.readInt());
-		din.readShort(); // MINOR -- don't care
-		assertTrue("Class file needs 1.5 compatibility",
-                din.readShort() >= 49); // 49 = Java 1.5 
+			assertEquals(0xCAFEBABE, din.readInt());
+			din.readShort(); // MINOR -- don't care
+			assertTrue("Class file needs 1.5 compatibility",
+					din.readShort() >= JAVA_15);
+		}
 	}
 }