@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity", "checkstyle:nestedifdepth"})
	private void appendInlineFeatureCallForCastedExpression(
			JvmAnnotationReference inlineAnnotation,
			JvmIdentifiableElement calledFeature,
			XExpression receiver,
			List<XExpression> arguments,
			EObject context,
			ITreeAppendable appendable) {
		// Overridden for fixing the @Inline behavior
		String formatString = null;
		final List<JvmTypeReference> importedTypes = Lists.newArrayListWithCapacity(2);
		for (final JvmAnnotationValue annotationValue: inlineAnnotation.getValues()) {
			final String valueName = annotationValue.getValueName();
			if (Strings.isEmpty(valueName)) {
				// Special case: the annotation value as no associated operation.
				// If it appends, we could assumes that the operation is "value()"
				if (!Strings.isEmpty(formatString)) {
					throw new IllegalStateException();
				}
				formatString = getAnnotationStringValue(annotationValue);
			} else if (INLINE_VALUE_NAME.equals(valueName)) {
				if (!Strings.isEmpty(formatString)) {
					throw new IllegalStateException();
				}
				formatString = getAnnotationStringValue(annotationValue);
			} else if (INLINE_IMPORTED_NAME.equals(valueName)) {
				importedTypes.addAll(getAnnotationTypeValue(annotationValue));
			}
		}

		if (formatString == null) {
			throw new IllegalStateException();
		}

		int numberVariadicParameter = 0;
		final int numberFormalParameters;
		JvmFormalParameter formalVariadicParameter = null;
		if (calledFeature instanceof JvmExecutable) {
			final JvmExecutable jvmexec = (JvmExecutable) calledFeature;
			numberFormalParameters = jvmexec.getParameters().size();
			if (numberFormalParameters > 0) {
				formalVariadicParameter = jvmexec.getParameters().get(numberFormalParameters - 1);
				if (jvmexec.isVarArgs()) {
					numberVariadicParameter = 1;
				}
			}
		} else {
			numberFormalParameters = arguments.size();
		}
		final Matcher matcher = INLINE_VARIABLE_PATTERN.matcher(formatString);
		int prevEnd = 0;


		while (matcher.find()) {
			final int start = matcher.start();
			if (start != prevEnd) {
				appendable.append(formatString.substring(prevEnd, start));
			}
			final String indexOrDollar = matcher.group(1);
			if (INLINE_VARIABLE_PREFIX.equals(indexOrDollar)) {
				appendable.append(INLINE_VARIABLE_PREFIX);
			} else {
				final int index = Integer.parseInt(indexOrDollar) - 1;
				// Treat the $0 parameter in the inline expression
				if (index < 0) {
					boolean hasReceiver = true;
					if (receiver != null) {
						internalToJavaExpression(receiver, appendable);
						if (receiver instanceof XAbstractFeatureCall) {
							if (((XAbstractFeatureCall) receiver).getFeature() instanceof JvmType) {
								final String referenceName = getReferenceName(receiver, appendable);
								if (referenceName != null && referenceName.length() == 0) {
									hasReceiver = false;
								}
							}
						}
					} else {
						hasReceiver = false;
					}
					if (hasReceiver) {
						appendable.append("."); //$NON-NLS-1$
					}
				} else {
					final int numberImports = importedTypes.size();
					final int numberFormalParametersImports = numberFormalParameters + numberImports;
					if (numberVariadicParameter != 0 && index < arguments.size() && index == (numberFormalParameters - 1)) {
						XExpression argument = arguments.get(index);
						appendArgument(argument, appendable, index > 0);
						for (int i = index + 1; i < arguments.size(); ++i) {
							appendable.append(", "); //$NON-NLS-1$
							argument = arguments.get(i);
							appendArgument(argument, appendable, true);
						}
					} else if (index > numberFormalParametersImports) {
						throw new IllegalStateException();
					} else if (index >= numberFormalParameters && index < numberFormalParametersImports) {
						serialize(importedTypes.get(index - numberFormalParameters), context, appendable);
					} else if (index == numberFormalParametersImports) {
						throw new IllegalStateException();
					} else if (index < arguments.size()) {
						final XExpression argument = arguments.get(index);
						appendArgument(argument, appendable, index > 0);
					} else if (formalVariadicParameter != null) {
						appendNullValue(formalVariadicParameter.getParameterType(), calledFeature, appendable);
					} else {
						throw new IllegalStateException();
					}
				}
			}
			prevEnd = matcher.end();
		}
		if (prevEnd != formatString.length()) {
			appendable.append(formatString.substring(prevEnd));
		}
	}
