Java Code Examples for org.eclipse.xtext.common.types.JvmOperation#getReturnType()

The following examples show how to use org.eclipse.xtext.common.types.JvmOperation#getReturnType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractTypeProviderTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_ParameterizedTypes_05() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodZ = getMethodFromType(type, ParameterizedTypes.class, "methodZ(java.util.List)");
	assertEquals(1, methodZ.getParameters().size());
	assertEquals(1, methodZ.getTypeParameters().size());
	assertEquals("Z", methodZ.getTypeParameters().get(0).getIdentifier());
	JvmTypeReference listZ = methodZ.getReturnType();
	assertFalse(listZ.toString(), listZ.getType().eIsProxy());
	assertEquals("java.util.List<? extends java.lang.Object & super Z>", listZ.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) listZ;
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertTrue(typeArgument instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcardTypeArgument = (JvmWildcardTypeReference) typeArgument;
	assertEquals("? extends java.lang.Object & super Z", wildcardTypeArgument.getIdentifier());
	assertEquals(2, wildcardTypeArgument.getConstraints().size());
	JvmUpperBound upperBound = (JvmUpperBound) wildcardTypeArgument.getConstraints().get(0);
	assertEquals("java.lang.Object", upperBound.getTypeReference().getIdentifier());
	JvmLowerBound lowerBound = (JvmLowerBound) wildcardTypeArgument.getConstraints().get(1);
	assertEquals("Z", lowerBound.getTypeReference().getIdentifier());
	JvmTypeParameter z = methodZ.getTypeParameters().get(0);
	assertSame(z, lowerBound.getTypeReference().getType());
}
 
Example 2
Source File: AbstractTypeProviderTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_twoListWildcardsListResult_03() {
	JvmOperation twoListWildcardsListResult = getMethodFromParameterizedMethods(
			"twoListWildcardsListResult(java.util.List,java.util.List)");
	JvmTypeReference returnType = twoListWildcardsListResult.getReturnType();
	JvmParameterizedTypeReference parameterized = (JvmParameterizedTypeReference) returnType;
	assertEquals(1, parameterized.getArguments().size());
	JvmTypeReference typeParameter = parameterized.getArguments().get(0);
	assertTrue(typeParameter instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcard = (JvmWildcardTypeReference) typeParameter;
	assertEquals(1, wildcard.getConstraints().size());
	assertTrue(wildcard.getConstraints().get(0) instanceof JvmUpperBound);
	JvmUpperBound upperBound = (JvmUpperBound) wildcard.getConstraints().get(0);
	assertNotNull(upperBound.getTypeReference());
	JvmType upperBoundType = upperBound.getTypeReference().getType();
	assertFalse(upperBoundType.eIsProxy());
	assertEquals("java.lang.Object", upperBoundType.getIdentifier());
}
 
Example 3
Source File: AbstractTypeProviderTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_ParameterizedTypes_Inner_05() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodV = getMethodFromType(type, ParameterizedTypes.Inner.class, "methodVArray_01()");
	JvmTypeReference listT = methodV.getReturnType();
	assertEquals("java.util.List<? extends V>[]", listT.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) ((JvmGenericArrayTypeReference) listT)
			.getComponentType();
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertTrue(typeArgument instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcardTypeArgument = (JvmWildcardTypeReference) typeArgument;
	assertEquals("? extends V", wildcardTypeArgument.getIdentifier());
	assertEquals(1, wildcardTypeArgument.getConstraints().size());
	JvmUpperBound upperBound = (JvmUpperBound) wildcardTypeArgument.getConstraints().get(0);
	JvmTypeParameter v = type.getTypeParameters().get(3);
	assertSame(v, upperBound.getTypeReference().getType());
}
 
Example 4
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
protected JvmOperation findOperation(final String name, final boolean mustBeArray) {
  final JvmOperation result = this.findOperation(name);
  JvmTypeReference _returnType = result.getReturnType();
  JvmType _type = null;
  if (_returnType!=null) {
    _type=_returnType.getType();
  }
  final JvmType returnType = _type;
  boolean _and = false;
  if (!mustBeArray) {
    _and = false;
  } else {
    EClass _eClass = null;
    if (returnType!=null) {
      _eClass=returnType.eClass();
    }
    boolean _notEquals = (!Objects.equal(_eClass, TypesPackage.Literals.JVM_ARRAY_TYPE));
    _and = _notEquals;
  }
  if (_and) {
    throw new IllegalArgumentException("Cannot assign array value to simple annotation property");
  }
  return result;
}
 
Example 5
Source File: AbstractTypeProviderTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_ParameterizedTypes_Inner_05() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodV = getMethodFromType(type, ParameterizedTypes.Inner.class, "methodVArray_01()");
	JvmTypeReference listT = methodV.getReturnType();
	assertEquals("java.util.List<? extends V>[]", listT.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) ((JvmGenericArrayTypeReference) listT)
			.getComponentType();
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertTrue(typeArgument instanceof JvmWildcardTypeReference);
	JvmWildcardTypeReference wildcardTypeArgument = (JvmWildcardTypeReference) typeArgument;
	assertEquals("? extends V", wildcardTypeArgument.getIdentifier());
	assertEquals(1, wildcardTypeArgument.getConstraints().size());
	JvmUpperBound upperBound = (JvmUpperBound) wildcardTypeArgument.getConstraints().get(0);
	JvmTypeParameter v = type.getTypeParameters().get(3);
	assertSame(v, upperBound.getTypeReference().getType());
}
 
