From 4f9533c7722fa07511a94d005227961f4a4dec23 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 18 May 2006 17:29:21 +0000 Subject: Imported GNU Classpath 0.90 Imported GNU Classpath 0.90 * scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale. * sources.am: Regenerated. * gcj/javaprims.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * gnu/java/lang/VMInstrumentationImpl.java: New override. * gnu/java/net/local/LocalSocketImpl.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest interface. * java/lang/Thread.java: Add UncaughtExceptionHandler. * java/lang/reflect/Method.java: Implements GenericDeclaration and isSynthetic(), * java/lang/reflect/Field.java: Likewise. * java/lang/reflect/Constructor.java * java/lang/Class.java: Implements Type, GenericDeclaration, getSimpleName() and getEnclosing*() methods. * java/lang/Class.h: Add new public methods. * java/lang/Math.java: Add signum(), ulp() and log10(). * java/lang/natMath.cc (log10): New function. * java/security/VMSecureRandom.java: New override. * java/util/logging/Logger.java: Updated to latest classpath version. * java/util/logging/LogManager.java: New override. From-SVN: r113887 --- libjava/java/lang/Class.java | 93 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 92 insertions(+), 1 deletion(-) (limited to 'libjava/java/lang/Class.java') diff --git a/libjava/java/lang/Class.java b/libjava/java/lang/Class.java index db2bf72..7c3eced 100644 --- a/libjava/java/lang/Class.java +++ b/libjava/java/lang/Class.java @@ -42,8 +42,11 @@ import java.io.InputStream; import java.io.Serializable; import java.lang.reflect.Constructor; import java.lang.reflect.Field; +import java.lang.reflect.GenericDeclaration; import java.lang.reflect.Member; import java.lang.reflect.Method; +import java.lang.reflect.Type; +import java.lang.reflect.TypeVariable; import java.net.URL; import java.security.ProtectionDomain; import java.util.ArrayList; @@ -79,7 +82,7 @@ import java.util.HashSet; * @since 1.0 * @see ClassLoader */ -public final class Class implements Serializable +public final class Class implements Type, GenericDeclaration, Serializable { /** * Class is non-instantiable from Java code; only the VM can create @@ -928,4 +931,92 @@ public final class Class implements Serializable sm.checkPackageAccess(pkg.getName()); } } + + /** + * Returns the simple name for this class, as used in the source + * code. For normal classes, this is the content returned by + * getName() which follows the last ".". Anonymous + * classes have no name, and so the result of calling this method is + * "". The simple name of an array consists of the simple name of + * its component type, followed by "[]". Thus, an array with the + * component type of an anonymous class has a simple name of simply + * "[]". + * + * @return the simple name for this class. + * @since 1.5 + */ + public String getSimpleName() + { + // FIXME write real implementation + return ""; + } + + /** + * Returns the class which immediately encloses this class. If this class + * is a top-level class, this method returns null. + * + * @return the immediate enclosing class, or null if this is + * a top-level class. + * @since 1.5 + */ + /* FIXME[GENERICS]: Should return Class */ + public Class getEnclosingClass() + { + // FIXME write real implementation + return null; + } + + /** + * Returns the constructor which immediately encloses this class. If + * this class is a top-level class, or a local or anonymous class + * immediately enclosed by a type definition, instance initializer + * or static initializer, then null is returned. + * + * @return the immediate enclosing constructor if this class is + * declared within a constructor. Otherwise, null + * is returned. + * @since 1.5 + */ + /* FIXME[GENERICS]: Should return Constructor */ + public Constructor getEnclosingConstructor() + { + // FIXME write real implementation + return null; + } + + /** + * Returns the method which immediately encloses this class. If + * this class is a top-level class, or a local or anonymous class + * immediately enclosed by a type definition, instance initializer + * or static initializer, then null is returned. + * + * @return the immediate enclosing method if this class is + * declared within a method. Otherwise, null + * is returned. + * @since 1.5 + */ + public Method getEnclosingMethod() + { + // FIXME write real implementation + return null; + } + + /** + * Returns an array of TypeVariable objects that represents + * the type variables declared by this class, in declaration order. + * An array of size zero is returned if this class has no type + * variables. + * + * @return the type variables associated with this class. + * @throws GenericSignatureFormatError if the generic signature does + * not conform to the format specified in the Virtual Machine + * specification, version 3. + * @since 1.5 + */ + /* FIXME[GENERICS]: Should return TypeVariable> */ + public TypeVariable[] getTypeParameters() + { + // FIXME - provide real implementation. + return new TypeVariable[0]; + } } -- cgit v1.1