@ SuppressWarnings ( { "checkstyle:cyclomaticcomplexity" , "checkstyle:npathcomplexity" , "checkstyle:nestedifdepth" } ) private void appendInlineFeatureCallForCastedExpression ( JvmAnnotationReference inlineAnnotation , JvmIdentifiableElement calledFeature , XExpression receiver , List < XExpression > arguments , EObject context , ITreeAppendable appendable ) { String formatString = null ; final List < JvmTypeReference > importedTypes = Lists . newArrayListWithCapacity ( 2 ) ; for ( final JvmAnnotationValue annotationValue : inlineAnnotation . getValues ( ) ) { final String valueName = annotationValue . getValueName ( ) ; if ( Strings . isEmpty ( valueName ) ) { if ( ! Strings . isEmpty ( formatString ) ) { throw new IllegalStateException ( ) ; } formatString = getAnnotationStringValue ( annotationValue ) ; } else if ( INLINE_VALUE_NAME . equals ( valueName ) ) { if ( ! Strings . isEmpty ( formatString ) ) { throw new IllegalStateException ( ) ; } formatString = getAnnotationStringValue ( annotationValue ) ; } else if ( INLINE_IMPORTED_NAME . equals ( valueName ) ) { importedTypes . addAll ( getAnnotationTypeValue ( annotationValue ) ) ; } } if ( formatString == null ) { throw new IllegalStateException ( ) ; } int numberVariadicParameter = 0 ; final int numberFormalParameters ; JvmFormalParameter formalVariadicParameter = null ; if ( calledFeature instanceof JvmExecutable ) { final JvmExecutable jvmexec = ( JvmExecutable ) calledFeature ; numberFormalParameters = jvmexec . getParameters ( ) . size ( ) ; if ( numberFormalParameters > 0 ) { formalVariadicParameter = jvmexec . getParameters ( ) . get ( numberFormalParameters - 1 ) ; if ( jvmexec . isVarArgs ( ) ) { numberVariadicParameter = 1 ; } } } else { numberFormalParameters = arguments . size ( ) ; } final Matcher matcher = INLINE_VARIABLE_PATTERN . matcher ( formatString ) ; int prevEnd = 0 ; while ( matcher . find ( ) ) { final int start = matcher . start ( ) ; if ( start != prevEnd ) { appendable . append ( formatString . substring ( prevEnd , start ) ) ; } final String indexOrDollar = matcher . group ( 1 ) ; if ( INLINE_VARIABLE_PREFIX . equals ( indexOrDollar ) ) { appendable . append ( INLINE_VARIABLE_PREFIX ) ; } else { final int index = Integer . parseInt ( indexOrDollar ) - 1 ; if ( index < 0 ) { boolean hasReceiver = true ; if ( receiver != null ) { internalToJavaExpression ( receiver , appendable ) ; if ( receiver instanceof XAbstractFeatureCall ) { if ( ( ( XAbstractFeatureCall ) receiver ) . getFeature ( ) instanceof JvmType ) { final String referenceName = getReferenceName ( receiver , appendable ) ; if ( referenceName != null && referenceName . length ( ) == 0 ) { hasReceiver = false ; } } } } else { hasReceiver = false ; } if ( hasReceiver ) { appendable . append ( "." ) ; } } else { final int numberImports = importedTypes . size ( ) ; final int numberFormalParametersImports = numberFormalParameters + numberImports ; if ( numberVariadicParameter != 0 && index < arguments . size ( ) && index == ( numberFormalParameters - 1 ) ) { XExpression argument = arguments . get ( index ) ; appendArgument ( argument , appendable , index > 0 ) ; for ( int i = index + 1 ; i < arguments . size ( ) ; ++ i ) { appendable . append ( ", " ) ; argument = arguments . get ( i ) ; appendArgument ( argument , appendable , true ) ; } } else if ( index > numberFormalParametersImports ) { throw new IllegalStateException ( ) ; } else if ( index >= numberFormalParameters && index < numberFormalParametersImports ) { serialize ( importedTypes . get ( index - numberFormalParameters ) , context , appendable ) ; } else if ( index == numberFormalParametersImports ) { throw new IllegalStateException ( ) ; } else if ( index < arguments . size ( ) ) { final XExpression argument = arguments . get ( index ) ; appendArgument ( argument , appendable , index > 0 ) ; } else if ( formalVariadicParameter != null ) { appendNullValue ( formalVariadicParameter . getParameterType ( ) , calledFeature , appendable ) ; } else { throw new IllegalStateException ( ) ; } } } prevEnd = matcher . end ( ) ; } if ( prevEnd != formatString . length ( ) ) { appendable . append ( formatString . substring ( prevEnd ) ) ; } }
Append the inline version for the given call.

<p>This function supports the specific semantic of the inline expression that is defined into the SARL specification.

@param inlineAnnotation the inline annotation.
@param calledFeature the called feature.
@param receiver the receiver of the call: {@code getActualReceiver(call)}.
@param arguments the call's argument: {@code getActualArguments(call)}.
@param context the context for finding types.
@param appendable the receiver.