Skip to content

Instantly share code, notes, and snippets.

@eyalgo
Created March 11, 2016 10:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eyalgo/aaa3b8b5d413f8a68070 to your computer and use it in GitHub Desktop.
Save eyalgo/aaa3b8b5d413f8a68070 to your computer and use it in GitHub Desktop.
def CLdump(cl: ClassLoader = Thread.currentThread().getContextClassLoader) = {
val f = classOf[ClassLoader].getDeclaredField("classes")
f.setAccessible(true)
dump(cl)
def dump(cl: ClassLoader): Unit = {
if (cl == null) return
val classes = f.get(cl).asInstanceOf[java.util.Vector[java.lang.Class[_]]]
println(cl)
println(classes.toArray.map(cl => "\t" + cl.toString).mkString("\n"))
dump(cl.getParent)
}
}
Raw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment