Index: java/lang/Class.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/lang/Class.java,v retrieving revision 1.22.2.11 diff -u -3 -p -u -r1.22.2.11 Class.java --- java/lang/Class.java 21 Mar 2005 12:10:17 -0000 1.22.2.11 +++ java/lang/Class.java 4 Apr 2005 22:11:26 -0000 @@ -1094,11 +1094,11 @@ public final class Class * @throws ExceptionInInitializerError if class initialization caused by * this call fails with an exception */ - public Object newInstance() + public T newInstance() throws InstantiationException, IllegalAccessException { memberAccessCheck(Member.PUBLIC); - Constructor constructor; + Constructor constructor; synchronized(this) { constructor = this.constructor; @@ -1151,7 +1151,7 @@ public final class Class } try { - return constructor.newInstance(null); + return constructor.newInstance(); } catch (InvocationTargetException e) { @@ -1393,7 +1393,28 @@ public final class Class */ public boolean isEnum() { - return getSuperclass() == Enum.class; + return VMClass.isEnum(this); + } + + /** + * Returns true if this class is a synthetic class, generated by + * the compiler. + * + * @return true if this is a synthetic class. + */ + public boolean isSynthetic() + { + return VMClass.isSynthetic(this); + } + + /** + * Returns true if this class is an Annotation. + * + * @return true if this is an annotation class. + */ + public boolean isAnnotation() + { + return VMClass.isAnnotation(this); } } Index: vm/reference/java/lang/VMClass.java =================================================================== RCS file: /cvsroot/classpath/classpath/vm/reference/java/lang/VMClass.java,v retrieving revision 1.10.2.2 diff -u -3 -p -u -r1.10.2.2 VMClass.java --- vm/reference/java/lang/VMClass.java 7 Jan 2005 03:42:30 -0000 1.10.2.2 +++ vm/reference/java/lang/VMClass.java 4 Apr 2005 22:11:27 -0000 @@ -296,4 +296,30 @@ final class VMClass * Downcast object to the class' type. */ static native K cast(Object obj, Class k); + + /** + * 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); + } // class VMClass Index: vm/reference/java/lang/reflect/Constructor.java =================================================================== RCS file: /cvsroot/classpath/classpath/vm/reference/java/lang/reflect/Constructor.java,v retrieving revision 1.11.2.2 diff -u -3 -p -u -r1.11.2.2 Constructor.java --- vm/reference/java/lang/reflect/Constructor.java 1 Nov 2004 15:57:08 -0000 1.11.2.2 +++ vm/reference/java/lang/reflect/Constructor.java 4 Apr 2005 22:11:27 -0000 @@ -248,7 +248,7 @@ public final class Constructor * @throws ExceptionInInitializerError if construction triggered class * initialization, which then failed */ - public T newInstance(Object args[]) + public T newInstance(Object... args) throws InstantiationException, IllegalAccessException, InvocationTargetException {