Class AbstractResolvedOperation

    • 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: IResolvedOperation
        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 of D#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 for C#method will be I1#method, I2#method, I5#method thus it will not contain and of I4#method. Only methods that would be successfully checked for IResolvedOperation.isOverridingOrImplementing(JvmOperation) will be returned.
        Specified by:
        getOverriddenAndImplementedMethods in interface IResolvedOperation
        Returns:
        a list of overridden and implemented methods.
        See Also:
        IResolvedOperation.getOverriddenAndImplementedMethodCandidates()
      • getResolvedTypeParameters

        public java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter> getResolvedTypeParameters()
        Description copied from interface: IResolvedOperation
        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 was C#method and the current handle points to I#method, the type parameters will contain V instead of T. 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 method I#method in the context of class C will yield an empty list of resolved type parameters even though it declares T.
        Specified by:
        getResolvedTypeParameters in interface IResolvedOperation
        Returns:
        the list of resolved type parameters.
      • getResolvedTypeParameterConstraints

        public java.util.List<LightweightTypeReference> getResolvedTypeParameterConstraints​(int idx)
                                                                                     throws java.lang.IndexOutOfBoundsException
        Description copied from interface: IResolvedOperation
        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 of I#method<V> in the context of class C is CharSequence.
        Specified by:
        getResolvedTypeParameterConstraints in interface IResolvedOperation
        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)
      • isResolvedTypeParameter

        protected boolean isResolvedTypeParameter​(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter)
        Description copied from class: AbstractResolvedFeature
        Allows to refuse a certain type parameter to be substituted.
        Overrides:
        isResolvedTypeParameter in class AbstractResolvedFeature<org.eclipse.xtext.common.types.JvmOperation>
        Parameters:
        typeParameter - the type parameter that should be substituted.
        Returns:
        false if the parameter may be substituted. true if it should be preserved.