This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ecj] Fix isEnum et al


Does what it says on the tin.

Andrew.


2006-11-21  Andrew Haley  <aph@redhat.com>

	* java/lang/Class.h: (isEnum, isSynthetic, isAnnotation): Move
	to native code. 
	* java/lang/Class.java (isEnum, isSynthetic, isAnnotation):
	Likewise.

Index: libjava/java/lang/Class.h
===================================================================
--- libjava/java/lang/Class.h   (revision 118943)
+++ libjava/java/lang/Class.h   (working copy)
@@ -441,7 +441,19 @@
                                      jboolean);
   jobjectArray getDeclaredAnnotations(::java::lang::reflect::Field *);
   JArray< ::java::lang::annotation::Annotation *> *getDeclaredAnnotationsInternal();
-  jboolean isEnum (void);
+
+  jboolean isEnum (void)
+  {
+    return (accflags & 0x4000) != 0;
+  }
+  jboolean isSynthetic (void)
+  {
+    return (accflags & 0x1000) != 0;
+  }
+  jboolean isAnnotation (void)
+  {
+    return (accflags & 0x2000) != 0;
+  }

   jboolean isAnonymousClass();
   jboolean isLocalClass();
Index: libjava/java/lang/Class.java
===================================================================
--- libjava/java/lang/Class.java        (revision 118943)
+++ libjava/java/lang/Class.java        (working copy)
@@ -1032,13 +1032,8 @@
    * @return true if this is an enumeration class.
    * @since 1.5
    */
-  public boolean isEnum()
-  {
-    // FIXME
-    int mod = getModifiers ();
-    // FIXME: was 'ENUM'
-    return (mod & 0x4000) != 0;
-  }
+  public native boolean isEnum();
+

   /**
    * Returns true if this class is a synthetic class, generated by
@@ -1047,13 +1042,8 @@
    * @return true if this is a synthetic class.
    * @since 1.5
    */
-  public boolean isSynthetic()
-  {
-    // FIXME
-    int mod = getModifiers ();
-    // FIXME: was SYNTHETIC
-    return (mod & 0x1000) != 0;
-  }
+  public native boolean isSynthetic();
+

   /**
    * Returns true if this class is an <code>Annotation</code>.
@@ -1061,13 +1051,8 @@
    * @return true if this is an annotation class.
    * @since 1.5
    */
-  public boolean isAnnotation()
-  {
-    // FIXME
-    int mod = getModifiers ();
-    // FIXME: was ANNOTATION
-    return (mod & 0x2000) != 0;
-  }
+  public native boolean isAnnotation();
+

   /**
    * Returns the simple name for this class, as used in the source


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]