@Override public Boolean doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, JvmTypeReference param) { if (!(param instanceof JvmGenericArrayTypeReference)) { return Boolean.FALSE; } JvmTypeReference myComponentType = reference.getComponentType(); JvmTypeReference otherComponentType = ((JvmGenericArrayTypeReference) param).getComponentType(); return visit(myComponentType, otherComponentType); }
@Override public JvmTypeReference doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, Boolean replaceWildcards) { JvmTypeReference copiedComponent = visit(reference.getComponentType(), replaceWildcards); JvmGenericArrayTypeReference result = typesFactory.createJvmGenericArrayTypeReference(); result.setComponentType(copiedComponent); return result; } @Override
protected JvmTypeReference createArrayTypeReference(Type componentType) { JvmTypeReference componentTypeReference = createTypeReference(componentType); JvmGenericArrayTypeReference result = TypesFactory.eINSTANCE.createJvmGenericArrayTypeReference(); result.setComponentType(componentTypeReference); return result; }
@Override public Boolean caseJvmGenericArrayTypeReference(JvmGenericArrayTypeReference object) { if (!object.eIsProxy()) { level++; final SuperTypeAcceptor original = acceptor; if (object.getComponentType() != null) { collecting = true; doSwitch(object.getComponentType()); JvmArrayType rawArrayType = object.getType(); if (rawArrayType != null) { JvmType rawType = rawArrayType.getComponentType();
throw new IllegalStateException("VarArg methods expect last paramter to be an array type"); JvmTypeReference varArgComponentType = ((JvmGenericArrayTypeReference) varArgParameterType).getComponentType(); if (lastArgumentType != null) { if (lastArgumentType instanceof JvmGenericArrayTypeReference) { if (((JvmGenericArrayTypeReference) lastArgumentType).getDimensions() == ((JvmGenericArrayTypeReference) varArgParameterType).getDimensions()) { resolveAgainstActualType(varArgParameterType, lastArgumentType, result, true, paramCount); Map<JvmTypeParameter, JvmTypeReference> normalized = normalizedCopy(result);
protected JvmTypeReference createLocalArrayTypeReference(Type componentType, JvmTypeParameterDeclarator container, GenericDeclaration member) { JvmTypeReference componentTypeReference = createLocalTypeReference(componentType, container, member); JvmGenericArrayTypeReference result = TypesFactory.eINSTANCE.createJvmGenericArrayTypeReference(); result.setComponentType(componentTypeReference); return result; }
protected void inplaceSortByDistanceAndName(List<Entry<JvmType>> candidates) { Collections.sort(candidates,new Comparator<Entry<JvmType>>() { public int compare(Entry<JvmType> o1, Entry<JvmType> o2) { if (o1.getCount() == o2.getCount()) { JvmType element1 = o1.getElement(); JvmType element2 = o2.getElement(); return compare(element1, element2); } if (o1.getCount() < o2.getCount()) return -1; return 1; } protected int compare(JvmType element1, JvmType element2) { if (element1 instanceof JvmArrayType && element2 instanceof JvmArrayType) { return compare(((JvmArrayType) element1).getComponentType(), ((JvmArrayType) element2).getComponentType()); } if (element1 instanceof JvmGenericType && element2 instanceof JvmGenericType) { int result = Booleans.compare(((JvmGenericType) element1).isInterface(), ((JvmGenericType) element2).isInterface()); if (result != 0) { return result; } } return element1.getIdentifier().compareTo(element2.getIdentifier()); } }); }
@Override public JvmTypeReference doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, Resource resource) { JvmTypeReference componentType = reference.getComponentType(); JvmTypeReference rawComponentType = visit(componentType, resource); if (componentType != rawComponentType) { JvmGenericArrayTypeReference result = factory.createJvmGenericArrayTypeReference(); result.setComponentType(rawComponentType); return result; } return reference; }
public JvmGenericArrayTypeReference createArrayType(JvmTypeReference componentType) { JvmGenericArrayTypeReference result = factory.createJvmGenericArrayTypeReference(); result.setComponentType(EcoreUtil2.cloneIfContained(componentType)); return result; }
@Override public Boolean doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, Boolean wildcardIsUnresolved) { return visit(reference.getComponentType(), wildcardIsUnresolved); } }
@Override public JvmTypeReference doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, Resource resource) { JvmTypeReference componentType = reference.getComponentType(); JvmTypeReference rawComponentType = visit(componentType, resource); if (componentType != rawComponentType) { JvmGenericArrayTypeReference result = factory.createJvmGenericArrayTypeReference(); result.setComponentType(rawComponentType); return result; } return reference; }
public JvmGenericArrayTypeReference createArrayType(JvmTypeReference componentType) { JvmGenericArrayTypeReference result = factory.createJvmGenericArrayTypeReference(); result.setComponentType(EcoreUtil2.cloneIfContained(componentType)); return result; }
@Override public StringBuilder doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, StringBuilder param) { param = visit(reference.getComponentType(), param); if (param != null) { param.append("[]"); } return param; }
@Override public JvmTypeReference doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, Pair<Resource, Set<JvmType>> context) { JvmTypeReference componentType = reference.getComponentType(); JvmTypeReference rawComponentType = visit(componentType, context); if (componentType != rawComponentType) { JvmGenericArrayTypeReference result = factory.createJvmGenericArrayTypeReference(); result.setComponentType(rawComponentType); return result; } return reference; }
protected JvmTypeReference createLocalArrayTypeReference(Type componentType, JvmTypeParameterDeclarator container, GenericDeclaration member) { JvmTypeReference componentTypeReference = createLocalTypeReference(componentType, container, member); JvmGenericArrayTypeReference result = TypesFactory.eINSTANCE.createJvmGenericArrayTypeReference(); result.setComponentType(componentTypeReference); return result; }
@Override public TypeConformanceResult doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference left, JvmGenericArrayTypeReference right, TypeConformanceComputationArgument.Internal<JvmGenericArrayTypeReference> param) { JvmTypeReference leftComponent = left.getComponentType(); JvmTypeReference rightComponent = right.getComponentType(); return conformanceComputer.isConformant(leftComponent, rightComponent, new TypeConformanceComputationArgument(param.rawType, param.asTypeArgument, false)); }
public JvmTypeReference apply(JvmTypeReference from) { if (from instanceof JvmGenericArrayTypeReference) return ((JvmGenericArrayTypeReference) from).getComponentType(); return from; result.setComponentType(componentTypeReference); return result;
protected JvmTypeReference createArrayTypeReference(Type componentType) { JvmTypeReference componentTypeReference = createTypeReference(componentType); JvmGenericArrayTypeReference result = TypesFactory.eINSTANCE.createJvmGenericArrayTypeReference(); result.setComponentType(componentTypeReference); return result; }
@Override public List<JvmType> doVisitGenericArrayTypeReference(JvmGenericArrayTypeReference reference, Resource resource) { JvmTypeReference componentType = reference.getComponentType(); List<JvmType> rawComponentTypes = visit(componentType, resource); List<JvmType> result = Lists.newArrayListWithCapacity(rawComponentTypes.size()); for(JvmType rawComponentType: rawComponentTypes) { if (!rawComponentType.eIsProxy() && rawComponentType instanceof JvmComponentType) { JvmArrayType arrayType = ((JvmComponentType) rawComponentType).getArrayType(); result.add(arrayType); } } return result; }
@Override public JvmTypeReference toTypeReference() { JvmGenericArrayTypeReference result = getTypesFactory().createJvmGenericArrayTypeReference(); result.setComponentType(component.toTypeReference()); return result; }