I guess my question would be:
What do you think (j/from-java-deep Class {})
should produce?
When you do (j/from-java-shallow Class {})
you can see a lot of properties that are of type array of Class
so if you try to "convert" those from Java to Clojure, you'll get recursion -- and in the case of Class
there is no "bottom" to that recursion.
For from-java-deep
to not blow up here, there needs to be some "bottom" to that recursion. Either an arbitrary depth or tracking all the Java objects you've seen and not expanding an identical object further down the tree (assuming that check is sufficient to create a "bottom"). But then there's also the question of what from-java-deep
should do at that point: return nil
for that subtree, return some other sentinel value, return the Java object itself, throwing a different exception (to indicate which getter expansion failed, so you could try again and tell it not to expand that getter)?