This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with invoke with method determined at runtime


On 01/07/2012 07:34 AM, Bill Robinson wrote:
Hi, I am trying to invoke a method to be determined at runtime on an
object, but this approach is yielding an exception:

(define-simple-class Test ()
   ((test (arg :: int)) :: void
    (java.lang.System:out:format "test %d\n" arg))
   ((main (args :: String[])) :: void allocation: 'static
    (let ((t ::Test (Test))
	 (method 'test))
      (invoke t 'test 1)  ;; Ok
      (invoke t method 2) ;;<---------------- FAILS
      )))

The result I get is this:

test 1
Exception in thread "main" java.lang.NullPointerException
	at gnu.expr.PrimProcedure.<init>(PrimProcedure.java:333)
	at gnu.kawa.reflect.ClassMethods.getMethods(ClassMethods.java:129)
	at gnu.kawa.reflect.ClassMethods.apply(ClassMethods.java:229)
	at gnu.kawa.reflect.Invoke.lookupMethods(Invoke.java:278)
	at gnu.kawa.reflect.Invoke.applyN(Invoke.java:185)
	at gnu.mapping.ProcedureN.apply3(ProcedureN.java:48)
	at Test.main(test.scm:10)

It works for me, using the latest SVN Kawa. It also also works on a old version of Kawa 1.11 that was convenient.

Could you try Kawa from Subversion?  And ell me exactly
what commands you used?
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]