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

The following examples show how to use org.eclipse.xtext.common.types.JvmOperation#isStatic() . 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: LogicalContainerAwareReentrantTypeResolver.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@SuppressWarnings("unused")
protected void _computeTypes(Map<JvmIdentifiableElement, ResolvedTypes> preparedResolvedTypes, ResolvedTypes resolvedTypes, IFeatureScopeSession featureScopeSession, JvmOperation operation) {
	ResolvedTypes childResolvedTypes = preparedResolvedTypes.get(operation);
	if (childResolvedTypes == null) {
		if (preparedResolvedTypes.containsKey(operation))
			return;
		throw new IllegalStateException("No resolved type found. Operation was: " + operation.getIdentifier());
	} else {
		preparedResolvedTypes.put(operation, null);
	}
	OperationBodyComputationState state = new OperationBodyComputationState(childResolvedTypes, operation.isStatic() ? featureScopeSession : featureScopeSession.toInstanceContext(), operation);
	addExtensionProviders(state, operation.getParameters());
	markComputing(operation.getReturnType());
	try {
		state.computeTypes();
	} finally {
		unmarkComputing(operation.getReturnType());
	}
	computeAnnotationTypes(childResolvedTypes, featureScopeSession, operation);
	computeLocalTypes(preparedResolvedTypes, childResolvedTypes, featureScopeSession, operation);
	mergeChildTypes(childResolvedTypes);
}
 
Example 2
Source File: OverrideTester.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
protected boolean isConflictingDefaultImplementation(AbstractResolvedOperation overriding, AbstractResolvedOperation overridden) {
	JvmOperation ridingDecl = overriding.getDeclaration();
	if (ridingDecl.isStatic()) {
		return false;
	}
	JvmOperation riddenDecl = overridden.getDeclaration();
	if (riddenDecl.isStatic()) {
		return false;
	}
	if (isInterface(ridingDecl.getDeclaringType()) && isInterface(riddenDecl.getDeclaringType())
			&& (!ridingDecl.isAbstract() || !riddenDecl.isAbstract())) {
		LightweightTypeReference ridingTypeRef = overriding.getResolvedDeclarator();
		LightweightTypeReference riddenTypeRef = overridden.getResolvedDeclarator();
		return !riddenTypeRef.isAssignableFrom(ridingTypeRef);
	}
	return false;
}
 
Example 3
Source File: OverrideTester.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
protected OverrideCheckDetails getPrimaryValidDetail(IResolvedOperation overriding, JvmOperation overridden) {
	OverrideCheckDetails result = OverrideCheckDetails.IMPLEMENTATION;
	JvmOperation declaration = overriding.getDeclaration();
	if (declaration.isStatic()) {
		result = OverrideCheckDetails.SHADOWED;
	} else if (declaration.isAbstract()) {
		if (overridden.isAbstract()) {
			result = OverrideCheckDetails.REPEATED;
		} else {
			result = OverrideCheckDetails.REDECLARATION;
		}
	} else if (!overridden.isAbstract()) {
		result = OverrideCheckDetails.OVERRIDE;
	}
	return result;
}
 
Example 4
Source File: OverrideProposalUtil.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
protected boolean isCandidate(LightweightTypeReference type, IResolvedExecutable executable,
		IVisibilityHelper visibilityHelper) {
	JvmDeclaredType declaringType = executable.getDeclaration().getDeclaringType();
	if (type.getType() != declaringType && isVisible(executable, visibilityHelper)) {
		JvmExecutable rawExecutable = executable.getDeclaration();
		if (rawExecutable instanceof JvmOperation) {
			JvmOperation operation = (JvmOperation) rawExecutable;
			if (operation.isFinal() || operation.isStatic()) {
				return false;
			} else {
				if (type.getType() instanceof JvmGenericType && ((JvmGenericType) type.getType()).isInterface()) {
					return  declaringType instanceof JvmGenericType
							&& ((JvmGenericType) declaringType).isInterface() && !operation.isAbstract();
				} else {
					return true;
				}
			}
		} else {
			return true;
		}
	}
	return false;
}
 
