This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: Class.newInstance()
- From: Bryce McKinlay <bryce at mckinlay dot net dot nz>
- To: GCC libjava patches <java-patches at gcc dot gnu dot org>
- Date: Tue, 4 Nov 2003 18:26:25 +1300
- Subject: Patch: FYI: Class.newInstance()
newInstance() was throwing the wrong exception when the class being
instantiated has no null constructor. I'm checking this in.
Regards
Bryce.
2003-11-04 Bryce McKinlay <bryce@mckinlay.net.nz>
* java/lang/natClass.cc (newInstance): Throw
InstantiationException
if class has no null-argument constructor.
--- natClass.cc 28 Oct 2003 22:45:57 -0000 1.71
+++ natClass.cc 4 Nov 2003 05:21:56 -0000
@@ -688,7 +688,7 @@
_Jv_Method *meth = _Jv_GetMethodLocal (this, init_name,
void_signature);
if (! meth)
- throw new java::lang::NoSuchMethodException
(_Jv_NewStringUtf8Const (init_name));
+ throw new java::lang::InstantiationException (getName());
jobject r = JvAllocObject (this);
((void (*) (jobject)) meth->ncode) (r);