private Class calcImplementationClass(Class concreteInterface) { final TreeSet<Class> set = new TreeSet<Class>(CLASS_COMPARATOR); findImplementationClassDFS(concreteInterface, set); if (!set.isEmpty()) { return set.first(); } final Implementation implementation = DomReflectionUtil.findAnnotationDFS(concreteInterface, Implementation.class); return implementation == null ? concreteInterface : implementation.value(); }