Suspect code in ReflectionBase.invoke
-------------------------------------
Key: RVM-830
URL:
http://jira.codehaus.org/browse/RVM-830 Project: RVM
Issue Type: Bug
Components: Runtime
Affects Versions: 3.1.0
Reporter: David Grove
Fix For: 3.1.1
There's some highly suspect code (below) in ReflectionBase.invoke that depends on comparing exception stack trace lengths to decide to convert a ClassCaseException into an IllegalArgumentException.
{code}
/**
* Invoke reflective method being wrapped by this object
* @param obj object for virtual method invocation
* @param args arguments to method call
* @return the object that is the result of the invoke
*/
public final Object invoke(RVMMethod method, Object obj, Object[] args) {
int argsLength = args == null ? 0 : args.length;
if (method.getParameterTypes().length != argsLength) {
throwIllegalArgumentException();
}
try {
return invokeInternal(obj, args);
} catch (ClassCastException e) {
// FIXME: This is fragile and ill-advised way to handle this situation
// I think A more robust way to handle it would be to put in the appropriate
// try/catch structure in the generated bytecodes and handle it there.
if (e.getStackTrace().length == (new Throwable()).getStackTrace().length+6) {
throw new IllegalArgumentException("argument type mismatch", e);
} else {
throw e;
}
}
}
{code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to:
http://p.sf.net/sfu/opensolaris-get_______________________________________________
Jikesrvm-issues mailing list
Jikesrvm-issues@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-issues