Example 5
Source File: ReflectionTypeFactory.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
protected void createMethods(Class<?> clazz, JvmDeclaredType result) {
	try {
		Method[] declaredMethods = clazz.getDeclaredMethods();
		if (declaredMethods.length != 0) {
			boolean intf = clazz.isInterface() && !clazz.isAnnotation();
			InternalEList<JvmMember> members = (InternalEList<JvmMember>)result.getMembers();
			for (Method method : declaredMethods) {
				if (!method.isSynthetic()) {
					JvmOperation operation = createOperation(method);
					if (clazz.isAnnotation()) {
						setDefaultValue(operation, method);
					} else if (intf && !operation.isAbstract() && !operation.isStatic()) {
						operation.setDefault(true);
					}
					members.addUnique(operation);
				}
			}
		}
	} catch (NoClassDefFoundError e) {
		logNoClassDefFoundError(e, clazz, "methods");
	}
}
 
Example 6
Source File: JvmDeclaredTypeSignatureHashProvider.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
protected SignatureHashBuilder appendSignature(JvmOperation operation) {
	appendVisibility(operation.getVisibility()).append(" ");
	if (operation.isAbstract())
		append("abstract ");
	if (operation.isStatic())
		append("static ");
	if (operation.isFinal())
		append("final ");
	appendType(operation.getReturnType()).appendTypeParameters(operation).append(" ")
			.append(operation.getSimpleName()).append("(");
	for (JvmFormalParameter p : operation.getParameters()) {
		appendType(p.getParameterType());
		append(" ");
	}
	append(") ");
	for (JvmTypeReference ex : operation.getExceptions()) {
		appendType(ex).append(" ");
	}
	return this;
}
 
Example 7
Source File: SARLValidator.java    From sarl with Apache License 2.0 6 votes vote down vote up
@Override
protected void checkAssignment(XExpression expression, EStructuralFeature feature, boolean simpleAssignment) {
	if (simpleAssignment && expression instanceof XAbstractFeatureCall) {
		final JvmIdentifiableElement assignmentFeature = ((XAbstractFeatureCall) expression).getFeature();
		if (assignmentFeature instanceof JvmField) {
			final JvmField field = (JvmField) assignmentFeature;
			if (!field.isFinal()) {
				return;
			}
			final JvmIdentifiableElement container = getLogicalContainerProvider().getNearestLogicalContainer(expression);
			if (container != null && container instanceof JvmOperation) {
				final JvmOperation operation = (JvmOperation) container;
				if (operation.isStatic() && field.getDeclaringType() == operation.getDeclaringType()
						&& Utils.STATIC_CONSTRUCTOR_NAME.equals(operation.getSimpleName())) {
					return;
				}
			}
		}
	}
	super.checkAssignment(expression, feature, simpleAssignment);
}
 
Example 8
Source File: JvmModelGenerator.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected ITreeAppendable _generateModifier(final JvmOperation it, final ITreeAppendable appendable, final GeneratorConfig config) {
  ITreeAppendable _xblockexpression = null;
  {
    this.generateVisibilityModifier(it, appendable);
    if ((it.isAbstract() && (!this.isDeclaredWithinInterface(it)))) {
      appendable.append("abstract ");
    }
    boolean _isStatic = it.isStatic();
    if (_isStatic) {
      appendable.append("static ");
    }
    if (((((!it.isAbstract()) && (!it.isStatic())) && config.getJavaSourceVersion().isAtLeast(JavaVersion.JAVA8)) && this.isDeclaredWithinInterface(it))) {
      appendable.append("default ");
    }
    boolean _isFinal = it.isFinal();
    if (_isFinal) {
      appendable.append("final ");
    }
    boolean _isSynchronized = it.isSynchronized();
    if (_isSynchronized) {
      appendable.append("synchronized ");
    }
    boolean _isStrictFloatingPoint = it.isStrictFloatingPoint();
    if (_isStrictFloatingPoint) {
      appendable.append("strictfp ");
    }
    ITreeAppendable _xifexpression = null;
    boolean _isNative = it.isNative();
    if (_isNative) {
      _xifexpression = appendable.append("native ");
    }
    _xblockexpression = _xifexpression;
  }
  return _xblockexpression;
}
 
