diff options
| author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-24 17:24:44 +0000 |
|---|---|---|
| committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-24 17:24:44 +0000 |
| commit | 5eebc41fc2d61e66d84f648fd6d59365facf185b (patch) | |
| tree | b60d1cfd5772caf8f4b4422879feb1f039755a71 /libjava/java/lang/reflect/natMethod.cc | |
| parent | 14795d175a44e80fa9bed1c5ef99944645198bdd (diff) | |
| download | gcc-5eebc41fc2d61e66d84f648fd6d59365facf185b.tar.gz | |
* java/lang/reflect/Field.java (toString): Use
Method.appendClassName.
* java/lang/reflect/Constructor.java (toString): Use
Method.appendClassName.
* java/lang/reflect/Method.java: Reindented.
(appendClassName): New method.
(toString): Use it.
* defineclass.cc (handleMethod ): Initialize `throws' field of
method.
(read_one_method_attribute): Handle Exceptions attribute.
* java/lang/reflect/natMethod.cc (ClassClass): Removed.
(ObjectClass): Removed.
(getType): Compute `exception_types'.
* java/lang/Class.h (struct _Jv_Method): Added `throws' field.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45153 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang/reflect/natMethod.cc')
| -rw-r--r-- | libjava/java/lang/reflect/natMethod.cc | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/libjava/java/lang/reflect/natMethod.cc b/libjava/java/lang/reflect/natMethod.cc index f269d2fdcf1..96cc13209ab 100644 --- a/libjava/java/lang/reflect/natMethod.cc +++ b/libjava/java/lang/reflect/natMethod.cc @@ -1,6 +1,6 @@ // natMethod.cc - Native code for Method class. -/* Copyright (C) 1998, 1999, 2000 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation This file is part of libgcj. @@ -38,10 +38,6 @@ details. */ #include <gcj/method.h> #include <gnu/gcj/RawData.h> -// FIXME: remove these -#define ObjectClass java::lang::Object::class$ -#define ClassClass java::lang::Class::class$ - #include <stdlib.h> #if USE_LIBFFI @@ -200,14 +196,27 @@ java::lang::reflect::Method::getName () void java::lang::reflect::Method::getType () { - _Jv_GetTypesFromSignature (_Jv_FromReflectedMethod (this), + _Jv_Method *method = _Jv_FromReflectedMethod (this); + _Jv_GetTypesFromSignature (method, declaringClass, ¶meter_types, &return_type); - // FIXME: for now we have no way to get exception information. - exception_types = (JArray<jclass> *) JvNewObjectArray (0, &ClassClass, - NULL); + int count = 0; + if (method->throws != NULL) + { + while (method->throws[count] != NULL) + ++count; + } + + exception_types + = (JArray<jclass> *) JvNewObjectArray (count, + &java::lang::Class::class$, + NULL); + jclass *elts = elements (exception_types); + for (int i = 0; i < count; ++i) + elts[i] = _Jv_FindClassFromSignature (method->throws[i]->data, + declaringClass->getClassLoader ()); } void @@ -254,7 +263,7 @@ _Jv_GetTypesFromSignature (jmethodID method, } JArray<jclass> *args = (JArray<jclass> *) - JvNewObjectArray (numArgs, &ClassClass, NULL); + JvNewObjectArray (numArgs, &java::lang::Class::class$, NULL); jclass* argPtr = elements (args); for (ptr = sig->data; *ptr != '\0'; ptr++) { |
