Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get all classes of a package

How can I get a list of all classes in a given package?
I tried this:

import scala.reflect.runtime.{currentMirror => cm}  
val classes = cm.staticPackage("scala.collection.mutable").typeSignature.declarations

But it seems to give me an empty list.

like image 890
Joan Avatar asked Dec 09 '25 05:12

Joan


1 Answers

At the moment, this is not possible, because the runtime reflection part of the Scala reflection API is based on classloaders, and they don't provide the functionality of enumerating contents of packages.

like image 137
Eugene Burmako Avatar answered Dec 12 '25 04:12

Eugene Burmako