Skip to content
Permalink
Browse files

Better fix for SI-5676. Review by @paulp

  • Loading branch information
hubertp committed May 9, 2012
1 parent 97046e6 commit 18efdedfb97de7ca9f6f6ce385194d5a6902769d
@@ -274,8 +274,10 @@ abstract class GenASM extends SubComponent with BytecodeWriters {
// we can exclude lateFINAL. Such symbols are eligible for inlining, but to
// avoid breaking proxy software which depends on subclassing, we do not
// emit ACC_FINAL.
// Nested objects won't receive ACC_FINAL in order to allow for their overloading.

val finalFlag = (
((sym.rawflags & (Flags.FINAL | Flags.MODULE)) != 0)
(sym.hasFlag(Flags.FINAL) || isTopLevelModule(sym))
&& !sym.enclClass.isInterface
&& !sym.isClassConstructor
&& !sym.isMutable // lazy vals and vars both
@@ -649,8 +651,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters {

val INNER_CLASSES_FLAGS =
(asm.Opcodes.ACC_PUBLIC | asm.Opcodes.ACC_PRIVATE | asm.Opcodes.ACC_PROTECTED |
asm.Opcodes.ACC_STATIC | asm.Opcodes.ACC_FINAL |
asm.Opcodes.ACC_INTERFACE | asm.Opcodes.ACC_ABSTRACT)
asm.Opcodes.ACC_STATIC | asm.Opcodes.ACC_INTERFACE | asm.Opcodes.ACC_ABSTRACT)

val PublicStatic = asm.Opcodes.ACC_PUBLIC | asm.Opcodes.ACC_STATIC
val PublicStaticFinal = asm.Opcodes.ACC_PUBLIC | asm.Opcodes.ACC_STATIC | asm.Opcodes.ACC_FINAL
@@ -191,7 +191,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with

val MIN_SWITCH_DENSITY = 0.7
val INNER_CLASSES_FLAGS =
(ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED | ACC_STATIC | ACC_FINAL | ACC_INTERFACE | ACC_ABSTRACT)
(ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED | ACC_STATIC | ACC_INTERFACE | ACC_ABSTRACT)

val PublicStatic = ACC_PUBLIC | ACC_STATIC
val PublicStaticFinal = ACC_PUBLIC | ACC_STATIC | ACC_FINAL
@@ -1954,8 +1954,10 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
// we can exclude lateFINAL. Such symbols are eligible for inlining, but to
// avoid breaking proxy software which depends on subclassing, we do not
// emit ACC_FINAL.
// Nested objects won't receive ACC_FINAL in order to allow for their overloading.

val finalFlag = (
((sym.rawflags & (Flags.FINAL | Flags.MODULE)) != 0)
(sym.hasFlag(Flags.FINAL) || isTopLevelModule(sym))
&& !sym.enclClass.isInterface
&& !sym.isClassConstructor
&& !sym.isMutable // lazy vals and vars both
@@ -0,0 +1,3 @@
ok
false
true
File renamed without changes.
@@ -0,0 +1,24 @@
import java.lang.reflect.Modifier

class Bar[T]

class Foo[T] {
object A extends Bar[T]
}

class Baz[S] extends Foo[S] {
override object A extends Bar[S] {
def foo(): String = "ok"
}
}

object Test {

def main(a: Array[String]) {
val b = new Baz[Any]
println(b.A.foo())
println(Modifier.isFinal(classOf[Baz[Any]].getModifiers()))
println(Modifier.isFinal(Test.getClass.getModifiers()))
}

}

This file was deleted.

0 comments on commit 18efded

Please sign in to comment.
You can’t perform that action at this time.