You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ar...@apache.org on 2006/06/04 22:55:04 UTC

svn commit: r411596 [3/4] - in /incubator/harmony/enhanced/classlibadapter/trunk: ./ modules/kernel/src/main/java/gnu/classpath/ modules/kernel/src/main/java/java/lang/ modules/kernel/src/main/java/java/lang/ref/ modules/kernel/src/main/java/java/lang/...

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/System.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/System.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/System.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/System.java Sun Jun  4 13:55:02 2006
@@ -23,7 +23,7 @@
 import java.io.InputStream;
 import java.io.PrintStream;
 import java.util.Properties;
-import java.util.PropertyPermission;
+import gnu.classpath.VMSystemProperties;
 
 
 /**
@@ -51,9 +51,6 @@
 	 */
 	public static final PrintStream err;
 
-	// Get a ref to the Runtime instance for faster lookup
-	private static final Runtime RUNTIME = Runtime.getRuntime();
-
 	// The System Properties table
 	private static Properties systemProperties;
 
@@ -62,32 +59,28 @@
 
 	// Initialize all the slots in System on first use.
 	static {
-        //fixit -- temporarily hard code the path to a DLL library that holds a native method for simple character output
-        int tt = VMRuntime.nativeLoad("/cygdrive/c/temp2/Harmony/native-src/linux.IA32/luni_gnuclasspathadapter/libOSFileSystem.a", ClassLoader.systemClassLoader);
-		// Fill in the properties from the VM information.
 		ensureProperties();
+        System.loadLibrary("hyluni");
+        System.loadLibrary("hyarchive");
+        System.loadLibrary("hyauth");
+        System.loadLibrary("hyprt");
+        System.loadLibrary("hysig");
+        System.loadLibrary("hytext");
+        System.loadLibrary("hythr");
+        System.loadLibrary("hyzlib");
+		// Fill in the properties from the VM information.
 		// Set up standard in, out, and err.
-		err = new String.ConsolePrintStream(new BufferedOutputStream(
-				new FileOutputStream(FileDescriptor.err)));
-        VMSystem.setErr(err);
-
+		err = new String.ConsolePrintStream(new FileOutputStream(FileDescriptor.err));
 		out = new String.ConsolePrintStream(new BufferedOutputStream(
 				new FileOutputStream(FileDescriptor.out)));
-        VMSystem.setOut(out);
-
-        /*   toss this
-        int xx;
-        for (xx = 0; xx < 100; xx++) 
-        {
-            // the below is a test that verifies System.out is initialized properly
-            out.write(0x41); out.write(0x42); out.write(0x43);
-        }
-        */
-
 		in = new BufferedInputStream(new FileInputStream(FileDescriptor.in));
-        VMSystem.setIn(in);
+        systemProperties.setProperty("user.dir", getcwd());
+        ClassLoader.setupSystemClassLoader();
 	}
 
