-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
scala/scala
#10100Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)regressionshould not compiletyper
Milestone
Description
The following code
class A {
def compareTo(o: Any): Int = 0
}
class B extends A with Comparable[B] {
def compareTo(b: B): Int = 0
}
object C {
def main(args: Array[String]): Unit = {
println(new B().compareTo(new Object()))
}
}
compiles without warnings. And it should be executed without any runtime error. However, ClassCastException occurs when the code is executed.
This problem is also known as an already fixed bug of Java Generics:
http://www.concurrentaffair.org/2006/10/10/java-generics-unsound/
Metadata
Metadata
Assignees
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)regressionshould not compiletyper