Skip to content
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

Converting varargs Java to Scala flags #201

Closed
jrudolph opened this issue Jan 22, 2018 · 2 comments · Fixed by #295
Closed

Converting varargs Java to Scala flags #201

jrudolph opened this issue Jan 22, 2018 · 2 comments · Fixed by #295
Assignees
Labels
Milestone

Comments

@jrudolph
Copy link
Contributor

Converting a Java class with varargs to Scala, mima doesn't seem to know about bridge methods created by the Scala @varargs annotation:

v1:

public class A {
    public static String create(String... args) {
        return null;
    }
}

v2:

import scala.annotation.varargs

object A {
  @varargs
  def create(args: String*): String = null
}
class A

Test here: https://github.com/lightbend/migration-manager/compare/master...jrudolph:show-varargs-issue?expand=1

@dwijnand
Copy link
Collaborator

Interesting. From diffing the bytecode it looks everything is the same:

diff --git a/A.class b/A.class
index 3804de7..850724c 100644
--- a/A.class
+++ b/A.class
@@ -1,15 +1,23 @@

-Compiled from "A.java"
+Compiled from "A.scala"
 public class A {
+  public static java.lang.String create(java.lang.String...);
+    descriptor: ([Ljava/lang/String;)Ljava/lang/String;
+    Code:
+##: getstatic     ###                 // Field A$.MODULE$:LA$;
+##: invokevirtual ###                 // Method A$.create:([Ljava/lang/String;)Ljava/lang/String;
+##: areturn
+
+  public static java.lang.String create(scala.collection.Seq<java.lang.String>);
+    descriptor: (Lscala/collection/Seq;)Ljava/lang/String;
+    Code:
+##: getstatic     ###                 // Field A$.MODULE$:LA$;
+##: invokevirtual ###                 // Method A$.create:(Lscala/collection/Seq;)Ljava/lang/String;
+##: areturn
+
   public A();
     descriptor: ()V
     Code:
 ##: invokespecial ###                 // Method java/lang/Object."<init>":()V
 ##: return
-
-  public static java.lang.String create(java.lang.String...);
-    descriptor: ([Ljava/lang/String;)Ljava/lang/String;
-    Code:
-##: aconst_null
-##: areturn
 }

@jrudolph
Copy link
Contributor Author

Yeah, exactly, that's the weird thing.

@SethTisue SethTisue added the bug label May 17, 2018
@dwijnand dwijnand self-assigned this Feb 7, 2019
@dwijnand dwijnand added this to the 0.4.0 milestone Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants