Documentation of ClassPath#getResources() is misleading
Author: rkosegiCreated Jan 15, 2017Updated Aug 15, 2026
Labelstype=enhancementtype=api-docsstatus=triagedpackage=reflectP3
Javadocs on ClassPath#getResources() reads:
Returns all resources loadable from the current class path, including the class files of all loadable classes but excluding the "META-INF/MANIFEST.MF" file
This is not exactly true for files which has same path relative to JAR. Eg. if I want to load files all resources named "META-INF/schema.xml" from all JAR files on classpath, it will pick only last one, due to nature of backing ImmutableSet. It should be either mentioned in javadocs, or allow "duplicates" for example by using ImmutableList or by changing ResourceInfo#equals to consider URL instead of just resourceName;
Source: google/guava