Example 9
Source File: XtendHoverSerializer.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public String computeUnsugaredExpression(EObject object) {
	if (object instanceof XAbstractFeatureCall) {
		StringBuilder stringBuilder = new StringBuilder();
		XAbstractFeatureCall featureCall = (XAbstractFeatureCall) object;
		JvmIdentifiableElement feature = featureCall.getFeature();
		if (feature != null && !feature.eIsProxy()) {
			// Static extensions which are no expliciteOperationCalls
			if (featureCall instanceof XMemberFeatureCall && feature instanceof JvmOperation && !((XMemberFeatureCall) featureCall).isExplicitOperationCall()) {
				JvmOperation jvmOperation = (JvmOperation) feature;
				if (jvmOperation.isStatic()) {
					return stringBuilder.append(getStaticCallDesugaredVersion(featureCall, jvmOperation)).toString();
				}
			}
			// Static calls with implicit receiver or implicit first argument
			if (featureCall.getImplicitReceiver() != null || featureCall.getImplicitFirstArgument() != null) {
				if (featureCall.isStatic()) {
					return stringBuilder.append(getStaticCallDesugaredVersion(featureCall, (JvmMember) feature)).toString();
				}
				XExpression receiver = featureCall.getActualReceiver();
				if (receiver instanceof XMemberFeatureCall) {
					stringBuilder.append(THIS).append(DELIMITER);
					stringBuilder.append(((XMemberFeatureCall) receiver).getFeature().getSimpleName()).append(DELIMITER);
				} else if (receiver instanceof XAbstractFeatureCall) {
					JvmIdentifiableElement receiverFeature = ((XAbstractFeatureCall) receiver).getFeature();
					if (receiverFeature == feature.eContainer()) {
						stringBuilder.append(THIS).append(DELIMITER);
					} else {
						stringBuilder.append(receiverFeature.getSimpleName()).append(DELIMITER);
					}
				}
				stringBuilder.append(feature.getSimpleName());
				if (feature instanceof JvmExecutable)
					stringBuilder.append(computeArguments(featureCall));
				return stringBuilder.toString();
			}
		}
	}
	return "";
}
 
Example 10
Source File: XtendReentrantTypeResolver.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
/* @Nullable */
protected JvmTypeReference doGetTypeReference(XComputedTypeReferenceImplCustom context) {
	try {
		CreateExtensionInfo createExtensionInfo = createFunction.getCreateExtensionInfo();
		XExpression expression = createExtensionInfo.getCreateExpression();
		LightweightTypeReference actualType = resolvedTypes.getReturnType(expression);
		if (actualType == null) {
			JvmOperation operation = typeResolver.associations.getDirectlyInferredOperation(createFunction);
			if (operation != null) {
				IFeatureScopeSession session = operation.isStatic() ? featureScopeSession : featureScopeSession.toInstanceContext();
				typeResolver.computeTypes(resolvedTypesByContext, resolvedTypes, session, operation);
				actualType = resolvedTypes.getReturnType(expression);
			}
		}
		if (actualType == null)
			return null;
		// actualType may not be java compliant but still carry more information than the
		// java compliant reference
		JvmTypeReference result = typeResolver.toJavaCompliantTypeReference(actualType, featureScopeSession);
		if (actualType.isMultiType() || result.getType() != actualType.getType()) {
			resolvedTypes.setType(param, resolvedTypes.getReferenceOwner().toLightweightTypeReference(result));
			resolvedTypes.reassignType(param, actualType);
		}
		return result;
	} finally {
		context.unsetTypeProviderWithoutNotification();
	}
}
 
Example 11
Source File: XtendResourceDescriptionStrategy.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected int getFlags(JvmOperation operation) {
	int flags = 0;
	if (dispatchHelper.isDispatcherFunction(operation))
		flags = descriptionFlags.setDispatcherOperation(flags);
	if (operation.isStatic())
		flags = descriptionFlags.setStatic(flags);
	return flags;
}
 
