@Override public ArrayTypeReference newArrayTypeReference(LightweightTypeReference componentTypeReference) { return new ArrayTypeReference(this, componentTypeReference); }
@Override protected List<LightweightTypeReference> getSuperTypes(TypeParameterSubstitutor<?> substitutor) { List<LightweightTypeReference> componentSuperTypes = component.getSuperTypes(substitutor); ITypeReferenceOwner owner = getOwner(); if (!componentSuperTypes.isEmpty()) { List<LightweightTypeReference> result = Lists.newArrayListWithCapacity(componentSuperTypes.size()); for(LightweightTypeReference componentSuperType: componentSuperTypes) { result.add(owner.newArrayTypeReference(componentSuperType)); } return result; } List<LightweightTypeReference> result = Lists.newArrayListWithCapacity(2); result.add(owner.newParameterizedTypeReference(findNonNullType(Cloneable.class))); result.add(owner.newParameterizedTypeReference(findNonNullType(Serializable.class))); return result; }
@Override public LightweightTypeReference doVisitArrayTypeReference(ArrayTypeReference reference) { return reference.getComponentType(); }
@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 /* @Nullable */ public LightweightTypeReference getSuperType(Class<?> rawType) { if (isType(rawType)) { return this; } Class<?> rawComponentType = rawType.getComponentType(); if (rawComponentType == null) { if (Object.class.equals(rawType) || Cloneable.class.equals(rawType) || Serializable.class.equals(rawType)) { return internalFindTopLevelType(rawType); } return null; } LightweightTypeReference resultComponent = component.getSuperType(rawComponentType); if (resultComponent == null) { return null; } return getOwner().newArrayTypeReference(resultComponent); }
@Override public LightweightTypeReference getNamedType() { if (isAnonymous()) { return getOwner().newArrayTypeReference(component.getNamedType()); } return super.getNamedType(); }
@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); }
if (hint.getActualVariance() == VarianceInfo.OUT && hint.getDeclaredVariance() == VarianceInfo.OUT && (hint.getSource() == BoundTypeArgumentSource.INFERRED || hint.getSource() == BoundTypeArgumentSource.INFERRED_LATER || hint.getSource() == BoundTypeArgumentSource.INFERRED_EXPECTATION)) { if (!declaration.isAssignableFrom(hint.getTypeReference())) { declarationMatches = false; } else if (!constraintSeen && !reference.internalIsResolved() && declaration.isResolved() && !getOwner().isResolved(reference.getHandle()) && reference.canResolveTo(declaration)) { reference.acceptHint(declaration, BoundTypeArgumentSource.RESOLVED, this, VarianceInfo.INVARIANT, VarianceInfo.INVARIANT); } else if (othersSeen && declarationMatches) {
ArrayTypeReference array = valueResultType.tryConvertToArray(); if (array != null) { LightweightTypeReference primitiveComponentType = array.getComponentType().getPrimitiveIfWrapperType(); state.addDiagnostic(new EObjectDiagnosticImpl( Severity.ERROR, null, -1, null)); state.refineExpectedType(value, array.getOwner().newArrayTypeReference(primitiveComponentType));
public LightweightTypeReference convertToList(final ArrayTypeReference type) { ITypeReferenceOwner owner = type.getOwner(); return owner.newReferenceTo(List.class, new TypeReferenceInitializer<ParameterizedTypeReference>() { @Override public LightweightTypeReference enhance(ParameterizedTypeReference reference) { LightweightTypeReference componentType = type.getComponentType(); LightweightTypeReference wrapper = componentType.getWrapperTypeIfPrimitive(); reference.addTypeArgument(wrapper); return reference; } }); }
@Override public JvmTypeReference toTypeReference() { JvmGenericArrayTypeReference result = getTypesFactory().createJvmGenericArrayTypeReference(); result.setComponentType(component.toTypeReference()); return result; }
@Override public LightweightTypeReference tryConvertToListType() { ArrayTypes arrayTypes = getServices().getArrayTypes(); return arrayTypes.convertToList(this); }
@Override public LightweightTypeReference getRawTypeReference() { LightweightTypeReference rawComponent = component.getRawTypeReference(); if (rawComponent == component) { return this; } return getOwner().newArrayTypeReference(rawComponent); }
@Override public JvmTypeReference toJavaCompliantTypeReference(IVisibilityHelper visibilityHelper) { JvmGenericArrayTypeReference result = getTypesFactory().createJvmGenericArrayTypeReference(); result.setComponentType(component.toJavaCompliantTypeReference(visibilityHelper)); return result; }
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 /* @Nullable */ public LightweightTypeReference getSuperType(JvmType rawType) { if (rawType.eClass() == TypesPackage.Literals.JVM_ARRAY_TYPE) { JvmComponentType rawComponentType = ((JvmArrayType) rawType).getComponentType(); LightweightTypeReference result = component.getSuperType(rawComponentType); if (result == null) { return null; } if (result == component) return this; return getOwner().newArrayTypeReference(result); } else if (rawType.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE) { String identifier = rawType.getIdentifier(); if (Object.class.getName().equals(identifier) || Cloneable.class.getName().equals(identifier) || Serializable.class.getName().equals(identifier)) { return getOwner().newParameterizedTypeReference(rawType); } } return null; }
@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 public Boolean doVisitArrayTypeReference(ArrayTypeReference reference, LightweightTraversalData data) { return reference.getComponentType().accept(this, data); } };
@Override protected Boolean doVisitArrayTypeReference(ArrayTypeReference reference) { return reference.getComponentType().accept(this); } });