Example 6
Source File: AbstractTypeProviderTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_ParameterizedTypes_Inner_08() {
	String typeName = ParameterizedTypes.Inner.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodV = getMethodFromType(type, ParameterizedTypes.Inner.class, "methodZArray_02()");
	JvmTypeReference listZ = methodV.getReturnType();
	assertEquals("java.util.List<Z[]>[]", listZ.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) ((JvmGenericArrayTypeReference) listZ)
			.getComponentType();
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	JvmType argumentType = typeArgument.getType();
	assertTrue(argumentType instanceof JvmArrayType);
	JvmComponentType componentType = ((JvmArrayType) argumentType).getComponentType();
	JvmTypeParameter z = type.getTypeParameters().get(2);
	assertSame(z, componentType);
}
 
Example 7
Source File: AbstractTypeProviderTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_ParameterizedTypes_Inner_08() {
	String typeName = ParameterizedTypes.Inner.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodV = getMethodFromType(type, ParameterizedTypes.Inner.class, "methodZArray_02()");
	JvmTypeReference listZ = methodV.getReturnType();
	assertEquals("java.util.List<Z[]>[]", listZ.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) ((JvmGenericArrayTypeReference) listZ)
			.getComponentType();
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	JvmType argumentType = typeArgument.getType();
	assertTrue(argumentType instanceof JvmArrayType);
	JvmComponentType componentType = ((JvmArrayType) argumentType).getComponentType();
	JvmTypeParameter z = type.getTypeParameters().get(2);
	assertSame(z, componentType);
}
 
Example 8
Source File: XbaseDeclarativeHoverSignatureProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected String _signature(JvmOperation jvmOperation, boolean typeAtEnd) {
		String returnTypeString = "void";
		// TODO resolved operations?
		JvmTypeReference returnType = jvmOperation.getReturnType();
		if (returnType != null) {
			if (returnType instanceof JvmAnyTypeReference) {
				throw new IllegalStateException();
//				returnTypeString = "Object";
			} else {
				returnTypeString = returnType.getSimpleName();
			}
		}

		String signature = jvmOperation.getSimpleName() + hoverUiStrings.parameters(jvmOperation)
				+ getThrowsDeclaration(jvmOperation);
		String typeParameter = uiStrings.typeParameters(jvmOperation.getTypeParameters());
		if(typeParameter != null && typeParameter.length() > 0){
			if (typeAtEnd)
				return signature + " " + typeParameter + " : " + returnTypeString;
			return typeParameter + " " + returnTypeString + " " + signature;
		}
		if (typeAtEnd)
			return signature + " : " + returnTypeString;
		return returnTypeString + " " + enrichWithDeclarator(signature, jvmOperation);
	}
 
Example 9
Source File: AbstractTypeProviderTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void test_ParameterizedTypes2_inner_return_02() {
	String typeName = ParameterizedTypes2.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation operation = getMethodFromType(type, ParameterizedTypes2.class, "concreteInner()");
	JvmTypeReference returnType = operation.getReturnType();
	assertTrue(returnType.getIdentifier(), returnType instanceof JvmInnerTypeReference);
	assertEquals("ParameterizedTypes2<Number>$Inner<String>", returnType.getSimpleName());
}
 
