This is a question derived from Build A Generic Tree With Inheritance . I open this one as a separate questi
Check out TypeTools for this. Example:
List<String> stringList = new ArrayList<String>() {}; Class<?> stringType = TypeResolver.resolveRawArgument(List.class, stringList.getClass()); assert stringType == String.class;