github classgraph/classgraph classgraph-4.2.7

latest releases: classgraph-4.8.172, classgraph-4.8.171, classgraph-4.8.170...
5 years ago

Adds a number of convenience methods, and the ability to detect resources with duplicate paths.

  • New methods for converting *List classes into a Map, indexed by name:

    • ClassInfoList#asMap()
    • MethodInfoList#asMap()
    • FieldInfoList#asMap()
    • AnnotationInfoList#asMap()
    • ResourceList#asMap()
  • New methods for filtering a ResourceList for only Resource elements with or without a .class extension respectively:

    • ResourceList#classFilesOnly()
    • ResourceList#nonClassFilesOnly()
  • New method for detecting resources with duplicate paths across different classpath or module path entries:

    • ResourceList#findDuplicatePaths() -- returns a List<Entry<String, ResourceList>> for all resources with duplicate paths (the Entry key is the path, and the value is a ResourceList consisting of two or more Resource elements 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 instead FieldInfo#getClassInfo()
    • FieldInfo#getDefiningClassName() -> use instead FieldInfo#getClassInfo().getName()
    • MethodInfo#getDefiningClass() -> use instead MethodInfo#getClassInfo()
    • MethodInfo#getDefiningClassName() -> use instead MethodInfo#getClassInfo().getName()

Don't miss a new classgraph release

NewReleases is sending notifications on new releases.