The com.google.cloud.datastore.BaseKey.Builder subclass has the protected accessor applied to the sub-class itself. While this normally wouldn't cause a problem with regular use in Java, it does cause an IllegalArgumentException when reflection is done to dynamically call a method on the protected sub-class. This is particularly problematic when Clojure is used because most inter-op with Java involves reflection.
So, if a builder has already been created and the setKind method is dynamically called, this occurs:
IllegalArgumentException Can't call public method of non-public class: public com.google.cloud.datastore.BaseKey$Builder com.google.cloud.datastore.BaseKey$Builder.setKind(java.lang.String) clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:88)
This happens when attempting to use Clojure to call .setKind on an instance of com.google.cloud.datastore.KeyFactory produced by calling newKeyFactory on an instance of com.google.cloud.datastore.Datastore.
This can be solved by changing the sub-class accessor to public instead of being set to protected.
The
com.google.cloud.datastore.BaseKey.Buildersubclass has theprotectedaccessor applied to the sub-class itself. While this normally wouldn't cause a problem with regular use in Java, it does cause anIllegalArgumentExceptionwhen reflection is done to dynamically call a method on the protected sub-class. This is particularly problematic when Clojure is used because most inter-op with Java involves reflection.So, if a builder has already been created and the
setKindmethod is dynamically called, this occurs:IllegalArgumentException Can't call public method of non-public class: public com.google.cloud.datastore.BaseKey$Builder com.google.cloud.datastore.BaseKey$Builder.setKind(java.lang.String) clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:88)This happens when attempting to use Clojure to call
.setKindon an instance ofcom.google.cloud.datastore.KeyFactoryproduced by callingnewKeyFactoryon an instance ofcom.google.cloud.datastore.Datastore.This can be solved by changing the sub-class accessor to
publicinstead of being set toprotected.