diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-07-03 14:27:25 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-07-03 14:27:25 -0700 |
commit | dcdf85e183cb7ba554a7fc22ad783ca55ecf50dd (patch) | |
tree | 8a406c2b92aed45c8586cc5c7873c46daeaa0fc9 /src/compiler | |
parent | 67cff1027738ec2818e9c3d98de3b2b8849fcc39 (diff) | |
parent | 1c69dbcead1d4b1d5033d316d1c0468e46b310b3 (diff) | |
download | scala-dcdf85e183cb7ba554a7fc22ad783ca55ecf50dd.tar.gz scala-dcdf85e183cb7ba554a7fc22ad783ca55ecf50dd.tar.bz2 scala-dcdf85e183cb7ba554a7fc22ad783ca55ecf50dd.zip |
Merge pull request #2660 from retronym/ticket/7582
SI-7582 Only inline accessible calls to package-private Java code
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/opt/Inliners.scala | 15 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | 2 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala index a6eedbd07e..56191cc981 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala @@ -679,9 +679,18 @@ abstract class Inliners extends SubComponent { } */ - def checkField(f: Symbol) = check(f, f.isPrivate && !canMakePublic(f)) - def checkSuper(n: Symbol) = check(n, n.isPrivate || !n.isClassConstructor) - def checkMethod(n: Symbol) = check(n, n.isPrivate) + + def isPrivateForInlining(sym: Symbol): Boolean = { + if (sym.isJavaDefined) { + def check(sym: Symbol) = !(sym.isPublic || sym.isProtected) + check(sym) || check(sym.owner) // SI-7582 Must check the enclosing class *and* the symbol for Java. + } + else sym.isPrivate // Scala never emits package-private bytecode + } + + def checkField(f: Symbol) = check(f, isPrivateForInlining(f) && !canMakePublic(f)) + def checkSuper(n: Symbol) = check(n, isPrivateForInlining(n) || !n.isClassConstructor) + def checkMethod(n: Symbol) = check(n, isPrivateForInlining(n)) def getAccess(i: Instruction) = i match { case CALL_METHOD(n, SuperCall(_)) => checkSuper(n) diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index cbfe5460f6..4c0c16690f 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -517,7 +517,7 @@ abstract class ClassfileParser { skipMembers() // methods if (!isScala) { clazz setFlag sflags - propagatePackageBoundary(jflags, clazz, staticModule) + propagatePackageBoundary(jflags, clazz, staticModule, staticModule.moduleClass) clazz setInfo classInfo moduleClass setInfo staticInfo staticModule setInfo moduleClass.tpe |