Closed
Description
minimized code
Named.java
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface Named {}
Test.scala
class Foo(@Named s: String)
object Test {
def main(args: Array[String]): Unit = {
val ctor = classOf[Foo].getDeclaredConstructors()(0)
val annots = ctor.getParameterAnnotations()(0)
println(annots.length) // == 0 in dotty, == 1 in scala 2
assert(annots.length == 1)
}
}
expectation
annots.length == 1
as in scala 2