Skip to content

Missing acc_varargs flag when overriding a Java varargs method #13137

@lrytz

Description

@lrytz

J.java

public class J {
    public void jva(String... s) { }
}

S.scala

class C extends J {
  override def jva(s: String*): Unit = println("c")
}

R.java

public class R {
  void main() {
    var c = new C();
    c.jva("x");      // compilation error: no suitable method found
    ((J)c).jva("x"); // ok
  }
}

The Scala compiler emits a "varargs bridge" to override J.jva, it forwards to the Scala varargs method. But the varargs bridge is missing the acc_varargs flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)java interopvarargs

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions