protected String checkJvmOperation( JvmOperation input, XAbstractFeatureCall context, boolean isExplicitOperationCall, JvmFeatureDescription jvmFeatureDescription, EList<XExpression> arguments) { List<XExpression> actualArguments = featureCall2JavaMapping.getActualArguments( context, input, jvmFeatureDescription.getImplicitReceiver()); if (!isValidNumberOfArguments(input, actualArguments)) return INVALID_NUMBER_OF_ARGUMENTS; if (!isExplicitOperationCall && !isSugaredMethodInvocationWithoutParanthesis(jvmFeatureDescription)) return METHOD_ACCESS_WITHOUT_PARENTHESES; if (!context.getTypeArguments().isEmpty() // raw type or type inference && input.getTypeParameters().size() != context.getTypeArguments().size()) return INVALID_NUMBER_OF_TYPE_ARGUMENTS; // TODO check type parameter bounds against type arguments if (!areArgumentTypesValid(input, actualArguments)) return INVALID_ARGUMENT_TYPES; return null; }
protected IScope createTypeScope( JvmIdentifiableElement context, EReference reference, IScope parentScope) { if (context == null) return parentScope; if (context.eContainer() instanceof JvmIdentifiableElement) { parentScope = createTypeScope((JvmIdentifiableElement) context.eContainer(), reference, parentScope); } if (context instanceof JvmGenericType) { JvmGenericType genericType = (JvmGenericType) context; List<IEObjectDescription> descriptions = Lists.newArrayList(); if (genericType.getSimpleName() != null) { QualifiedName inferredDeclaringTypeName = QualifiedName.create(genericType.getSimpleName()); descriptions.add(EObjectDescription.create(inferredDeclaringTypeName, genericType)); } for (JvmTypeParameter param : genericType.getTypeParameters()) { if (param.getSimpleName() != null) { QualifiedName paramName = QualifiedName.create(param.getSimpleName()); descriptions.add(EObjectDescription.create(paramName, param)); } } if (!descriptions.isEmpty()) return MapBasedScope.createScope(parentScope, descriptions); } else if (context instanceof JvmOperation) { JvmOperation operation = (JvmOperation) context; List<IEObjectDescription> descriptions = null; for (JvmTypeParameter param : operation.getTypeParameters()) { if (param.getSimpleName() != null) { if (descriptions == null) descriptions = Lists.newArrayList(); QualifiedName paramName = QualifiedName.create(param.getSimpleName()); descriptions.add(EObjectDescription.create(paramName, param)); } } if (descriptions != null && !descriptions.isEmpty()) return MapBasedScope.createScope(parentScope, descriptions); } return parentScope; }