From b49b6cf7f0f42d74da854d96eeb0f863357c04cd Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Thu, 6 Jun 2013 13:41:15 +0200 Subject: 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. --- test/files/run/t7151.check | 6 ++++++ test/files/run/t7151.scala | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 test/files/run/t7151.check create mode 100644 test/files/run/t7151.scala (limited to 'test/files') diff --git a/test/files/run/t7151.check b/test/files/run/t7151.check new file mode 100644 index 0000000000..d532d9589f --- /dev/null +++ b/test/files/run/t7151.check @@ -0,0 +1,6 @@ +class Test$InnerObject$ isFinal = false +class Test$InnerCase isFinal = true +class Test$InnerNonCase isFinal = true +class TopLevelObject$ isFinal = true +class TopLevelCase isFinal = true +class TopLevelNonCase isFinal = true diff --git a/test/files/run/t7151.scala b/test/files/run/t7151.scala new file mode 100644 index 0000000000..f6492ba43c --- /dev/null +++ b/test/files/run/t7151.scala @@ -0,0 +1,24 @@ +import java.lang.reflect.Modifier.isFinal + +object Test { + object InnerObject + final case class InnerCase() + final class InnerNonCase() + + def main(args: Array[String]) { + def checkFinal(clazz: Class[_]) = + println(s"${clazz} isFinal = ${isFinal(clazz.getModifiers())}") + + checkFinal(InnerObject.getClass) + checkFinal(classOf[InnerCase]) + checkFinal(classOf[InnerNonCase]) + + checkFinal(TopLevelObject.getClass) + checkFinal(classOf[TopLevelCase]) + checkFinal(classOf[TopLevelNonCase]) + } +} + +object TopLevelObject +final case class TopLevelCase() +final case class TopLevelNonCase() -- cgit v1.2.3