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]

Problem with invoke with method determined at runtime


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)

Anyone have any ideas of an alternative approach for invoking a method
to be determined at runtime on an object?

Thanks
Bill


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