-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
Milestone
Description
Early Java pickling (using -Ypickle-java
) applies the wrong (Scala) visibility when typing Java sources. Given P.scala
:
package com.example.test
private[test] class P
and U.java
package com.example.test2;
import com.example.test.P;
public class U {
private P p;
}
$ ~/scala/scala-2.13.10/bin/scalac -Ypickle-java -Ypickle-write p-pickle.jar -d p.jar P.scala U.java
U.java:6: error: not found: type P
private P p;
^
1 error
The Scala package-private (or private-within) visibility is erased in the bytecode, making the class public
for Java. This normally allows U.java
to be compiled with Zinc in a mixed project. The extra Java typing introduced by -Ypickle-java
breaks this. I encountered this originally in 2.12.15 and it is reproducible in 2.12.17 and 2.13.10.