You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi,
I want to reflect a high-order function of scala,so i use classUtil to track it, but I found the print sigature of the method is wrong(just print as method name):
val classpath = List(
new File("target/scala-2.10/classes/com/alibaba/fodps/classUtil/"))
val finder = ClassFinder(classpath)
//val classes = finder.getClasses // classes is an Iterator[ClassInfo]
println("interface ...")
val ifaces = finder.getClasses.filter(_.isInterface)
ifaces.foreach(println(_))
println("concrete ...")
val crete = finder.getClasses.filter(_.isConcrete)
for (cls <- crete){
println(cls.name)
if (cls.name == "com.alibaba.fodps.classUtil.Foo$$anonfun$run$1"){
printf("bingo, methods:%s\n",cls.methods)
for (m <- cls.methods){
if (m.name == "apply")
printf("desc=%s,sig=%s\n", m.descriptor, m.signature)
}
}
}
}
use sbt and print:
run
[info] Compiling 1 Scala source to /Users/zhangjun/Documents/workspace/classUtil/target/scala-2.10/classes...
[info] Running com.alibaba.fodps.classUtil.Main
interface ...
concrete ...
com.alibaba.fodps.classUtil.Foo$$anonfun$run$1
bingo, methods:Set(, apply, apply$mcII$sp)
desc=(I)I,sig=apply <--------------------the sig is wrong here!!!
com.alibaba.fodps.classUtil.Foo
com.alibaba.fodps.classUtil.Main$$anonfun$1
com.alibaba.fodps.classUtil.Main$$anonfun$2
com.alibaba.fodps.classUtil.Main$$anonfun$3
com.alibaba.fodps.classUtil.Main$$anonfun$4$$anonfun$apply$1
com.alibaba.fodps.classUtil.Main$$anonfun$4
com.alibaba.fodps.classUtil.Main$
com.alibaba.fodps.classUtil.Main$delayedInit$body
com.alibaba.fodps.classUtil.Main
[success] Total time: 1 s, completed Nov 27, 2013 12:35:14 PM
hi,
I want to reflect a high-order function of scala,so i use classUtil to track it, but I found the print sigature of the method is wrong(just print as method name):
import org.clapper.classutil.ClassFinder
import org.clapper.classutil.ClassUtil
import java.io.File
object Main extends App {
}
use sbt and print:
build.sbt:
scalaVersion := "2.10.2"
libraryDependencies ++= Seq(
"org.scalatest" % "scalatest_2.10" % "2.0" % "test",
"org.slf4j" % "slf4j-api" % "1.7.2",
"org.slf4j" % "slf4j-simple" % "1.7.2",
"org.clapper" % "grizzled-scala_2.10" % "1.1.4",
"org.clapper" % "grizzled-slf4j_2.10" % "1.0.1",
"asm" % "asm" % "3.3.1",
"org.clapper" % "classutil_2.10" % "1.0.2"
)
The text was updated successfully, but these errors were encountered: