How to call a public class non-public method in Clojure?

I call the twitter4j library using Clojure as follows:

(def twitter (. (TwitterFactory.) getInstance)) 

This works great when I call it a script. But when I use gen-class, I get:

 java.lang.IllegalArgumentException: Can't call public method of non-public class: public java.lang.Object twitter4j.TwitterFactoryBase.getInstance() 

Is there a workaround for this?

+4
source share
2 answers

I have no experience with this, but Michelle Brandmeyer once made a wonderful entry in the gen class, maybe this will help you:

http://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html

+1
source

Try:

 (def twitter (.getInstance (new TwitterFactory))) 
0
source

Source: https://habr.com/ru/post/1304891/


All Articles