// Class.h - Header file for java.lang.Class. -*- c++ -*-
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation
This file is part of libgcj.
class _Jv_ExecutionEngine;
class _Jv_CompiledEngine;
class _Jv_IndirectCompiledEngine;
-class _Jv_InterpreterEngine;
#ifdef INTERPRETER
+class _Jv_InterpreterEngine;
class _Jv_ClassReader;
class _Jv_InterpClass;
class _Jv_InterpMethod;
#endif
+class _Jv_ClosureList
+{
+ _Jv_ClosureList *next;
+ void *ptr;
+public:
+ void registerClosure (jclass klass, void *ptr);
+ static void releaseClosures (_Jv_ClosureList **closures);
+};
+
struct _Jv_Constants
{
jint size;
_Jv_Utf8Const *op2;
};
+typedef enum
+{
+ JV_CLASS_ATTR,
+ JV_METHOD_ATTR,
+ JV_FIELD_ATTR,
+ JV_DONE_ATTR
+} jv_attr_type;
+
+typedef enum
+{
+ JV_INNER_CLASSES_KIND,
+ JV_ENCLOSING_METHOD_KIND,
+ JV_SIGNATURE_KIND,
+ JV_ANNOTATIONS_KIND,
+ JV_PARAMETER_ANNOTATIONS_KIND,
+ JV_ANNOTATION_DEFAULT_KIND
+} jv_attr_kind;
+
#define JV_PRIMITIVE_VTABLE ((_Jv_VTable *) -1)
#define JV_CLASS(Obj) ((jclass) (*(_Jv_VTable **) Obj)->clas)
_Jv_Method* _Jv_LookupDeclaredMethod (jclass, _Jv_Utf8Const *,
_Jv_Utf8Const*, jclass * = NULL);
+java::lang::reflect::Method *_Jv_GetReflectedMethod (jclass klass,
+ _Jv_Utf8Const *name,
+ _Jv_Utf8Const *signature);
jfieldID JvGetFirstInstanceField (jclass);
jint JvNumInstanceFields (jclass);
jfieldID JvGetFirstStaticField (jclass);
const _Jv_Utf8Const*,
const _Jv_Utf8Const*);
-jobject _Jv_JNI_ToReflectedField (_Jv_JNIEnv *, jclass, jfieldID,
- jboolean);
-jobject _Jv_JNI_ToReflectedMethod (_Jv_JNIEnv *, jclass, jmethodID,
- jboolean);
+jobject JNICALL _Jv_JNI_ToReflectedField (_Jv_JNIEnv *, jclass, jfieldID,
+ jboolean);
+jobject JNICALL _Jv_JNI_ToReflectedMethod (_Jv_JNIEnv *, jclass, jmethodID,
+ jboolean);
jfieldID _Jv_FromReflectedField (java::lang::reflect::Field *);
jmethodID _Jv_FromReflectedMethod (java::lang::reflect::Method *);
// Finds a desired interpreter method in the given class or NULL if not found
class _Jv_MethodBase;
_Jv_MethodBase *_Jv_FindInterpreterMethod (jclass, jmethodID);
+jstring _Jv_GetInterpClassSourceFile (jclass);
#endif
-// Friend classes and functions to implement the ClassLoader
-class java::lang::ClassLoader;
-class java::lang::VMClassLoader;
-
-class java::io::ObjectOutputStream;
-class java::io::ObjectInputStream;
-class java::io::ObjectStreamClass;
+jbyte _Jv_GetClassState (jclass);
void _Jv_RegisterClassHookDefault (jclass klass);
void _Jv_RegisterInitiatingLoader (jclass,java::lang::ClassLoader*);
class _Jv_StackTrace;
class _Jv_BytecodeVerifier;
-class java::io::VMObjectStreamClass;
void _Jv_sharedlib_register_hook (jclass klass);
java::lang::reflect::Method *_getMethod (jstring, JArray<jclass> *);
java::lang::reflect::Method *_getDeclaredMethod (jstring, JArray<jclass> *);
+ jstring getReflectionSignature (jint /*jv_attr_type*/ type,
+ jint obj_index);
+ jstring getReflectionSignature (::java::lang::reflect::Method *);
+ jstring getReflectionSignature (::java::lang::reflect::Constructor *);
+ jstring getReflectionSignature (::java::lang::reflect::Field *);
+
+ jstring getClassSignature();
+ jobject getMethodDefaultValue (::java::lang::reflect::Method *);
+
public:
JArray<java::lang::reflect::Field *> *getFields (void);
JArray<java::lang::reflect::TypeVariable *> *getTypeParameters (void);
+ jint getEnclosingMethodData(void);
java::lang::Class *getEnclosingClass (void);
java::lang::reflect::Constructor *getEnclosingConstructor (void);
java::lang::reflect::Method *getEnclosingMethod (void);
- jboolean isEnum (void);
+ jobjectArray getDeclaredAnnotations(jint, jint, jint);
+ jobjectArray getDeclaredAnnotations(::java::lang::reflect::Method *,
+ jboolean);
+ jobjectArray getDeclaredAnnotations(::java::lang::reflect::Constructor *,
+ jboolean);
+ jobjectArray getDeclaredAnnotations(::java::lang::reflect::Field *);
+ JArray< ::java::lang::annotation::Annotation *> *getDeclaredAnnotationsInternal();
+
+ 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();
+ jboolean isMemberClass();
// FIXME: this probably shouldn't be public.
jint size (void)
// types. See prims.cc.
Class ();
+ // Given the BC ABI version, return the size of an Class initializer.
+ static jlong initializerSize (jlong ABI)
+ {
+ unsigned long version = ABI & 0xfffff;
+ int abi_rev = version % 100;
+
+ // The reflection_data field was added by abi_rev 1.
+ if (abi_rev == 0)
+ return ((char*)(&::java::lang::Class::class$.reflection_data)
+ - (char*)&::java::lang::Class::class$);
+
+ return sizeof (::java::lang::Class);
+ }
+
static java::lang::Class class$;
private:
notifyAll ();
}
+ jint findInnerClassAttribute();
+ jint findDeclaredClasses(JArray<jclass> *, jboolean, jint);
+
// Friend functions implemented in natClass.cc.
friend _Jv_Method *::_Jv_GetMethodLocal (jclass klass, _Jv_Utf8Const *name,
_Jv_Utf8Const *signature);
friend _Jv_Method* ::_Jv_LookupDeclaredMethod (jclass, _Jv_Utf8Const *,
_Jv_Utf8Const*, jclass *);
+ friend java::lang::reflect::Method* ::_Jv_GetReflectedMethod (jclass klass,
+ _Jv_Utf8Const *name,
+ _Jv_Utf8Const *signature);
friend jfieldID (::JvGetFirstInstanceField) (jclass);
friend jint (::JvNumInstanceFields) (jclass);
friend jfieldID (::JvGetFirstStaticField) (jclass);
friend void *::_Jv_AllocPtrFreeObj (jint, jclass);
friend void *::_Jv_AllocArray (jint, jclass);
- friend jobject (::_Jv_JNI_ToReflectedField) (_Jv_JNIEnv *, jclass, jfieldID,
+ friend jobject JNICALL (::_Jv_JNI_ToReflectedField) (_Jv_JNIEnv *, jclass, jfieldID,
jboolean);
friend jobject (::_Jv_JNI_ToReflectedMethod) (_Jv_JNIEnv *, jclass, jmethodID,
jboolean);
#ifdef INTERPRETER
friend _Jv_MethodBase *(::_Jv_FindInterpreterMethod) (jclass klass,
jmethodID desired_method);
+ friend jstring ::_Jv_GetInterpClassSourceFile (jclass);
#endif
+ friend jbyte (::_Jv_GetClassState) (jclass klass);
// Friends classes and functions to implement the ClassLoader
friend class java::lang::ClassLoader;
friend class ::_Jv_ClassReader;
friend class ::_Jv_InterpClass;
friend class ::_Jv_InterpMethod;
+ friend class ::_Jv_InterpreterEngine;
#endif
friend class ::_Jv_StackTrace;
friend class ::_Jv_ExecutionEngine;
friend class ::_Jv_CompiledEngine;
friend class ::_Jv_IndirectCompiledEngine;
- friend class ::_Jv_InterpreterEngine;
+ friend class ::_Jv_ClosureList;
friend void ::_Jv_sharedlib_register_hook (jclass klass);
friend void ::_Jv_CopyClassesToSystemLoader (gnu::gcj::runtime::SystemClassLoader *);
+ friend class java::lang::reflect::Field;
+ friend class java::lang::reflect::Method;
+ friend class java::lang::reflect::Constructor;
+ friend class java::lang::reflect::VMProxy;
+
// Chain for class pool. This also doubles as the ABI version
// number. It is only used for this purpose at class registration
// time, and only for precompiled classes.
void *aux_info;
// Execution engine.
_Jv_ExecutionEngine *engine;
+ // Reflection data.
+ unsigned char *reflection_data;
};
// Inline functions that are friends of java::lang::Class