Skip to content

Commit ddc0f44

Browse files
committed
Remove unnessecary check when computing InnerClass attribute flags
The final flag is computed correctly by javaFlags.
1 parent 4083742 commit ddc0f44

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,12 +755,23 @@ abstract class BCodeTypes extends BCodeIdiomatic {
755755
innerSym.rawname + innerSym.moduleSuffix
756756
}
757757

758-
val flagsWithFinal: Int = mkFlags(
758+
// TODO @lry compare with table in spec: for example, deprecated should not be there it seems.
759+
// http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6-300-D.1-D.1
760+
// including "deprecated" was added in the initial commit of GenASM, but it was never in GenJVM.
761+
val flags: Int = mkFlags(
762+
// TODO @lry adding "static" whenever the class is owned by a module seems wrong.
763+
// class C { object O { class I } }
764+
// here, I is marked static in the InnerClass attribute. But the I constructor takes an outer instance.
765+
// was added in 0469d41
766+
// what should it be? check what would make sense for java reflection.
767+
// member of top-level object should be static? how about anonymous / local class that has
768+
// been lifted to a top-level object?
769+
// member that is only nested in objects should be static?
770+
// verify: will ICodeReader still work after that? the code was introduced because of icode reader.
759771
if (innerSym.rawowner.hasModuleFlag) asm.Opcodes.ACC_STATIC else 0,
760772
javaFlags(innerSym),
761773
if (isDeprecated(innerSym)) asm.Opcodes.ACC_DEPRECATED else 0 // ASM pseudo-access flag
762774
) & (INNER_CLASSES_FLAGS | asm.Opcodes.ACC_DEPRECATED)
763-
val flags = if (innerSym.isModuleClass) flagsWithFinal & ~asm.Opcodes.ACC_FINAL else flagsWithFinal // For SI-5676, object overriding.
764775

765776
val jname = innerSym.javaBinaryName.toString // never null
766777
val oname = { // null when method-enclosed

0 commit comments

Comments
 (0)