void (@NotNull Class<?> clazz, @NotNull List<? super Field> result) { result.addAll(Arrays.asList(clazz.getDeclaredFields())); Class<?> superClass = clazz.getSuperclass(); if (superClass != null) { collectFields(superClass, result); } for (Class<?> each : clazz.getInterfaces()) { collectFields(each, result); } }