Example 12
Source File: Utils.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Replies if the given type is a functional interface.
 *
 * <p>This function does not test if the {@code @FunctionalInterface} is attached to the type.
 * The function counts the number of operations.
 *
 * @param type the type to test.
 * @param sarlSignatureProvider the provider of SARL operation signatures.
 * @return {@code true} if the given type is final.
 */
public static boolean isFunctionalInterface(JvmGenericType type, IActionPrototypeProvider sarlSignatureProvider) {
	if (type != null && type.isInterface()) {
		final Map<ActionPrototype, JvmOperation> operations = new HashMap<>();
		populateInterfaceElements(type, operations, null, sarlSignatureProvider);
		if (operations.size() == 1) {
			final JvmOperation op = operations.values().iterator().next();
			return !op.isStatic() && !op.isDefault();
		}
	}
	return false;
}
 
Example 13
Source File: OverrideTester.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Checks if the overriding method and the given overridden candidate have compatible subsignatures
 * according to JLS 8.4.2. Uses information about static-ness and visibility for early exits.
 * 
 * The implemented algorithm pretty much mirrors the one from
    * class <code>org.eclipse.jdt.internal.corext.util.MethodOverrideTester</code>.
 * 
 * @param checkInheritance <code>true</code> if it is unknown whether the given operations are declared in a valid type hierarchy.
 */
public IOverrideCheckResult isSubsignature(AbstractResolvedOperation overriding, JvmOperation overridden, boolean checkInheritance) {
	JvmOperation declaration = overriding.getDeclaration();
	if (declaration == overridden) {
		return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.CURRENT);
	}
	if (overridden.getDeclaringType() == declaration.getDeclaringType()) {
		return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.SAME_DECLARATOR);
	}
	ITypeReferenceOwner owner = overriding.getContextType().getOwner();
	LightweightTypeReference currentDeclarator = null;
	if (checkInheritance) {
		// here we use the raw types intentionally since there is no need to resolve
		// declarators to concrete bounds to determine the override relationship of types
		currentDeclarator = owner.newParameterizedTypeReference(declaration.getDeclaringType());
		if (!currentDeclarator.isSubtypeOf(overridden.getDeclaringType())) {
			return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.NO_INHERITANCE);	
		}
	}
	if (!Strings.equal(overridden.getSimpleName(), declaration.getSimpleName())) {
		return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.NAME_MISMATCH);
	}
	int parameterCount = overridden.getParameters().size();
	if (parameterCount != declaration.getParameters().size()) {
		return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.ARITY_MISMATCH);
	}
	if (currentDeclarator == null) {
		currentDeclarator = owner.newParameterizedTypeReference(declaration.getDeclaringType());
	}
	if (!(new ContextualVisibilityHelper(visibilityHelper, currentDeclarator).isVisible(overridden))) {
		return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.NOT_VISIBLE);
	}
	if (declaration.isStatic() != overridden.isStatic()) {
		return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.STATIC_MISMATCH);
	}
	AbstractResolvedOperation overriddenInHierarchy = new ResolvedOperationInHierarchy(overridden, overriding.getBottom());
	if (parameterCount != 0 && !isMatchingParameterList(overriding, overriddenInHierarchy)) {
		return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.PARAMETER_TYPE_MISMATCH);
	}
	if (!isMatchingTypeParameters(overriding, overriddenInHierarchy))
		return new LazyOverrideCheckResult(overriding, overridden, OverrideCheckDetails.TYPE_PARAMETER_MISMATCH);
	return new LazyOverrideCheckResult(overriding, overridden, getPrimaryValidDetail(overriding, overridden));
}
 
