Class OverrideHelper
- java.lang.Object
-
- org.eclipse.xtext.xbase.typesystem.override.OverrideHelper
-
public class OverrideHelper extends java.lang.ObjectUtilities to deal with overridden or implemented operations.
-
-
Constructor Summary
Constructors Constructor Description OverrideHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TypeParameterSubstitutor<?>createSubstitutor(ITypeReferenceOwner owner, LightweightTypeReference declaringType)org.eclipse.xtext.common.types.JvmOperationfindOverriddenOperation(org.eclipse.xtext.common.types.JvmOperation operation)protected org.eclipse.xtext.common.types.JvmOperationfindOverriddenOperation(org.eclipse.xtext.common.types.JvmOperation operation, LightweightTypeReference declaringType, TypeParameterSubstitutor<?> substitutor, ITypeReferenceOwner owner, IVisibilityHelper visibilityHelper)ResolvedFeaturesgetResolvedFeatures(org.eclipse.xtext.common.types.JvmDeclaredType type)Returns the resolved features that are defined in the giventypeand its supertypes.ResolvedFeaturesgetResolvedFeatures(org.eclipse.xtext.common.types.JvmDeclaredType type, org.eclipse.xtext.util.JavaVersion targetVersion)Returns the resolved features targeting a specific Java version in order to support new language features.ResolvedFeaturesgetResolvedFeatures(org.eclipse.xtext.common.types.JvmTypeReference contextType)Returns the resolved features that are defined in the givencontext typeand its supertypes.ResolvedFeaturesgetResolvedFeatures(org.eclipse.xtext.common.types.JvmTypeReference contextType, org.eclipse.xtext.util.JavaVersion targetVersion)Returns the resolved features targeting a specific Java version in order to support new language features.ResolvedFeaturesgetResolvedFeatures(LightweightTypeReference contextType)Returns the resolved features that are defined in the givencontext typeand its supertypes.ResolvedFeaturesgetResolvedFeatures(LightweightTypeReference contextType, org.eclipse.xtext.util.JavaVersion targetVersion)Returns the resolved features targeting a specific Java version in order to support new language features.LightweightTypeReferencegetReturnTypeOfOverriddenOperation(org.eclipse.xtext.common.types.JvmOperation operation, ITypeReferenceOwner owner, IVisibilityHelper visibilityHelper)Returnsnullif the given operation declares it's own return type or if it does not override another operation.LightweightTypeReferencegetReturnTypeOfOverriddenOperation(org.eclipse.xtext.common.types.JvmOperation operation, LightweightTypeReference context)Returnsnullif the given operation declares it's own return type or if it does not override another operation.protected booleanisMatchesSignature(org.eclipse.xtext.common.types.JvmFormalParameter parameter, org.eclipse.xtext.common.types.JvmFormalParameter candidateParameter, TypeParameterSubstitutor<?> substitutor, ITypeReferenceOwner owner)
-
-
-
Method Detail
-
getReturnTypeOfOverriddenOperation
public LightweightTypeReference getReturnTypeOfOverriddenOperation(org.eclipse.xtext.common.types.JvmOperation operation, ITypeReferenceOwner owner, IVisibilityHelper visibilityHelper)
Returnsnullif the given operation declares it's own return type or if it does not override another operation. TODO support this case:interface I { String m() String m2() } class A { CharSequence m() int m2() } class B extends A implements I { m() will expect String since this is the best choice m2() will expect int since this is actually overridden and not compatible to String from I#m2 }
-
getReturnTypeOfOverriddenOperation
public LightweightTypeReference getReturnTypeOfOverriddenOperation(org.eclipse.xtext.common.types.JvmOperation operation, LightweightTypeReference context)
Returnsnullif the given operation declares it's own return type or if it does not override another operation. TODO support this case:interface I { String m() String m2() } class A { CharSequence m() int m2() } class B extends A implements I { m() will expect String since this is the best choice m2() will expect int since this is actually overridden and not compatible to String from I#m2 }
-
findOverriddenOperation
protected org.eclipse.xtext.common.types.JvmOperation findOverriddenOperation(org.eclipse.xtext.common.types.JvmOperation operation, LightweightTypeReference declaringType, TypeParameterSubstitutor<?> substitutor, ITypeReferenceOwner owner, IVisibilityHelper visibilityHelper)
-
isMatchesSignature
protected boolean isMatchesSignature(org.eclipse.xtext.common.types.JvmFormalParameter parameter, org.eclipse.xtext.common.types.JvmFormalParameter candidateParameter, TypeParameterSubstitutor<?> substitutor, ITypeReferenceOwner owner)
-
createSubstitutor
protected TypeParameterSubstitutor<?> createSubstitutor(ITypeReferenceOwner owner, LightweightTypeReference declaringType)
-
findOverriddenOperation
public org.eclipse.xtext.common.types.JvmOperation findOverriddenOperation(org.eclipse.xtext.common.types.JvmOperation operation)
-
getResolvedFeatures
public ResolvedFeatures getResolvedFeatures(org.eclipse.xtext.common.types.JvmDeclaredType type)
Returns the resolved features that are defined in the giventypeand its supertypes. Considers private methods of super types, too.- Parameters:
type- the type. Has to be contained in a resource.- Returns:
- the resolved features.
-
getResolvedFeatures
public ResolvedFeatures getResolvedFeatures(org.eclipse.xtext.common.types.JvmDeclaredType type, org.eclipse.xtext.util.JavaVersion targetVersion)
Returns the resolved features targeting a specific Java version in order to support new language features.
-
getResolvedFeatures
public ResolvedFeatures getResolvedFeatures(org.eclipse.xtext.common.types.JvmTypeReference contextType)
Returns the resolved features that are defined in the givencontext typeand its supertypes. Considers private methods of super types, too.- Parameters:
contextType- the context type. Has to be contained in a resource.- Returns:
- the resolved features.
-
getResolvedFeatures
public ResolvedFeatures getResolvedFeatures(org.eclipse.xtext.common.types.JvmTypeReference contextType, org.eclipse.xtext.util.JavaVersion targetVersion)
Returns the resolved features targeting a specific Java version in order to support new language features.
-
getResolvedFeatures
public ResolvedFeatures getResolvedFeatures(LightweightTypeReference contextType)
Returns the resolved features that are defined in the givencontext typeand its supertypes. Considers private methods of super types, too.- Returns:
- the resolved features.
-
getResolvedFeatures
public ResolvedFeatures getResolvedFeatures(LightweightTypeReference contextType, org.eclipse.xtext.util.JavaVersion targetVersion)
Returns the resolved features targeting a specific Java version in order to support new language features.
-
-