This is the mail archive of the
mauve-discuss@sources.redhat.com
mailing list for the Mauve project.
Method.invoke() test bug
- From: Mark Wielaard <mark at klomp dot org>
- To: mauve-discuss at sources dot redhat dot com
- Date: 05 Apr 2002 14:58:24 +0200
- Subject: Method.invoke() test bug
Hi,
The spec says:
For each actual parameter in the supplied args array:
If the corresponding formal parameter has a primitive type, an
unwrapping conversion is attempted to convert the object value to a
value of a primitive type. If this attempt fails, the invocation
throws an IllegalArgumentException.
If, after possible unwrapping, the parameter value cannot be
converted to the corresponding formal parameter type by an identity
or widening conversion, the invocation throws an
IllegalArgumentException.
So the following test should be changed to expect an
IllegalArgumentException and not a NullPointerException.
* gnu/testlet/java/lang/reflect/Method/invoke.java (test): Expect
IllegalArgument exception when argument for a method that takes an
int is null.
Any objections?
Cheers,
Mark
Index: gnu/testlet/java/lang/reflect/Method/invoke.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/lang/reflect/Method/invoke.java,v
retrieving revision 1.8
diff -u -r1.8 invoke.java
--- invoke.java 2001/11/25 19:30:21 1.8
+++ invoke.java 2002/04/05 12:54:32
@@ -166,7 +166,7 @@
new IllegalArgumentException ());
args1[0] = null;
try_invoke (harness, ti_meth, null, args1,
- new NullPointerException ());
+ new IllegalArgumentException ());
args1[0] = new Integer (-5);
try_invoke (harness, ti_meth, null, args1,
new InvocationTargetException (new IllegalArgumentException ()));