protected String getClassType(Method method, List<Class<?>> alsoRead) { Field field = getFieldForMethod(method); if (field == null) { return "n/a"; } if (List.class.isAssignableFrom(field.getType())) { Type generic = field.getGenericType(); if (listWithSingleGenericType(generic)) { Type genericType = ((ParameterizedType) generic).getActualTypeArguments()[0]; // if the generic type is not specified, we'll just return "list of T" if (!(genericType instanceof Class<?>)) { return "List of T"; } else { Class genericClass = (Class) genericType; if (!skipForInspection(genericClass)) { alsoRead.add(genericClass); } return "List of ".concat(genericClass.getSimpleName()); } } else { return "List"; } } else { if (!skipForInspection(method.getReturnType())) { alsoRead.add(method.getReturnType()); } return method.getReturnType().getSimpleName(); } }