title: Clojure reify a Java interface with overloaded methods
body: <p>I'm trying to implement the following Java interface in Clojure:</p>
  
  <pre><code>package quickfix;
  
  public interface MessageFactory {
      Message create(String beginString, String msgType);
      Group create(String beginString, String msgType, int correspondingFieldID);
  }
  </code></pre>
  
  <p>The following Clojure code is my attempt at doing this:</p>
  
  <pre><code>(defn -create-message-factory 
    []
    (reify quickfix.MessageFactory
      (create [beginString msgType]
        nil)
      (create [beginString msgType correspondingFieldID]
        nil)))
  </code></pre>
  
  <p>This fails to compile with the error:</p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: Can't define method not in interfaces: create</p>
  </blockquote>
  
  <p>The <a href="http://clojuredocs.org/clojure_core/clojure.core/reify" rel="noreferrer">documentation</a> suggests overloaded interface methods are ok, so long as the arity is different as it is in this case:</p>
  
  <blockquote>
    <p>If a method is overloaded in a protocol/interface, multiple
    independent method definitions must be supplied. If overloaded with
    same arity in an interface you must specify complete hints to
    disambiguate - a missing hint implies Object.</p>
  </blockquote>
  
  <p>How can I get this working?</p>