I am trying to figure out how to accomplish this, but so far from reading the documentation I have not been able to figure it out.
Basically, I want to scan for all classes that have been compiled locally by Maven or Gradle or something. I sort of figured out how to do it by doing this:
List<String> classnames = new ClassGraph()
.acceptPackages("")
.disableJarScanning()
.rejectClasses(Closure.class.getName())
.scan()
.getAllClasses()
.getNames();
Since I'm doing this on Groovy classes, I am getting a ton of extra classes that represent the Groovy closures in many of the classes. For example (the highlighted classes in this list of variables in IntelliJ are closure classes):

What I want to do is exclude classes that have groovy.lang.Closure as their super class (or at any other arbitrary location below the class in the class hierarchy).
I tried using rejectClasses, but closures are compiled into anonymous classes that extend groovy.lang.Closure instead of being an instance of a Closure, and it seems that rejectClasses only works the provided class itself.
Is there a way to do this that I am overlooking?
Thanks
I am trying to figure out how to accomplish this, but so far from reading the documentation I have not been able to figure it out.
Basically, I want to scan for all classes that have been compiled locally by Maven or Gradle or something. I sort of figured out how to do it by doing this:
Since I'm doing this on Groovy classes, I am getting a ton of extra classes that represent the Groovy closures in many of the classes. For example (the highlighted classes in this list of variables in IntelliJ are closure classes):
What I want to do is exclude classes that have
groovy.lang.Closureas their super class (or at any other arbitrary location below the class in the class hierarchy).I tried using
rejectClasses, but closures are compiled into anonymous classes that extendgroovy.lang.Closureinstead of being an instance of aClosure, and it seems thatrejectClassesonly works the provided class itself.Is there a way to do this that I am overlooking?
Thanks