On 26 Apr 2006, at 18:37, Tom Tromey wrote:

"Mark" == Mark Wielaard <[EMAIL PROTECTED]> writes:

Mark> It would be a good point to declare the vm classes interface
Mark> frozen for now and work towards a new snapshot release that
Mark> includes them.

Actually I would like to make one more change before 0.91.  This one
is very simple, though, and won't affect VMs much, since it is
compatible with what is in the tree now.

I've appended it.  Please comment, everybody.  I'll check it in after
a few days if there is no objection.

Tom

2006-04-26  Tom Tromey  <[EMAIL PROTECTED]>

        * java/lang/Class.java (SYNTHETIC, ENUM, ANNOTATION): New fields.
        (isEnum): Rewrote.
        (isSynthetic): Likewise.
        (isAnnotation): Likewise.
        * vm/reference/java/lang/VMClass.java (isSynthetic): Removed.
        (isAnnotation): Likewise.
        (isEnum): Likewise.

Index: java/lang/Class.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/Class.java,v
retrieving revision 1.48
diff -u -r1.48 Class.java
--- java/lang/Class.java        23 Apr 2006 10:21:56 -0000      1.48
+++ java/lang/Class.java        26 Apr 2006 17:44:42 -0000
@@ -109,6 +109,23 @@
    */
   private static final long serialVersionUID = 3206093459760846163L;

+  /**
+   * Flag indicating a synthetic member.
+   * Note that this duplicates a constant in Modifier.
+   */
+  private static final int SYNTHETIC = 0x1000;
+
+  /**
+   * Flag indiciating an annotation class.
+   */
+  private static final int ANNOTATION = 0x2000;
+
+  /**
+   * Flag indicating an enum constant or an enum class.
+   * Note that this duplicates a constant in Modifier.
+   */
+  private static final int ENUM = 0x4000;
+
   /** The class signers. */
   private Object[] signers = null;
   /** The class protection domain. */
@@ -1417,7 +1434,8 @@
    */
   public boolean isEnum()
   {
-    return VMClass.isEnum(this);
+    int mod = VMClass.getModifiers (this, true);
+    return (mod & ENUM) != 0;
   }

   /**
@@ -1429,7 +1447,8 @@
    */
   public boolean isSynthetic()
   {
-    return VMClass.isSynthetic(this);
+    int mod = VMClass.getModifiers (this, true);
+    return (mod & SYNTHETIC) != 0;
   }

   /**
@@ -1440,7 +1459,8 @@
    */
   public boolean isAnnotation()
   {
-    return VMClass.isAnnotation(this);
+    int mod = VMClass.getModifiers (this, true);
+    return (mod & ANNOTATION) != 0;
   }

   /**
Index: vm/reference/java/lang/VMClass.java
===================================================================
RCS file: /cvsroot/classpath/classpath/vm/reference/java/lang/ VMClass.java,v
retrieving revision 1.17
diff -u -r1.17 VMClass.java
--- vm/reference/java/lang/VMClass.java 23 Apr 2006 10:21:56 -0000 1.17
+++ vm/reference/java/lang/VMClass.java 26 Apr 2006 17:44:43 -0000
@@ -284,31 +284,6 @@
   static native void throwException(Throwable t);

   /**
- * Returns true if this class is a synthetic class, generated by the
-   * compiler.
-   *
-   * @param klass the Class object that's calling us
-   * @return whether this class is synthetic or not
-   */
-  static native boolean isSynthetic(Class klass);
-
-  /**
-   * Returns true if this class represents an annotation.
-   *
-   * @param klass the Class object that's calling us
-   * @return whether this class is an annotation or not
-   */
-  static native boolean isAnnotation(Class klass);
-
-  /**
-   * Returns true if this class was declared as an enum.
-   *
-   * @param klass the Class object that's calling us
-   * @return whether this class is an enumeration or not
-   */
-  static native boolean isEnum(Class klass);
-
-  /**
* Returns the simple name for the specified class, as used in the source
    * code.  For normal classes, this is the content returned by
    * <code>getName()</code> which follows the last ".".  Anonymous


Seems fine to me. I didn't realise we already had the flags or I would have written it like this to begin with.
Although your Changelog should say 'rewritten' not 'rewrote'... :)

BTW, any thoughts on this release, especially as regards a suitable time to create the branch? I suggest we choose a suitable point, create the branch and then merge up to the point to the generics branch.

Cheers,
--
Andrew ;)

Reply via email to