Class OverrideHelper


  • public class OverrideHelper
    extends java.lang.Object
    Utilities to deal with overridden or implemented operations.
    • Constructor Detail

      • OverrideHelper

        public OverrideHelper()
    • Method Detail

      • getReturnTypeOfOverriddenOperation

        public LightweightTypeReference getReturnTypeOfOverriddenOperation​(org.eclipse.xtext.common.types.JvmOperation operation,
                                                                           ITypeReferenceOwner owner,
                                                                           IVisibilityHelper visibilityHelper)
        Returns null if 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)
        Returns null if 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
         }
         
      • isMatchesSignature

        protected boolean isMatchesSignature​(org.eclipse.xtext.common.types.JvmFormalParameter parameter,
                                             org.eclipse.xtext.common.types.JvmFormalParameter candidateParameter,
                                             TypeParameterSubstitutor<?> substitutor,
                                             ITypeReferenceOwner owner)
      • 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 given type and 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 given context type and 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 given context type and 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.