void (@Nullable String className, Class<?> ... types) { if (className == null) return; try { Class<?> aClass = myClassLoader.loadClass(className); for (Class<?> t : types) { if (t.isAssignableFrom(aClass)) return; } assert false : "Incorrect class type: " + aClass + " must be one of " + Arrays.asList(types); assert Modifier.isPublic(aClass.getConstructor(ArrayUtil.EMPTY_CLASS_ARRAY).getModifiers()); } catch (Exception e) { throw new RuntimeException(e); } }