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

Correctly deal with Java/Scala impedence mismatch between Object/Any when using -Ypickle-write-java #12512

Closed
retronym opened this issue Dec 10, 2021 · 0 comments · Fixed by scala/scala#9826
Assignees
Milestone

Comments

@retronym
Copy link
Member

The specific case that I believe is caused by this is:

package demo;

public class C {
  public static void ol(scala.Equals o) {} // Equals extends AnyVal
  public static void ol(Object o) {}
}
package demo
class Client {
  C.ol(Option(""))
}
$ for V in 2.12.15 2.13.6; do echo $V; scalac --scala-version $V -d /tmp -Ypickle-java -Ypickle-write /tmp/c.jar /tmp/C.java && scalac --scala-version $V -cp /tmp/c.jar /tmp/Client.scala; done
2.12.15
2.13.6
/tmp/Client.scala:3: error: ambiguous reference to overloaded definition,
both method ol in class C of type (o: Object): Unit
and  method ol in class C of type (o: Equals): Unit
match argument types (Option[String])
  C.ol(Option(""))
    ^
1 error

The relevant changes in 2.13 were:

scala/scala#7966
scala/scala#8049

-Ypickle-write is part of the infrastructure to support build pipelining. It writes a .sig file for .java source file that has its API typechecked by the Scala compiler. This can be uses on the classpath of downstream Scala compilation, instead of .class files.

retronym added a commit to retronym/scala that referenced this issue Dec 10, 2021
-Ypickle-write-java can generate Scala pickles for Java files.
Unpickler needs to deal with the special case for Object/Any,
as we do when using Java sources of javac compiled .class files
as inputs.

Fixes scala/bug#12512
@SethTisue SethTisue added this to the 2.13.8 milestone Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants