Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def readClass(bytes: Array[Byte]): ClassNode = {
val node = new ClassNode()
new ClassReader(bytes).accept(node, Array[Attribute](InlineInfoAttributePrototype), 0)
node
}
def readClass(filename: String): ClassNode = {
val f = new java.io.RandomAccessFile(filename, "r")
val b = new Array[Byte](f.length.toInt)
f.read(b)
readClass(b)
}
@lrytz
Copy link
Author

lrytz commented Sep 3, 2015

val cn = readClass("/Users/luc/scala/scala/sandbox/Test$.class")
import scala.collection.convert.decorateAsScala._
val m = cn.methods.iterator.asScala.find(_.name == "delayedEndpoint$Test$1").head

@lrytz
Copy link
Author

lrytz commented Sep 3, 2015

import scala.tools.nsc.backend.jvm._
AsmUtils.textify(...) // overlaods for class,  method, insn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment