I'm having an issue where I can see the fields of a Java class/object, but I can't actually access them. I can see the fields in two ways. Using this following code.
=>(require '[clojure.reflect :as r])
=>(use '[clojure.pprint :only [print-table]])
=>(print-table (sort-by :name (:members (r/reflect myClass))))
And also, by creating an instance of the object. Let's say the fields are an int denoted a, a string denoted word , and a String ArrayList denoted mylist.
=>myObj
#<myClass 1 hello [world]>
In both cases, I can see that these fields exist. However, when I run the following code, I get the following error.
=>(. myObj mylist)
IllegalArgumentException No matching field found: mylist for class myClass clojure.lang.Reflector.getInstanceField (Reflector.java:271)
Does anyone have any idea what is going on?
In response to Nicolas Modrzyk's answer, I run (.-myFieild myObject) and get IllegalArgumentException No matching field found: myField for class myClass clojure.lang.Reflector.invokeNoArgInstanceMember (Reflector.java:308)
Additionally, these fields are not private. I have the Java source code in front of me.