|
From: <cr...@us...> - 2008-04-25 12:01:09
|
Revision: 4020
http://jnode.svn.sourceforge.net/jnode/?rev=4020&view=rev
Author: crawley
Date: 2008-04-25 05:01:06 -0700 (Fri, 25 Apr 2008)
Log Message:
-----------
Fixed bug 888 (leaving the previous incorrect fix commented out.)
Modified Paths:
--------------
trunk/core/src/core/org/jnode/vm/VmReflection.java
Modified: trunk/core/src/core/org/jnode/vm/VmReflection.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmReflection.java 2008-04-25 11:59:50 UTC (rev 4019)
+++ trunk/core/src/core/org/jnode/vm/VmReflection.java 2008-04-25 12:01:06 UTC (rev 4020)
@@ -324,11 +324,21 @@
}
if (!method.isStatic()) {
- if( o == null )
+ if (o == null) {
throw new NullPointerException();
+ }
Unsafe.pushObject(o);
- if(!method.isConstructor())
- method = o.getClass().getVmClass().getMethod(method.getName(), method.getSignature());
+ // This is incorrect ... JDK 1.6 throws IllegalArgumentException if the
+ // class of 'o' is the declaring class of 'method'. Stephen Crawley 2008-04-25.
+// if (!method.isConstructor()) {
+// method = o.getClass().getVmClass().getMethod(method.getName(), method.getSignature());
+// }
+ Class declaringClass = method.getDeclaringClass().asClass();
+ if (!declaringClass.isInstance(o)) {
+ throw new IllegalArgumentException("Target object arg is not an instance of " +
+ declaringClass.getName());
+ }
+
} else {
method.getDeclaringClass().initialize();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|