         partitioner (org.apache.spark.Partitioner/defaultPartitioner
                      rdd (scala-seq rdds))]
     (by-key (compile-cond
-              (has-class? org.apache.spark.rdd.CoGroupedRDD [nil "<init>" [scala.collection.Seq org.apache.spark.Partitioner scala.reflect.ClassTag]] )
+              (has-method? org.apache.spark.rdd.CoGroupedRDD [nil "<init>" [scala.collection.Seq org.apache.spark.Partitioner scala.reflect.ClassTag]] )
               (org.apache.spark.rdd.CoGroupedRDD.
               (scala-seq (cons rdd rdds))
               partitioner
               (.AnyRef scala.reflect.ClassTag$/MODULE$))
-              (has-class? org.apache.spark.rdd.CoGroupedRDD [nil "<init>" [scala.collection.Seq org.apache.spark.Partitioner]] )
+              (has-method? org.apache.spark.rdd.CoGroupedRDD [nil "<init>" [scala.collection.Seq org.apache.spark.Partitioner]] )
               (org.apache.spark.rdd.CoGroupedRDD.
               (scala-seq (cons rdd rdds))
               partitioner))

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

    (vector? msig) (= msig (sig x))
    (fn? msig)     (msig x)))

(defn- has-method? [^Class class msig]
  (some (partial sig-matches? msig) (concat (.getMethods class) (.getConstructors class))))

(defmacro ^:private compile-cond [& choices]
