private static Type createTypeNode(ITypeBinding binding, AST ast) { if (binding.isPrimitive()) return ast.newPrimitiveType(PrimitiveType.toCode(binding.getName())); ITypeBinding normalized= Bindings.normalizeTypeBinding(binding); if (normalized == null) return ast.newSimpleType(ast.newSimpleName("invalid")); else if (normalized.isTypeVariable()) return ast.newSimpleType(ast.newSimpleName(Bindings.getRawName(binding))); else if (normalized.isWildcardType()) { WildcardType type= ast.newWildcardType(); ITypeBinding bound= normalized.getBound(); if (bound != null) type.setBound(createTypeNode(bound, ast), normalized.isUpperbound()); return type; } else if (normalized.isArray()) return ast.newArrayType(createTypeNode(normalized.getElementType(), ast), normalized.getDimensions()); String qualified= Bindings.getRawQualifiedName(normalized); if (qualified.length() > 0) { ITypeBinding[] typeArguments= normalized.getTypeArguments(); if (typeArguments.length > 0) { ParameterizedType type= ast.newParameterizedType(ast.newSimpleType(ast.newSimpleName(qualified))); List arguments= type.typeArguments(); for (int index= 0; index < typeArguments.length; index++) arguments.add(createTypeNode(typeArguments[index], ast)); return type; } return ast.newSimpleType(ast.newSimpleName(qualified)); } return ast.newSimpleType(ast.newSimpleName(Bindings.getRawName(normalized)));
private static Type createTypeNode(ImportsStructure structure, ITypeBinding binding, AST ast) { if (structure != null) return structure.addImport(binding, ast); return createTypeNode(binding, ast);
	private static Type createTypeNode(ITypeBinding binding, AST ast) {		if (binding.isPrimitive())			return ast.newPrimitiveType(PrimitiveType.toCode(binding.getName()));		ITypeBinding normalized= Bindings.normalizeTypeBinding(binding);		if (normalized == null)			return ast.newSimpleType(ast.newSimpleName("invalid")); //$NON-NLS-1$		else if (normalized.isTypeVariable())			return ast.newSimpleType(ast.newSimpleName(Bindings.getRawName(binding)));		else if (normalized.isWildcardType()) {			WildcardType type= ast.newWildcardType();			ITypeBinding bound= normalized.getBound();			if (bound != null)				type.setBound(createTypeNode(bound, ast), normalized.isUpperbound());			return type;		} else if (normalized.isArray())			return ast.newArrayType(createTypeNode(normalized.getElementType(), ast), normalized.getDimensions());		String qualified= Bindings.getRawQualifiedName(normalized);		if (qualified.length() > 0) {			ITypeBinding[] typeArguments= normalized.getTypeArguments();			if (typeArguments.length > 0) {				ParameterizedType type= ast.newParameterizedType(ast.newSimpleType(ast.newSimpleName(qualified)));				List arguments= type.typeArguments();				for (int index= 0; index < typeArguments.length; index++)					arguments.add(createTypeNode(typeArguments[index], ast));				return type;			}			return ast.newSimpleType(ast.newSimpleName(qualified));		}		return ast.newSimpleType(ast.newSimpleName(Bindings.getRawName(normalized)));	}