Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.1.1
-
None
-
None
Description
The Discover class uses this method to get a class:
private static <T> Class<T> getClass(ClassLoader loader, String spec) { Class<T> c = null; try { c = (Class<T>)loader.loadClass(spec); c = (Class<T>)(c != null ? c : getClass(Discover.class.getClassLoader(), spec)); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } return c; }
However the first line inside the try statement will throw a CNF exception if the class cannot be found. As a result, the second line is never executed.
c = (Class<T>)(c != null ? c : getClass(Discover.class.getClassLoader(), spec));
The code executes recursively, which makes things harder. I would recommend changing the way the code is currently written to avoid recursion.