+    // FIXME: should be somewhere in jchevm or classlib
+    private static native String getcwd();
+
 	/**
 	 * Sets the value of the static slot "in" in the receiver to the passed in
 	 * argument.
@@ -96,10 +89,7 @@
 	 *            the new value for in.
 	 */
 	public static void setIn(InputStream newIn) {
-		//SecurityManager secMgr = System.getSecurityManager();
-		//setFieldImpl("in", newIn);
-        //fixit -- get security out of the way while bringing up simple "hello world" demo
-        VMSystem.setIn(newIn);
+        throw new RuntimeException("not implemented");
 	}
 
 	/**
@@ -110,10 +100,7 @@
 	 *            the new value for out.
 	 */
 	public static void setOut(java.io.PrintStream newOut) {
-		//SecurityManager secMgr = System.getSecurityManager();
-		//setFieldImpl("out", newOut);
-        //fixit -- get security out of the way while bringing up simple "hello world" demo
-        VMSystem.setOut(newOut);
+        throw new RuntimeException("not implemented");
 	}
 
 	/**
@@ -124,10 +111,7 @@
 	 *            the new value for err.
 	 */
 	public static void setErr(java.io.PrintStream newErr) {
-		//SecurityManager secMgr = System.getSecurityManager();
-        //fixit -- get security out of the way while bringing up simple "hello world" demo
-        VMSystem.setErr(newErr);
-
+        throw new RuntimeException("not implemented");
 	}
 
 	/**
@@ -154,309 +138,7 @@
 	 */
 	public static void arraycopy(Object array1, int start1, Object array2,
 			int start2, int length) {
-		// sending getClass() to both arguments will check for null
-		Class type1 = array1.getClass();
-		Class type2 = array2.getClass();
-		if (!type1.isArray() || !type2.isArray())
-			throw new ArrayStoreException();
-		Class componentType1 = type1.getComponentType();
-		Class componentType2 = type2.getComponentType();
-		if (!componentType1.isPrimitive()) {
-			if (componentType2.isPrimitive())
-				throw new ArrayStoreException();
-			arraycopy((Object[]) array1, start1, (Object[]) array2, start2,
-					length);
-		} else {
-			if (componentType2 != componentType1)
-				throw new ArrayStoreException();
-			if (componentType1 == Integer.TYPE) {
-				arraycopy((int[]) array1, start1, (int[]) array2, start2,
-						length);
-			} else if (componentType1 == Byte.TYPE) {
-				arraycopy((byte[]) array1, start1, (byte[]) array2, start2,
-						length);
-			} else if (componentType1 == Long.TYPE) {
-				arraycopy((long[]) array1, start1, (long[]) array2, start2,
-						length);
-			} else if (componentType1 == Short.TYPE) {
-				arraycopy((short[]) array1, start1, (short[]) array2, start2,
-						length);
-			} else if (componentType1 == Character.TYPE) {
-				arraycopy((char[]) array1, start1, (char[]) array2, start2,
-						length);
-			} else if (componentType1 == Boolean.TYPE) {
-				arraycopy((boolean[]) array1, start1, (boolean[]) array2,
-						start2, length);
-			} else if (componentType1 == Double.TYPE) {
-				arraycopy((double[]) array1, start1, (double[]) array2, start2,
-						length);
-			} else if (componentType1 == Float.TYPE) {
-				arraycopy((float[]) array1, start1, (float[]) array2, start2,
-						length);
-			}
-		}
-	}
-
-	/**
-	 * Private version of the arraycopy method (used by the jit for reference arraycopies)
-	 */
-	private static void arraycopy(Object[] A1, int offset1, Object[] A2,
-			int offset2, int length) {
-		if (offset1 >= 0 && offset2 >= 0 && length >= 0
-				&& length <= A1.length - offset1
-				&& length <= A2.length - offset2) {
-			// Check if this is a forward or backwards arraycopy
-			if (A1 != A2 || offset1 > offset2 || offset1 + length <= offset2) {
-				for (int i = 0; i < length; ++i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			} else {
-				for (int i = length - 1; i >= 0; --i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			}
-		} else
-			throw new ArrayIndexOutOfBoundsException();
-	}
-
-	/**
-	 * Copies the contents of <code>A1</code> starting at offset <code>offset1</code>
-	 * into <code>A2</code> starting at offset <code>offset2</code> for
-	 * <code>length</code> elements.
-	 *
-	 * @param		A1 			the array to copy out of
-	 * @param		offset1 	the starting index in array1
-	 * @param		A2 			the array to copy into
-	 * @param		offset2 	the starting index in array2
-	 * @param		length 		the number of elements in the array to copy
-	 */
-	private static void arraycopy(int[] A1, int offset1, int[] A2, int offset2,
-			int length) {
-		if (offset1 >= 0 && offset2 >= 0 && length >= 0
-				&& length <= A1.length - offset1
-				&& length <= A2.length - offset2) {
-			// Check if this is a forward or backwards arraycopy
-			if (A1 != A2 || offset1 > offset2 || offset1 + length <= offset2) {
-				for (int i = 0; i < length; ++i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			} else {
-				for (int i = length - 1; i >= 0; --i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			}
-		} else
-			throw new ArrayIndexOutOfBoundsException();
-	}
-
-	/**
-	 * Copies the contents of <code>A1</code> starting at offset <code>offset1</code>
-	 * into <code>A2</code> starting at offset <code>offset2</code> for
-	 * <code>length</code> elements.
-	 *
-	 * @param		A1 			the array to copy out of
-	 * @param		offset1 	the starting index in array1
-	 * @param		A2 			the array to copy into
-	 * @param		offset2 	the starting index in array2
-	 * @param		length 		the number of elements in the array to copy
-	 */
-	private static void arraycopy(byte[] A1, int offset1, byte[] A2,
-			int offset2, int length) {
-		if (offset1 >= 0 && offset2 >= 0 && length >= 0
-				&& length <= A1.length - offset1
-				&& length <= A2.length - offset2) {
-			// Check if this is a forward or backwards arraycopy
-			if (A1 != A2 || offset1 > offset2 || offset1 + length <= offset2) {
-				for (int i = 0; i < length; ++i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			} else {
-				for (int i = length - 1; i >= 0; --i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			}
-		} else
-			throw new ArrayIndexOutOfBoundsException();
-	}
-
-	/**
-	 * Copies the contents of <code>A1</code> starting at offset <code>offset1</code>
-	 * into <code>A2</code> starting at offset <code>offset2</code> for
-	 * <code>length</code> elements.
-	 *
-	 * @param		A1 			the array to copy out of
-	 * @param		offset1 	the starting index in array1
-	 * @param		A2 			the array to copy into
-	 * @param		offset2 	the starting index in array2
-	 * @param		length 		the number of elements in the array to copy
-	 */
-	private static void arraycopy(short[] A1, int offset1, short[] A2,
-			int offset2, int length) {
-		if (offset1 >= 0 && offset2 >= 0 && length >= 0
-				&& length <= A1.length - offset1
-				&& length <= A2.length - offset2) {
-			// Check if this is a forward or backwards arraycopy
-			if (A1 != A2 || offset1 > offset2 || offset1 + length <= offset2) {
-				for (int i = 0; i < length; ++i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			} else {
-				for (int i = length - 1; i >= 0; --i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			}
-		} else
-			throw new ArrayIndexOutOfBoundsException();
-	}
-
-	/**
-	 * Copies the contents of <code>A1</code> starting at offset <code>offset1</code>
-	 * into <code>A2</code> starting at offset <code>offset2</code> for
-	 * <code>length</code> elements.
-	 *
-	 * @param		A1 			the array to copy out of
-	 * @param		offset1 	the starting index in array1
-	 * @param		A2 			the array to copy into
-	 * @param		offset2 	the starting index in array2
-	 * @param		length 		the number of elements in the array to copy
-	 */
-	private static void arraycopy(long[] A1, int offset1, long[] A2,
-			int offset2, int length) {
-		if (offset1 >= 0 && offset2 >= 0 && length >= 0
-				&& length <= A1.length - offset1
-				&& length <= A2.length - offset2) {
-			// Check if this is a forward or backwards arraycopy
-			if (A1 != A2 || offset1 > offset2 || offset1 + length <= offset2) {
-				for (int i = 0; i < length; ++i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			} else {
-				for (int i = length - 1; i >= 0; --i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			}
-		} else
-			throw new ArrayIndexOutOfBoundsException();
-	}
-
-	/**
-	 * Copies the contents of <code>A1</code> starting at offset <code>offset1</code>
-	 * into <code>A2</code> starting at offset <code>offset2</code> for
-	 * <code>length</code> elements.
-	 *
-	 * @param		A1 			the array to copy out of
-	 * @param		offset1 	the starting index in array1
-	 * @param		A2 			the array to copy into
-	 * @param		offset2 	the starting index in array2
-	 * @param		length 		the number of elements in the array to copy
-	 */
-	private static void arraycopy(char[] A1, int offset1, char[] A2,
-			int offset2, int length) {
-		if (offset1 >= 0 && offset2 >= 0 && length >= 0
-				&& length <= A1.length - offset1
-				&& length <= A2.length - offset2) {
-			// Check if this is a forward or backwards arraycopy
-			if (A1 != A2 || offset1 > offset2 || offset1 + length <= offset2) {
-				for (int i = 0; i < length; ++i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			} else {
-				for (int i = length - 1; i >= 0; --i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			}
-		} else
-			throw new ArrayIndexOutOfBoundsException();
-	}
-
-	/**
-	 * Copies the contents of <code>A1</code> starting at offset <code>offset1</code>
-	 * into <code>A2</code> starting at offset <code>offset2</code> for
-	 * <code>length</code> elements.
-	 *
-	 * @param		A1 			the array to copy out of
-	 * @param		offset1 	the starting index in array1
-	 * @param		A2 			the array to copy into
-	 * @param		offset2 	the starting index in array2
-	 * @param		length 		the number of elements in the array to copy
-	 */
-	private static void arraycopy(boolean[] A1, int offset1, boolean[] A2,
-			int offset2, int length) {
-		if (offset1 >= 0 && offset2 >= 0 && length >= 0
-				&& length <= A1.length - offset1
-				&& length <= A2.length - offset2) {
-			// Check if this is a forward or backwards arraycopy
-			if (A1 != A2 || offset1 > offset2 || offset1 + length <= offset2) {
-				for (int i = 0; i < length; ++i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			} else {
-				for (int i = length - 1; i >= 0; --i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			}
-		} else
-			throw new ArrayIndexOutOfBoundsException();
-	}
-
-	/**
-	 * Copies the contents of <code>A1</code> starting at offset <code>offset1</code>
-	 * into <code>A2</code> starting at offset <code>offset2</code> for
-	 * <code>length</code> elements.
-	 *
-	 * @param		A1 			the array to copy out of
-	 * @param		offset1 	the starting index in array1
-	 * @param		A2 			the array to copy into
-	 * @param		offset2 	the starting index in array2
-	 * @param		length 		the number of elements in the array to copy
-	 */
-	private static void arraycopy(double[] A1, int offset1, double[] A2,
-			int offset2, int length) {
-		if (offset1 >= 0 && offset2 >= 0 && length >= 0
-				&& length <= A1.length - offset1
-				&& length <= A2.length - offset2) {
-			// Check if this is a forward or backwards arraycopy
-			if (A1 != A2 || offset1 > offset2 || offset1 + length <= offset2) {
-				for (int i = 0; i < length; ++i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			} else {
-				for (int i = length - 1; i >= 0; --i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			}
-		} else
-			throw new ArrayIndexOutOfBoundsException();
-	}
-
-	/**
-	 * Copies the contents of <code>A1</code> starting at offset <code>offset1</code>
-	 * into <code>A2</code> starting at offset <code>offset2</code> for
-	 * <code>length</code> elements.
-	 *
-	 * @param		A1 			the array to copy out of
-	 * @param		offset1 	the starting index in array1
-	 * @param		A2 			the array to copy into
-	 * @param		offset2 	the starting index in array2
-	 * @param		length 		the number of elements in the array to copy
-	 */
-	private static void arraycopy(float[] A1, int offset1, float[] A2,
-			int offset2, int length) {
-		if (offset1 >= 0 && offset2 >= 0 && length >= 0
-				&& length <= A1.length - offset1
-				&& length <= A2.length - offset2) {
-			// Check if this is a forward or backwards arraycopy
-			if (A1 != A2 || offset1 > offset2 || offset1 + length <= offset2) {
-				for (int i = 0; i < length; ++i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			} else {
-				for (int i = length - 1; i >= 0; --i) {
-					A2[offset2 + i] = A1[offset1 + i];
-				}
-			}
-		} else
-			throw new ArrayIndexOutOfBoundsException();
+        VMSystem.arraycopy(array1, start1, array2, start2, length);
 	}
 
 	/**
@@ -465,10 +147,7 @@
 	 * 
 	 * @return the time in milliseconds.
 	 */
-    public static  long currentTimeMillis() 
-    {
-        return VMSystem.currentTimeMillis();
-    }
+    public static native long currentTimeMillis();
 
 	private static final int InitLocale = 0;
 
@@ -483,8 +162,7 @@
 	 * provided by the virtual machine.
 	 */
 	private static void ensureProperties() {
-		systemProperties = new Properties();
-
+		systemProperties = VMSystemProperties.getSystemProperties();
 		String platformEncoding = null;
 		String fileEncoding, osEncoding = null;
 		String definedFileEncoding = getEncoding(FileEncoding);
@@ -512,16 +190,6 @@
 
 		systemProperties.put("file.encoding", fileEncoding);
 
-		systemProperties.put("java.version", "1.4.2 subset");
-		systemProperties.put("java.specification.version", "1.4");
-
-		systemProperties.put("java.specification.vendor",
-				"Sun Microsystems Inc.");
-		systemProperties.put("java.specification.name",
-				"Java Platform API Specification");
-
-		systemProperties.put("com.ibm.oti.configuration", "clear");
-		systemProperties.put("com.ibm.oti.configuration.dir", "jclClear");
 
 		String[] list = getPropertyList();
 		for (int i = 0; i < list.length; i += 2) {
@@ -538,8 +206,10 @@
 				platformEncoding = getEncoding(PlatformEncoding);
 			consoleEncoding = platformEncoding;
 			systemProperties.put("console.encoding", consoleEncoding);
-		}
+        }
 
+		systemProperties.put("com.ibm.oti.configuration", "clear");
+		systemProperties.put("com.ibm.oti.configuration.dir", "jclClear");
 		systemProperties.put("com.ibm.oti.jcl.build", "plugin");
 	}
 
@@ -727,7 +397,8 @@
 	//fixit  below is a non-native version for getting "hello world" to work ---- private static native String getEncoding(int type);
     private static String getEncoding(int type) 
     {
-        return "java.lang.System.getEncoding()";
+        // FIXME: not correct, need to get from system
+        return "ISO-8859-1";
         /*
         String str = "java.lang.System.getEncoding() type = ???";
         if (type == 0)
@@ -770,6 +441,7 @@
         return hash;
     }
 
+
 	/**
 	 * Loads the specified file as a dynamic library.
 	 * 
@@ -777,14 +449,9 @@
 	 *            the path of the file to be loaded
 	 */
 	public static void load(String pathName) {
-        //fixit -- set aside security while bringing up simple "hello world" demo
-		/*
-        SecurityManager smngr = System.getSecurityManager();
-		if (smngr != null)
-			smngr.checkLink(pathName);
-        */
-		ClassLoader.loadLibraryWithPath(pathName, ClassLoader
-				.callerClassLoader(), null);
+        // FIXME: all the security checks
+        ClassLoader classLoader = ClassLoader.callerClassLoader();
+        Runtime.getRuntime().loadInternal(pathName, classLoader);
 	}
 
 	/**
@@ -799,8 +466,9 @@
 	 *             if the library was not allowed to be loaded
 	 */
 	public static void loadLibrary(String libName) {
-		ClassLoader.loadLibraryWithClassLoader(libName, ClassLoader
-				.callerClassLoader());
+        // FIXME: all the security checks
+        ClassLoader classLoader = ClassLoader.callerClassLoader();
+        Runtime.getRuntime().loadLibraryInternal(libName, classLoader);
 	}
 
 	/**
@@ -859,7 +527,7 @@
 	 *             if the security manager has already been set.
 	 */
 	public static void setSecurityManager(final SecurityManager s) {
-		final SecurityManager currentSecurity = security;
+		//final SecurityManager currentSecurity = security;
 		try {
 			// Preload classes used for checkPackageAccess(),
 			// otherwise we could go recursive
@@ -880,9 +548,8 @@
 	 */
 	//fixit -- the original stub declares this routine a native method.  Is this required?
     // public static native String mapLibraryName(String userLibName);
-    public static String mapLibraryName(String userLibName) 
-    {
-        return "System.mapLibraryName() is not implemented";
+    public static String mapLibraryName(String libName) {
+        return VMRuntime.mapLibraryName(libName);
     }
 
 	/**
@@ -896,10 +563,10 @@
 	 */
 	//fixit -- the original stub declares this routine a native method.  Is this required?
 	//private static native void setFieldImpl(String fieldName, Object stream);
-    private static void setFieldImpl(String fieldName, Object stream) 
+    /*private static void setFieldImpl(String fieldName, Object stream) 
     {
         return;
-    }
+    }*/
 
 }
 

Added: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/SystemClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/SystemClassLoader.java?rev=411596&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/SystemClassLoader.java (added)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/SystemClassLoader.java Sun Jun  4 13:55:02 2006
@@ -0,0 +1,59 @@
+package java.lang;
+
+import java.net.URLClassLoader;
+import java.net.URL;
+import java.io.File;
+import java.util.StringTokenizer;
+
+final class SystemClassLoader extends URLClassLoader {
+
+    //private Object[] path;
+    private String sep;
+
+    SystemClassLoader() {
+        super(new URL[0]);
+    }
+
+
+    private void setup() {
+        String classpath = System.getProperty("java.class.path");
+        sep = System.getProperty("file.separator");
+        String pathSep = System.getProperty("path.separator");
+        StringTokenizer tokens = new StringTokenizer(classpath, pathSep);
+
+        while (tokens.hasMoreElements()) {
+            String filename = tokens.nextToken();
+
+            System.err.println("user.dir = " + System.getProperty("user.dir"));
+
+            try {
+                File f = new File(filename);
+                if (f.isDirectory()) {
+                    String u = "file://" + f.getAbsolutePath() + "/";
+                    System.err.println("url = " + u);
+                    addURL(new URL(u));
+                } else {
+                    String u = "file://" + f.getAbsolutePath();
+                    System.err.println("url(jar) = " + u);
+                    addURL(new URL(u));
+                }
+            } catch (Throwable t) {
+                t.printStackTrace();
+            }
+        }
+    }
+
+
+	protected Class findClass(String className) throws ClassNotFoundException {
+        if (sep == null) setup();
+        return super.findClass(className);
+    }
+
+	public URL getResource(String resName) {
+        URL resource = getSystemResource(resName);
+        if (resource != null) return resource;
+
+        if (sep == null) setup();
+        return findResource(resName);
+	}
+}

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/Thread.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/Thread.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/Thread.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/Thread.java Sun Jun  4 13:55:02 2006
@@ -46,7 +46,7 @@
     /////ThreadGroup threadGroupSlot;  //maybe same as next one
     ThreadGroup group;
     ////VMThread threadSlot;  //maybe same as next one
-    VMThread vmThread;  
+    final VMThread vmThread;  
     ///boolean isDaemonSlot;  //maybe this is the same as daemon
     boolean daemon;
     ThreadLocal threadLocalSlot;
@@ -54,13 +54,6 @@
     int priority;
 
 
-	/**
-	 * Constructs a new Thread with no runnable object and a newly generated
-	 * name. The new Thread will belong to the same ThreadGroup as the Thread
-	 * calling this constructor.
-	 * 
-	 * @see java.lang.ThreadGroup
-	 */
     public Thread(VMThread vmt1, String s1, int i1, boolean b1) 
     {
         super();
@@ -69,9 +62,17 @@
         priority = i1;
         daemon = b1;
     }
+
+	/**
+	 * Constructs a new Thread with no runnable object and a newly generated
+	 * name. The new Thread will belong to the same ThreadGroup as the Thread
+	 * calling this constructor.
+	 * 
+	 * @see java.lang.ThreadGroup
+	 */
 	public Thread() {
         super();
-        vmThread = new VMThread();
+        vmThread = new VMThread(this);
 	}
 
 	/**
@@ -88,7 +89,7 @@
 	public Thread(Runnable runnable) {
 		super();
         runnableSlot = runnable;
-        vmThread = new VMThread();
+        vmThread = new VMThread(this);
 	}
 
 	/**
@@ -108,7 +109,7 @@
 		super();
         runnableSlot = runnable;
         name = threadName;
-        vmThread = new VMThread();
+        vmThread = new VMThread(this);
 
 	}
 
@@ -125,7 +126,7 @@
 	public Thread(String threadName) {
         super();
         name = threadName;
-        vmThread = new VMThread();
+        vmThread = new VMThread(this);
 	}
 
 	/**
@@ -151,7 +152,7 @@
         super();
         group = gr;
         runnableSlot = runnable;
-        vmThread = new VMThread();
+        vmThread = new VMThread(this);
 	}
 
 	/**
@@ -183,7 +184,7 @@
         group = gr;
         runnableSlot = runnable;
         name = threadName;
-        vmThread = new VMThread();
+        vmThread = new VMThread(this);
 	}
 
 	/**
@@ -212,7 +213,7 @@
         group = gr;
         runnableSlot = runnable;
         name = threadName;
-        vmThread = new VMThread();
+        vmThread = new VMThread(this);
 	}
 
 	/**
@@ -236,7 +237,7 @@
 		super();
         group = gr;
         name = threadName;
-        vmThread = new VMThread();
+        vmThread = new VMThread(this);
 	}
 
 	/**
@@ -298,7 +299,11 @@
 	 * 
 	 */
 	public static void dumpStack() {
-		//VMThrowable.getStackTrace(this);  // fixit -- not required for simple "hello world" demo
+        try {
+            throw new Exception("stack dump");
+        } catch (Throwable t) {
+            t.printStackTrace();
+        }
 	}
 
 	/**
@@ -338,7 +343,7 @@
 	 * @return the receiver's name (a java.lang.String)
 	 */
 	public final String getName() {
-        String ss = name + this.toString();
+        //String ss = name + this.toString();
 		return this.toString();  // fixit -- find out the proper construction for thread names
 	}
 
@@ -417,7 +422,7 @@
 	 * @see Thread#start
 	 */
 	public final boolean isAlive() {
-		return false;  //fixit -- obviously incorrect but probably OK for simple "hello world" demo
+		return vmThread.isAlive();
 	}
 
 	/**
@@ -657,26 +662,22 @@
 	 * @see Thread#run
 	 */
 	public void start() {
-        //debugging aid -- the s1 and s2 strings are easy to spot in jchevm since string creation calls into the jvm
-        String s1 = "Thread.start() -- TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT";
         int stackSize = 1024 * 64;
-        vmThread.thread = this;
         if (java.lang.ThreadGroup.root == null) 
         {
             java.lang.ThreadGroup tg = new java.lang.ThreadGroup();
             java.lang.ThreadGroup.root = tg;
         }
         group = java.lang.ThreadGroup.root; //wjw temporary, during bringup
-        vmThread.start(stackSize);
-        String s2 = "Thread.start() -- BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB";
-        int xx = 0;
-        /*
-         while (true)
-        {
-            xx++;
+        try {
+            synchronized (vmThread) {
+                vmThread.start(stackSize);
+                vmThread.wait();
+            }
+        } catch (Throwable t) {
+            System.err.println("error starting thread");
+            t.printStackTrace();
         }
-        */
-		return;
 	}
 
 	/**

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/ThreadGroup.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/ThreadGroup.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/ThreadGroup.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/ThreadGroup.java Sun Jun  4 13:55:02 2006
@@ -67,7 +67,7 @@
 	private boolean isDestroyed = false;
 
 	// Memory space to associate all new threads with
-	private long memorySpace;
+	//private long memorySpace;
 
 	/**
 	 * Used by the JVM to create the "system" ThreadGroup. Construct a

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/Throwable.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/Throwable.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/Throwable.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/Throwable.java Sun Jun  4 13:55:02 2006
@@ -50,7 +50,7 @@
 	 * An object which describes the walkback. This field is stored by the
 	 * fillInStackTrace() native, and used by the getStackTraceImpl() native.
 	 */
-	private transient Object walkback;
+	//private transient Object walkback;
 
 	/**
 	 * The cause of this Throwable. Null when there is no cause.
@@ -63,9 +63,7 @@
 	 * Constructs a new instance of this class with its walkback filled in.
 	 */
 	public Throwable() {
-		super();
-        //fixit -- is the below code correct?
-		fillInStackTrace();
+		this((String)null);
 	}
 
 	/**
@@ -76,9 +74,15 @@
 	 *            String The detail message for the exception.
 	 */
 	public Throwable(String detailMessage) {
-		this();
 		this.detailMessage = detailMessage;
+		fillInStackTrace();
+        /*num++;
+        if (num > 100
+                && !(this instanceof ClassNotFoundException)
+                && !(this instanceof NoClassDefFoundError))
+            printStackTrace();*/
 	}
+    //static int num = 0;
 
 	/**
 	 * Constructs a new instance of this class with its walkback, message and
@@ -119,11 +123,10 @@
 	 * 
 	 * @return the receiver
 	 */
-	//  this is a native instance method, wrong!  ---->public native Throwable fillInStackTrace();
     public Throwable fillInStackTrace() 
     {
-        Throwable thr = VMThrowable.fillInStackTrace(this);
-        return thr;
+        vmState = VMThrowable.fillInStackTrace(this);
+        return this;
     }
 
 	/**
@@ -162,9 +165,7 @@
 	//  this is a native instance method, wrong!  ----> private native StackTraceElement[] getStackTraceImpl();
     private StackTraceElement[] getStackTraceImpl()
     {
-        // fixit -- commented out the below line to get simple "hello world" demo to work
-        //VMThrowable.getStackTrace(this);
-        return null;
+        return vmState.getStackTrace(this);
     }
 	/**
 	 * Answers an array of StackTraceElement. Each StackTraceElement represents

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMRuntime.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMRuntime.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMRuntime.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMRuntime.java Sun Jun  4 13:55:02 2006
@@ -17,30 +17,18 @@
 public class VMRuntime 
 {
     //this class was created by looking at the native methods contained in Apache JCHEVM
-    static public final native int availableProcessors();
-
-    static public final native void exit(int code);
-
-    static public final native long freeMemory();
-
-    static public final native void gc();
-
-    static public final native String mapLibraryName(String ss);
-
-    static public final native long maxMemory();
-
-    static public final native int nativeLoad(String ss, ClassLoader cl);
-
-    static public final native void runFinalization();
-
-    static public final native void runFinalizationForExit();
-
-    static public final native void runFinalizersOnExit(boolean bb);
-
-    static public final native long totalMemory();
-
-    static public final native void traceInstructions(boolean bb);
-
-    static public final native void traceMethodCalls(boolean bb);
+    static final native int availableProcessors();
+    static final native void exit(int code);
+    static final native long freeMemory();
+    static final native void gc();
+    static final native String mapLibraryName(String ss);
+    static final native long maxMemory();
+    static final native int nativeLoad(String ss, ClassLoader cl);
+    static final native void runFinalization();
+    static final native void runFinalizationForExit();
+    static final native void runFinalizersOnExit(boolean bb);
+    static final native long totalMemory();
+    static final native void traceInstructions(boolean bb);
+    static final native void traceMethodCalls(boolean bb);
 
 }

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMSystem.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMSystem.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMSystem.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMSystem.java Sun Jun  4 13:55:02 2006
@@ -14,20 +14,12 @@
  */
 package java.lang;
 
-import java.io.*;
-
 public class VMSystem 
 {
     //VMSystem was created by looking at Apache JCHEVM native methods
-    // not necessary for simple "hello world" demo --> static final native void arraycopy(Object obj, int ii, Object obj2, int jj, int kk);
+    static final native void arraycopy(Object obj, int ii, Object obj2, int jj, int kk);
 
     static public final native int identityHashCode(Object obj);
-
-    static public final native void setIn(InputStream is);
-
-    static public final native void setOut(PrintStream ps);
-
-    static public final native void setErr(PrintStream ps);
 
     public static final native long currentTimeMillis();
 

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMThread.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMThread.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMThread.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMThread.java Sun Jun  4 13:55:02 2006
@@ -16,26 +16,50 @@
 
 class VMThread 
 {
-    //VMThread was created by looking at the native methods for Apache JCHEVM
     VMThread(Thread t1) 
     {
         this.thread = t1;
-        //the below is a diagnostic/debug aid (you can set breakpoint in JCHEVM where this string object is created
-        String s1 = "VMThread.<init>(Thread) is not fully implemented";
+        this.vmdata = null;
     }
-    VMThread()
-    {
-        //the below is a diagnostic/debug aid (you can set breakpoint in JCHEVM where this string object is created
-        String s1 = "VMThread.<init>() is not fully implemented";
-    }
-    Thread thread;
+
+    final Thread thread;
     Object vmdata;
-    void run() 
-    {
-        //the below is a diagnostic/debug aid (you can set breakpoint in JCHEVM where this string object is created
-        String s1 = "NNNNNNNNNNNNNNNN VMThread.run() has been called";
-        thread.run();
+    private boolean started = false;
+    private boolean running = false;
+
+    void run() {
+        attach();
+        try {
+            synchronized (this) {
+                if (started) return;
+                started = true;
+                running = true;
+                notifyAll();
+            }
+
+            thread.run();
+
+            synchronized (this) {
+                running = false;
+                notifyAll();
+            }
+        } catch (Throwable t) {
+            System.err.println("Thread dead with exception:");
+            t.printStackTrace();
+        }
+        destroy();
+    }
+
+    final boolean isAlive() {
+        synchronized (this) {
+            return running;
+        }
     }
+
+    private final native void attach();
+    private final native void destroy();
+
+
     final native int countStackFrames();
 
     static final native Thread currentThread();

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMThrowable.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMThrowable.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMThrowable.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/VMThrowable.java Sun Jun  4 13:55:02 2006
@@ -14,10 +14,10 @@
  */
 package java.lang;
 
-public class VMThrowable 
+final class VMThrowable 
 {
-    private Object vmdata;  //  jchevm/libjc/bootstrap.c needs to resolve this field for "hello world to work"
-    static public final native Throwable fillInStackTrace(Throwable thr); // corresponds to jchevm/libjc/native/java_lang_VMThrowable.c
+    Object vmdata;
+    static public final native VMThrowable fillInStackTrace(Throwable thr); // corresponds to jchevm/libjc/native/java_lang_VMThrowable.c
     final public native StackTraceElement[] getStackTrace(Throwable thr); // corresponds to jchevm/libjc/native/java_lang_VMThrowable.c
 }
 

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/ref/Reference.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/ref/Reference.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/ref/Reference.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/ref/Reference.java Sun Jun  4 13:55:02 2006
@@ -29,6 +29,7 @@
 
     Object referent;
     ReferenceQueue queue;
+    private static ReferenceQueue dummy = new ReferenceQueue();
 
 	/**
 	 * Make the referent null. This does not force the reference object to be
@@ -36,6 +37,7 @@
 	 * 
 	 */
 	public void clear() {
+        referent = null;
 		return;
 	}
 
@@ -46,7 +48,20 @@
 	 * @return boolean true if Reference is enqueued. false otherwise.
 	 */
 	public boolean enqueue() {
-		return false;
+        ReferenceQueue q;
+        synchronized (this) {
+            if (queue == null || queue == dummy) return false;
+            q = queue;
+            queue = null;
+        }
+
+        try {
+            q.enqueue(this);
+            return true;
+        } catch (Throwable t) {
+            t.printStackTrace();
+        }
+        return false;
 	}
 
 	/**
@@ -56,7 +71,7 @@
 	 *         been cleared.
 	 */
 	public Object get() {
-		return null;
+		return referent;
 	}
 
 	/**
@@ -65,17 +80,7 @@
 	 * @return boolean true if Reference has been enqueued. false otherwise.
 	 */
 	public boolean isEnqueued() {
-		return false;
-	}
-
-	/**
-	 * Enqueue the reference object on the associated queue.
-	 * 
-	 * @return boolean true if the Reference was successfully enqueued. false
-	 *         otherwise.
-	 */
-	boolean enqueueImpl() {
-		return false;
+		return queue == null;
 	}
 
 	/**
@@ -95,6 +100,8 @@
 	 *            the referent
 	 */
 	void initReference(Object r) {
+        referent = r;
+        queue = dummy;
 		return;
 	}
 
@@ -109,6 +116,8 @@
 	 *            the ReferenceQueue
 	 */
 	void initReference(Object r, ReferenceQueue q) {
+        referent = r;
+        queue = q;
 		return;
 	}
 
@@ -119,6 +128,5 @@
 	void dequeue() {
 		return;
 	}
-
 }
 

Added: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/AccessibleObject.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/AccessibleObject.java?rev=411596&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/AccessibleObject.java (added)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/AccessibleObject.java Sun Jun  4 13:55:02 2006
@@ -0,0 +1,176 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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 java.lang.reflect;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * This class must be implemented by the VM vendor. This class is the superclass
+ * of all member reflect classes (Field, Constructor, Method). AccessibleObject
+ * provides the ability to toggle access checks for these objects. By default
+ * accessing a member (for example, setting a field or invoking a method) checks
+ * the validity of the access (for example, invoking a private method from
+ * outside the defining class is prohibited) and throws IllegalAccessException
+ * if the operation is not permitted. If the accessible flag is set to true,
+ * these checks are omitted. This allows privileged applications such as Java
+ * Object Serialization, inspectors, and debuggers to have complete access to
+ * objects.
+ * 
+ * @see Field
+ * @see Constructor
+ * @see Method
+ * @see ReflectPermission
+ * @since 1.2
+ */
+public class AccessibleObject implements AnnotatedElement {
+	static final Object[] emptyArgs = new Object[0];
+
+	/**
+	 * AccessibleObject constructor. AccessibleObjects can only be created by
+	 * the Virtual Machine.
+	 */
+	protected AccessibleObject() {
+		super();
+	}
+
+	/**
+	 * Returns the value of the accessible flag. This is false if access checks
+	 * are performed, true if they are skipped.
+	 * 
+	 * @return the value of the accessible flag
+	 */
+	public boolean isAccessible() {
+		return true;
+	}
+
+	/**
+	 * Attempts to set the value of the accessible flag for all the objects in
+	 * the array provided. Only one security check is performed. Setting this
+	 * flag to false will enable access checks, setting to true will disable
+	 * them. If there is a security manager, checkPermission is called with a
+	 * ReflectPermission("suppressAccessChecks").
+	 * 
+	 * @param objects
+	 *            the accessible objects
+	 * @param flag
+	 *            the new value for the accessible flag
+	 * @see #setAccessible(boolean)
+	 * @see ReflectPermission
+	 * @throws SecurityException
+	 *             if the request is denied
+	 */
+	public static void setAccessible(AccessibleObject[] objects, boolean flag)
+			throws SecurityException {
+		return;
+	}
+
+	/**
+	 * Attempts to set the value of the accessible flag. Setting this flag to
+	 * false will enable access checks, setting to true will disable them. If
+	 * there is a security manager, checkPermission is called with a
+	 * ReflectPermission("suppressAccessChecks").
+	 * 
+	 * @param flag
+	 *            the new value for the accessible flag
+	 * @see ReflectPermission
+	 * @throws SecurityException
+	 *             if the request is denied
+	 */
+	public void setAccessible(boolean flag) throws SecurityException {
+		return;
+	}
+    
+    public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
+        throw new RuntimeException("not implemented");
+        //return false;
+    }
+    
+    public Annotation[] getDeclaredAnnotations() {
+        throw new RuntimeException("not implemented");
+        //return new Annotation[0];
+    }
+    
+    public Annotation[] getAnnotations() {
+        throw new RuntimeException("not implemented");
+        //return new Annotation[0];
+    }
+    
+    public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
+        throw new RuntimeException("not implemented");
+		//return null;
+    }
+
+	static Object[] marshallArguments(Class[] parameterTypes, Object[] args)
+			throws IllegalArgumentException {
+        throw new RuntimeException("not implemented");
+		//return null;
+	}
+
+	void invokeV(Object receiver, Object args[])
+			throws InvocationTargetException {
+        throw new RuntimeException("not implemented");
+		//return;
+	}
+
+	Object invokeL(Object receiver, Object args[])
+			throws InvocationTargetException {
+        throw new RuntimeException("not implemented");
+		//return null;
+	}
+
+	int invokeI(Object receiver, Object args[])
+			throws InvocationTargetException {
+        throw new RuntimeException("not implemented");
+		//return 0;
+	}
+
+	long invokeJ(Object receiver, Object args[])
+			throws InvocationTargetException {
+        throw new RuntimeException("not implemented");
+		//return 0L;
+	}
+
+	float invokeF(Object receiver, Object args[])
+			throws InvocationTargetException {
+        throw new RuntimeException("not implemented");
+		//return 0.0F;
+	}
+
+	double invokeD(Object receiver, Object args[])
+			throws InvocationTargetException {
+        throw new RuntimeException("not implemented");
+		//return 0.0D;
+	}
+
+	native Class[] getParameterTypesImpl();
+
+	native int getModifiers();
+
+	native Class[] getExceptionTypesImpl();
+
+	native String getSignature();
+
+	native boolean checkAccessibility(Class senderClass, Object receiver);
+
+	static native void initializeClass(Class clazz);
+
+	/**
+	 * Answer the class at depth. Notes: 1) This method operates on the defining
+	 * classes of methods on stack. NOT the classes of receivers. 2) The item at
+	 * index zero describes the caller of this method.
+	 */
+	static final native Class getStackClass(int depth);
+}

Added: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Array.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Array.java?rev=411596&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Array.java (added)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Array.java Sun Jun  4 13:55:02 2006
@@ -0,0 +1,472 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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 java.lang.reflect;
+
+/**
+ * This class must be implemented by the vm vendor. This class provides methods
+ * to dynamically create and access arrays.
+ * 
+ */
+public final class Array {
+
+	/**
+	 * Return the element of the array at the specified index. This reproduces
+	 * the effect of <code>array[index]</code> If the array component is a
+	 * base type, the result is automatically wrapped.
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element, possibly wrapped
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native Object get(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to a
+	 * boolean if possible. This reproduces the effect of
+	 * <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native boolean getBoolean(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to a
+	 * byte if possible. This reproduces the effect of <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native byte getByte(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to a
+	 * char if possible. This reproduces the effect of <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native char getChar(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to a
+	 * double if possible. This reproduces the effect of
+	 * <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native double getDouble(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to a
+	 * float if possible. This reproduces the effect of
+	 * <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native float getFloat(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to an
+	 * int if possible. This reproduces the effect of <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native int getInt(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the length of the array. This reproduces the effect of
+	 * <code>array.length</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @return the length
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array
+	 */
+	public static native int getLength(Object array)
+			throws IllegalArgumentException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to a
+	 * long if possible. This reproduces the effect of <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native long getLong(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return the element of the array at the specified index, converted to a
+	 * short if possible. This reproduces the effect of
+	 * <code>array[index]</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @return the requested element
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the element cannot be
+	 *                converted to the requested type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native short getShort(Object array, int index)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Return a new multidimensional array of the specified component type and
+	 * dimensions. This reproduces the effect of
+	 * <code>new componentType[d0][d1]...[dn]</code> for a dimensions array of {
+	 * d0, d1, ... , dn }
+	 * 
+	 * @param componentType
+	 *            the component type of the new array
+	 * @param dimensions
+	 *            the dimensions of the new array
+	 * @return the new array
+	 * @exception java.lang.NullPointerException
+	 *                if the component type is null
+	 * @exception java.lang.NegativeArraySizeException
+	 *                if any of the dimensions are negative
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array of dimensions is of size zero, or exceeds the
+	 *                limit of the number of dimension for an array (currently
+	 *                255)
+	 */
+	public static native Object newInstance(Class<?> componentType, int[] dimensions)
+			throws NegativeArraySizeException, IllegalArgumentException;
+
+	/**
+	 * Return a new array of the specified component type and length. This
+	 * reproduces the effect of <code>new componentType[size]</code>
+	 * 
+	 * @param componentType
+	 *            the component type of the new array
+	 * @param size
+	 *            the length of the new array
+	 * @return the new array
+	 * @exception java.lang.NullPointerException
+	 *                if the component type is null
+	 * @exception java.lang.NegativeArraySizeException
+	 *                if the size if negative
+	 */
+	public static native Object newInstance(Class<?> componentType, int size)
+			throws NegativeArraySizeException;
+
+	/**
+	 * Set the element of the array at the specified index to the value. This
+	 * reproduces the effect of <code>array[index] = value</code> If the array
+	 * component is a base type, the value is automatically unwrapped
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void set(Object array, int index, Object value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the boolean value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setBoolean(Object array, int index, boolean value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the byte value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setByte(Object array, int index, byte value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the char value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setChar(Object array, int index, char value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the double value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setDouble(Object array, int index, double value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the float value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setFloat(Object array, int index, float value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the int value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setInt(Object array, int index, int value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the long value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setLong(Object array, int index, long value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Set the element of the array at the specified index to the short value.
+	 * This reproduces the effect of <code>array[index] = value</code>
+	 * 
+	 * @param array
+	 *            the array
+	 * @param index
+	 *            the index
+	 * @param value
+	 *            the new value
+	 * @exception java.lang.NullPointerException
+	 *                if the array is null
+	 * @exception java.lang.IllegalArgumentException
+	 *                if the array is not an array or the value cannot be
+	 *                converted to the array type by a widening conversion
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                if the index is out of bounds -- negative or greater than
+	 *                or equal to the array length
+	 */
+	public static native void setShort(Object array, int index, short value)
+			throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
+
+}

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Constructor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Constructor.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Constructor.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Constructor.java Sun Jun  4 13:55:02 2006
@@ -23,6 +23,16 @@
  */
 public final class Constructor extends AccessibleObject implements Member {
 
+        private Class clazz;            //required by JCHEVM's bootstrap.c
+        private int slot;               //required by JCHEVM's bootstrap.c
+
+        // FIXME: security violation: should be package private or private
+        public Constructor(Class c1, int i1) {
+            clazz = c1;
+            slot = i1;
+        }
+
+
 	/**
 	 * Compares the specified object to this Constructor and answer if they are
 	 * equal. The object must be an instance of Constructor with the same
@@ -35,15 +45,9 @@
 	 * @see #hashCode
 	 */
 
-    Constructor(Class c1, int i1) 
-    {
-    }
-
-    Class clazz;            //required by JCHEVM's bootstrap.c
-    int slot;               //required by JCHEVM's bootstrap.c
 
 	public boolean equals(Object object) {
-		return false;
+        throw new RuntimeException("not implemented");
 	}
 
 	/**
@@ -53,7 +57,7 @@
 	 * @return the declaring class
 	 */
 	public Class getDeclaringClass() {
-		return null;
+		return clazz;
 	}
 
 	/**
@@ -64,9 +68,7 @@
 	 * 
 	 * @return the declared exception classes
 	 */
-	public Class[] getExceptionTypes() {
-		return null;
-	}
+	public native Class[] getExceptionTypes();
 
 	/**
 	 * Return the modifiers for the modelled constructor. The Modifier class
@@ -75,9 +77,7 @@
 	 * @return the modifiers
 	 * @see java.lang.reflect.Modifier
 	 */
-	public int getModifiers() {
-		return 0;
-	}
+	public native int getModifiers();
 
 	/**
 	 * Return the name of the modelled constructor. This is the name of the
@@ -86,7 +86,7 @@
 	 * @return the name
 	 */
 	public String getName() {
-		return null;
+		return clazz.getName();
 	}
 
 	/**
@@ -96,9 +96,7 @@
 	 * 
 	 * @return the parameter types
 	 */
-	public Class[] getParameterTypes() {
-		return null;
-	}
+	public native Class[] getParameterTypes();
 
 	/**
 	 * Answers an integer hash code for the receiver. Objects which are equal
@@ -109,7 +107,7 @@
 	 * @see #equals
 	 */
 	public int hashCode() {
-		return 0;
+		return getName().hashCode();
 	}
 
 	/**
@@ -157,9 +155,12 @@
 	public Object newInstance(Object args[]) throws InstantiationException,
 			IllegalAccessException, IllegalArgumentException,
 			InvocationTargetException {
-		return null;
+            // FIXME: no corresponding checks is done
+            return constructNative(args, clazz, slot);
 	}
 
+    private native Object constructNative(Object[] args, Class c, int slot);
+
 	/**
 	 * Answers a string containing a concise, human-readable description of the
 	 * receiver. The format of the string is modifiers (if any) declaring class
@@ -170,7 +171,12 @@
 	 * @return a printable representation for the receiver
 	 */
 	public String toString() {
-		return null;
+        throw new RuntimeException("not implemented");
 	}
+
+    public boolean isSynthetic() {
+        // FIXME: not implemented
+        return false;
+    }
 }
 

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Field.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Field.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Field.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Field.java Sun Jun  4 13:55:02 2006
@@ -23,6 +23,10 @@
  */
 public final class Field extends AccessibleObject implements Member {
 
+    String name;
+    Class declaringClass;           //required by JCHEVM's bootstrap.c
+    int slot;                       //required by JCHEVN's bootstrap.c
+
 	/**
 	 * Compares the specified object to this Field and answer if they are equal.
 	 * The object must be an instance of Field with the same defining class and
@@ -34,14 +38,15 @@
 	 *         otherwise
 	 * @see #hashCode
 	 */
-    Field (Class c1, String s1, int i1) 
-    {
+    Field (Class clss, String name, int slot) {
+        this.declaringClass = clss;
+        this.name = name;
+        this.slot = slot;
     }
+
 	public boolean equals(Object object) {
-		return false;
+        throw new RuntimeException("not implemented");
 	}
-    Class declaringClass;           //required by JCHEVM's bootstrap.c
-    int slot;                       //required by JCHEVN's bootstrap.c
 
 	/**
 	 * Return the value of the field in the specified object. This reproduces
@@ -157,7 +162,7 @@
 	 * @return the declaring class
 	 */
 	public Class getDeclaringClass() {
-		return null;
+		return declaringClass;
 	}
 
 	/**
@@ -279,7 +284,7 @@
 	 * @return the name
 	 */
 	public String getName() {
-		return null;
+		return name;
 	}
 
 	/**
@@ -309,16 +314,12 @@
 	public native short getShort(Object object) throws IllegalAccessException,
 			IllegalArgumentException;
 
-	native String getSignature();
-
 	/**
 	 * Return the java.lang.Class associated with the type of this field.
 	 * 
 	 * @return the type
 	 */
-	public Class getType() {
-		return null;
-	}
+	public native Class getType();
 
 	/**
 	 * Answers an integer hash code for the receiver. Objects which are equal
@@ -330,7 +331,7 @@
 	 * @see #equals
 	 */
 	public int hashCode() {
-		return 0;
+		return name.hashCode();
 	}
 
 	/**
@@ -624,7 +625,12 @@
 	 * @return a printable representation for the receiver
 	 */
 	public String toString() {
-		return null;
+        throw new RuntimeException("not implemented");
 	}
+
+    public boolean isSynthetic() {
+        // FIXME: not implemented
+        return false;
+    }
 }
 

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Method.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Method.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Method.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/reflect/Method.java Sun Jun  4 13:55:02 2006
@@ -22,6 +22,10 @@
  * 
  */
 public final class Method extends AccessibleObject implements Member {
+    Class declaringClass;  //required by JCHEVM's bootstrap.c
+    int slot;               // required by JCHEVM's bootstrap.c
+    String name;
+
 	/**
 	 * Compares the specified object to this Method and answer if they are
 	 * equal. The object must be an instance of Method with the same defining
@@ -33,14 +37,15 @@
 	 *         otherwise
 	 * @see #hashCode
 	 */
-    Method (Class c1, String s1, int i1) 
+    Method (Class declaringClass, String name, int slot) 
     {
+        this.declaringClass = declaringClass;
+        this.name = name;
+        this.slot = slot;
     }
-    Class declaringClass;  //required by JCHEVM's bootstrap.c
-    int slot;               // required by JCHEVM's bootstrap.c
 
 	public boolean equals(Object object) {
-		return false;
+        throw new RuntimeException("not implemented");
 	}
 
 	/**
@@ -50,7 +55,7 @@
 	 * @return the declaring class
 	 */
 	public Class getDeclaringClass() {
-		return null;
+		return declaringClass;
 	}
 
 	/**
@@ -60,9 +65,7 @@
 	 * 
 	 * @return the declared exception classes
 	 */
-	public Class[] getExceptionTypes() {
-		return null;
-	}
+	public native Class[] getExceptionTypes();
 
 	/**
 	 * Return the modifiers for the modelled constructor. The Modifier class
@@ -71,9 +74,7 @@
 	 * @return the modifiers
 	 * @see java.lang.reflect.Modifier
 	 */
-	public int getModifiers() {
-		return 0;
-	}
+	public native int getModifiers();
 
 	/**
 	 * Return the name of the modelled method.
@@ -81,7 +82,7 @@
 	 * @return the name
 	 */
 	public String getName() {
-		return null;
+		return name;
 	}
 
 	/**
@@ -91,9 +92,7 @@
 	 * 
 	 * @return the parameter types
 	 */
-	public Class[] getParameterTypes() {
-		return null;
-	}
+	public native Class[] getParameterTypes();
 
 	/**
 	 * Return the java.lang.Class associated with the return type of this
@@ -101,9 +100,7 @@
 	 * 
 	 * @return the return type
 	 */
-	public Class getReturnType() {
-		return null;
-	}
+	public native Class getReturnType();
 
 	/**
 	 * Answers an integer hash code for the receiver. Objects which are equal
@@ -114,7 +111,7 @@
 	 * @see #equals
 	 */
 	public int hashCode() {
-		return 0;
+		return name.hashCode();
 	}
 
 	/**
@@ -173,9 +170,13 @@
 	public Object invoke(Object receiver, Object args[])
 			throws IllegalAccessException, IllegalArgumentException,
 			InvocationTargetException {
-		return null;
+        // FIXME access control
+        return invokeNative(receiver, args, declaringClass, slot);
 	}
 
+    private final native Object invokeNative(Object obj, Object[] args, Class cl, int slt)
+        throws IllegalAccessException, InvocationTargetException;
+
 	/**
 	 * Answers a string containing a concise, human-readable description of the
 	 * receiver. The format of the string is modifiers (if any) return type
@@ -187,7 +188,12 @@
 	 * @return a printable representation for the receiver
 	 */
 	public String toString() {
-		return null;
+        throw new RuntimeException("not implemented");
 	}
+
+    public boolean isSynthetic() {
+        // FIXME: not implemented
+        return false;
+    }
 }
 

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/nio/DirectByteBufferImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/nio/DirectByteBufferImpl.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/nio/DirectByteBufferImpl.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/nio/DirectByteBufferImpl.java Sun Jun  4 13:55:02 2006
@@ -11,7 +11,7 @@
 
     public void doit()
     {
-        ReadWrite kk = new ReadWrite();
+        new ReadWrite();
     }
 
     static final class ReadWrite extends DirectByteBufferImpl

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/security/AccessController.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/security/AccessController.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/security/AccessController.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/security/AccessController.java Sun Jun  4 13:55:02 2006
@@ -75,9 +75,11 @@
 	 *         the other elements are ProtectionsDomain.
 	 */
 
-    private static Object[] getProtectionDomains(int depth) 
-    {
-        return null;  //this incorrect code is good enough for simple "hello world" demo
+    private static Object[] getProtectionDomains(int depth) {
+        // FIXME: not quite understand what should be here
+        return new Object[] {
+            new AccessControlContext(new ProtectionDomain[0], false)
+        };
     }
 
 	/**