Example 10
Source File: AbstractTypeProviderTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void test_twoListParamsListResult_03() {
	JvmOperation twoListParamsListResult = getMethodFromParameterizedMethods(
			"twoListParamsListResult(java.util.List,java.util.List)");
	JvmTypeReference returnType = twoListParamsListResult.getReturnType();
	JvmParameterizedTypeReference parameterized = (JvmParameterizedTypeReference) returnType;
	assertEquals(1, parameterized.getArguments().size());
	JvmTypeReference typeParameter = parameterized.getArguments().get(0);
	JvmType referencedType = typeParameter.getType();
	assertFalse(referencedType.eIsProxy());
	assertTrue(referencedType instanceof JvmTypeParameter);
	JvmTypeParameter typeVar = (JvmTypeParameter) referencedType;
	assertEquals("T", typeVar.getName());
	assertSame(twoListParamsListResult, typeVar.getDeclarator());
}
 
Example 11
Source File: AbstractTypeProviderTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void test_ParameterizedTypes_inner_return_01() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation operation = getMethodFromType(type, ParameterizedTypes.class,
			"plainInner(org.eclipse.xtext.common.types.testSetups.ParameterizedTypes$Inner)");
	JvmTypeReference returnType = operation.getReturnType();
	assertTrue(returnType.getIdentifier(), returnType instanceof JvmInnerTypeReference);
	assertEquals("ParameterizedTypes<S, T, U, V, W>$Inner<W, List<W>, List<W>>", returnType.getSimpleName());
}
 
Example 12
Source File: AbstractTypeProviderTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void test_ParameterizedTypes2_inner_return_02() {
	String typeName = ParameterizedTypes2.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation operation = getMethodFromType(type, ParameterizedTypes2.class, "concreteInner()");
	JvmTypeReference returnType = operation.getReturnType();
	assertTrue(returnType.getIdentifier(), returnType instanceof JvmInnerTypeReference);
	assertEquals("ParameterizedTypes2<Number>$Inner<String>", returnType.getSimpleName());
}
 
Example 13
Source File: AbstractTypeProviderTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void test_twoListParamsListResult_03() {
	JvmOperation twoListParamsListResult = getMethodFromParameterizedMethods(
			"twoListParamsListResult(java.util.List,java.util.List)");
	JvmTypeReference returnType = twoListParamsListResult.getReturnType();
	JvmParameterizedTypeReference parameterized = (JvmParameterizedTypeReference) returnType;
	assertEquals(1, parameterized.getArguments().size());
	JvmTypeReference typeParameter = parameterized.getArguments().get(0);
	JvmType referencedType = typeParameter.getType();
	assertFalse(referencedType.eIsProxy());
	assertTrue(referencedType instanceof JvmTypeParameter);
	JvmTypeParameter typeVar = (JvmTypeParameter) referencedType;
	assertEquals("T", typeVar.getName());
	assertSame(twoListParamsListResult, typeVar.getDeclarator());
}
 
Example 14
Source File: LinkingTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testTypeParameterReference_11() throws Exception {
	XtendFunction func = (XtendFunction) ((XtendClass)file("class X<Z> implements Iterable<Z> { def Iterable<Z> foo() { val result = new X result }}")
			.getXtendTypes().get(0)).getMembers().get(0);
	JvmOperation operation = associator.getDirectlyInferredOperation(func);
	JvmTypeReference returnType = operation.getReturnType();
	assertEquals("java.lang.Iterable<Z>", returnType.getIdentifier());
	LightweightTypeReference bodyType = getType(func.getExpression());
	assertEquals("X<Z>", bodyType.getIdentifier());
	LightweightTypeReference bodyReturnType = getReturnType(func.getExpression());
	assertEquals("X<Z>", bodyReturnType.getIdentifier());
}
 
Example 15
Source File: CompilationUnitImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected JvmTypeReference findExpectedType(final JvmAnnotationValue value) {
  JvmOperation _operation = value.getOperation();
  boolean _tripleNotEquals = (_operation != null);
  if (_tripleNotEquals) {
    return value.getOperation().getReturnType();
  }
  JvmTypeReference _switchResult = null;
  EObject _eContainer = value.eContainer();
  final EObject container = _eContainer;
  boolean _matched = false;
  if (container instanceof JvmOperation) {
    _matched=true;
    _switchResult = ((JvmOperation)container).getReturnType();
  }
  if (!_matched) {
    if (container instanceof JvmAnnotationReference) {
      _matched=true;
      JvmTypeReference _xblockexpression = null;
      {
        final JvmOperation defaultOp = IterableExtensions.<JvmOperation>head(Iterables.<JvmOperation>filter(((JvmAnnotationReference)container).getAnnotation().findAllFeaturesByName("value"), JvmOperation.class));
        JvmTypeReference _xifexpression = null;
        if ((defaultOp != null)) {
          _xifexpression = defaultOp.getReturnType();
        }
        _xblockexpression = _xifexpression;
      }
      _switchResult = _xblockexpression;
    }
  }
  return _switchResult;
}
 
