This seems to compile fine with Java 7, and any version of the Scala libraries:
public static void main(String[] args) {
scala.collection.immutable.Set<String> set = new scala.collection.immutable.HashSet<String>();
Iterator<String> iterator = set.iterator();
}
It also compiles fine with Java 8 and Scala 2.11.5+. But with Java 8 and Scala 2.11.4, Eclipse complains:
The method iterator() is ambiguous for the type Set<String>
I don't understand this. You might get ambiguity over which overloaded method to select in some contexts, but surely not if you're not passing any arguments?
The really weird thing is that if I recast it like this:
public static void main(String[] args) {
Iterator<String> iterator = new scala.collection.immutable.HashSet<String>().iterator();
}
then the complaint goes away. This seems to me to be exactly equivalent to the version above. So why would it now compile fine?