From e077c24525bf8f9bd8b73684e630eb7fc6bcb5f6 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Thu, 14 Apr 2016 14:00:33 +1000 Subject: SI-9390 Emit local defs that don't capture this as static This avoids unnecessary memory retention, and allows lambdas that call the local methods to be serializable, regardless of whether or not the enclosing class is serializable. The second point is especially pressing, given that the enclosing class for local methods defined in a used to be the (serializable) anonymous function class, but as of Scala 2.12 will be the enclosing class of the lambda. This change is similar in spirit to SI-9408 / 93bee55e. --- test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala | 4 ++-- test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'test/junit') diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala index 6161dc7b73..024cf0c416 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala @@ -113,7 +113,7 @@ class InlineWarningTest extends BytecodeTesting { val warn = """M::f()I is annotated @inline but could not be inlined: - |The callee M::f()I contains the instruction INVOKESPECIAL M.nested$1 ()I + |The callee M::f()I contains the instruction INVOKESTATIC M.nested$1 ()I |that would cause an IllegalAccessError when inlined into class N""".stripMargin var c = 0 @@ -140,7 +140,7 @@ class InlineWarningTest extends BytecodeTesting { val warn = """M::f(Lscala/Function1;)I could not be inlined: - |The callee M::f(Lscala/Function1;)I contains the instruction INVOKESPECIAL M.nested$1 ()I + |The callee M::f(Lscala/Function1;)I contains the instruction INVOKESTATIC M.nested$1 ()I |that would cause an IllegalAccessError when inlined into class N""".stripMargin var c = 0 diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala index 7234659a1d..02cd632af1 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala @@ -1141,7 +1141,7 @@ class InlinerTest extends BytecodeTesting { val warn = """C::h()I is annotated @inline but could not be inlined: - |The callee C::h()I contains the instruction INVOKESPECIAL C.f$1 ()I + |The callee C::h()I contains the instruction INVOKESTATIC C.f$1 ()I |that would cause an IllegalAccessError when inlined into class D.""".stripMargin val List(c, d) = compile(code, allowMessage = _.msg contains warn) -- cgit v1.2.3