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 /test/files | |
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 'test/files')
-rw-r--r-- | test/files/run/t7151.check | 6 | ||||
-rw-r--r-- | test/files/run/t7151.scala | 24 |
2 files changed, 30 insertions, 0 deletions
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() |