harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r446873 - in /incubator/harmony/enhanced/drlvm/trunk/vm: tests/kernel/org/apache/harmony/lang/annotation/ vmcore/src/kernel_classes/javasrc/java/lang/
Date Sat, 16 Sep 2006 13:17:42 GMT
Author: geirm
Date: Sat Sep 16 06:17:41 2006
New Revision: 446873

URL: http://svn.apache.org/viewvc?view=rev&rev=446873
Log:
HARMONY-1434

Assorted fixes in kernel classes:

1) Uncommented enum elements of annotations in kernel tests after serialization was fixed
in classlib.

2) Fixed UnsatisfiedLinkError on j.l.Thread.countStackFrames():
This method is strongly deprecated and poorly documented, see 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4082398; so provided dummy implementation
and removed declaration 
of native method j.l.VMThreadManager.countStackFrames().

3) Fixed UnsupportedOperationException on j.l.Compiler methods invocations. The API specification
for this class 
implies that calls are ignored silently if no compiler available.

4) Fixed incompatibility in j.l.Class.isEnum(). Accordingly to specification, this method
should return true if and 
only if the class is declared "enum" in source code. However, in DRLVM it returned true also
for anonymous body 
classes of enum elements.

5) Fixed typo in j.l.ClassLoader which prevents user-defined system classloader.

Several classlib tests were failing due to these issues:
<testcase classname="org.apache.harmony.luni.tests.java.lang.ThreadTest" name="test_countStackFrames"/>
<testcase classname="tests.api.java.util.EnumMapTest" name="test_ConstructorLjava_lang_Class"/>
<testcase classname="tests.api.java.util.EnumSetTest" name="test_NoneOf_LClass"/>
<testcase classname="org.apache.harmony.luni.tests.java.lang.CompilerTest"/>



Tested on ubuntu - did see PhantomTestQueue fail once... but that went away.  We need a stabilization-fest...



Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/annotation/AllTypesAntn.java
    incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/annotation/AllTypesAntn2.java
    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/ClassLoader.java
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Compiler.java
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMThreadManager.java

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/annotation/AllTypesAntn.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/annotation/AllTypesAntn.java?view=diff&rev=446873&r1=446872&r2=446873
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/annotation/AllTypesAntn.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/annotation/AllTypesAntn.java
Sat Sep 16 06:17:41 2006
@@ -40,7 +40,7 @@
     double doubleValue() default 7E-34;
     boolean booleanValue() default true;
     Class classValue() default AllTypesAntn.class;
-    //TheEnum enumValue() default TheEnum.A; //FIXME enum de/serialization fails
+    TheEnum enumValue() default TheEnum.A;
     TheAntn antnValue() default @TheAntn;
     
     int[] intArrayValue() default 345;
@@ -52,7 +52,7 @@
     double[] doubleArrayValue() default 7E-34;
     boolean[] booleanArrayValue() default true;
     Class[] classArrayValue() default AllTypesAntn.class;
