private boolean isCheckedException(Class clazz) {
        boolean checked = true;
        Class superclass = clazz;
        while (superclass != Object.class) {
            if (superclass == RuntimeException.class || superclass == Error.class) {
                checked = false;
                break;
            }
            superclass = superclass.getSuperclass();
        }
        return checked;
    }