diff options
author | Paul Phillips <paulp@improving.org> | 2013-04-01 21:27:06 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-04-03 01:30:57 -0700 |
commit | 8c78d4bfc60d8ebc2bd72899a57d2abf2b2eced1 (patch) | |
tree | b71bb8bf8d2a9ffd7c5a2106c22d891b5251f51c /src/reflect | |
parent | 71c14e41adc29a7c7db18c54baedd7319c63e3bc (diff) | |
download | scala-8c78d4bfc60d8ebc2bd72899a57d2abf2b2eced1.tar.gz scala-8c78d4bfc60d8ebc2bd72899a57d2abf2b2eced1.tar.bz2 scala-8c78d4bfc60d8ebc2bd72899a57d2abf2b2eced1.zip |
Brought some structure to the classfileparser.
I run out of ways to describe this sort of work: removes
code which does too much, too verbosely and too explicitly,
using too much indirection and too much duplication. Replace
it with code which offers less of these things.
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/PrivateWithin.scala | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/PrivateWithin.scala b/src/reflect/scala/reflect/internal/PrivateWithin.scala index 9b99b94b41..7c4e9c7b48 100644 --- a/src/reflect/scala/reflect/internal/PrivateWithin.scala +++ b/src/reflect/scala/reflect/internal/PrivateWithin.scala @@ -2,6 +2,8 @@ package scala.reflect package internal import ClassfileConstants._ +import java.lang.{ Class => jClass } +import java.lang.reflect.{ Member => jMember } trait PrivateWithin { self: SymbolTable => @@ -20,4 +22,21 @@ trait PrivateWithin { sym } -}
\ No newline at end of file + + def propagatePackageBoundary(c: jClass[_], syms: Symbol*): Unit = + propagatePackageBoundary(JavaAccFlags(c), syms: _*) + def propagatePackageBoundary(m: jMember, syms: Symbol*): Unit = + propagatePackageBoundary(JavaAccFlags(m), syms: _*) + def propagatePackageBoundary(jflags: JavaAccFlags, syms: Symbol*) { + if (jflags.hasPackageAccessBoundary) + syms foreach setPackageAccessBoundary + } + + // protected in java means package protected. #3946 + // See ticket #1687 for an example of when the enclosing top level class is NoSymbol; + // it apparently occurs when processing v45.3 bytecode. + def setPackageAccessBoundary(sym: Symbol): Symbol = ( + if (sym.enclosingTopLevelClass eq NoSymbol) sym + else sym setPrivateWithin sym.enclosingTopLevelClass.owner + ) +} |