harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r659908 - /harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
Date Sun, 25 May 2008 04:12:37 GMT
Author: ndbeyer
Date: Sat May 24 21:12:36 2008
New Revision: 659908

URL: http://svn.apache.org/viewvc?rev=659908&view=rev
Log:
Apply modified patch for HARMONY-5829

Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java?rev=659908&r1=659907&r2=659908&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
Sat May 24 21:12:36 2008
@@ -22,6 +22,7 @@
 import static org.apache.harmony.vm.ClassFormat.ACC_INTERFACE;
 import static org.apache.harmony.vm.ClassFormat.ACC_SYNTHETIC;
 
+import java.io.Externalizable;
 import java.io.InputStream;
 import java.io.Serializable;
 import java.lang.annotation.Annotation;
@@ -79,6 +80,18 @@
     transient ReflectionData reflectionData;
     transient SoftReference<GACache> softCache;
     
+    /** 
+     * Indicates where the following properties have been calculated;
+     * isSerializable, isExternalizable, isPrimitive
+     * 
+     * @see #resolveProperties() 
+     */
+    private transient volatile boolean arePropertiesResolved;
+    
+    private transient boolean isSerializable;
+    private transient boolean isExternalizable;
+    private transient boolean isPrimitive;
+    
     private GACache getCache() {
         GACache cache = null;
         if (softCache != null) { 
@@ -601,10 +614,33 @@
         return reflectionData.isArray;
     }
 
+    private void resolveProperties() {
+        if (arePropertiesResolved) {
+        	return;
+        }
+        isExternalizable = VMClassRegistry.isAssignableFrom(Externalizable.class, this);
+        isSerializable = VMClassRegistry.isAssignableFrom(Serializable.class, this);
+        isPrimitive = VMClassRegistry.isPrimitive(this);
+        arePropertiesResolved = true;
+    }
+    
     /**
      * @com.intel.drl.spec_ref
      */
     public boolean isAssignableFrom(Class<?> clazz) {
+        
+        if (Serializable.class.equals(this)) {
+            // assure that props have been resolved
+        	clazz.resolveProperties();
+            return clazz.isSerializable;
+        }
+        
+        if (Externalizable.class.equals(this)) {
+            // assure that props have been resolved
+        	clazz.resolveProperties();
+            return clazz.isExternalizable;
+        }
+        
         return VMClassRegistry.isAssignableFrom(this, clazz);
     }
 
@@ -626,7 +662,9 @@
      * @com.intel.drl.spec_ref
      */
     public boolean isPrimitive() {
-        return VMClassRegistry.isPrimitive(this);
+    	// assure that props have been resolved
+        resolveProperties();
+        return isPrimitive;
     }
 
     /**



Mime
View raw message