harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r414608 - in /incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc: com/ibm/oti/vm/ java/lang/ java/lang/reflect/ org/apache/harmony/kernel/ org/apache/harmony/kernel/vm/
Date Thu, 15 Jun 2006 15:03:45 GMT
Author: geirm
Date: Thu Jun 15 08:03:45 2006
New Revision: 414608

URL: http://svn.apache.org/viewvc?rev=414608&view=rev
Log:
Minor updates, including :

- genericizing 


Added:
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/kernel/
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/kernel/vm/
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/kernel/vm/VM.java
Removed:
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/com/ibm/oti/vm/VM.java
Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Constructor.java
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Field.java
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Method.java

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java?rev=414608&r1=414607&r2=414608&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
Thu Jun 15 08:03:45 2006
@@ -23,6 +23,13 @@
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.GenericDeclaration;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.annotation.Annotation;
+
 import java.net.URL;
 import java.security.AccessController;
 import java.security.AllPermission;
@@ -44,7 +51,9 @@
  * @author Evgueni Brevnov
  * @version $Revision: 1.1.2.2.4.5 $
  */
-public final class Class implements Serializable {
+//public final class Class implements Serializable {
+
+public final class Class<T> implements Serializable, AnnotatedElement, GenericDeclaration,
Type {
 
     private static final long serialVersionUID = 3206093459760846163L;
 
@@ -797,6 +806,48 @@
     }
 
     static final native Class[] getStackClasses(int maxDepth, boolean stopAtPrivileged);
+
+    /**
+     *  TODO - provide real implementation
+     * @param annotationType
+     * @return
+     */
+    public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
{
+        return false;
+    }
+
+    /**
+     *  TODO - provide real implementation
+     * @param annotationType
+     * @return
+     */
+    public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
+        return null;
+    }
+
+    /**
+     *  TODO - provide real implementatoin
+     * @return
+     */
+    public Annotation[] getAnnotations() {
+        return new Annotation[0];
+    }
+
+    /**
+     *  TODO - provide real implementatoin
+     * @return
+     */
+    public Annotation[] getDeclaredAnnotations() {
+        return new Annotation[0];
+    }
+
+    /**
+     *  TODO - provide real implementatoin
+     * @return
+     */
+    public TypeVariable<?>[] getTypeParameters() {
+        return new TypeVariable<?>[0];
+    }
 
     /* END OF IBM SPECIFIC PART */
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Constructor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Constructor.java?rev=414608&r1=414607&r2=414608&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Constructor.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Constructor.java
Thu Jun 15 08:03:45 2006
@@ -53,6 +53,13 @@
     Constructor(Object obj) {
         data = new ConstructorData(obj);
     }
+
+    /**
+     *  TODO : fix gmj
+     */
+    public boolean isSynthetic() {
+        return false;
+    }
     
     /**
      * Called by VM to obtain this constructor's handle.

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Field.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Field.java?rev=414608&r1=414607&r2=414608&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Field.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Field.java
Thu Jun 15 08:03:45 2006
@@ -51,6 +51,13 @@
     Field(Object obj) {
         data = new FieldData(obj);
     }
+
+    /**
+     *  TODO : fix gmj
+     */
+    public boolean isSynthetic() {
+        return false;
+    }
     
     /**
      * Called by VM to obtain this field's handle.

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Method.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Method.java?rev=414608&r1=414607&r2=414608&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Method.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/Method.java
Thu Jun 15 08:03:45 2006
@@ -53,6 +53,13 @@
     Method(Object obj) {
         data = new MethodData(obj);
     }
+
+    /**
+     *  TODO : fix gmj
+     */
+    public boolean isSynthetic() {
+        return false;
+    }
     
     /**
      * Called by VM to obtain this method's handle.

Added: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/kernel/vm/VM.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/kernel/vm/VM.java?rev=414608&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/kernel/vm/VM.java
(added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/kernel/vm/VM.java
Thu Jun 15 08:03:45 2006
@@ -0,0 +1,110 @@
+/*
+ *  Copyright 2005-2006 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.
+ */
+/**
+ * @author Evgueni V. Brevnov
+ * @version $Revision: 1.1.2.3.4.3 $
+ */ 
+
+package org.apache.harmony.kernel.vm;
+
+import org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection;
+import org.apache.harmony.luni.util.DeleteOnExit;
+
+import org.apache.harmony.vm.VMStack;
+
+public final class VM {
+
+	private static boolean closeJars = false;
+	private static boolean deleteOnExit = false;
+
+    private VM() {
+    }
+
+    /* PUBLIC */
+
+    /**
+     * 1) Our implementation uses null for bootstrap class loader. So we return
+     *    first non-null class loader.
+     * 2) We expect this method will be removed since it's
+     *    not safe to return class loader from the stack with out security checks.
+     * @deprecated
+     */
+    public static ClassLoader getNonBootstrapClassLoader() {        
+        
+        for (int i = 0;;i++) {
+            Class clazz = VMStack.getCallerClass(i);
+            if (clazz == null) {
+                return null;
+            }
+            ClassLoader loader = getClassLoader(clazz); 
+            if (loader != null) {
+                return loader;
+            }
+        }        
+    }
+
+    /**
+     * 1) We expect this method will be removed since it's
+     *    not safe to return class loader from the stack with out security checks.
+     * @deprecated
+     */
+    public static ClassLoader callerClassLoader() {
+        return getClassLoader(VMStack.getCallerClass(1));
+    }
+
+    private static native ClassLoader getClassLoader(Class clazz);
+
+    /* PACKAGE PRIVATE */
+
+    static final ClassLoader getStackClassLoader(int depth) {
+        Class clazz = VMStack.getCallerClass(depth);
+        return clazz != null ? getClassLoader(clazz) : null;
+    }
+
+    /* PRIVATE */
+
+    /**
+     * 1) This is temporary implementation
+     * 2) We've proposed another approach to perform shutdown actions.
+     */
+    public static void closeJars() {
+    	class CloseJarsHook implements Runnable {
+    		public void run() {
+    			JarURLConnection.closeCachedFiles();
+    		}
+    	}
+    	if (!closeJars) {
+        	closeJars = true;
+        	Runtime.getRuntime().addShutdownHook(new Thread(new CloseJarsHook()));
+    	}
+    }
+
+    /**
+     * 1) This is temporary implementation
+     * 2) We've proposed another approach to perform shutdown actions.
+     */
+    public static void deleteOnExit() {
+    	class DeleteOnExitHook implements Runnable {
+    		public void run() {
+    			DeleteOnExit.deleteOnExit();
+    		}
+    	}
+    	if (!deleteOnExit) {
+        	deleteOnExit = true;
+        	Runtime.getRuntime().addShutdownHook(new Thread(new DeleteOnExitHook()));
+    	}
+    }
+}



Mime
View raw message