@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
that method will always have object as its return
type hints won't be used when gen'ing the class iirc
that is my current guess as to the problem - deftype wont have that issue
You guys, are awesome. Clojure community are awesome. Thanks you!