org.eclipse.xtext.xbase.typing
Class AbstractTypeProvider
java.lang.Object
org.eclipse.xtext.xbase.typing.AbstractTypeProvider
- All Implemented Interfaces:
- ITypeProvider
- Direct Known Subclasses:
- XbaseTypeProvider
public abstract class AbstractTypeProvider
- extends java.lang.Object
- implements ITypeProvider
- Author:
- Sven Efftinge - Initial contribution and API
Method Summary |
protected void |
_earlyExits(org.eclipse.emf.ecore.EObject expr,
AbstractTypeProvider.EarlyExitAcceptor acceptor)
|
protected void |
_earlyExits(JvmTypeReference ref,
AbstractTypeProvider.EarlyExitAcceptor a)
|
protected void |
_earlyExits(java.lang.Void expr,
AbstractTypeProvider.EarlyExitAcceptor a)
|
protected JvmTypeReference |
_expectedType(org.eclipse.emf.ecore.EObject container,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_type(XExpression expression,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_typeForIdentifiable(JvmIdentifiableElement identifiable,
boolean rawType)
|
protected void |
checkIsSingelton()
|
protected
|
doGetType(java.lang.String key,
T object,
boolean rawType,
org.eclipse.xtext.xbase.typing.AbstractTypeProvider.CyclicHandlingSupport<T> typeComputer)
|
protected JvmTypeReference |
expectedType(org.eclipse.emf.ecore.EObject container,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
JvmTypeReference |
getCommonReturnType(XExpression expression,
boolean assumeImplicitReturnExpression)
The return type of an expression is the common super type of all types used within a return expression. |
protected JvmConstructor |
getConstructor(XConstructorCall expr)
|
protected JvmConstructor |
getConstructor(XConstructorCall expr,
boolean resolve)
|
protected Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,java.lang.Integer> |
getContainingInfo(XExpression obj)
|
protected java.lang.String |
getDebugIndentation(boolean rawType)
|
JvmTypeReference |
getExpectedType(XExpression expression)
Return the resolved expected type of the given expression. |
JvmTypeReference |
getExpectedType(XExpression expression,
boolean rawType)
|
protected JvmIdentifiableElement |
getFeature(XAbstractFeatureCall expr)
|
protected JvmIdentifiableElement |
getFeature(XAbstractFeatureCall expr,
boolean resolve)
|
protected org.eclipse.emf.ecore.EObject |
getLogicalOrRealContainer(org.eclipse.emf.ecore.EObject obj)
|
protected
|
getLogicalOrRealContainer(org.eclipse.emf.ecore.EObject obj,
java.lang.Class<T> type)
|
protected JvmTypeParameterDeclarator |
getNearestTypeParameterDeclarator(org.eclipse.emf.ecore.EObject obj)
|
java.lang.Iterable<JvmTypeReference> |
getThrownExceptionTypes(XExpression expression)
returns all exception types, thrown within the given expression. |
JvmTypeReference |
getType(XExpression expression)
Return the resolved type of the given expression. |
JvmTypeReference |
getType(XExpression expression,
boolean rawType)
|
JvmTypeReference |
getType(XExpression expression,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected TypeArgumentContextProvider |
getTypeArgumentContextProvider()
|
protected TypeConformanceComputer |
getTypeConformanceComputer()
|
JvmTypeReference |
getTypeForIdentifiable(JvmIdentifiableElement identifiableElement)
Return the resolved type of the element. |
JvmTypeReference |
getTypeForIdentifiable(JvmIdentifiableElement identifiableElement,
boolean rawType)
|
protected TypeReferences |
getTypeReferences()
|
protected JvmTypeReference |
handleCycleGetExpectedType(XExpression expression,
boolean rawType)
|
protected JvmTypeReference |
handleCycleGetTypeForIdentifiable(JvmIdentifiableElement identifiableElement,
boolean rawType)
|
protected JvmTypeReference |
handleCyclicGetType(XExpression expression,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected void |
internalCollectEarlyExits(org.eclipse.emf.ecore.EObject expr,
AbstractTypeProvider.EarlyExitAcceptor acceptor)
|
protected boolean |
isDeclaratorOf(JvmTypeParameterDeclarator declarator,
JvmTypeParameter param)
|
protected boolean |
isResolved(JvmTypeReference reference,
JvmTypeParameterDeclarator declarator,
boolean rawType)
|
protected boolean |
isResolved(JvmTypeReference reference,
JvmTypeParameterDeclarator declarator,
boolean rawType,
boolean allowAnyType,
java.util.Set<JvmTypeReference> visited)
|
protected JvmTypeReference |
type(XExpression expression,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
typeForIdentifiable(JvmIdentifiableElement identifiable,
boolean rawType)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getType
protected org.eclipse.xtext.xbase.typing.AbstractTypeProvider.CyclicHandlingSupport<Pair<XExpression,JvmTypeReference>> getType
getExpectedType
protected org.eclipse.xtext.xbase.typing.AbstractTypeProvider.CyclicHandlingSupport<XExpression> getExpectedType
getTypeForIdentifiable
protected org.eclipse.xtext.xbase.typing.AbstractTypeProvider.CyclicHandlingSupport<JvmIdentifiableElement> getTypeForIdentifiable
AbstractTypeProvider
public AbstractTypeProvider()
checkIsSingelton
protected void checkIsSingelton()
isResolved
protected boolean isResolved(JvmTypeReference reference,
JvmTypeParameterDeclarator declarator,
boolean rawType)
isResolved
protected boolean isResolved(JvmTypeReference reference,
JvmTypeParameterDeclarator declarator,
boolean rawType,
boolean allowAnyType,
java.util.Set<JvmTypeReference> visited)
getNearestTypeParameterDeclarator
protected JvmTypeParameterDeclarator getNearestTypeParameterDeclarator(org.eclipse.emf.ecore.EObject obj)
getLogicalOrRealContainer
protected org.eclipse.emf.ecore.EObject getLogicalOrRealContainer(org.eclipse.emf.ecore.EObject obj)
getLogicalOrRealContainer
protected <T> T getLogicalOrRealContainer(org.eclipse.emf.ecore.EObject obj,
java.lang.Class<T> type)
isDeclaratorOf
protected boolean isDeclaratorOf(JvmTypeParameterDeclarator declarator,
JvmTypeParameter param)
_type
protected JvmTypeReference _type(XExpression expression,
JvmTypeReference rawExpectation,
boolean rawType)
getFeature
protected JvmIdentifiableElement getFeature(XAbstractFeatureCall expr,
boolean resolve)
getFeature
protected JvmIdentifiableElement getFeature(XAbstractFeatureCall expr)
getConstructor
protected JvmConstructor getConstructor(XConstructorCall expr,
boolean resolve)
getConstructor
protected JvmConstructor getConstructor(XConstructorCall expr)
type
protected JvmTypeReference type(XExpression expression,
JvmTypeReference rawExpectation,
boolean rawType)
getDebugIndentation
protected java.lang.String getDebugIndentation(boolean rawType)
doGetType
protected <T> JvmTypeReference doGetType(java.lang.String key,
T object,
boolean rawType,
org.eclipse.xtext.xbase.typing.AbstractTypeProvider.CyclicHandlingSupport<T> typeComputer)
getType
public JvmTypeReference getType(XExpression expression)
- Description copied from interface:
ITypeProvider
- Return the resolved type of the given expression. Same as
getType(expression, false
.
- Specified by:
getType
in interface ITypeProvider
- Parameters:
expression
- the expression. May not be null
.
- Returns:
- the fully-resolved type of the
XExpression
, if a correct, fully-linkable model is given.
null
indicates a problem during resolution.
getType
public JvmTypeReference getType(XExpression expression,
boolean rawType)
- Specified by:
getType
in interface ITypeProvider
- Parameters:
expression
- the expression. May not be null
.rawType
- true
if the raw type is sufficient.
- Returns:
- the fully-resolved type of the
XExpression
, if a correct, fully-linkable model is given.
null
indicates a problem during resolution.
getType
public JvmTypeReference getType(XExpression expression,
JvmTypeReference rawExpectation,
boolean rawType)
- Specified by:
getType
in interface ITypeProvider
- Parameters:
expression
- the expression. May not be null
.rawType
- true
if the raw type is sufficient.
- Returns:
- the fully-resolved type of the
XExpression
, if a correct, fully-linkable model is given.
null
indicates a problem during resolution.
handleCyclicGetType
protected JvmTypeReference handleCyclicGetType(XExpression expression,
JvmTypeReference rawExpectation,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(org.eclipse.emf.ecore.EObject container,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
expectedType
protected JvmTypeReference expectedType(org.eclipse.emf.ecore.EObject container,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
getExpectedType
public JvmTypeReference getExpectedType(XExpression expression)
- Description copied from interface:
ITypeProvider
- Return the resolved expected type of the given expression.
Same as
getExpectedType(expression, false
.
- Specified by:
getExpectedType
in interface ITypeProvider
- Parameters:
expression
- the expression. May not be null
.
- Returns:
- the fully-resolved expected type of the given expression, if a correct, fully-linkable model is given.
Returns
null
if no special type is expected
getExpectedType
public JvmTypeReference getExpectedType(XExpression expression,
boolean rawType)
- Specified by:
getExpectedType
in interface ITypeProvider
- Parameters:
expression
- the expression. May not be null
.rawType
- true
if the raw type is sufficient.
- Returns:
- the fully-resolved expected type of the given expression, if a correct, fully-linkable model is given.
Returns
null
if no special type is expected
handleCycleGetExpectedType
protected JvmTypeReference handleCycleGetExpectedType(XExpression expression,
boolean rawType)
getContainingInfo
protected Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EReference,java.lang.Integer> getContainingInfo(XExpression obj)
_typeForIdentifiable
protected JvmTypeReference _typeForIdentifiable(JvmIdentifiableElement identifiable,
boolean rawType)
typeForIdentifiable
protected JvmTypeReference typeForIdentifiable(JvmIdentifiableElement identifiable,
boolean rawType)
getTypeForIdentifiable
public JvmTypeReference getTypeForIdentifiable(JvmIdentifiableElement identifiableElement)
- Description copied from interface:
ITypeProvider
- Return the resolved type of the element. Same as
getTypeForIdentifiable(identifiableElement, false
.
- Specified by:
getTypeForIdentifiable
in interface ITypeProvider
- Parameters:
identifiableElement
- the identifiable element. May not be null
.
- Returns:
- the fully-resolved type of the
JvmIdentifiableElement
, if a correct, fully-linkable model is
given. null
indicates a problem during resolution. given.
getTypeForIdentifiable
public JvmTypeReference getTypeForIdentifiable(JvmIdentifiableElement identifiableElement,
boolean rawType)
- Specified by:
getTypeForIdentifiable
in interface ITypeProvider
- Parameters:
identifiableElement
- the identifiable element. May not be null
.rawType
- true
if the raw type is sufficient.
- Returns:
- the fully-resolved type of the
JvmIdentifiableElement
, if a correct, fully-linkable model is
given. null
indicates a problem during resolution. given.
handleCycleGetTypeForIdentifiable
protected JvmTypeReference handleCycleGetTypeForIdentifiable(JvmIdentifiableElement identifiableElement,
boolean rawType)
getCommonReturnType
public JvmTypeReference getCommonReturnType(XExpression expression,
boolean assumeImplicitReturnExpression)
- Description copied from interface:
ITypeProvider
- The return type of an expression is the common super type of all types used within a return expression.
- Specified by:
getCommonReturnType
in interface ITypeProvider
- Parameters:
expression
- May not be null
.assumeImplicitReturnExpression
- indicating whether an implicit return expression should be assumed
- Returns:
- the fully-resolved common return type of the
XExpression
, if a correct, fully-linkable model is
given. null
indicates a problem during computation, the primitive void indicates that no return expression was found.
getThrownExceptionTypes
public java.lang.Iterable<JvmTypeReference> getThrownExceptionTypes(XExpression expression)
- Description copied from interface:
ITypeProvider
- returns all exception types, thrown within the given expression.
This includes explicitly declared
RuntimeException
s as well.
- Specified by:
getThrownExceptionTypes
in interface ITypeProvider
- Parameters:
expression
- May not be null
.
- Returns:
- the iterable of fully-resolved exception types, if a correct, fully-linkable model is
given.
null
indicates a problem during computation, an empty iterable means no thrown exceptions were found.
internalCollectEarlyExits
protected void internalCollectEarlyExits(org.eclipse.emf.ecore.EObject expr,
AbstractTypeProvider.EarlyExitAcceptor acceptor)
_earlyExits
protected void _earlyExits(java.lang.Void expr,
AbstractTypeProvider.EarlyExitAcceptor a)
_earlyExits
protected void _earlyExits(JvmTypeReference ref,
AbstractTypeProvider.EarlyExitAcceptor a)
_earlyExits
protected void _earlyExits(org.eclipse.emf.ecore.EObject expr,
AbstractTypeProvider.EarlyExitAcceptor acceptor)
getTypeConformanceComputer
protected TypeConformanceComputer getTypeConformanceComputer()
getTypeReferences
protected TypeReferences getTypeReferences()
getTypeArgumentContextProvider
protected TypeArgumentContextProvider getTypeArgumentContextProvider()