diff options
author | Tom Tromey <tromey@redhat.com> | 2006-04-28 13:43:02 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2006-04-28 13:43:02 +0000 |
commit | 9e030d82fbb11b539e4cc456b5713a9018d1851f (patch) | |
tree | f394803fda239571ceaf34c3552affcd3d4384dc | |
parent | 88152829d1f306335d45d36dc871480944b6fe25 (diff) | |
download | classpath-9e030d82fbb11b539e4cc456b5713a9018d1851f.tar.gz |
* 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.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | java/lang/Class.java | 26 | ||||
-rw-r--r-- | vm/reference/java/lang/VMClass.java | 25 |
3 files changed, 33 insertions, 28 deletions
@@ -1,3 +1,13 @@ +2006-04-28 Tom Tromey <tromey@redhat.com> + + * 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. + 2006-04-28 Robert Schuster <robertschuster@fsfe.org> * javax/swing/text/View.java: diff --git a/java/lang/Class.java b/java/lang/Class.java index e101dafb0..090ac234a 100644 --- a/java/lang/Class.java +++ b/java/lang/Class.java @@ -109,6 +109,23 @@ public final class Class */ 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 final class Class */ public boolean isEnum() { - return VMClass.isEnum(this); + int mod = VMClass.getModifiers (this, true); + return (mod & ENUM) != 0; } /** @@ -1429,7 +1447,8 @@ public final class Class */ public boolean isSynthetic() { - return VMClass.isSynthetic(this); + int mod = VMClass.getModifiers (this, true); + return (mod & SYNTHETIC) != 0; } /** @@ -1440,7 +1459,8 @@ public final class Class */ public boolean isAnnotation() { - return VMClass.isAnnotation(this); + int mod = VMClass.getModifiers (this, true); + return (mod & ANNOTATION) != 0; } /** diff --git a/vm/reference/java/lang/VMClass.java b/vm/reference/java/lang/VMClass.java index aae263bf3..25965068d 100644 --- a/vm/reference/java/lang/VMClass.java +++ b/vm/reference/java/lang/VMClass.java @@ -284,31 +284,6 @@ final class VMClass 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 |