@Override public LightweightTypeReference doVisitArrayTypeReference(ArrayTypeReference reference) { return reference.getComponentType(); }
protected int doIsConformant(ArrayTypeReference left, ArrayTypeReference right, int flags) { LightweightTypeReference leftComponent = left.getComponentType(); LightweightTypeReference rightComponent = right.getComponentType(); return doIsConformant(leftComponent, rightComponent, flags & ~(ALLOW_BOXING_UNBOXING | ALLOW_PRIMITIVE_WIDENING | ALLOW_SYNONYMS | ALLOW_FUNCTION_CONVERSION)); }
@Override protected void doVisitArrayTypeReference(ArrayTypeReference reference, ArrayTypeReference declaration) { outerVisit(declaration.getComponentType(), reference.getComponentType()); }
protected void addComponentType(LightweightTypeReference reference, List<LightweightTypeReference> result) { if (reference.isArray()) { result.add(((ArrayTypeReference) reference).getComponentType()); } else { result.add(reference); } }
@Override protected Boolean doVisitArrayTypeReference(ArrayTypeReference reference) { return reference.getComponentType().accept(this); } });
@Override protected void doVisitArrayTypeReference(ArrayTypeReference reference, StringBuilder param) { reference.getComponentType().accept(this, param); param.append("[]"); }
@Override protected Boolean doVisitArrayTypeReference(ArrayTypeReference reference) { return reference.getComponentType().accept(this); }
@Override public Boolean doVisitArrayTypeReference(ArrayTypeReference reference, LightweightTraversalData data) { return reference.getComponentType().accept(this, data); } };
@Override protected LightweightTypeReference doVisitArrayTypeReference(final ArrayTypeReference reference) { return reference.getComponentType().<LightweightTypeReference>accept(this); }
protected int doIsConformant(ArrayTypeReference left, ParameterizedTypeReference right, int flags) { if ((flags & AS_TYPE_ARGUMENT) == 0 && (flags & ALLOW_SYNONYMS) != 0) { ArrayTypeReference rightAsArray = right.tryConvertToArray(); if (rightAsArray != null) { LightweightTypeReference leftComponent = left.getComponentType().getWrapperTypeIfPrimitive(); LightweightTypeReference rightComponent = rightAsArray.getComponentType(); int result = doIsConformant(leftComponent, rightComponent, flags & ~(ALLOW_BOXING_UNBOXING | ALLOW_PRIMITIVE_WIDENING | ALLOW_SYNONYMS | ALLOW_FUNCTION_CONVERSION)); if ((result & SUCCESS) != 0) { return result | DEMAND_CONVERSION | SYNONYM; } } } return flags; }
@Override protected void doVisitArrayTypeReference(final ArrayTypeReference reference) { reference.getComponentType().accept(this); this.appender.append("[]"); }
@Override public LightweightTypeReference enhance(ParameterizedTypeReference reference) { LightweightTypeReference componentType = type.getComponentType(); LightweightTypeReference wrapper = componentType.getWrapperTypeIfPrimitive(); reference.addTypeArgument(wrapper); return reference; } });
@Override protected ArrayTypeReference doVisitArrayTypeReference(ArrayTypeReference reference, ResourceSet resourceSet) { if (reference.isRawType()) return reference; LightweightTypeReference componentType = reference.getComponentType(); LightweightTypeReference rawComponentType = componentType.accept(this, resourceSet); return reference.getOwner().newArrayTypeReference(rawComponentType); }
@Override protected LocalTypeSubstitutor.SubstitutionResult doVisitArrayTypeReference(ArrayTypeReference reference, VarianceInfo varianceInfo) { SubstitutionResult visited = reference.getComponentType().accept(this, varianceInfo); if (visited.didSubstitute) { return new SubstitutionResult(owner.newArrayTypeReference(visited.typeReference), true); } return new SubstitutionResult(reference, false); }
@Override protected List<JvmType> doVisitArrayTypeReference(ArrayTypeReference reference, ResourceSet resourceSet) { LightweightTypeReference componentType = reference.getComponentType(); List<JvmType> result; if (!componentType.isResolved()) { result = createObjectReference(resourceSet); } else { List<JvmType> rawComponentTypes = componentType.accept(this, resourceSet); result = Lists.newArrayListWithCapacity(rawComponentTypes.size()); for(JvmType rawComponentType: rawComponentTypes) { if (!rawComponentType.eIsProxy() && rawComponentType instanceof JvmComponentType) { JvmArrayType arrayType = ((JvmComponentType) rawComponentType).getArrayType(); if (arrayType == null) { arrayType = factory.createJvmArrayType(); arrayType.setComponentType((JvmComponentType) rawComponentType); } result.add(arrayType); } } } return result; }
protected int doIsConformant(ParameterizedTypeReference left, ArrayTypeReference right, int flags) { if (left.isType(Object.class) || left.isType(Serializable.class) || left.isType(Cloneable.class)) { return flags | SUCCESS | SUBTYPE; } if ((flags & ALLOW_SYNONYMS) != 0) { // Arrays are generally assignable to List and its supertypes if (left.isType(List.class) || left.isType(Collection.class) || left.isType(Iterable.class)) { List<LightweightTypeReference> arguments = left.getTypeArguments(); if (arguments.isEmpty()) { // type argument is bound to Object return flags | SUCCESS | DEMAND_CONVERSION; } LightweightTypeReference componentType = right.getComponentType().getWrapperTypeIfPrimitive(); int result = doIsConformant(arguments.get(0).getInvariantBoundSubstitute(), componentType, flags); if ((result & SUCCESS) != 0) { return result | DEMAND_CONVERSION; } } } return flags; }
@Override protected LightweightTypeReference doVisitArrayTypeReference(ArrayTypeReference reference, Visiting visiting) { if (reference.isResolved() && reference.isOwnedBy(getOwner())) return reference; LightweightTypeReference component = visitTypeArgument(reference.getComponentType(), visiting); component = component.getUpperBoundSubstitute(); return getOwner().newArrayTypeReference(component); }
@Override protected void doVisitArrayTypeReference(ArrayTypeReference reference, ParameterizedTypeReference declaration) { JvmType type = declaration.getType(); if (type instanceof JvmTypeParameter) { if (shouldProcess((JvmTypeParameter) type)) { JvmTypeParameter typeParameter = (JvmTypeParameter) type; processTypeParameter(typeParameter, reference); } } else { if (!declaration.isRawType() && (declaration.isType(List.class) || declaration.isType(Collection.class) || declaration.isType(Iterable.class))) { LightweightTypeReference elementType = declaration.getTypeArguments().get(0); LightweightTypeReference componentType = reference.getComponentType(); outerVisit(componentType.getInvariantBoundSubstitute(), elementType); } } } }
ArrayTypeReference arrayType = type.tryConvertToArray(); if (arrayType != null) { LightweightTypeReference componentType = arrayType.getComponentType(); LightweightTypeReference primitiveComponentType = componentType.getPrimitiveIfWrapperType(); if (primitiveComponentType != componentType) {
ArrayTypeReference array = forExpressionType.tryConvertToArray(); if (array != null) { LightweightTypeReference arrayComponentType = array.getComponentType(); if (parameterType.isAssignableFrom(arrayComponentType)) { iterableState.refineExpectedType(object.getForExpression(), forExpressionType);