Example 14
Source File: XbaseHighlightingCalculator.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
protected void computeFeatureCallHighlighting(XAbstractFeatureCall featureCall, IHighlightedPositionAcceptor acceptor) {
	JvmIdentifiableElement feature = featureCall.getFeature();
	if (feature != null && !feature.eIsProxy()) {
		
		if (feature instanceof XVariableDeclaration) {
			if (!SPECIAL_FEATURE_NAMES.contains(((XVariableDeclaration) feature).getName())) {
				// highlighting of special identifiers is done separately, so it's omitted here 
				highlightFeatureCall(featureCall, acceptor, LOCAL_VARIABLE);
				
				if (!((XVariableDeclaration) feature).isWriteable()) {
					highlightFeatureCall(featureCall, acceptor, LOCAL_FINAL_VARIABLE);
				}
			}
			
		} else if (feature instanceof JvmFormalParameter) {
			if (!SPECIAL_FEATURE_NAMES.contains(((JvmFormalParameter) feature).getName())) {
				// highlighting of special identifiers is done separately, so it's omitted here 
				final EObject eContainingFeature = feature.eContainingFeature();
				
				if (eContainingFeature == TypesPackage.Literals.JVM_EXECUTABLE__PARAMETERS
						|| eContainingFeature == XbasePackage.Literals.XCLOSURE__DECLARED_FORMAL_PARAMETERS) {
					// which is the case for constructors and methods
					highlightFeatureCall(featureCall, acceptor, PARAMETER_VARIABLE);
				} else {
					// covers parameters of for and template expr FOR loops, as well as switch statements
					highlightFeatureCall(featureCall, acceptor, LOCAL_VARIABLE);
					highlightFeatureCall(featureCall, acceptor, LOCAL_FINAL_VARIABLE);
				}
			}
			
		} else if (feature instanceof JvmTypeParameter) {
			highlightFeatureCall(featureCall, acceptor, TYPE_VARIABLE);
			
		} else if (feature instanceof JvmField) {
			highlightFeatureCall(featureCall, acceptor, FIELD);
			
			if (((JvmField) feature).isStatic()) {
				highlightFeatureCall(featureCall, acceptor, STATIC_FIELD);
				
				if (((JvmField) feature).isFinal()) {
					highlightFeatureCall(featureCall, acceptor, STATIC_FINAL_FIELD);
				}
			}
			
		} else if (feature instanceof JvmOperation && !featureCall.isOperation()) {
			JvmOperation jvmOperation = (JvmOperation) feature;
			
			highlightFeatureCall(featureCall, acceptor, METHOD);
			
			if (jvmOperation.isAbstract()) {
				highlightFeatureCall(featureCall, acceptor, ABSTRACT_METHOD_INVOCATION);
			}
			
			if (jvmOperation.isStatic()) {
				highlightFeatureCall(featureCall, acceptor, STATIC_METHOD_INVOCATION);
			}
			
			if (featureCall.isExtension() || isExtensionWithImplicitFirstArgument(featureCall)) {
				highlightFeatureCall(featureCall, acceptor, EXTENSION_METHOD_INVOCATION);
			}
			
		} else if (feature instanceof JvmDeclaredType) {
			highlightReferenceJvmType(acceptor, featureCall, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, feature);
		}
		
		if(feature instanceof JvmAnnotationTarget && DeprecationUtil.isTransitivelyDeprecated((JvmAnnotationTarget)feature)){
			highlightFeatureCall(featureCall, acceptor, DEPRECATED_MEMBERS);
		}
	}
}
 
