org.eclipse.xtext.xbase.linking
Class FeatureCallChecker
java.lang.Object
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:
- The arity of the member is lesser or equal to the arity of the method invocation.
- If the member is a variable arity method with arity n, the arity of the method invocation is greater or equal to
n-1.
- If the member is a fixed arity method with arity n, the arity of the method invocation is equal to n.
- 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
Method Summary |
protected java.lang.String |
_case(JvmConstructor input,
XConstructorCall context,
org.eclipse.emf.ecore.EReference ref,
JvmFeatureDescription jvmFeatureDescription)
|
protected java.lang.String |
_case(JvmConstructor input,
XFeatureCall context,
org.eclipse.emf.ecore.EReference reference,
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,
ITypeArgumentContext typeArgumentContext)
|
protected java.util.List<java.util.EnumSet<TypeConformanceResult.Kind>> |
areGenericArgumentTypesValid(JvmExecutable exectuable,
java.util.List<XExpression> arguments,
ITypeArgumentContext typeArgumentContext)
|
protected java.lang.String |
checkJvmOperation(JvmExecutable executable,
XAbstractFeatureCall featureCall,
boolean isExplicitOperationCall,
JvmFeatureDescription jvmFeatureDescription)
|
boolean |
checkTypesWithGenerics(IEObjectDescription input)
|
protected boolean |
checkTypesWithGenerics(JvmFeatureDescription featureDescription,
JvmExecutable executable,
java.util.List<XExpression> actualArguments,
ITypeArgumentContext typeContext)
|
boolean |
checkTypesWithoutGenerics(IEObjectDescription input)
|
protected boolean |
checkTypesWithoutGenerics(JvmFeatureDescription featureDescription,
JvmExecutable executable,
java.util.List<XExpression> actualArguments)
|
java.lang.String |
checkWithoutTypes(IEObjectDescription input)
|
protected
|
doCheck(IValidatedEObjectDescription input,
com.google.inject.Provider<T> validator)
|
protected ITypeProvider |
getTypeProvider()
|
void |
initialize(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EReference reference)
|
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 |
FeatureCallChecker
public FeatureCallChecker()
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)
checkTypesWithGenerics
public boolean checkTypesWithGenerics(IEObjectDescription input)
checkTypesWithGenerics
protected boolean checkTypesWithGenerics(JvmFeatureDescription featureDescription,
JvmExecutable executable,
java.util.List<XExpression> actualArguments,
ITypeArgumentContext typeContext)
checkWithoutTypes
public java.lang.String checkWithoutTypes(IEObjectDescription input)
checkTypesWithoutGenerics
public boolean checkTypesWithoutGenerics(IEObjectDescription input)
checkTypesWithoutGenerics
protected boolean checkTypesWithoutGenerics(JvmFeatureDescription featureDescription,
JvmExecutable executable,
java.util.List<XExpression> actualArguments)
doCheck
protected <T> T doCheck(IValidatedEObjectDescription input,
com.google.inject.Provider<T> validator)
_case
protected java.lang.String _case(java.lang.Object input,
java.lang.Object context,
org.eclipse.emf.ecore.EReference ref,
IValidatedEObjectDescription description)
- Parameters:
input
- the input element (dispatch parameter).context
- the context element (dispatch parameter).ref
- the reference that potentially points from context
to input
(dispatch parameter).description
- the description for the input
(dispatch parameter).
_case
protected java.lang.String _case(JvmConstructor input,
XConstructorCall context,
org.eclipse.emf.ecore.EReference ref,
JvmFeatureDescription jvmFeatureDescription)
- Parameters:
input
- the input element (dispatch parameter).context
- the context element (dispatch parameter).ref
- the reference that potentially points from context
to input
(dispatch parameter).jvmFeatureDescription
- the description for the input
(dispatch parameter).
_case
protected java.lang.String _case(JvmOperation input,
XBinaryOperation context,
org.eclipse.emf.ecore.EReference ref,
JvmFeatureDescription jvmFeatureDescription)
- Parameters:
input
- the input element (dispatch parameter).context
- the context element (dispatch parameter).ref
- the reference that potentially points from context
to input
(dispatch parameter).jvmFeatureDescription
- the description for the input
(dispatch parameter).
_case
protected java.lang.String _case(JvmOperation input,
XAssignment context,
org.eclipse.emf.ecore.EReference ref,
JvmFeatureDescription jvmFeatureDescription)
- Parameters:
input
- the input element (dispatch parameter).context
- the context element (dispatch parameter).ref
- the reference that potentially points from context
to input
(dispatch parameter).jvmFeatureDescription
- the description for the input
(dispatch parameter).
_case
protected java.lang.String _case(JvmField input,
XAssignment context,
org.eclipse.emf.ecore.EReference ref,
JvmFeatureDescription jvmFeatureDescription)
- Parameters:
input
- the input element (dispatch parameter).context
- the context element (dispatch parameter).ref
- the reference that potentially points from context
to input
(dispatch parameter).jvmFeatureDescription
- the description for the input
(dispatch parameter).
_case
protected java.lang.String _case(JvmField input,
XMemberFeatureCall context,
org.eclipse.emf.ecore.EReference ref,
JvmFeatureDescription jvmFeatureDescription)
- Parameters:
input
- the input element (dispatch parameter).context
- the context element (dispatch parameter).ref
- the reference that potentially points from context
to input
(dispatch parameter).jvmFeatureDescription
- the description for the input
(dispatch parameter).
_case
protected java.lang.String _case(JvmIdentifiableElement input,
XFeatureCall context,
org.eclipse.emf.ecore.EReference ref,
LocalVarDescription description)
- Parameters:
input
- the input element (dispatch parameter).context
- the context element (dispatch parameter).ref
- the reference that potentially points from context
to input
(dispatch parameter).description
- the description for the input
(dispatch parameter).
_case
protected java.lang.String _case(JvmField input,
XFeatureCall context,
org.eclipse.emf.ecore.EReference reference,
JvmFeatureDescription jvmFeatureDescription)
- Parameters:
input
- the input element (dispatch parameter).context
- the context element (dispatch parameter).reference
- the reference that potentially points from context
to input
(dispatch parameter).jvmFeatureDescription
- the description for the input
(dispatch parameter).
_case
protected java.lang.String _case(JvmOperation input,
XMemberFeatureCall context,
org.eclipse.emf.ecore.EReference ref,
JvmFeatureDescription jvmFeatureDescription)
- Parameters:
input
- the input element (dispatch parameter).context
- the context element (dispatch parameter).ref
- the reference that potentially points from context
to input
(dispatch parameter).jvmFeatureDescription
- the description for the input
(dispatch parameter).
_case
protected java.lang.String _case(JvmOperation input,
XFeatureCall context,
org.eclipse.emf.ecore.EReference reference,
JvmFeatureDescription jvmFeatureDescription)
- Parameters:
input
- the input element (dispatch parameter).context
- the context element (dispatch parameter).reference
- the reference that potentially points from context
to input
(dispatch parameter).jvmFeatureDescription
- the description for the input
(dispatch parameter).
_case
protected java.lang.String _case(JvmConstructor input,
XFeatureCall context,
org.eclipse.emf.ecore.EReference reference,
JvmFeatureDescription jvmFeatureDescription)
- Parameters:
input
- the input element (dispatch parameter).context
- the context element (dispatch parameter).reference
- the reference that potentially points from context
to input
(dispatch parameter).jvmFeatureDescription
- the description for the input
(dispatch parameter).
_case
protected java.lang.String _case(JvmOperation input,
XUnaryOperation context,
org.eclipse.emf.ecore.EReference reference,
JvmFeatureDescription jvmFeatureDescription)
- Parameters:
input
- the input element (dispatch parameter).context
- the context element (dispatch parameter).reference
- the reference that potentially points from context
to input
(dispatch parameter).jvmFeatureDescription
- the description for the input
(dispatch parameter).
checkJvmOperation
protected java.lang.String checkJvmOperation(JvmExecutable executable,
XAbstractFeatureCall featureCall,
boolean isExplicitOperationCall,
JvmFeatureDescription jvmFeatureDescription)
areArgumentTypesValid
protected boolean areArgumentTypesValid(JvmExecutable exectuable,
java.util.List<XExpression> arguments,
ITypeArgumentContext typeArgumentContext)
areGenericArgumentTypesValid
protected java.util.List<java.util.EnumSet<TypeConformanceResult.Kind>> areGenericArgumentTypesValid(JvmExecutable exectuable,
java.util.List<XExpression> arguments,
ITypeArgumentContext typeArgumentContext)
isValidNumberOfArguments
protected boolean isValidNumberOfArguments(JvmExecutable executable,
java.util.List<XExpression> arguments)
isSugaredMethodInvocationWithoutParanthesis
protected boolean isSugaredMethodInvocationWithoutParanthesis(JvmFeatureDescription jvmFeatureDescription)