private <T> void insertGenericTypesInNoClasspathFromJDTInSpoon(TypeReference original, CtTypeReference<T> type) { if (original.resolvedType instanceof ProblemReferenceBinding && original.getTypeArguments() != null) { for (TypeReference[] typeReferences : original.getTypeArguments()) { if (typeReferences != null) { for (TypeReference typeReference : typeReferences) { type.addActualTypeArgument(this.getTypeReference(typeReference.resolvedType)); } } } } }
if (type.getTypeArguments() != null && type.getTypeArguments().length - 1 <= position && type.getTypeArguments()[position] != null && type.getTypeArguments()[position].length > 0) { CtTypeReference<?> componentReference = getTypeReferenceOfArrayComponent(currentReference); componentReference.getActualTypeArguments().clear(); for (TypeReference typeArgument : type.getTypeArguments()[position]) { if (typeArgument instanceof Wildcard || typeArgument.resolvedType instanceof WildcardBinding || typeArgument.resolvedType instanceof TypeVariableBinding) { componentReference.addActualTypeArgument(buildTypeParameterReference(typeArgument, scope)); && !isTypeArgumentExplicit(type.getTypeArguments())) { for (CtTypeReference<?> actualTypeArgument : currentReference.getActualTypeArguments()) { actualTypeArgument.setImplicit(true);
private int getSourceEndOfTypeReference(char[] contents, TypeReference node, int sourceEnd) { TypeReference[][] typeArgs = node.getTypeArguments(); if (typeArgs != null && typeArgs.length > 0) { TypeReference[] trs = typeArgs[typeArgs.length - 1];
@NonNull @Override public PsiType[] getTypeParameters() { if (!(mNativeNode instanceof TypeReference)) { // No type parameters for import statements return PsiType.EMPTY_ARRAY; } TypeReference typeReference = (TypeReference)mNativeNode; TypeReference[][] typeArguments = typeReference.getTypeArguments(); if (typeArguments == null || typeArguments.length == 0) { return PsiType.EMPTY_ARRAY; } for (int i = typeArguments.length - 1; i >= 0; i--) { TypeReference[] refs = typeArguments[i]; if (refs != null && refs.length > 0) { List<PsiType> types = Lists.newArrayListWithCapacity(refs.length); for (TypeReference ref : refs) { PsiType type = mManager.findType(ref); if (type != null) { types.add(type); } } return types.toArray(PsiType.EMPTY_ARRAY); } } return PsiType.EMPTY_ARRAY; }
private <T extends CtConstructorCall<Object>> T buildCommonPartForCtNewClassAndCtConstructorCall(AllocationExpression allocationExpression, BlockScope scope, T constructorCall) { if (allocationExpression.type != null) { final TypeReference[][] typeArguments = allocationExpression.type.getTypeArguments();