classgraph-4.2.7
Adds a number of convenience methods, and the ability to detect resources with duplicate paths.
-
New methods for converting
*Listclasses into aMap, indexed by name:ClassInfoList#asMap()MethodInfoList#asMap()FieldInfoList#asMap()AnnotationInfoList#asMap()ResourceList#asMap()
-
New methods for filtering a
ResourceListfor onlyResourceelements with or without a.classextension respectively:ResourceList#classFilesOnly()ResourceList#nonClassFilesOnly()
-
New method for detecting resources with duplicate paths across different classpath or module path entries:
ResourceList#findDuplicatePaths()-- returns aList<Entry<String, ResourceList>>for all resources with duplicate paths (theEntrykey is the path, and the value is aResourceListconsisting of two or moreResourceelements with that path). Thanks to @vorburger for the suggestion and a code submission for this feature (#256).- e.g. to find duplicate classfiles:
for (Entry<String, ResourceList> dup : new ClassGraph().scan().getAllResources().classFilesOnly().findDuplicatePaths()) { System.out.println(dup.getKey()); for (Resource res : dup.getValue()) { System.out.println(" -> " + res.getURL()); } }
-
Newly deprecated methods:
FieldInfo#getDefiningClass()-> use insteadFieldInfo#getClassInfo()FieldInfo#getDefiningClassName()-> use insteadFieldInfo#getClassInfo().getName()MethodInfo#getDefiningClass()-> use insteadMethodInfo#getClassInfo()MethodInfo#getDefiningClassName()-> use insteadMethodInfo#getClassInfo().getName()