Example 16
Source File: AbstractTypeProviderTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void test_ParameterizedTypes_inner_return_01() {
	String typeName = ParameterizedTypes.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation operation = getMethodFromType(type, ParameterizedTypes.class,
			"plainInner(org.eclipse.xtext.common.types.testSetups.ParameterizedTypes$Inner)");
	JvmTypeReference returnType = operation.getReturnType();
	assertTrue(returnType.getIdentifier(), returnType instanceof JvmInnerTypeReference);
	assertEquals("ParameterizedTypes<S, T, U, V, W>$Inner<W, List<W>, List<W>>", returnType.getSimpleName());
}
 
Example 17
Source File: SARLJvmGenerator.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
protected ITreeAppendable _generateMember(JvmOperation it, ITreeAppendable appendable, GeneratorConfig config) {
	if (Utils.STATIC_CONSTRUCTOR_NAME.equals(it.getSimpleName())) {
		// The constructor name is not the same as the declaring type.
		// We assume that the constructor is a static constructor.
		return generateStaticConstructor(it, appendable, config);
	}
	// The code below is adapted from the code of the Xtend super type.
	appendable.newLine();
	appendable.openScope();
	generateJavaDoc(it, appendable, config);
	final ITreeAppendable tracedAppendable = appendable.trace(it);
	generateAnnotations(it.getAnnotations(), tracedAppendable, true, config);
	// Specific case: automatic generation
	if (this.operationHelper.isPureOperation(it)
			&& this.annotations.findAnnotation(it, Pure.class) == null) {
		tracedAppendable.append("@").append(Pure.class).newLine(); //$NON-NLS-1$
	}
	generateModifier(it, tracedAppendable, config);
	generateTypeParameterDeclaration(it, tracedAppendable, config);
	if (it.getReturnType() == null) {
		tracedAppendable.append("void"); //$NON-NLS-1$
	} else {
		this._errorSafeExtensions.serializeSafely(it.getReturnType(), Object.class.getSimpleName(), tracedAppendable);
	}
	tracedAppendable.append(" "); //$NON-NLS-1$
	this._treeAppendableUtil.traceSignificant(tracedAppendable, it).append(makeJavaIdentifier(it.getSimpleName()));
	tracedAppendable.append("("); //$NON-NLS-1$
	generateParameters(it, tracedAppendable, config);
	tracedAppendable.append(")"); //$NON-NLS-1$
	generateThrowsClause(it, tracedAppendable, config);
	if (it.isAbstract() || !hasBody(it)) {
		tracedAppendable.append(";"); //$NON-NLS-1$
	} else {
		tracedAppendable.append(" "); //$NON-NLS-1$
		generateExecutableBody(it, tracedAppendable, config);
	}
	appendable.closeScope();
	return appendable;
}
 
Example 18
Source File: AbstractTypeProviderTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void test_ParameterizedTypes_Inner_04() {
	String typeName = ParameterizedTypes.Inner.class.getName();
	JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
	JvmOperation methodT = getMethodFromType(type, ParameterizedTypes.Inner.class, "methodT()");
	JvmTypeReference listT = methodT.getReturnType();
	assertEquals("java.util.List<T>", listT.getIdentifier());
	JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) listT;
	assertEquals(1, listType.getArguments().size());
	JvmTypeReference typeArgument = listType.getArguments().get(0);
	assertEquals("T", typeArgument.getIdentifier());
	JvmTypeParameter t = ((JvmTypeParameterDeclarator) type.getDeclaringType()).getTypeParameters().get(1);
	assertSame(t, typeArgument.getType());
}
 
Example 19
Source File: Jdt2Ecore.java    From sarl with Apache License 2.0 4 votes vote down vote up
/** Create the operations into the SARL feature container.
 *
 * @param codeBuilder the builder of the script.
 * @param methods the operations to create.
 * @param context the context of the actions. If {@code null}, the block of the actions are not generated.
 * @throws JavaModelException if the Java model is invalid.
 * @throws IllegalArgumentException if the signature is not syntactically correct.
 */
