What steps will reproduce the problem?
Execute the following code:
public class ReflectionUtilsAndClassesNotFound {
public static void main(String[] args) {
List<String> classes = ImmutableList.of("a.class.that.does.not.exist");
List<?> result = ReflectionUtils.forNames(classes);
ImmutableSet.copyOf(result); // throws NullPointerException
}
}
The expected situation is that every classname that can't be resolved as a
type, log a message and don't be added to the collection as null ( or Have it
been done for some reason in this way? )
We access through an instance of Reflections, which we have no way to filter
out null elements that come to the classnames' collection (or we haven't found
it);
We create & use the Reflections instance like this:
new Reflections(new ConfigurationBuilder()
.filterInputsBy(FilterBuilder.parse(SOME_OWN_FILTER))
.setUrls(VALID_JAR_URLS_TO_SCAN)
.setScanners(new TypeAnnotationsScanner())
).getTypesAnnotatedWith(ANNOTATION_TO_FIND);
The NullPointerException is catched in the
org.reflections.ReflectionUtils#forName without any warning;
We are using Reflections 0.9.5 on winxp
Thanks in advance
Diego M.
Original issue reported on code.google.com by Diegoariel83@gmail.com on 17 Apr 2012 at 4:24
Original issue reported on code.google.com by
Diegoariel83@gmail.com
on 17 Apr 2012 at 4:24