Aurélien Thieriot is right, you need to assist the compiler - but in a different place:
classes.filter(
clazz => clazz.isInterface
).map(
klazz => (
klazz.getDeclaringClass,
klazz,
klazz.getDeclaringClass.getDeclaredClasses.filter(
klass => klass.getSimpleName.equals("PythonJ")
).head
): (Class[_],Class[_],Class[_]) // <--type spec
).zipWithIndex.map { case ((service, iteratr, privte), port) => caseClass(
service.getName, port, service, iteratr, privte
)
}.toSet
This will (in my understanding) help by fixing the type parameters of the result of map
into existential types, which makes the subsequent type inference result unambiguous (i.e. the compiler will not be forced to infer "Class
of what?").