Interface IResolvedOperation
-
- All Superinterfaces:
IResolvedExecutable
,IResolvedFeature
- All Known Implementing Classes:
AbstractResolvedOperation
,BottomResolvedOperation
,ConflictingDefaultOperation
,InvokedResolvedOperation
,ResolvedOperationInHierarchy
public interface IResolvedOperation extends IResolvedExecutable
Resolved representation of aJvmOperation
. Parameter types, return type, declared exceptions and type arguments are put into the context of a specific declaring reference, e.g.List#add(Object)
becomesList#add(String)
in the context of anArrayList<String>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IResolvedOperation
getAsBottom()
Returns the current method as abottom method
.org.eclipse.xtext.common.types.JvmOperation
getDeclaration()
Returns the declared operation that is resolved.java.util.List<LightweightTypeReference>
getIllegallyDeclaredExceptions()
Returns the list of exceptions that are declared in this operation but do not match the super implementation.java.util.List<org.eclipse.xtext.common.types.JvmOperation>
getOverriddenAndImplementedMethodCandidates()
Returns the inherited methods with the same simple name as this method.java.util.List<IResolvedOperation>
getOverriddenAndImplementedMethods()
Returns overridden and implemented methods for this method.IResolvedOperation
getOverriddenMethod()
Returns the overridden method, if any.IOverrideCheckResult
getOverrideCheckResult()
The override check result that is associated with this operation.LightweightTypeReference
getResolvedReturnType()
Returns the resolved return types in the current context.java.util.List<LightweightTypeReference>
getResolvedTypeParameterConstraints(int idx)
Returns the list of resolved constraints for the given type parameter index.java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter>
getResolvedTypeParameters()
Returns the resolved type parameters for a given operation.boolean
isBottomInContext()
Returnstrue
if the bottom of this resolved method hierachy, which that there is no specialization of this method in the current context.IOverrideCheckResult
isOverridingOrImplementing(org.eclipse.xtext.common.types.JvmOperation operation)
Transitively check whether this operation if implementing or overriding the given operation.-
Methods inherited from interface org.eclipse.xtext.xbase.typesystem.override.IResolvedExecutable
getResolvedExceptions, getResolvedParameterTypes, getTypeParameters
-
Methods inherited from interface org.eclipse.xtext.xbase.typesystem.override.IResolvedFeature
getContextType, getResolvedDeclarator, getResolvedErasureSignature, getResolvedSignature, getSimpleSignature
-
-
-
-
Method Detail
-
getOverriddenAndImplementedMethods
java.util.List<IResolvedOperation> getOverriddenAndImplementedMethods()
Returns overridden and implemented methods for this method. Example:interface I { void method() } abstract class C { abstract void method() } class D extends C implements I { void method() {} }
The resolved representation ofD#method
will return a list with two elements:C#method, I#method
. The first element in the list is always the overridden implementation or the inherited abstract method from the superclass, if any. Thus the list is sorted. The elements in the list are not transitively collected.interface I1 { void method() } interface I2 { void method() } interface I3 extends I1, I2 { } interface I4 { void method() } interface I5 extends I4 { void method() } class C implements I5, I3 { void method() }
The list of resolved inherited methods forC#method
will beI1#method, I2#method, I5#method
thus it will not contain and ofI4#method
. Only methods that would be successfully checked forisOverridingOrImplementing(JvmOperation)
will be returned.- Returns:
- a list of overridden and implemented methods.
- See Also:
getOverriddenAndImplementedMethodCandidates()
-
getOverriddenMethod
IResolvedOperation getOverriddenMethod()
Returns the overridden method, if any. A candidate is considered to be the overridden method if this method itself is not abstract, the candidate is contained in the list ofoverridden and implemented methods
, and the candidate is not abstract. It may happen that two methods are overridden, e.g.class A<T> { void m(T t) { } void m(String s) { } } class B extends A<String> { @Override void m(String s) { } }
In that case, the first match is returned thus it depends on the order in the super type.- Returns:
- a super implementation or
null
if none. - See Also:
getOverriddenAndImplementedMethods()
-
getOverriddenAndImplementedMethodCandidates
java.util.List<org.eclipse.xtext.common.types.JvmOperation> getOverriddenAndImplementedMethodCandidates()
Returns the inherited methods with the same simple name as this method.- Returns:
- a list of methods with the same simple name.
- See Also:
getOverriddenAndImplementedMethods()
,isOverridingOrImplementing(JvmOperation)
-
isOverridingOrImplementing
IOverrideCheckResult isOverridingOrImplementing(org.eclipse.xtext.common.types.JvmOperation operation)
Transitively check whether this operation if implementing or overriding the given operation.- Returns:
- the check result.
-
getOverrideCheckResult
IOverrideCheckResult getOverrideCheckResult()
The override check result that is associated with this operation. If this is abottom
, thedetails
will only include thecurrent
detail. In other cases, the actual information about the relationship of the hierarchy function to its specialization in thecontext
is returned.- Returns:
- the computed check result
-
getIllegallyDeclaredExceptions
java.util.List<LightweightTypeReference> getIllegallyDeclaredExceptions()
Returns the list of exceptions that are declared in this operation but do not match the super implementation.- Returns:
- the list of illegally declared exceptions.
-
getResolvedTypeParameters
java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter> getResolvedTypeParameters()
Returns the resolved type parameters for a given operation. If this operation represents an overridden operation, the type parameters are the ones that are declared on the initially requested resolved operation. Consider the following interface and implementation class:interface I { <T extends CharSequence> T method() } class C implements I { public <V extends CharSequence> V method() { return null; } }
If the initially requested method wasC#method
and the current handle points toI#method
, the type parameters will containV
instead ofT
. The list may contain a different number of type parameters than the actual operation.interface I { <T> T method() } class C implements I { public String method() { return null; } }
The methodI#method
in the context of classC
will yield an empty list of resolved type parameters even though itdeclares
T
.- Returns:
- the list of resolved type parameters.
-
getResolvedTypeParameterConstraints
java.util.List<LightweightTypeReference> getResolvedTypeParameterConstraints(int idx) throws java.lang.IndexOutOfBoundsException
Returns the list of resolved constraints for the given type parameter index. Consider the following example:interface I<T> { <V extends T> V method(Class<? extends V> c); } abstract class C implements I<CharSequence> { }
The resolved constraint ofI#method<V>
in the context of classC
isCharSequence
.- Parameters:
idx
- the index of the considered type parameter.- Returns:
- a list of resolved upper bound constraints for the type parameter at index
idx
. - Throws:
java.lang.IndexOutOfBoundsException
- if the idx does not match the resolved type parameter list.- See Also:
getResolvedTypeParameterConstraints(int)
-
getResolvedReturnType
LightweightTypeReference getResolvedReturnType()
Returns the resolved return types in the current context. That is, all free type variables are bound according to the bottom of this method hierarchy.- Returns:
- the return type.
- See Also:
IResolvedFeature.getContextType()
,getResolvedTypeParameters()
-
isBottomInContext
boolean isBottomInContext()
Returnstrue
if the bottom of this resolved method hierachy, which that there is no specialization of this method in the current context.interface I1 { void m() } interface I2 { void m() } abstract class C implements I1, I2 { }
If you get hold on the abstract methodI1#m
orI2#m
both will returntrue
.- See Also:
getAsBottom()
-
getAsBottom
IResolvedOperation getAsBottom()
Returns the current method as abottom method
. That implies, that thecontext type
of the result is the resolved declarator of the currentdeclaration
.interface I<T> { <K> T m(K k); } class C implements I<V< { <U> V m(U u); }
If this resolved method representsI#m
in the context of classC
(thus the return type will beV
and theresolved type parameters
includeU
,getAsBottom()
will yieldI#m
in the context ofI<V<
. That is, the return type is still resolved toV
. Nevertheless, the local type parameter ofI#m
is now resolved to its declarationK
. This implies that the parameter type is no longer resolved toU
butK
instead. The bottom representation can be used to create descriptive error messages. If the current resolved method is already a bottom type, it is returned itself.- Returns:
- the current operation as bottom type.
- See Also:
isBottomInContext()
-
getDeclaration
org.eclipse.xtext.common.types.JvmOperation getDeclaration()
Returns the declared operation that is resolved.- Specified by:
getDeclaration
in interfaceIResolvedExecutable
- Specified by:
getDeclaration
in interfaceIResolvedFeature
- Returns:
- the declaration.
-
-