Get super class's  generic types. eg. A extends B(T1,T2)  will return [T1,T2]<br>
If no generic type is defined for the super class, then null is returned.
328705
public static Type[] getSupperGenericType(Class clazz) {
        ParameterizedType parameterizedType;
        if (clazz.getGenericInterfaces().length > 0) {//父类是interface, the super type is an interface.
            if (clazz.getGenericInterfaces()[0] instanceof ParameterizedType) {
                /*注意：有多个父接口时，这里是取第一个父接口
                  Attention: if multiple parents are defined, we only get the first one.*/
                parameterizedType = (ParameterizedType) clazz.getGenericInterfaces()[0];
            } else {
                return null;
            }
        } else {//父类是class, the super type is a class.
            if (clazz.getGenericSuperclass() instanceof ParameterizedType) {
                parameterizedType = (ParameterizedType) clazz.getGenericSuperclass();
            } else {
                return null;
            }
        }
        return parameterizedType.getActualTypeArguments();
    }
190244
public static void getAllInterfaces(Class<?> classObject, ArrayList<Type> interfaces) {
        Type[] superInterfaces = classObject.getGenericInterfaces();
        interfaces.addAll((Arrays.asList(superInterfaces)));

        // for cases where the extended class is defined with a Generic.
        Type tgs = classObject.getGenericSuperclass();
        if (tgs != null) {
            if ((tgs) instanceof ParameterizedType) {
                interfaces.add(tgs);
            }
        }

        if (tc.isDebugEnabled()) {
            Tr.debug(tc, "updated interfaces to: " + interfaces);
        }

        Class<?> superClass = classObject.getSuperclass();
        if (superClass != null) {
            getAllInterfaces(superClass, interfaces);
        }
    }
419931
public ClassInfo getSuperclass() {
        final Set<ClassInfo> superClasses = relatedClasses.get(RelType.SUPERCLASSES);
        if (superClasses == null || superClasses.isEmpty()) {
            return null;
        } else if (superClasses.size() > 2) {
            throw new IllegalArgumentException("More than one superclass: " + superClasses);
        } else {
            final ClassInfo superclass = superClasses.iterator().next();
            if (superclass.getName().equals("java.lang.Object")) {
                return null;
            } else {
                return superclass;
            }
        }
    }
759461
public static List<Class<?>> getAllSuperclasses(final Class<?> cls) {
        if (cls == null) {
            return null;
        }
        final List<Class<?>> classes = new ArrayList<>();
        Class<?> superclass = cls.getSuperclass();
        while (superclass != null) {
            classes.add(superclass);
            superclass = superclass.getSuperclass();
        }
        return classes;
    }
1148043
@Nullable
  public static ClassType getType(@Nullable ClassTree tree) {
    Type type = getType((Tree) tree);
    return type instanceof ClassType ? (ClassType) type : null;
  }
829801
public static Class[] getTypes(Object... args) {
      if (args.length == 0) {
         return new Class[0];
      }
      Class[] types = new Class[args.length];
      for (int i = 0; i < args.length; i++) {
         types[i] = args[i] == null ? Object.class : args[i].getClass();
      }
      return types;
   }
1351709
public ClassInfoList getSubclasses(final String superclassName) {
        if (closed.get()) {
            throw new IllegalArgumentException("Cannot use a ScanResult after it has been closed");
        }
        if (!scanSpec.enableClassInfo) {
            throw new IllegalArgumentException("Please call ClassGraph#enableClassInfo() before #scan()");
        }
        if (superclassName.equals("java.lang.Object")) {
            // Return all standard classes (interfaces don't extend Object)
            return getAllStandardClasses();
        } else {
            final ClassInfo superclass = classNameToClassInfo.get(superclassName);
            return superclass == null ? ClassInfoList.EMPTY_LIST : superclass.getSubclasses();
        }
    }
1083369
public Class[] getClasses(String superclass) {
    List<Class>	list;

    list = m_ListClasses.get(superclass);
    if (list == null)
      return new Class[0];
    else
      return list.toArray(new Class[list.size()]);
  }
5318
public static com.sun.javadoc.Type[] getTypes(DocEnv env, List<Type> ts) {
        return getTypes(env, ts, new com.sun.javadoc.Type[ts.length()]);
    }
