reflections icon indicating copy to clipboard operation
reflections copied to clipboard

Remove getAllTypes() empty exception?

Open immortius opened this issue 7 years ago • 0 comments

https://github.com/ronmamo/reflections/blob/94f9d5a3de9b1e268280fe974a60147f575929d7/src/main/java/org/reflections/Reflections.java#L637

This is probably debatable, but:

Reflections#getAllTypes() throws an exception if the set of types that are subtypes of Object is empty. However this does not differentiate between whether the scanner was not configured to scan for Object subtypes or whether there are no types at all - potentially a legitimate use case if dealing with jars that may provide resources and/or classes. Throwing an exception makes it more difficult to check whether the jar provides no classes, as it requires catching the exception. Alternatively maybe a "hasAnyTypes()" method or similar?

immortius avatar Jun 14 '18 12:06 immortius