You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Classes or Objects containing methods annotated with @VarArgs and higher-order functions (on return) will generate compilation errors when used form Java code.
In the following example, compilation of A.java will fail if C.g() or O.g() are uncommented
// C.scalaclassC {
@scala.annotation.varargs
deff(values:String*) = println("Calling C.f(): "+ values)
// uncommenting that line will cause an AssertionError// def g(): String => Int = s => s.hashCode
}
// O.scalaobjectO {
definstance=this@scala.annotation.varargs
deff(values:String*) = println("Calling O.f(): "+ values)
// uncommenting g() results in errors in A.java// def g(): String => Int = s => s.hashCode
}
// A.java
public classA {
public static void main(String[] args) {
// uncommenting C.g() will generate AssertionErrornewC().f("a", "b", "c");
// uncommenting O.g() will generate NoSuchMethodErrorO.f("a", "b", "c");
// uncommenting O.g() will generate "f(Seq<String>) in O$ cannot be applied to (String,String,String)"O.instance().f("a", "b", "c");
}
}
In the attachment, you'll find a small sbt project containing the code.
I've tried it with 2.9.1 and the 2.10.0-SNAPSHOT (from 28 Oct).
The text was updated successfully, but these errors were encountered:
Classes or Objects containing methods annotated with @VarArgs and higher-order functions (on return) will generate compilation errors when used form Java code.
In the following example, compilation of A.java will fail if C.g() or O.g() are uncommented
In the attachment, you'll find a small sbt project containing the code.
I've tried it with 2.9.1 and the 2.10.0-SNAPSHOT (from 28 Oct).
The text was updated successfully, but these errors were encountered: