docs: @SuppressWarnings("unchecked")
     public static <T extends Annotation> T getAnnotation(Class<?> clazz, Class<T> ann) {
        while (true) {
           // first check class
           T a = clazz.getAnnotation(ann);
           if (a != null) return a;
  
           // check interfaces
           if (!clazz.isInterface()) {
              Class<?>[] interfaces = clazz.getInterfaces();
              for (Class<?> inter : interfaces) {
                 a = getAnnotation(inter, ann);
                 if (a != null) return a;
              }
           }
  
           // check superclasses
           Class<?> superclass = clazz.getSuperclass();
           if (superclass == null) return null; // no where else to look
           clazz = superclass;
        }
     }