@Override public MutableDeclaredType cloneTypeVariables(MutableDeclaredType declaredType) { // dirty(); this.typeVariables = new LinkedList<MutableTypeVariable>(); for (MutableTypeVariable typeVariable: declaredType.getTypeVariables()) { this.typeVariables.add(typeVariable.clone()); } return this; }
@Override public MutableTypeVariable clone() { return ensureDelegateType().clone(); } }
result.typeVariables = new LinkedList<MutableTypeVariable>(); for (MutableTypeVariable typeVariable: typeVariables) { result.typeVariables.add(typeVariable.clone());
@Override protected MutableTypeVariable getTypeVariable(MutableTypeVariable variable) { if (variable.getVariable() != null && variable.getVariable().length() > 0) { return variable.clone().setVariable(ConverterTypeElement.DOMAIN_TYPE_ARGUMENT_PREFIX + "_" + variable.getVariable()); } return variable; } }
public static MutableTypeMirror stripTypeParametersVariables(MutableTypeMirror parameterType) { switch (parameterType.getKind()) { case CLASS: case INTERFACE: return ((MutableDeclaredType)parameterType).clone().stripTypeParametersVariables(); case TYPEVAR: if (((MutableTypeVariable)parameterType).getVariable() != null && ((MutableTypeVariable)parameterType).getVariable() != MutableWildcardType.WILDCARD_NAME) { return ((MutableTypeVariable)parameterType).clone().setVariable(null); } default: return parameterType; } }
public static MutableTypeMirror stripTypeParametersTypes(MutableTypeMirror parameterType) { switch (parameterType.getKind()) { case CLASS: case INTERFACE: return ((MutableDeclaredType)parameterType).clone().stripTypeParametersTypes(); case TYPEVAR: if (((MutableTypeVariable)parameterType).getVariable() != null && ((MutableTypeVariable)parameterType).getVariable() != MutableWildcardType.WILDCARD_NAME) { return ((MutableTypeVariable)parameterType).clone().setLowerBounds(null).setUpperBounds(null); } default: return parameterType; } }
mutableTypeVariable = mutableTypeVariable.clone();
private MutableTypeMirror findSubtypesForWildcards(MutableTypeMirror type, ExecutableElement ownerMethod) { if (type == null) { return null; } switch (type.getKind()) { case CLASS: case INTERFACE: MutableDeclaredType clone = ((MutableDeclaredType)type).clone(); List<? extends MutableTypeVariable> typeVariables = clone.getTypeVariables(); clone.setTypeVariables(getSubtypesForWildcards((MutableDeclaredType)processingEnv.getTypeUtils().toMutableType(processingEnv.getElementUtils().getTypeElement(((MutableDeclaredType)type).getCanonicalName())), typeVariables, ownerMethod).toArray(new MutableTypeVariable[] {})); return clone; case TYPEVAR: if (((MutableTypeVariable)type).getVariable() != null && ((MutableTypeVariable)type).getVariable() == MutableWildcardType.WILDCARD_NAME) { return getBoundType(((MutableTypeVariable)type).clone(), ownerMethod); } default: return type; } }