title: Access public method defined on abstract base class from Clojure
body: <p>I'm attempting to use the DNSJava library from clojure. I attempt the following:</p>
  
  <pre><code>dmarced.dns&gt; (def results (.run (Lookup. "google.com" Type/TXT)))
  #'dmarced.dns/results
  dmarced.dns&gt; (def r (get results 0))
  #'dmarced.dns/r
  dmarced.dns&gt; r
  #object[org.xbill.DNS.TXTRecord 0x687a3556 "google.com.\t\t3599\tIN\tTXT\t\"v=spf1 include:_spf.google.com ~all\""]
  dmarced.dns&gt; (class r)
  org.xbill.DNS.TXTRecord
  dmarced.dns&gt; (instance? TXTRecord r)
  true
  </code></pre>
  
  <p>Great! I know from the <a href="http://www.xbill.org/dnsjava/dnsjava-current/doc/org/xbill/DNS/TXTRecord.html" rel="nofollow">docs</a> that I should be able to use .getStrings to get the content of the record.</p>
  
  <pre><code>dmarced.dns&gt; (.getStrings r)
  Reflection warning, *cider-repl dmarced*:150:13 - reference to field getStrings can't be resolved.
  IllegalArgumentException Can't call public method of non-public class: public java.util.List org.xbill.DNS.TXTBase.getStrings()  clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:88)
  </code></pre>
  
  <p>Ok quick google tells me this can be solved via type hints:</p>
  
  <pre><code>dmarced.dns&gt; (.getStrings ^TXTRecord r)
  Reflection warning, *cider-repl dmarced*:153:13 - call to method getStrings on org.xbill.DNS.TXTRecord can't be resolved (argument types: ).
  IllegalArgumentException Can't call public method of non-public class: public java.util.List org.xbill.DNS.TXTBase.getStrings()  clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:88)
  </code></pre>
  
  <p>Huh. At I've search Google further, and read the full page on <a href="http://clojure.org/reference/java_interop" rel="nofollow">interop</a>, but I'm not having any luck.</p>
  
  <p>Looking at the source for <a href="https://github.com/dnsjava/dnsjava/blob/master/org/xbill/DNS/TXTRecord.java" rel="nofollow">TXTRecord</a> I see that it extends <a href="https://github.com/dnsjava/dnsjava/blob/master/org/xbill/DNS/TXTBase.java" rel="nofollow">TXTBase</a> which is an abstract class where <a href="https://github.com/dnsjava/dnsjava/blob/master/org/xbill/DNS/TXTBase.java#L97" rel="nofollow">getStrings</a> is implemented. Since TXTRecord extends it, I should have access to getStrings through that (and I went so far as to write a Java program to verify it.</p>
  
  <p>Does anyone know how I can access this via Clojure?</p>
  
  <p><strong>EDIT</strong> Working java program</p>
  
  <pre><code>import org.xbill.DNS.*;
  
  class Main {
      public static void main(String [] args) throws TextParseException {
          Lookup l = new Lookup("google.com", Type.TXT);
          Record [] rs = l.run();
          for(int i = 0; i &lt; rs.length; i++) {
              TXTRecord tr = (TXTRecord)rs[i];
              for(int j = 0; j &lt; tr.getStrings().size(); j ++) {
                  System.out.println(tr.getStrings().get(j));
              }
          }
  
      }
  }
  </code></pre>