Ateempt to rewrite a example from bytecode package on scheme

Per Bothner per@bothner.com
Wed Nov 19 08:09:00 GMT 2008


Yaroslav Kavenchuk wrote:
> Example is attached
> 
> I get error at code
>> (*:getMethod helloWorldClass "add" argTypes)
>> Argument #3 ([Ljava.lang.Class;@54c4ad) to 
>> 'java.lang.Class.getMethod(java.lang.String,java.lang.Class[])' has 
> ...
> What is wrong? How to resolve problem?

The main problem was varargs handling.  I think I fixed it so
that is much better now (in SVN trunk).

A minor bug is that you used null instead of #!null.

A trickier issues is since the add method takes Java int
values, you need to pass java.lang.Integer values to
the Method:invoke call: That method knows to "unbox"
java.lang.Integer to int, but it doesn't handle
Scheme integers (which are gnu.math.IntNum).

I think this might be useful as both an example and
a test case.  Can I use it as such, including checking
it into the testsuite?
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/



More information about the Kawa mailing list