org.eclipse.xtext.xbase.linking
Class FeatureCallChecker

java.lang.Object
  extended by org.eclipse.xtext.xbase.linking.FeatureCallChecker

public class FeatureCallChecker
extends java.lang.Object

Checks whether a given JvmIdentifiableElement can possibly be called by a given XAbstractFeatureCall.

Taken from section 15.12.2.1 Identify Potentially Applicable Methods of the Java Language Specification, the following rules are applied:

  1. The arity of the member is lesser or equal to the arity of the method invocation.
  2. If the member is a variable arity method with arity n, the arity of the method invocation is greater or equal to n-1.
  3. If the member is a fixed arity method with arity n, the arity of the method invocation is equal to n.
  4. If the method invocation includes explicit type parameters, and the member is a generic method, then the number of actual type parameters is equal to the number of formal type parameters.

Author:
Sven Efftinge

Constructor Summary
FeatureCallChecker()
           
 
Method Summary
protected  java.lang.String _case(JvmConstructor input, XConstructorCall context, org.eclipse.emf.ecore.EReference ref, JvmFeatureDescription jvmFeatureDescription)
           
protected  java.lang.String _case(JvmField input, XAssignment context, org.eclipse.emf.ecore.EReference ref, JvmFeatureDescription jvmFeatureDescription)
           
protected  java.lang.String _case(JvmField input, XFeatureCall context, org.eclipse.emf.ecore.EReference reference, JvmFeatureDescription jvmFeatureDescription)
           
protected  java.lang.String _case(JvmField input, XMemberFeatureCall context, org.eclipse.emf.ecore.EReference ref, JvmFeatureDescription jvmFeatureDescription)
           
protected  java.lang.String _case(JvmIdentifiableElement input, XFeatureCall context, org.eclipse.emf.ecore.EReference ref, LocalVarDescription description)
           
protected  java.lang.String _case(JvmOperation input, XAssignment context, org.eclipse.emf.ecore.EReference ref, JvmFeatureDescription jvmFeatureDescription)
           
protected  java.lang.String _case(JvmOperation input, XBinaryOperation context, org.eclipse.emf.ecore.EReference ref, JvmFeatureDescription jvmFeatureDescription)
           
protected  java.lang.String _case(JvmOperation input, XFeatureCall context, org.eclipse.emf.ecore.EReference reference, JvmFeatureDescription jvmFeatureDescription)
           
protected  java.lang.String _case(JvmOperation input, XMemberFeatureCall context, org.eclipse.emf.ecore.EReference ref, JvmFeatureDescription jvmFeatureDescription)
           
protected  java.lang.String _case(JvmOperation input, XUnaryOperation context, org.eclipse.emf.ecore.EReference reference, JvmFeatureDescription jvmFeatureDescription)
           
protected  java.lang.String _case(java.lang.Object input, java.lang.Object context, org.eclipse.emf.ecore.EReference ref, IValidatedEObjectDescription description)
           
protected  boolean areArgumentTypesValid(JvmExecutable exectuable, java.util.List<XExpression> arguments, TypeArgumentContext typeArgumentContext)
           
 java.lang.String check(IEObjectDescription input)
           
protected  java.lang.String checkJvmOperation(JvmOperation input, XAbstractFeatureCall context, boolean isExplicitOperationCall, JvmFeatureDescription jvmFeatureDescription, org.eclipse.emf.common.util.EList<XExpression> arguments)
           
protected  ITypeProvider getTypeProvider()
           
 void initialize(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference)
           
protected  boolean isCompatibleArgument(JvmTypeReference declaredType, JvmTypeReference actualType)
           
protected  boolean isSugaredMethodInvocationWithoutParanthesis(JvmFeatureDescription jvmFeatureDescription)
           
protected  boolean isValidNumberOfArguments(JvmExecutable executable, java.util.List<XExpression> arguments)
           
 void setTypeProvider(ITypeProvider typeProvider)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureCallChecker

public FeatureCallChecker()
Method Detail

setTypeProvider

public void setTypeProvider(ITypeProvider typeProvider)

getTypeProvider

protected ITypeProvider getTypeProvider()

initialize

public void initialize(org.eclipse.emf.ecore.EObject context,
                       org.eclipse.emf.ecore.EReference reference)

check

public java.lang.String check(IEObjectDescription input)

_case

protected java.lang.String _case(java.lang.Object input,
                                 java.lang.Object context,
                                 org.eclipse.emf.ecore.EReference ref,
                                 IValidatedEObjectDescription description)

_case

protected java.lang.String _case(JvmConstructor input,
                                 XConstructorCall context,
                                 org.eclipse.emf.ecore.EReference ref,
                                 JvmFeatureDescription jvmFeatureDescription)

_case

protected java.lang.String _case(JvmOperation input,
                                 XBinaryOperation context,
                                 org.eclipse.emf.ecore.EReference ref,
                                 JvmFeatureDescription jvmFeatureDescription)

_case

protected java.lang.String _case(JvmOperation input,
                                 XAssignment context,
                                 org.eclipse.emf.ecore.EReference ref,
                                 JvmFeatureDescription jvmFeatureDescription)

_case

protected java.lang.String _case(JvmField input,
                                 XAssignment context,
                                 org.eclipse.emf.ecore.EReference ref,
                                 JvmFeatureDescription jvmFeatureDescription)

_case

protected java.lang.String _case(JvmField input,
                                 XMemberFeatureCall context,
                                 org.eclipse.emf.ecore.EReference ref,
                                 JvmFeatureDescription jvmFeatureDescription)

_case

protected java.lang.String _case(JvmIdentifiableElement input,
                                 XFeatureCall context,
                                 org.eclipse.emf.ecore.EReference ref,
                                 LocalVarDescription description)

_case

protected java.lang.String _case(JvmField input,
                                 XFeatureCall context,
                                 org.eclipse.emf.ecore.EReference reference,
                                 JvmFeatureDescription jvmFeatureDescription)

_case

protected java.lang.String _case(JvmOperation input,
                                 XMemberFeatureCall context,
                                 org.eclipse.emf.ecore.EReference ref,
                                 JvmFeatureDescription jvmFeatureDescription)

_case

protected java.lang.String _case(JvmOperation input,
                                 XFeatureCall context,
                                 org.eclipse.emf.ecore.EReference reference,
                                 JvmFeatureDescription jvmFeatureDescription)

_case

protected java.lang.String _case(JvmOperation input,
                                 XUnaryOperation context,
                                 org.eclipse.emf.ecore.EReference reference,
                                 JvmFeatureDescription jvmFeatureDescription)

checkJvmOperation

protected java.lang.String checkJvmOperation(JvmOperation input,
                                             XAbstractFeatureCall context,
                                             boolean isExplicitOperationCall,
                                             JvmFeatureDescription jvmFeatureDescription,
                                             org.eclipse.emf.common.util.EList<XExpression> arguments)

areArgumentTypesValid

protected boolean areArgumentTypesValid(JvmExecutable exectuable,
                                        java.util.List<XExpression> arguments,
                                        TypeArgumentContext typeArgumentContext)

isValidNumberOfArguments

protected boolean isValidNumberOfArguments(JvmExecutable executable,
                                           java.util.List<XExpression> arguments)

isSugaredMethodInvocationWithoutParanthesis

protected boolean isSugaredMethodInvocationWithoutParanthesis(JvmFeatureDescription jvmFeatureDescription)

isCompatibleArgument

protected boolean isCompatibleArgument(JvmTypeReference declaredType,
                                       JvmTypeReference actualType)