diff options
author | Paul Phillips <paulp@improving.org> | 2009-03-13 22:02:34 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-03-13 22:02:34 +0000 |
commit | a14b43742168c3dae77cafeb2ed7862e8890945e (patch) | |
tree | 33efa6ca8b29b57942378c9c57ac1afd2aea6079 | |
parent | 3bbffde3033aa8fecae6f23140421c04cf215544 (diff) | |
download | scala-a14b43742168c3dae77cafeb2ed7862e8890945e.tar.gz scala-a14b43742168c3dae77cafeb2ed7862e8890945e.tar.bz2 scala-a14b43742168c3dae77cafeb2ed7862e8890945e.zip |
Incomplete fix for bug #1240.
-rwxr-xr-x | src/compiler/scala/tools/nsc/javac/JavaParsers.scala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index ae0712e7a6..c3288db37a 100755 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -386,9 +386,13 @@ trait JavaParsers extends JavaScanners { def modifiers(inInterface: Boolean): Modifiers = { var flags: Long = Flags.JAVA + // assumed true unless we see public/private/protected - see bug #1240 + var defaultAccess = true var privateWithin: Name = if (inInterface) nme.EMPTY.toTypeName else thisPackageName + while (true) { + if (List(PUBLIC, PROTECTED, PRIVATE) contains in.token) defaultAccess = false in.token match { case AT if (in.lookaheadToken != INTERFACE) => in.nextToken @@ -416,6 +420,17 @@ trait JavaParsers extends JavaScanners { case NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE | STRICTFP => in.nextToken case _ => + // XXX both these checks are definitely necessary, which would + // seem to indicate the empty package situation needs review + def isEmptyPkg() = + privateWithin == nme.EMPTY.toTypeName || + privateWithin == nme.EMPTY_PACKAGE_NAME_tn + // XXX I think this test should just be "if (defaultAccess)" + // 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 + return Modifiers(flags, privateWithin) } } |