Example 15
Source File: XbaseReferenceProposalCreator.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected Image computeImage(JvmFeature feature) {
	int flags = 0;
	int decorator = 0;
	switch(feature.getVisibility()) {
		case PUBLIC: flags = Flags.AccPublic; break;
		case PROTECTED: flags = Flags.AccProtected; break;
		case PRIVATE: flags = Flags.AccPrivate; break;
		case DEFAULT: flags = Flags.AccDefault; break;
	}
	JvmDeclaredType declaringType = feature.getDeclaringType();
	boolean interfaceOrAnnotation = false;
	if (declaringType instanceof JvmGenericType) {
		interfaceOrAnnotation = ((JvmGenericType) declaringType).isInterface();
	} else if (declaringType instanceof JvmAnnotationType) {
		interfaceOrAnnotation = true;
	}
	if (feature instanceof JvmConstructor) {
		decorator = JavaElementImageDescriptor.CONSTRUCTOR;
		if (declaringType.isAbstract()) {
			flags |= Flags.AccAbstract;
			decorator |= JavaElementImageDescriptor.ABSTRACT;
		}
		return computeConstructorImage(declaringType.getDeclaringType() != null, interfaceOrAnnotation, flags, decorator);
	} else if (feature instanceof JvmOperation) {
		JvmOperation operation = (JvmOperation) feature;
		if (operation.isStatic()) {
			flags |= Flags.AccStatic;
			decorator |= JavaElementImageDescriptor.STATIC;
		}
		if (operation.isAbstract()) {
			flags |= Flags.AccAbstract;
			decorator |= JavaElementImageDescriptor.ABSTRACT;
		}
		if (operation.isFinal()) {
			flags |= Flags.AccFinal;
			decorator |= JavaElementImageDescriptor.FINAL;
		}
		return computeMethodImage(interfaceOrAnnotation, flags, decorator);
	} else if (feature instanceof JvmField) {
		JvmField field = (JvmField) feature;
		if (field.isStatic()) {
			flags |= Flags.AccStatic;
			decorator |= JavaElementImageDescriptor.STATIC;
		}
		if (field.isFinal()) {
			flags |= Flags.AccFinal;
			decorator |= JavaElementImageDescriptor.FINAL;
		}
		if (declaringType instanceof JvmEnumerationType)
			flags |= Flags.AccEnum;
		return computeFieldImage(interfaceOrAnnotation, flags, decorator);
	} 
	return null;
}
 
Example 16
Source File: XtendJvmModelInferrer.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
protected void transform(XtendFunction source, JvmGenericType container, boolean allowDispatch) {
	JvmOperation operation = typesFactory.createJvmOperation();
	operation.setAbstract(source.isAbstract());
	operation.setNative(source.isNative());
	operation.setSynchronized(source.isSynchonized());
	operation.setStrictFloatingPoint(source.isStrictFloatingPoint());
	if (!source.isAbstract())
		operation.setFinal(source.isFinal());
	container.getMembers().add(operation);
	associator.associatePrimary(source, operation);
	String sourceName = source.getName();
	JvmVisibility visibility = source.getVisibility();
	if (allowDispatch && source.isDispatch()) {
		if (source.getDeclaredVisibility() == null)
			visibility = JvmVisibility.PROTECTED;
		sourceName = "_" + sourceName;
	}
	operation.setSimpleName(sourceName);
	operation.setVisibility(visibility);
	operation.setStatic(source.isStatic());
	if (!operation.isAbstract() && !operation.isStatic() && container.isInterface())
		operation.setDefault(true);
	for (XtendParameter parameter : source.getParameters()) {
		translateParameter(operation, parameter);
	}
	XExpression expression = source.getExpression();
	CreateExtensionInfo createExtensionInfo = source.getCreateExtensionInfo();
	
	JvmTypeReference returnType = null;
	if (source.getReturnType() != null) {
		returnType = jvmTypesBuilder.cloneWithProxies(source.getReturnType());
	} else if (createExtensionInfo != null) {
		returnType = jvmTypesBuilder.inferredType(createExtensionInfo.getCreateExpression());
	} else if (expression != null) {
		returnType = jvmTypesBuilder.inferredType(expression);
	} else {
		returnType = jvmTypesBuilder.inferredType();
	}
	
	operation.setReturnType(returnType);
	copyAndFixTypeParameters(source.getTypeParameters(), operation);
	for (JvmTypeReference exception : source.getExceptions()) {
		operation.getExceptions().add(jvmTypesBuilder.cloneWithProxies(exception));
	}
	translateAnnotationsTo(source.getAnnotations(), operation);
	if (source.isOverride() && typeReferences.findDeclaredType(Override.class, source) != null)
		setOverride(operation);
	if (createExtensionInfo != null) {
		transformCreateExtension(source, createExtensionInfo, container, operation, returnType);
	} else {
		setBody(operation, expression);
	}
	jvmTypesBuilder.copyDocumentationTo(source, operation);
}