diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-06-06 13:41:15 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-06-07 21:53:52 +0200 |
commit | b49b6cf7f0f42d74da854d96eeb0f863357c04cd (patch) | |
tree | 3710705d5a15c68fd7b3af24ae725d204d422985 /src/compiler | |
parent | 5312d6305530eb14d369d0f4acaf7ca4e278ea72 (diff) | |
download | scala-b49b6cf7f0f42d74da854d96eeb0f863357c04cd.tar.gz scala-b49b6cf7f0f42d74da854d96eeb0f863357c04cd.tar.bz2 scala-b49b6cf7f0f42d74da854d96eeb0f863357c04cd.zip |
SI-7151 Emit final in bytecode for final inner classes.
As we did before a regression in 18efdedfb / SI-5676.
This commit tightens up the condition in which the FINAL
modifier is omitted; it now *only* does this for the module
classes of nested objects.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index 7edcc944e1..ef8f0a71ef 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -415,7 +415,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { val INNER_CLASSES_FLAGS = (asm.Opcodes.ACC_PUBLIC | asm.Opcodes.ACC_PRIVATE | asm.Opcodes.ACC_PROTECTED | - asm.Opcodes.ACC_STATIC | asm.Opcodes.ACC_INTERFACE | asm.Opcodes.ACC_ABSTRACT) + asm.Opcodes.ACC_STATIC | asm.Opcodes.ACC_INTERFACE | asm.Opcodes.ACC_ABSTRACT | asm.Opcodes.ACC_FINAL) // ----------------------------------------------------------------------------------------- // factory methods @@ -648,11 +648,12 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { // sort them so inner classes succeed their enclosing class to satisfy the Eclipse Java compiler for (innerSym <- allInners sortBy (_.name.length)) { // TODO why not sortBy (_.name.toString()) ?? - val flags = mkFlags( + val flagsWithFinal: Int = mkFlags( if (innerSym.rawowner.hasModuleFlag) asm.Opcodes.ACC_STATIC else 0, javaFlags(innerSym), if(isDeprecated(innerSym)) asm.Opcodes.ACC_DEPRECATED else 0 // ASM pseudo-access flag ) & (INNER_CLASSES_FLAGS | asm.Opcodes.ACC_DEPRECATED) + val flags = if (innerSym.isModuleClass) flagsWithFinal & ~asm.Opcodes.ACC_FINAL else flagsWithFinal // For SI-5676, object overriding. val jname = javaName(innerSym) // never null val oname = outerName(innerSym) // null when method-enclosed val iname = innerName(innerSym) // null for anonymous inner class |