Open
Description
Reproduction steps
Scala version: 2.13.15
object Foo {
def fill[T](elem: => T): Array[T] = ???
}
Problem
The genric signature in the bytecode should include the generic type T
. Currently, it is not the case:
scalac foo.scala; javap Foo.class
Compiled from "foo.scala"
public final class Foo {
public static java.lang.Object fill(scala.Function0);
}
Scala 3 does a better job here:
scalac foo.scala -Ycompile-scala2-library; javap foo.class
Compiled from "foo.scala"
public final class Foo {
public static <T> java.lang.Object fill(scala.Function0<T>);
}
note that the
-Ycompile-scala2-library
is not really necessary