-    //TheEnum[] enumArrayValue() default TheEnum.A; //FIXME enum de/serialization fails
+    TheEnum[] enumArrayValue() default TheEnum.A;
     TheAntn[] antnArrayValue() default @TheAntn;
     
     /**
@@ -74,7 +74,7 @@
         public double doubleValue() {return 7E-34;}
         public boolean booleanValue() {return true;}
         public Class classValue() {return AllTypesAntn.class;}
-        //public TheEnum enumValue() {return TheEnum.A; } //FIXME enum de/serialization fails
+        public TheEnum enumValue() {return TheEnum.A; }
         public TheAntn antnValue() {return new TheAntnImpl();}
         
         public int[] intArrayValue() {return new int[]{345};}
@@ -86,7 +86,7 @@
         public double[] doubleArrayValue() {return new double[] {7E-34};}
         public boolean[] booleanArrayValue() {return new boolean[]{true};}
         public Class[] classArrayValue() {return new Class[] {AllTypesAntn.class};}
-        //public TheEnum[] enumArrayValue() {return new TheEnum[] {TheEnum.A}; } //FIXME
enum de/serialization fails
+        public TheEnum[] enumArrayValue() {return new TheEnum[] {TheEnum.A}; }
         public TheAntn[] antnArrayValue() {return new TheAntn[] {new TheAntnImpl()};}
     }
 }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/annotation/AllTypesAntn2.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/annotation/AllTypesAntn2.java?view=diff&rev=446873&r1=446872&r2=446873
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/annotation/AllTypesAntn2.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/annotation/AllTypesAntn2.java
Sat Sep 16 06:17:41 2006
@@ -34,7 +34,7 @@
         doubleArrayValue=34, doubleValue=345,
         booleanArrayValue=true, booleanValue=false,
         classArrayValue=AllTypesAntn2.class, classValue=AllTypesAntn2.class,
-        //enumArrayValue=AllTypesAntn2.TheEnum.B, enumValue=AllTypesAntn2.TheEnum.C, //FIXME
enum de/serialization fails
+        enumArrayValue=AllTypesAntn2.TheEnum.B, enumValue=AllTypesAntn2.TheEnum.C,
         antnArrayValue=@AllTypesAntn2.TheAntn, antnValue=@AllTypesAntn2.TheAntn)
 public @interface AllTypesAntn2 {
     public enum TheEnum {A, B, C, }
@@ -49,7 +49,7 @@
     double doubleValue() ;
     boolean booleanValue();
     Class classValue() ;
-    //TheEnum enumValue(); //FIXME enum de/serialization fails
+    TheEnum enumValue();
     TheAntn antnValue();
     
     int[] intArrayValue() ;
@@ -61,6 +61,6 @@
     double[] doubleArrayValue();
     boolean[] booleanArrayValue() ;
     Class[] classArrayValue() ;
-    // TheEnum[] enumArrayValue(); //FIXME enum de/serialization fails
+    TheEnum[] enumArrayValue();
     TheAntn[] antnArrayValue();
 }

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?view=diff&rev=446873&r1=446872&r2=446873
==============================================================================
--- 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
Sat Sep 16 06:17:41 2006
@@ -971,7 +971,9 @@
      * 
      **/
     public boolean isEnum() {
-        return (getModifiers() & ACC_ENUM) != 0;
+        // check for superclass is needed for compatibility
+        // otherwise there are false positives on anonymous element classes
+        return ((getModifiers() & ACC_ENUM) != 0 && getSuperclass() == Enum.class);
     }
 
     /**

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java?view=diff&rev=446873&r1=446872&r2=446873
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java
Sat Sep 16 06:17:41 2006
@@ -643,7 +643,7 @@
             try {
                 final Class<?> userClassLoader = systemClassLoader
                     .loadClass(className);
-                if (ClassLoader.class.isAssignableFrom(userClassLoader)) {
+                if (!ClassLoader.class.isAssignableFrom(userClassLoader)) {
                     throw new Error(userClassLoader.toString()
                         + " must inherit java.lang.ClassLoader");
                 }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Compiler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Compiler.java?view=diff&rev=446873&r1=446872&r2=446873
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Compiler.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Compiler.java
Sat Sep 16 06:17:41 2006
@@ -46,7 +46,10 @@
      * @api2vm
      */
     public static Object command(Object obj) {
-        throw new UnsupportedOperationException("Not implemented");
+       if (obj == null) {
+           throw new NullPointerException();
+       }
+       return null;
     }
 
     /**
@@ -57,7 +60,10 @@
      * @api2vm
      */
     public static boolean compileClass(Class<?> clazz) {
-        throw new UnsupportedOperationException("Not implemented");
+       if (clazz == null) {
+           throw new NullPointerException();
+       }
+       return false;
     }
 
     /**
@@ -68,7 +74,10 @@
      * @api2vm
      */
     public static boolean compileClasses(String name){
-        throw new UnsupportedOperationException("Not implemented");
+       if (name == null) {
+           throw new NullPointerException();
+       }
+       return false;
     }
 
     /**
@@ -78,7 +87,6 @@
      * @api2vm
      */
     public static void disable() {
-        throw new UnsupportedOperationException("Not implemented");
     }
 
     /**
@@ -88,6 +96,5 @@
      * @api2vm
      */
     public static void enable() {
-       throw new UnsupportedOperationException("Not implemented");
     }
 }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java?view=diff&rev=446873&r1=446872&r2=446873
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
Sat Sep 16 06:17:41 2006
@@ -367,7 +367,7 @@
      * @com.intel.drl.spec_ref
      */
     public int countStackFrames() {
-        return VMThreadManager.countStackFrames(this);
+        return 0; //deprecated
     }
 
     /**

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMThreadManager.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMThreadManager.java?view=diff&rev=446873&r1=446872&r2=446873
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMThreadManager.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMThreadManager.java
Sat Sep 16 06:17:41 2006
@@ -73,13 +73,6 @@
 
     /**
      * This method satisfies the requirements of the specification for the
-     * {@link Thread#countStackFrames() Thread.countStackFrames()} method.
-     * @api2vm
-     */
-    static native int countStackFrames(Thread thread);
-
-    /**
-     * This method satisfies the requirements of the specification for the
      * {@link Thread#currentThread() Thread.currentThread()} method.
      * <p> 
      * But there is one special case. When this method is called while



Mime
View raw message