Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
s12 -Ccom.google.guava:guava:30.1-jre
val ps = Set("scala.collection", "scala.collection.convert", "scala.collection.immutable", "scala.collection.mutable")
val cp = com.google.common.reflect.ClassPath.from(classOf[List[_]].getClassLoader)
import scala.collection.JavaConverters._
val topLevel = ps.flatMap(p => cp.getTopLevelClasses(p).asScala)
val all = topLevel.flatMap(c => {
val cl = c.load
cl.getDeclaredClasses.toSet + cl
})
val ser = classOf[java.io.Serializable]
def isSer(c: Class[_]): Boolean = ser.isAssignableFrom(c)
def id(c: Class[_]): Long = java.io.ObjectStreamClass.lookup(c).getSerialVersionUID()
all.foreach(c => if (isSer(c)) println(s"$c : ${id(c)}"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment