Class AbstractPendingLinkingCandidate<Expression extends XExpression>

    • Field Detail

      • description

        protected final IIdentifiableElementDescription description
        The backing feature descriptions. It carries the information about the potentially resolved feature, e.g. the implicit receiver, whether it's an extension and more.
    • Method Detail

      • setAllDescriptionsHash

        protected void setAllDescriptionsHash​(com.google.common.hash.HashCode hashCode)
        Since:
        2.30
      • getAllDescriptionsHash

        protected com.google.common.hash.HashCode getAllDescriptionsHash()
        Since:
        2.30
      • getFeatureTypeName

        protected abstract java.lang.String getFeatureTypeName()
        Returns the name of the feature type, e.g. a feature of type JvmOperation may return method, a XVariableDeclaration may identify itself as local variable.
      • getArgumentTypesAsString

        protected java.lang.String getArgumentTypesAsString()
        Returns the resolved string representation of the argument types. The simple names of the types are used. The string representation includes the parenthesis.
      • getFeatureParameterTypesAsString

        protected java.lang.String getFeatureParameterTypesAsString()
        Returns the unresolved string representation of the parameter types of the feature. The simple names of the types are used. The string representation includes the parenthesis.
      • getFeatureParameterTypesAsString

        protected java.lang.String getFeatureParameterTypesAsString​(org.eclipse.xtext.common.types.JvmExecutable executable)
      • getFeatureTypeParametersAsString

        protected java.lang.String getFeatureTypeParametersAsString​(boolean showBounds)
        Returns the unresolved string representation of the unresolved type parameters of the feature. The simple names of the type bounds are used. The string representation includes the angle brackets.
      • getTypeParameterAsString

        protected java.lang.String getTypeParameterAsString​(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter)
        Returns the unresolved string representation of the given type parameter. The simple names of the type bounds are used. The string representation includes the bounds, except for the upper bound Object.
      • getTypeArgumentsAsString

        protected java.lang.String getTypeArgumentsAsString​(java.util.List<? extends LightweightTypeReference> typeArguments)
        Returns the resolved string representation of the type arguments. The simple names of the types are used. The string representation includes the angle brackets.
      • validate

        public boolean validate​(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
        Validates this linking candidate and adds respective diagnostics to the given queue. This checks the following criteria:
        1. visibility,
        2. arity,
        3. type arity,
        4. type arguments,
        5. unhandled excptions,
        Returns:
        true if further validation should be performed.
      • validateVisibility

        protected boolean validateVisibility​(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
      • getSimpleFeatureName

        protected java.lang.String getSimpleFeatureName()
      • getDefaultValidationFeature

        protected org.eclipse.emf.ecore.EReference getDefaultValidationFeature()
      • getInvalidArgumentsValidationFeature

        protected org.eclipse.emf.ecore.EReference getInvalidArgumentsValidationFeature()
      • validateArity

        protected boolean validateArity​(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
      • validateTypeArity

        protected boolean validateTypeArity​(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
      • validateTypeArgumentConformance

        protected boolean validateTypeArgumentConformance​(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
      • validateUnhandledExceptions

        protected boolean validateUnhandledExceptions​(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
      • validateUnhandledExceptions

        protected boolean validateUnhandledExceptions​(org.eclipse.xtext.common.types.JvmExecutable executable,
                                                      org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> result)
      • getUnhandledExceptionSeverity

        protected org.eclipse.xtext.diagnostics.Severity getUnhandledExceptionSeverity​(org.eclipse.xtext.common.types.JvmExecutable executable)
        Obtain the currently applicable severity for uncaught exceptions. Sneaky throw techniques cannot be applied to delegating constructor calls. Therefore it's possible to raise the severity for them by checking the linked executable.
        Parameters:
        executable - the executable that declares the exception.
      • getSeverity

        protected org.eclipse.xtext.diagnostics.Severity getSeverity​(java.lang.String issueCode)
        Returns the current severity for the given issue code.
      • isDefiniteEarlyExit

        protected boolean isDefiniteEarlyExit​(XExpression expression)
      • getSyntacticArguments

        protected java.util.List<XExpression> getSyntacticArguments()
      • getPreferredCandidate

        public ILinkingCandidate getPreferredCandidate​(ILinkingCandidate other)
        Returns the best candidate considering the this and the given other candidate. The result is not necessarily this or the other, but may also be a third instance, e.g. in order to disambiguate certain error conditions.
      • createSuspiciousLinkingCandidate

        protected ILinkingCandidate createSuspiciousLinkingCandidate​(AbstractPendingLinkingCandidate<?> chosenCandidate)
        Produce a candidate that carries the information about suspicious overload resolution where a member on 'this' wins over a member on 'it'.
        Parameters:
        chosenCandidate - the candidate that was picked.
      • compareTo

        protected CandidateCompareResult compareTo​(AbstractPendingLinkingCandidate<?> right,
                                                   boolean invalid)
        Returns CandidateCompareResult#THIS if this candidate is better, CandidateCompareResult#OTHER if the right candidate was better, CandidateCompareResult#AMBIGUOUS if both candidates are valid but ambiguous or CandidateCompareResult#EQUALLY_INVALID if both candidates are ambiguous but erroneous. The invalid flag indicates if we already know that both candidates are equally invalid.
      • isVisible

        protected boolean isVisible()
      • isVarArgs

        protected boolean isVarArgs()
      • isExtension

        protected boolean isExtension()
      • getTypeArgumentConformanceFailures

        protected int getTypeArgumentConformanceFailures​(org.eclipse.xtext.util.IAcceptor<? super org.eclipse.xtext.diagnostics.AbstractDiagnostic> acceptor)
      • compareByArgumentTypesFlags

        protected CandidateCompareResult compareByArgumentTypesFlags​(AbstractPendingLinkingCandidate<?> other,
                                                                     int leftIdx,
                                                                     int rightIdx,
                                                                     int leftConformance,
                                                                     int rightConformance)
        Compare this linking candidate with the given other candidate at leftIdx and rightIdx respectively. Returns CandidateCompareResult#THIS if this candidate is better, CandidateCompareResult#OTHER if the right candidate was better, CandidateCompareResult#AMBIGUOUS if both candidates are valid but ambiguous or CandidateCompareResult#EQUALLY_INVALID if both candidates are ambiguous but erroneous.
        Parameters:
        other - the other candidate
        leftIdx - the semantic argument index on this candidate
        rightIdx - the semantic argument index on the other candidate
        leftConformance - the computed conformance in this linking candidate
        rightConformance - the computed conformance if the other candidate was chosen
      • compareByArgumentTypes

        protected CandidateCompareResult compareByArgumentTypes​(AbstractPendingLinkingCandidate<?> other,
                                                                int leftBoxing,
                                                                int rightBoxing,
                                                                int leftDemand,
                                                                int rightDemand)
        Compare this linking candidate with the given other candidate at argumentIndex Returns CandidateCompareResult#THIS if this candidate is better, CandidateCompareResult#OTHER if the right candidate was better, CandidateCompareResult#AMBIGUOUS if both candidates are valid but ambiguous or CandidateCompareResult#EQUALLY_INVALID if both candidates are ambiguous but erroneous.
        Parameters:
        other - the other candidate (the rhs of the comparison)
        leftBoxing - the number of required boxing conversions if this candidate was chosen
        rightBoxing - the number of required boxing conversions if the other candidate was chosen
        leftDemand - the number of required demand conversions if this candidate was chosen
        rightDemand - the number of required demand conversions if the other candidate was chosen
      • isPossibleFunctionType

        protected boolean isPossibleFunctionType​(int idx)
        Returns false if the argument expression is a lambda and the expected type of the argument is not a function type or Object. Returns true in all other cases. This serves as a shortcut to rule out decision path's where a method is overloaded and one of the overloads accepts a function type but the other doesn't. In those cases it is not necessary to compute the type of the lamdba expression twice. An example for this pattern is IterableExtensions.filter(Iterable, Class) vs IterableExtensions.filter(Iterable, org.eclipse.xtext.xbase.lib.Functions.Function1).
      • getConformanceFlags

        protected int getConformanceFlags​(int idx,
                                          boolean recompute)
      • isLambdaExpression

        protected boolean isLambdaExpression​(int argumentIdx)
      • getExpectedTypeCompareResultOther

        protected CandidateCompareResult getExpectedTypeCompareResultOther​(AbstractPendingLinkingCandidate<?> other)
        Returns the compare result for the declared parameter types if the given other candidate had won.
        Parameters:
        other - the winner of the comparison.
      • compareByArity

        protected CandidateCompareResult compareByArity​(int leftArityMismatch,
                                                        int rightArityMismatch)
      • getArityMismatch

        public int getArityMismatch()
        Returns the mismatch of actually given arguments and declared parameters. Receivers and staticness of the feature is taken into account, too. The mismatch may either be negative or positive.
      • getTypeArityMismatch

        public int getTypeArityMismatch()
      • resolveLinkingProxy

        protected void resolveLinkingProxy​(org.eclipse.emf.ecore.EReference structuralFeature,
                                           int featureId)
      • getArityMismatch

        protected int getArityMismatch​(org.eclipse.xtext.common.types.JvmExecutable executable,
                                       java.util.List<XExpression> arguments)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object