-
Notifications
You must be signed in to change notification settings - Fork 21
There should be a way of generating a Java-style varargs method signature from a Scala sequence method #3621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Imported From: https://issues.scala-lang.org/browse/SI-3621?orig=1 |
@oxbowlakes said: |
@axel22 said: One thing troubles me, though. Why do you want to mark the method as |
@oxbowlakes said: I now cannot find any reference to this, so I am presumably wrong. However, IDEA will mark a varargs method in a class file as being "transient", so perhaps that's the source of the issue. |
@oxbowlakes said: import java.lang.reflect.Method; public class VarargsTest {
} |
@axel22 said: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6516895 Ok, then so be it. |
@dcsobral said: |
@axel22 said: |
@paulp said: |
If I declare a method in a class in "scala-sequence" style:
And inspect the generated class file (as if it had been generated from a Java class), the signature looks like:
I think that, for interop with Java, it would be nice if we could generate a Java varargs method signature (that is, taking a String array with the transient modifier set):
public transient void foo(java.lang.String[] p0)
I tried adding the @transient annotation but this was ignored by scalac!
I would ask for either:
The compiler automatically generates Java varargs-style "forwarder" methods for Scala sequence ones
A @VarArgs annotation is supplied, which, when used in conjunction with a scala-sequence method, generates a Java varargs forwarder as in Scaladoc NullPointerException #1
Chris
The text was updated successfully, but these errors were encountered: