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,
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)
|
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 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 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)
|
protected TypeArgumentContextProvider |
getTypeArgumentContextProvider()
|
protected XbaseTypeConformanceComputer |
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,
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)
|
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<XExpression> 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)
getNearestTypeParameterDeclarator
protected JvmTypeParameterDeclarator getNearestTypeParameterDeclarator(org.eclipse.emf.ecore.EObject obj)
isDeclaratorOf
protected boolean isDeclaratorOf(JvmTypeParameterDeclarator declarator,
JvmTypeParameter param)
_type
protected JvmTypeReference _type(XExpression expression,
boolean rawType)
getDebugIndentation
protected java.lang.String getDebugIndentation(boolean rawType)
doGetType
protected <T extends org.eclipse.emf.ecore.EObject> 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.
handleCyclicGetType
protected JvmTypeReference handleCyclicGetType(XExpression expression,
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)
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 XbaseTypeConformanceComputer getTypeConformanceComputer()
getTypeReferences
protected TypeReferences getTypeReferences()
getTypeArgumentContextProvider
protected TypeArgumentContextProvider getTypeArgumentContextProvider()