308850
@Override
    public Class[] getParameterTypes() {
        Class[] a, b, result;

        a = base.getParameterTypes();
        b = para.getParameterTypes();
        result = new Class[a.length - 1 + b.length];
        System.arraycopy(a, 0,  result, 0,  idx);
        System.arraycopy(b, 0,  result, idx, b.length);
        System.arraycopy(a, idx + 1,  result, idx + b.length,
                         a.length - (idx + 1));
        return result;
    }
897250
public <T extends SimonConsolePlugin> List<T> getPluginsByType(Class<T> pluginType) {
		List<T> specPlugins = new ArrayList<>();
		for (SimonConsolePlugin plugin : plugins) {
			if (pluginType.isInstance(plugin)) {
				specPlugins.add(pluginType.cast(plugin));
			}
		}
		return Collections.unmodifiableList(specPlugins);
	}
563552
@Nonnull
    public <T extends QEmuOption> List<? extends T> getOptions(@Nonnull Class<T> type) {
        List<T> out = new ArrayList<T>();
        getOptions(out, getOptions(), type);
        return out;
    }
894090
@SuppressWarnings("unchecked")
    public <M extends T> List<M> findList() {
        return (List<M>) query().findList();
    }
1342349
public static Class<?>[] getActualClass(Type genericType) {

        if (genericType instanceof ParameterizedType) {

            Type[] actualTypes = ((ParameterizedType) genericType).getActualTypeArguments();
            Class<?>[] actualClasses = new Class<?>[actualTypes.length];

            int i = 0;
            while (i < actualTypes.length) {
                Type actualType = actualTypes[i];
                if (actualType instanceof Class<?>) {
                    actualClasses[i] = (Class<?>) actualType;
                } else if (actualType instanceof GenericArrayType) {
                    Type componentType = ((GenericArrayType) actualType).getGenericComponentType();
                    actualClasses[i] = Array.newInstance((Class<?>) componentType, 0).getClass();
                }
                i++;
            }

            return actualClasses;
        }

        return EMPTY_CLASSES;
    }
617333
public <E extends Enum<E>> List<E> getTypeList(Class<E> clz, E[] typeList) {
        if (typeList.length > 0) {
            return new ArrayList<>(Arrays.asList(typeList));
        } else {
            return new ArrayList<>(EnumSet.allOf(clz));
        }
    }
1079096
static <T> List<Class> getTypeArguments(Class<T> baseClass, Class<? extends T> childClass) {
        Map<Type, Type> resolvedTypes = new LinkedHashMap<Type, Type>();
        Type type = childClass;
        // start walking up the inheritance hierarchy until we hit baseClass
        while (! getClass(type).equals(baseClass)) {
            if (type instanceof Class) {
                // there is no useful information for us in raw types, so just keep going.
                type = ((Class) type).getGenericSuperclass();
            }
            else {
                ParameterizedType parameterizedType = (ParameterizedType) type;
                Class<?> rawType = (Class) parameterizedType.getRawType();

                Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
                TypeVariable<?>[] typeParameters = rawType.getTypeParameters();
                for (int i = 0; i < actualTypeArguments.length; i++) {
                    resolvedTypes.put(typeParameters[i], actualTypeArguments[i]);
                }

                if (!rawType.equals(baseClass)) {
                    type = rawType.getGenericSuperclass();
                }
            }
        }

        // finally, for each actual type argument provided to baseClass, determine (if possible)
        // the raw class for that type argument.
        Type[] actualTypeArguments;
        if (type instanceof Class) {
            actualTypeArguments = ((Class) type).getTypeParameters();
        }
        else {
            actualTypeArguments = ((ParameterizedType) type).getActualTypeArguments();
        }
        List<Class> typeArgumentsAsClasses = new ArrayList<Class>();
        // resolve types by chasing down type variables.
        for (Type baseType: actualTypeArguments) {
            while (resolvedTypes.containsKey(baseType)) {
                baseType = resolvedTypes.get(baseType);
            }
            typeArgumentsAsClasses.add(getClass(baseType));
        }
        return typeArgumentsAsClasses;
    }
808478
@SuppressWarnings("unchecked")
	public static Type getSuperclassTypeParameter(Class<?> subclass) {
		Type superclass = subclass.getGenericSuperclass();
		if (superclass instanceof Class) {
			throw new RuntimeException("Missing type parameter.");
		}
		return ((ParameterizedType) superclass).getActualTypeArguments()[0];
	}