static void addNeededTypes(Set<TypeElement> imports, TypeMirror type) {
		switch (type.getKind()) {
			case DECLARED:
				DeclaredType dt = (DeclaredType) type;
				imports.add((TypeElement) dt.asElement());
				for (TypeMirror genericType : dt.getTypeArguments()) {
					addNeededTypes(imports, genericType);
				}
				break;
			case WILDCARD:
				WildcardType wt = (WildcardType) type;
				TypeMirror base = wt.getExtendsBound();
				if (base == null) {
					base = wt.getSuperBound();
				}
				if (base != null) {
					addNeededTypes(imports, base);
				}
				break;
			default:
				break;
		}
	}
Recursively adds the type and it's generic parameters to the provided imports set.

@param imports the set of imported types
@param type the type to add to the imports
GhidraBuild/BuildFiles/Doclets/src/main/java/ghidra/doclets/typestubs/PythonTypeStubElement.java