This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-02
Channels
- # announcements (2)
- # babashka (10)
- # beginners (61)
- # calva (17)
- # cider (27)
- # clj-kondo (14)
- # clojure (230)
- # clojure-austin (4)
- # clojure-europe (17)
- # clojure-france (6)
- # clojure-hungary (3)
- # clojure-norway (30)
- # clojure-sweden (9)
- # clojure-uk (2)
- # clojurescript (58)
- # conjure (11)
- # core-async (7)
- # cursive (74)
- # datalog (2)
- # datomic (15)
- # events (8)
- # figwheel-main (5)
- # fulcro (2)
- # graalvm (23)
- # graphql (2)
- # helix (17)
- # humbleui (2)
- # jobs (2)
- # kaocha (6)
- # lsp (19)
- # malli (7)
- # nbb (51)
- # off-topic (33)
- # pathom (26)
- # pedestal (2)
- # polylith (1)
- # portal (4)
- # re-frame (17)
- # react (3)
- # reitit (5)
- # releases (2)
- # remote-jobs (2)
- # shadow-cljs (18)
- # sql (65)
- # tools-deps (8)
- # xtdb (28)
Is there a way to eliminate reflection on zero argument java constructor calls?
I'm currently passing around an anonymous fn that looks like this:
:listener-ctor #(XListener.)
and then it's invoked and used by the caller, but graal can't find it.
I have a multitude of different Listeners
and they don't share any meaningful base class unfortunately.
Maybe helping GraalVM along with a reflection.json helps?
{
"name": "foo.bar.XListener",
"queryAllDeclaredConstructors": true,
"queryAllPublicConstructors": true
},
Yes @U7ERLH6JX it does work to do that, and that might be my fallback approach.
yeah eliminating it via a typehint should be nicer
Yeah so the problem I guess is that in the call site we use a .instanceMethod
type of call, and that function that looks roughly like this:
(defn ->top-secret
[listener]
(->> listener
.getFunctions
parsed-fns->internal-format
(into [])))
*warn-on-reflection*
doesn't like that one, but I have 25 different listeners without a common base class to hint against
I might have to pass it the ->top-secret
function or a wrapped getFunctions
instead I think? because the caller does not have access to my 25 different types of Listener and there's no commonality between them
It's generated code so I'm a bit tied up on the java side - but could I do something in clojure?