Skip to content

Commit 2f9b708

Browse files
committed
[nomaster] inline importPrivateWithinFromJavaFlags into SymbolTable
This reworks 02ed5fb so that we don't change JavaUniverse's super classes. This is necessary to maintain binary compatibility with 2.10.0.
1 parent ddfe3a0 commit 2f9b708

File tree

3 files changed

+19
-28
lines changed

3 files changed

+19
-28
lines changed

bincompat-forward.whitelist.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ filter {
8585
# matchName="scala.reflect.runtime.SymbolLoaders.initClassModule"
8686
# problemName=MissingMethodProblem
8787
# },
88-
{
89-
matchName="scala.reflect.runtime.JavaUniverse"
90-
problemName=MissingTypesProblem
91-
},
88+
# {
89+
# matchName="scala.reflect.runtime.JavaUniverse"
90+
# problemName=MissingTypesProblem
91+
# },
9292
# {
9393
# matchName="scala.reflect.runtime.JavaUniverse.initClassAndModule"
9494
# problemName=MissingMethodProblem

src/reflect/scala/reflect/internal/PrivateWithin.scala

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/reflect/scala/reflect/internal/SymbolTable.scala

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ abstract class SymbolTable extends macros.Universe
3838
with StdAttachments
3939
with StdCreators
4040
with BuildUtils
41-
with PrivateWithin
4241
{
4342

4443
val gen = new TreeGen { val global: SymbolTable.this.type = SymbolTable.this }
@@ -352,6 +351,21 @@ abstract class SymbolTable extends macros.Universe
352351
*/
353352
implicit val StringContextStripMarginOps: StringContext => StringContextStripMarginOps = util.StringContextStripMarginOps
354353

354+
def importPrivateWithinFromJavaFlags(sym: Symbol, jflags: Int): Symbol = {
355+
import ClassfileConstants._
356+
if ((jflags & (JAVA_ACC_PRIVATE | JAVA_ACC_PROTECTED | JAVA_ACC_PUBLIC)) == 0)
357+
// See ticket #1687 for an example of when topLevelClass is NoSymbol: it
358+
// apparently occurs when processing v45.3 bytecode.
359+
if (sym.enclosingTopLevelClass != NoSymbol)
360+
sym.privateWithin = sym.enclosingTopLevelClass.owner
361+
362+
// protected in java means package protected. #3946
363+
if ((jflags & JAVA_ACC_PROTECTED) != 0)
364+
if (sym.enclosingTopLevelClass != NoSymbol)
365+
sym.privateWithin = sym.enclosingTopLevelClass.owner
366+
367+
sym
368+
}
355369
}
356370

357371
object SymbolTableStats {

0 commit comments

Comments
 (0)