Skip to content

Commit

Permalink
Merge pull request #10276 from som-snytt/tweak/t7253-broken
Browse files Browse the repository at this point in the history
  • Loading branch information
SethTisue committed Jan 31, 2023
2 parents 8d2641e + 25aef2c commit 0958b82
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
1 change: 0 additions & 1 deletion test/files/jvm/t7253.check

This file was deleted.

33 changes: 12 additions & 21 deletions test/files/jvm/t7253/test.scala
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
import scala.tools.partest.BytecodeTest
import scala.tools.testkit.ASMConverters
// scalac: -Werror -Xlint

import scala.tools.nsc.util.JavaClassPath
import java.io.InputStream
import scala.tools.asm
import asm.ClassReader
import asm.tree.{ClassNode, InsnList}
import scala.collection.JavaConverters._
import scala.tools.asm.Opcodes
import scala.tools.partest.BytecodeTest
import scala.tools.testkit.ASMConverters._

object Test extends BytecodeTest {
import ASMConverters._

def show: Unit = {
val instrBaseSeqs = Seq("ScalaClient_1", "JavaClient_1") map (name => instructionsFromMethod(getMethod(loadClassNode(name), "foo")))
val instrSeqs = instrBaseSeqs map (_ filter isInvoke)
cmpInstructions(instrSeqs(0), instrSeqs(1))
def show(): Unit = {
def fooOf(name: String) = instructionsFromMethod(getMethod(loadClassNode(name), "foo")).filter(isInvoke)
cmpInstructions(fooOf("ScalaClient_1"), fooOf("JavaClient_1"))
}

def cmpInstructions(isa: List[Instruction], isb: List[Instruction]) = {
if (isa == isb) println("bytecode identical")
else diffInstructions(isa, isb)
}
def cmpInstructions(isa: List[Instruction], isb: List[Instruction]) =
if (!isa.sameElements(isb))
diffInstructions(isa, isb)

def isInvoke(node: Instruction): Boolean = {
val opcode = node.opcode
(opcode == "INVOKEVIRTUAL") || (opcode == "INVOKEINTERFACE")
}
def isInvoke(node: Instruction): Boolean =
node.opcode == Opcodes.INVOKEVIRTUAL || node.opcode == Opcodes.INVOKEINTERFACE
}

0 comments on commit 0958b82

Please sign in to comment.