diff options
-rwxr-xr-x | src/compiler/scala/tools/nsc/javac/JavaParsers.scala | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index c3288db37a..b9c1383c76 100755 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -392,21 +392,24 @@ trait JavaParsers extends JavaScanners { if (inInterface) nme.EMPTY.toTypeName else thisPackageName while (true) { - if (List(PUBLIC, PROTECTED, PRIVATE) contains in.token) defaultAccess = false + // if any explicit access modifier is present, we set privateWithin + // to the empty package so the flag is correctly interpreted. + if (List(PUBLIC, PROTECTED, PRIVATE) contains in.token) { + defaultAccess = false + privateWithin = nme.EMPTY.toTypeName + } + in.token match { case AT if (in.lookaheadToken != INTERFACE) => in.nextToken annotation() case PUBLIC => - privateWithin = nme.EMPTY.toTypeName in.nextToken case PROTECTED => flags |= Flags.PROTECTED - //privateWithin = thisPackageName in.nextToken case PRIVATE => flags |= Flags.PRIVATE - privateWithin = nme.EMPTY.toTypeName in.nextToken case STATIC => flags |= Flags.STATIC @@ -429,7 +432,7 @@ trait JavaParsers extends JavaScanners { // but then many cases like pos5/t1176 fail because scala code // with no package cannot access java code with no package. if (defaultAccess && !isEmptyPkg) - flags |= Flags.LOCAL // package private + flags |= Flags.PROTECTED // package private return Modifiers(flags, privateWithin) } |