Skip to content

Commit c50b219

Browse files
committed
Update BytecodeTest
1 parent 77dfcfe commit c50b219

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/junit/scala/issues/BytecodeTest.scala

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import org.junit.Assert._
1212
import scala.collection.JavaConverters._
1313
import scala.tools.asm.Opcodes
1414
import scala.tools.asm.tree.ClassNode
15+
import scala.tools.nsc.backend.jvm.opt.BytecodeUtils
1516
import scala.tools.partest.ASMConverters._
1617
import scala.tools.testing.ClearAfterClass
1718

@@ -221,7 +222,7 @@ class BytecodeTest extends ClearAfterClass {
221222

222223
def checkForwarder(c: ClassNode, target: String) = {
223224
val List(f) = findMethods(c, "f")
224-
assertSameCode(f, List(VarOp(ALOAD, 0), Invoke(INVOKESPECIAL, target, "f", "()I", false), Op(IRETURN)))
225+
assertSameCode(f, List(VarOp(ALOAD, 0), Invoke(INVOKESTATIC, target, "f", s"(L$target;)I", false), Op(IRETURN)))
225226
}
226227
}
227228

@@ -347,7 +348,7 @@ class BytecodeTest extends ClearAfterClass {
347348
def invocationReceivers(): Unit = {
348349
val List(c1, c2, t, u) = compileClasses(compiler)(invocationReceiversTestCode.definitions("Object"))
349350
// mixin forwarder in C1
350-
assertSameCode(getSingleMethod(c1, "clone"), List(VarOp(ALOAD, 0), Invoke(INVOKESPECIAL, "T", "clone", "()Ljava/lang/Object;", false), Op(ARETURN)))
351+
assertSameCode(getSingleMethod(c1, "clone"), List(VarOp(ALOAD, 0), Invoke(INVOKESTATIC, "T", "clone", "(LT;)Ljava/lang/Object;", false), Op(ARETURN)))
351352
assertInvoke(getSingleMethod(c1, "f1"), "T", "clone")
352353
assertInvoke(getSingleMethod(c1, "f2"), "T", "clone")
353354
assertInvoke(getSingleMethod(c1, "f3"), "C1", "clone")
@@ -356,8 +357,8 @@ class BytecodeTest extends ClearAfterClass {
356357
assertInvoke(getSingleMethod(c2, "f3"), "C1", "clone")
357358

358359
val List(c1b, c2b, tb, ub) = compileClasses(compiler)(invocationReceiversTestCode.definitions("String"))
359-
def ms(c: ClassNode, n: String) = c.methods.asScala.toList.filter(_.name == n)
360-
assert(ms(tb, "clone").length == 1)
360+
def ms(c: ClassNode, n: String) = c.methods.asScala.toList.filter(_.name == n).filterNot(BytecodeUtils.isStaticMethod)
361+
assert(ms(tb, "clone").length == 1, tb.methods.asScala.map(_.name))
361362
assert(ms(ub, "clone").isEmpty)
362363
val List(c1Clone) = ms(c1b, "clone")
363364
assertEquals(c1Clone.desc, "()Ljava/lang/Object;")

0 commit comments

Comments
 (0)