This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-20
Channels
- # babashka (56)
- # beginners (151)
- # calva (3)
- # cider (31)
- # clj-kondo (17)
- # cljs-dev (5)
- # clojure (26)
- # clojure-australia (21)
- # clojure-dev (7)
- # clojure-europe (23)
- # clojure-nl (5)
- # clojure-spec (54)
- # clojure-uk (11)
- # clojuredesign-podcast (8)
- # clojurescript (77)
- # community-development (10)
- # core-typed (1)
- # cursive (3)
- # datomic (7)
- # docker (67)
- # emacs (10)
- # expound (6)
- # figwheel-main (3)
- # graalvm (67)
- # helix (10)
- # java (13)
- # jobs (6)
- # kaocha (4)
- # leiningen (15)
- # malli (2)
- # meander (31)
- # off-topic (40)
- # pedestal (9)
- # rdf (7)
- # reagent (5)
- # reitit (9)
- # remote-jobs (5)
- # shadow-cljs (94)
- # sql (7)
- # testing (12)
- # tools-deps (75)
- # vim (13)
@emccue Hey thanks again for all the effort and answers, I appreciate.
I learned a lot in a few days about Java interop even if it was not the easiest path.
For the moment, I left aside this test project because I had a lot of work but I did not completely give up.
I intend to recover and compile the dbus-java library locally in order to be able to put debug points in the function which poses a problem.
That is to say this one recursiveGetDBusType
here: https://github.com/hypfvieh/dbus-java/blob/f51c6668c7a92cd1cdbc4cac1156cd3797a8474a/dbus-java/src/main/java/org/freedesktop/dbus/Marshalling.java#L297
This will allow me to see how Java sees the object that Clojure sends it.
Hey! I think I just find out what is wrong! 🙂
I'm a Java newbies, but if I understand correctly this following for
loop, the condition block tests some types, right?
boolean found = false;
for (Entry<Class<?>, Byte> entry : CLASS_TO_ARGUMENTTYPE.entrySet()) {
if (entry.getKey().isAssignableFrom(dataTypeClazz)) {
_out[_level].append((char) entry.getValue().byteValue());
found = true;
break;
}
}
if (!found) {
throw new DBusException("Exporting non-exportable type: " + _dataType);
}
Source: https://github.com/hypfvieh/dbus-java/blob/f51c6668c7a92cd1cdbc4cac1156cd3797a8474a/dbus-java/src/main/java/org/freedesktop/dbus/Marshalling.java#L297It's the lack of typing on my object created in my Clojure code that doesn't meet the condition, right?
We can see that CLASS_TO_ARGUMENTTYPE
is a LinkedHashMap which contains a list of excpected type:
https://github.com/hypfvieh/dbus-java/blob/f51c6668c7a92cd1cdbc4cac1156cd3797a8474a/dbus-java/src/main/java/org/freedesktop/dbus/Marshalling.java#L56
Does someone master in Java confirm my diagnosis? 😉
what you said seems correct
by default, most of the class generating things in Clojure create methods that only take and return Object. But if you are implementing an interface and its methods, it will use those types instead
so @emccue's advice above is probably right
the gen-class is going to have the right type hints, but instead of making state
a public final field, it also adds a method to access it
type hints won't be used when gen'ing the class iirc
You guys, are awesome. Clojure community are awesome. Thanks you!