public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* Receiver class does not define or inherit an implementation of the resolved method
@ 2021-08-29 19:03 Phil Eaton
  2021-08-30 16:40 ` Per Bothner
  0 siblings, 1 reply; 13+ messages in thread
From: Phil Eaton @ 2021-08-29 19:03 UTC (permalink / raw)
  To: kawa mailing list

Hey folks!

Still new to Kawa. I'm trying to implement an interface (
io.jooby.Route$Handler
<https://github.com/jooby-project/jooby/blob/2.x/jooby/src/main/java/io/jooby/Route.java#L247>).
It only has a single non-default method, apply.

Here's what I've got

(define (route app method path handler)
  (let ((handler (object (io.jooby.Route$Handler)
                         #| This method exists just to stop Jooby from
trying to introspect Java code that doesn't exist because this isn't
written in Java. |#
                         ((apply (ctx ::io.jooby.Context)) ::string
                          #!null)
                         ((apply (ctx ::io.jooby.Context))
::java.lang.Object
                          (handler ctx)))))
    (app:route method path handler)))


But when this gets exercised, I get:

[worker-1-3] ERROR io.jooby.Jooby - GET /hello-world 500 Server Error
java.lang.AbstractMethodError: Receiver class main$0 does not define or
inherit an implementation of the resolved method 'abstract java.lang.Object
apply(io.jooby.Context)' of interface io.jooby.Route$Handler.
        at
io.jooby.internal.handler.SendCharSequence.apply(SendCharSequence.java:22)
        at
io.jooby.internal.handler.WorkerHandler.lambda$apply$0(WorkerHandler.java:23)
        at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
        at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
        at
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:831)


Also on a tangent, I was excited about the lambda shorthand for single
method objects. Like I said this interface only has a single non-default
method: apply. But I tried just calling `(app:route method handler)`
without wrapping it in the io.jooby.Route$Handler object but it still
failed. I guess it couldn't figure out this one method.

Or I'm doing everything wrong.

The full code is available here
<https://github.com/eatonphil/jvm-lisp-examples/tree/main/kawa> and can be
run just by calling make. The exception happens when you `curl
localhost:8080/`.

Any ideas about what I'm doing wrong?

Thanks!
Phil

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-09-08 14:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-29 19:03 Receiver class does not define or inherit an implementation of the resolved method Phil Eaton
2021-08-30 16:40 ` Per Bothner
2021-08-30 23:09   ` Phil Eaton
2021-08-30 23:18     ` Phil Eaton
2021-09-07 10:59       ` spellcard199
2021-09-07 13:02         ` Phil Eaton
2021-09-07 17:58           ` spellcard199
2021-09-07 19:35             ` Phil Eaton
2021-09-08 14:14               ` spellcard199
2021-09-08 14:20                 ` spellcard199
2021-09-07 19:31           ` Per Bothner
2021-09-07 19:45             ` Phil Eaton
2021-09-07 20:13               ` Per Bothner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).