Commit f8799933 by Tom Tromey Committed by Tom Tromey

natConstructor.cc (newInstance): Initialize class.

	* java/lang/reflect/natConstructor.cc (newInstance): Initialize
	class.
	* java/lang/reflect/natMethod.cc (invoke): Initialize class.

From-SVN: r56624
parent 7ee425e4
2002-08-27 Tom Tromey <tromey@redhat.com>
* java/lang/reflect/natConstructor.cc (newInstance): Initialize
class.
* java/lang/reflect/natMethod.cc (invoke): Initialize class.
2002-08-27 Michael Koch <konqueror@gmx.de> 2002-08-27 Michael Koch <konqueror@gmx.de>
* java/net/BindException.java, * java/net/BindException.java,
......
// natConstructor.cc - Native code for Constructor class. // natConstructor.cc - Native code for Constructor class.
/* Copyright (C) 1999, 2000, 2001 Free Software Foundation /* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
This file is part of libgcj. This file is part of libgcj.
...@@ -50,6 +50,8 @@ java::lang::reflect::Constructor::newInstance (jobjectArray args) ...@@ -50,6 +50,8 @@ java::lang::reflect::Constructor::newInstance (jobjectArray args)
if (Modifier::isAbstract (declaringClass->getModifiers())) if (Modifier::isAbstract (declaringClass->getModifiers()))
throw new InstantiationException; throw new InstantiationException;
_Jv_InitClass (declaringClass);
jmethodID meth = _Jv_FromReflectedConstructor (this); jmethodID meth = _Jv_FromReflectedConstructor (this);
// In the constructor case the return type is the type of the // In the constructor case the return type is the type of the
// constructor. // constructor.
......
...@@ -156,6 +156,13 @@ java::lang::reflect::Method::invoke (jobject obj, jobjectArray args) ...@@ -156,6 +156,13 @@ java::lang::reflect::Method::invoke (jobject obj, jobjectArray args)
// of the object. // of the object.
meth = _Jv_LookupDeclaredMethod (k, meth->name, meth->signature); meth = _Jv_LookupDeclaredMethod (k, meth->name, meth->signature);
} }
else
{
// We have to initialize a static class. It is safe to do this
// here and not in _Jv_CallAnyMethodA because JNI initializes a
// class whenever a method lookup is done.
_Jv_InitClass (declaringClass);
}
return _Jv_CallAnyMethodA (obj, return_type, meth, false, return _Jv_CallAnyMethodA (obj, return_type, meth, false,
parameter_types, args); parameter_types, args);
...@@ -405,8 +412,6 @@ _Jv_CallAnyMethodA (jobject obj, ...@@ -405,8 +412,6 @@ _Jv_CallAnyMethodA (jobject obj,
p += tsize; p += tsize;
} }
// FIXME: initialize class here.
using namespace java::lang; using namespace java::lang;
using namespace java::lang::reflect; using namespace java::lang::reflect;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment