|
From: <ls...@us...> - 2008-06-01 18:38:15
|
Revision: 4174
http://jnode.svn.sourceforge.net/jnode/?rev=4174&view=rev
Author: lsantha
Date: 2008-06-01 11:38:11 -0700 (Sun, 01 Jun 2008)
Log Message:
-----------
Fixed regression when invocation target was checked against declaring class of method.
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-06-01 15:50:10 UTC (rev 4173)
+++ trunk/core/src/core/org/jnode/vm/VmReflection.java 2008-06-01 18:38:11 UTC (rev 4174)
@@ -332,18 +332,18 @@
if (o == null) {
throw new NullPointerException();
}
- Unsafe.pushObject(o);
- // 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());
-// }
+
+ //todo should we make this check here or on a higher level?
Class declaringClass = method.getDeclaringClass().asClass();
if (!declaringClass.isInstance(o)) {
throw new IllegalArgumentException("Target object arg is not an instance of " +
declaringClass.getName());
}
+ Unsafe.pushObject(o);
+ if (!method.isConstructor()) {
+ method = o.getClass().getVmClass().getMethod(method.getName(), method.getSignature());
+ }
} else {
method.getDeclaringClass().initialize();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|