     (vector? msig) (= msig (sig x))
     (fn? msig)     (msig x)))
 
-(defn- has-class? [^Class class msig]
+(defn- has-method? [^Class class msig]
   (some (partial sig-matches? msig) (concat (.getMethods class) (.getConstructors class))))
 
 (defmacro ^:private compile-cond [& choices]

        ([] (rf))
        ([acc] (rf acc))
        ([acc left right] (rf acc (compile-cond
                                   (has-class? org.apache.spark.api.java.JavaPairRDD
                                               (partial left-outer-join-optional "org.apache.spark.api.java.Optional"))
                                   (.or ^org.apache.spark.api.java.Optional left not-found)
                                   (has-class? org.apache.spark.api.java.JavaPairRDD
                                               (partial left-outer-join-optional "com.google.common.base.Optional"))
                                   (.or ^com.google.common.base.Optional left not-found)) right))))))


              (reify org.apache.spark.api.java.function.FlatMapFunction ; todo: skip api.java.* go to spark
                (call [_ it] 
                  (compile-cond
                    (has-method? org.apache.spark.api.java.function.FlatMapFunction [java.util.Iterator "call" [Object]])
                    (.iterator ((df) it))
                    (has-method? org.apache.spark.api.java.function.FlatMapFunction [Iterable "call" [Object]])
                    ((df) it))))
              preserve-partitioning)]
    rdd))