public void createActionsWith(
		ActionBuilder codeBuilder,
		Collection<IMethod> methods,
		XtendTypeDeclaration context) throws JavaModelException, IllegalArgumentException {
	if (methods != null) {
		for (final IMethod operation : methods) {
			if (!isGeneratedOperation(operation)) {
				final ISarlActionBuilder action = codeBuilder.addAction(operation.getElementName());
				action.setReturnType(Signature.toString(operation.getReturnType()));
				final IFormalParameterBuilder[] sarlParams = createFormalParametersWith(
					name -> action.addParameter(name), operation);
				if (context != null) {
					final JvmType type = this.typeReferences.findDeclaredType(
							operation.getDeclaringType().getFullyQualifiedName(),
							context);
					final JvmOperation superOperation = getJvmOperation(operation, type);
					// Create the block
					final IBlockExpressionBuilder block = action.getExpression();
					if ((type.eClass() != TypesPackage.Literals.JVM_GENERIC_TYPE
							|| !((JvmGenericType) type).isInterface())
							&& superOperation != null
							&& !superOperation.isAbstract()) {
						// Create the super-call expression
						final IExpressionBuilder superCall = block.addExpression();
						final XMemberFeatureCall call = XbaseFactory.eINSTANCE.createXMemberFeatureCall();
						superCall.setXExpression(call);
						superCall.setDocumentation(block.getAutoGeneratedActionString());
						call.setFeature(superOperation);
						call.setMemberCallTarget(superCall.createReferenceToSuper());
						final List<XExpression> arguments = call.getMemberCallArguments();
						for (final IFormalParameterBuilder currentParam : sarlParams) {
							final XFeatureCall argumentSource = XbaseFactory.eINSTANCE.createXFeatureCall();
							arguments.add(argumentSource);
							currentParam.setReferenceInto(argumentSource);
						}
					} else {
						final JvmTypeReference ret = superOperation != null ? superOperation.getReturnType() : null;
						block.setDefaultAutoGeneratedContent(
								ret == null ? null : ret.getIdentifier());
					}
				}
			}
		}
	}
}
 
Example 20
Source File: SARLCodeMiningProvider.java    From sarl with Apache License 2.0 4 votes vote down vote up
/** Add an annotation when the action's return type is implicit and inferred by the SARL compiler.
 *
 * @param resource the resource to parse.
 * @param acceptor the code mining acceptor.
 */
@SuppressWarnings("checkstyle:npathcomplexity")
private void createImplicitActionReturnType(XtextResource resource, IAcceptor<? super ICodeMining> acceptor) {
	final List<XtendFunction> actions = EcoreUtil2.eAllOfType(resource.getContents().get(0), XtendFunction.class);

	for (final XtendFunction action : actions) {
		// inline annotation only for methods with no return type
		if (action.getReturnType() != null) {
			continue;
		}
		// get return type name from operation
		final JvmOperation inferredOperation = (JvmOperation) this.jvmModelAssocitions.getPrimaryJvmElement(action);
		if (inferredOperation == null || inferredOperation.getReturnType() == null) {
			continue;
		}
		// find document offset for inline annotationn
		final ICompositeNode node = NodeModelUtils.findActualNodeFor(action);
		final Keyword parenthesis = this.grammar.getAOPMemberAccess().getRightParenthesisKeyword_2_5_6_2();
		final Assignment fctname = this.grammar.getAOPMemberAccess().getNameAssignment_2_5_5();
		int offsetFctname = -1;
		int offsetParenthesis = -1;
		for (Iterator<INode> it = node.getAsTreeIterable().iterator(); it.hasNext();) {
			final INode child = it.next();
			if (child != node) {
				final EObject grammarElement = child.getGrammarElement();
				if (grammarElement instanceof RuleCall) {
					if (fctname.equals(grammarElement.eContainer())) {
						offsetFctname = child.getTotalEndOffset();
					}
				} else if (parenthesis.equals(grammarElement)) {
					offsetParenthesis = child.getTotalEndOffset();
					break;
				}
			}
		}
		int offset = -1;
		if (offsetParenthesis >= 0) {
			offset = offsetParenthesis;
		} else if (offsetFctname >= 0) {
			offset = offsetFctname;
		}
		if (offset >= 0) {
			final String returnType = inferredOperation.getReturnType().getSimpleName();
			final String text = " " + this.keywords.getColonKeyword() + " " + returnType; //$NON-NLS-1$ //$NON-NLS-2$
			acceptor.accept(createNewLineContentCodeMining(offset, text));
		}
	}
}