-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
We would like to implement a custom storage provider for Keycloak with scala3. But we have a ArrayIndexOutOfBoundsException
on startup. Because getGenericInterfaces
and getInterfaces
are not the same length.
https://scastie.scala-lang.org/rrramiro/JayfF4WNRJSGZiBN8v0Atw/7
Compiler version
version >= 3.0.0
Minimized code
public interface BaseRootJava {
default void someMethod() {
}
}
public interface GenericBaseIntermidiateJava<T> extends BaseRootJava {
}
class ChildScala extends GenericBaseIntermidiateJava[Int] {
}
object Main {
def main(args: Array[String]): Unit = {
val c = classOf[ChildScala]
assert(
c.getGenericInterfaces.length == c.getInterfaces.length,
s"mismatch between ${c.getGenericInterfaces.mkString("Array(", ", ", ")")} and ${c.getInterfaces.mkString("Array(", ", ", ")")}"
)
}
}
Output
Exception in thread "main" java.lang.AssertionError: assertion failed: mismatch between Array(org.example.GenericBaseIntermidiateJava<java.lang.Object>) and Array(interface org.example.BaseRootJava, interface org.example.GenericBaseIntermidiateJava)
Expectation
The size of getGenericInterfaces and getInterfaces should be equal according to this test:
https://github.com/scala/scala3/blob/main/tests/run/t8931.scala