File tree Expand file tree Collapse file tree 4 files changed +25
-1
lines changed
compiler/src/dotty/tools/dotc/core
forwarder-java-package-private Expand file tree Collapse file tree 4 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -1388,7 +1388,7 @@ object SymDenotations {
13881388 final def accessBoundary (base : Symbol )(using Context ): Symbol =
13891389 if (this .is(Private )) owner
13901390 else if (this .isAllOf(StaticProtected )) defn.RootClass
1391- else if (privateWithin.exists && ! ctx.phase.erasedTypes) privateWithin
1391+ else if (privateWithin.exists && ( ! ctx.phase.erasedTypes || this .is( JavaDefined )) ) privateWithin
13921392 else if (this .is(Protected )) base
13931393 else defn.RootClass
13941394
Original file line number Diff line number Diff line change 1+ public static java.lang.String scalapackage.Foo.publicMethod()
Original file line number Diff line number Diff line change 1+ package javapackage ;
2+
3+ public class Base_1 {
4+ int packagePrivateMethod () {
5+ return 42 ;
6+ }
7+
8+ public String publicMethod () {
9+ return "foo" ;
10+ }
11+ }
Original file line number Diff line number Diff line change 1+ package scalapackage:
2+ object Foo extends javapackage.Base_1
3+ end scalapackage
4+
5+ object Test {
6+ def main (args : Array [String ]): Unit = {
7+ println(
8+ Class .forName(" scalapackage.Foo" ).getMethods
9+ .filter(m => (m.getModifiers & java.lang.reflect.Modifier .STATIC ) != 0 )
10+ .mkString(" \n " ))
11+ }
12+ }
You can’t perform that action at this time.
0 commit comments