This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: minor Class improvement
- From: Tom Tromey <tromey at redhat dot com>
- To: GCC libjava patches <java-patches at gcc dot gnu dot org>
- Date: 29 Mar 2003 13:12:17 -0700
- Subject: Patch: FYI: minor Class improvement
- Reply-to: tromey at redhat dot com
I'm checking this in on the trunk.
There were a few places in Class that threw an exception without a
descriptive message. This makes it harder to figure out what has gone
wrong. (In the early days, this was how we did things. Nowadays we
can do better.)
Tom
Index: ChangeLog
from Tom Tromey <tromey at redhat dot com>
* java/lang/natClass.cc (newInstance): Put method name in
exception.
(getConstructor): Likewise.
(getDeclaredConstructor): Likewise.
(getPrivateMethod): Likewise.
Index: java/lang/natClass.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natClass.cc,v
retrieving revision 1.60
diff -u -r1.60 natClass.cc
--- java/lang/natClass.cc 30 Jan 2003 23:20:45 -0000 1.60
+++ java/lang/natClass.cc 29 Mar 2003 20:15:07 -0000
@@ -1,6 +1,6 @@
// natClass.cc - Implementation of java.lang.Class native methods.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -157,7 +157,7 @@
return cons;
}
}
- throw new java::lang::NoSuchMethodException;
+ throw new java::lang::NoSuchMethodException (_Jv_NewStringUtf8Const (init_name));
}
JArray<java::lang::reflect::Constructor *> *
@@ -224,7 +224,7 @@
return cons;
}
}
- throw new java::lang::NoSuchMethodException;
+ throw new java::lang::NoSuchMethodException (_Jv_NewStringUtf8Const (init_name));
}
java::lang::reflect::Field *
@@ -707,13 +707,13 @@
|| isInterface ()
|| isArray ()
|| java::lang::reflect::Modifier::isAbstract(accflags))
- throw new java::lang::InstantiationException;
+ throw new java::lang::InstantiationException (getName ());
_Jv_InitClass (this);
_Jv_Method *meth = _Jv_GetMethodLocal (this, init_name, void_signature);
if (! meth)
- throw new java::lang::NoSuchMethodException;
+ throw new java::lang::NoSuchMethodException (_Jv_NewStringUtf8Const (init_name));
jobject r = JvAllocObject (this);
((void (*) (jobject)) meth->ncode) (r);
@@ -1504,7 +1504,7 @@
}
}
}
- throw new java::lang::NoSuchMethodException;
+ throw new java::lang::NoSuchMethodException (name);
}
// Private accessor method for Java code to retrieve the protection domain.