Class AbstractResolvedOperation
- java.lang.Object
-
- org.eclipse.xtext.xbase.typesystem.override.AbstractResolvedFeature<T>
-
- org.eclipse.xtext.xbase.typesystem.override.AbstractResolvedExecutable<org.eclipse.xtext.common.types.JvmOperation>
-
- org.eclipse.xtext.xbase.typesystem.override.AbstractResolvedOperation
-
- All Implemented Interfaces:
IResolvedExecutable,IResolvedFeature,IResolvedOperation
- Direct Known Subclasses:
BottomResolvedOperation,ResolvedOperationInHierarchy
public abstract class AbstractResolvedOperation extends AbstractResolvedExecutable<org.eclipse.xtext.common.types.JvmOperation> implements IResolvedOperation
Base class for resolved representation of aJvmOperation.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractResolvedOperation(org.eclipse.xtext.common.types.JvmOperation declaration, LightweightTypeReference contextType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ResolvedOperationInHierarchycreateResolvedOperationInHierarchy(org.eclipse.xtext.common.types.JvmOperation candidate, IOverrideCheckResult checkResult)protected abstract BottomResolvedOperationgetBottom()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.IResolvedOperationgetOverriddenMethod()Returns the overridden method, if any.protected OverrideTestergetOverrideTester()LightweightTypeReferencegetResolvedReturnType()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.protected booleanisIllegallyDeclaredException(LightweightTypeReference exception, java.util.List<IResolvedOperation> overriddenAndImplemented)IOverrideCheckResultisOverridingOrImplementing(org.eclipse.xtext.common.types.JvmOperation operation)Transitively check whether this operation if implementing or overriding the given operation.protected booleanisRawTypeInheritance()protected booleanisResolvedTypeParameter(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter)Allows to refuse a certain type parameter to be substituted.-
Methods inherited from class org.eclipse.xtext.xbase.typesystem.override.AbstractResolvedExecutable
getResolvedErasureSignature, getResolvedExceptions, getResolvedParameterTypes, getResolvedSignature, getSimpleSignature, getTypeParameters, toString
-
Methods inherited from class org.eclipse.xtext.xbase.typesystem.override.AbstractResolvedFeature
computeContextTypeParameterMapping, getContextType, getContextTypeParameterMapping, getDeclaration, getResolvedDeclarator, getResolvedReference, getResolvedReferences, getSubstitutor, isResolvedTypeParameter
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
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
-
Methods inherited from interface org.eclipse.xtext.xbase.typesystem.override.IResolvedOperation
getAsBottom, getDeclaration, getOverrideCheckResult, isBottomInContext
-
-
-
-
Constructor Detail
-
AbstractResolvedOperation
protected AbstractResolvedOperation(org.eclipse.xtext.common.types.JvmOperation declaration, LightweightTypeReference contextType)
-
-
Method Detail
-
getOverriddenAndImplementedMethods
public java.util.List<IResolvedOperation> getOverriddenAndImplementedMethods()
Description copied from interface:IResolvedOperationReturns 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#methodwill 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#methodwill beI1#method, I2#method, I5#methodthus it will not contain and ofI4#method. Only methods that would be successfully checked forIResolvedOperation.isOverridingOrImplementing(JvmOperation)will be returned.- Specified by:
getOverriddenAndImplementedMethodsin interfaceIResolvedOperation- Returns:
- a list of overridden and implemented methods.
- See Also:
IResolvedOperation.getOverriddenAndImplementedMethodCandidates()
-
getOverriddenMethod
public IResolvedOperation getOverriddenMethod()
Description copied from interface:IResolvedOperationReturns 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.- Specified by:
getOverriddenMethodin interfaceIResolvedOperation- Returns:
- a super implementation or
nullif none. - See Also:
IResolvedOperation.getOverriddenAndImplementedMethods()
-
getIllegallyDeclaredExceptions
public java.util.List<LightweightTypeReference> getIllegallyDeclaredExceptions()
Description copied from interface:IResolvedOperationReturns the list of exceptions that are declared in this operation but do not match the super implementation.- Specified by:
getIllegallyDeclaredExceptionsin interfaceIResolvedOperation- Returns:
- the list of illegally declared exceptions.
-
isIllegallyDeclaredException
protected boolean isIllegallyDeclaredException(LightweightTypeReference exception, java.util.List<IResolvedOperation> overriddenAndImplemented)
-
createResolvedOperationInHierarchy
protected ResolvedOperationInHierarchy createResolvedOperationInHierarchy(org.eclipse.xtext.common.types.JvmOperation candidate, IOverrideCheckResult checkResult)
-
getOverriddenAndImplementedMethodCandidates
public java.util.List<org.eclipse.xtext.common.types.JvmOperation> getOverriddenAndImplementedMethodCandidates()
Description copied from interface:IResolvedOperationReturns the inherited methods with the same simple name as this method.- Specified by:
getOverriddenAndImplementedMethodCandidatesin interfaceIResolvedOperation- Returns:
- a list of methods with the same simple name.
- See Also:
IResolvedOperation.getOverriddenAndImplementedMethods(),IResolvedOperation.isOverridingOrImplementing(JvmOperation)
-
isOverridingOrImplementing
public IOverrideCheckResult isOverridingOrImplementing(org.eclipse.xtext.common.types.JvmOperation operation)
Description copied from interface:IResolvedOperationTransitively check whether this operation if implementing or overriding the given operation.- Specified by:
isOverridingOrImplementingin interfaceIResolvedOperation- Returns:
- the check result.
-
getResolvedTypeParameters
public java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter> getResolvedTypeParameters()
Description copied from interface:IResolvedOperationReturns 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#methodand the current handle points toI#method, the type parameters will containVinstead 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#methodin the context of classCwill yield an empty list of resolved type parameters even though itdeclaresT.- Specified by:
getResolvedTypeParametersin interfaceIResolvedOperation- Returns:
- the list of resolved type parameters.
-
getResolvedTypeParameterConstraints
public java.util.List<LightweightTypeReference> getResolvedTypeParameterConstraints(int idx) throws java.lang.IndexOutOfBoundsException
Description copied from interface:IResolvedOperationReturns 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 classCisCharSequence.- Specified by:
getResolvedTypeParameterConstraintsin interfaceIResolvedOperation- 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:
IResolvedOperation.getResolvedTypeParameterConstraints(int)
-
getResolvedReturnType
public LightweightTypeReference getResolvedReturnType()
Description copied from interface:IResolvedOperationReturns the resolved return types in the current context. That is, all free type variables are bound according to the bottom of this method hierarchy.- Specified by:
getResolvedReturnTypein interfaceIResolvedOperation- Returns:
- the return type.
- See Also:
IResolvedFeature.getContextType(),IResolvedOperation.getResolvedTypeParameters()
-
isRawTypeInheritance
protected boolean isRawTypeInheritance()
- Overrides:
isRawTypeInheritancein classAbstractResolvedFeature<org.eclipse.xtext.common.types.JvmOperation>
-
isResolvedTypeParameter
protected boolean isResolvedTypeParameter(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter)
Description copied from class:AbstractResolvedFeatureAllows to refuse a certain type parameter to be substituted.- Overrides:
isResolvedTypeParameterin classAbstractResolvedFeature<org.eclipse.xtext.common.types.JvmOperation>- Parameters:
typeParameter- the type parameter that should be substituted.- Returns:
falseif the parameter may be substituted.trueif it should be preserved.
-
getBottom
protected abstract BottomResolvedOperation getBottom()
-
getOverrideTester
protected OverrideTester getOverrideTester()
-
-