summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/backend/jvm
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan@lightbend.com>2016-08-22 09:48:04 -0700
committerGitHub <noreply@github.com>2016-08-22 09:48:04 -0700
commit7039097606ac98c23c64ec14b3c026b0e5a96a99 (patch)
tree1bca08a4eb5952cedae5bfc68862daf80e577f0b /src/compiler/scala/tools/nsc/backend/jvm
parentb8e4d1f692c5712990b45f50625627015112df32 (diff)
parentbb882e7249d4b9aa0b0c92ec9058d58464f6ed7a (diff)
downloadscala-7039097606ac98c23c64ec14b3c026b0e5a96a99.tar.gz
scala-7039097606ac98c23c64ec14b3c026b0e5a96a99.tar.bz2
scala-7039097606ac98c23c64ec14b3c026b0e5a96a99.zip
Merge pull request #5322 from retronym/topic/SD-194
SD-194 Tweak module initialization to comply with JVM spec
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/jvm')
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
index 481f71cb5d..dbad37cd5b 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
@@ -181,8 +181,15 @@ abstract class BCodeSkelBuilder extends BCodeHelpers {
* can-multi-thread
*/
private def addModuleInstanceField() {
+ // TODO confirm whether we really don't want ACC_SYNTHETIC nor ACC_DEPRECATED
+ // SD-194 This can't be FINAL on JVM 1.9+ because we assign it from within the
+ // instance constructor, not from <clinit> directly. Assignment from <clinit>,
+ // after the constructor has completely finished, seems like the principled
+ // thing to do, but it would change behaviour when "benign" cyclic references
+ // between modules exist.
+ val mods = GenBCode.PublicStatic
val fv =
- cnode.visitField(GenBCode.PublicStaticFinal, // TODO confirm whether we really don't want ACC_SYNTHETIC nor ACC_DEPRECATED
+ cnode.visitField(mods,
strMODULE_INSTANCE_FIELD,
thisBType.descriptor,
null, // no java-generic-signature