private String getQualifiedSimpleName(JvmIdentifiableElement element) { if (element.eContainer() instanceof JvmType) { return getQualifiedSimpleName((JvmIdentifiableElement) element.eContainer()) + "." + element.getSimpleName(); } return element.getSimpleName(); }
protected boolean isAmbiguousExtensionProvider(AbstractPendingLinkingCandidate<?> right) { XExpression implicitReceiver = getImplicitReceiver(); if (implicitReceiver instanceof XAbstractFeatureCall) { XExpression otherImplicitReceiver = right.description.getImplicitReceiver(); if (otherImplicitReceiver instanceof XAbstractFeatureCall) { JvmIdentifiableElement feature = ((XAbstractFeatureCall) implicitReceiver).getFeature(); JvmIdentifiableElement otherFeature = ((XAbstractFeatureCall) otherImplicitReceiver).getFeature(); // e.g. two local extension variables in same block if (feature.eContainer() == otherFeature.eContainer()) { return true; } } } return false; }
public boolean isOperatorFromExtension(XAbstractFeatureCall featureCall, String concreteSyntax, QualifiedName operatorSymbol, Class<?> definingExtensionClass) { if(!equal(concreteSyntax, operatorSymbol.getLastSegment())) return false; List<QualifiedName> methodNames = getMethodNames(featureCall, operatorSymbol); JvmDeclaredType definingJvmType = (JvmDeclaredType) typeReferences.findDeclaredType(definingExtensionClass, featureCall); if (definingJvmType == null) return false; JvmIdentifiableElement feature = featureCall.getFeature(); if (definingJvmType != feature.eContainer()) { return false; } for (QualifiedName methodName : methodNames) { if (methodName.getLastSegment().equals(feature.getSimpleName())) { return true; } } return false; }
@Override protected CandidateCompareResult getExpectedTypeCompareResultOther(AbstractPendingLinkingCandidate<?> right) { if (!(right instanceof FeatureLinkingCandidate) || getState().isIgnored(IssueCodes.SUSPICIOUSLY_OVERLOADED_FEATURE)) return CandidateCompareResult.OTHER; FeatureLinkingCandidate casted = (FeatureLinkingCandidate) right; XExpression otherImplicitReceiver = casted.getImplicitReceiver(); if (otherImplicitReceiver != null) { if (isStatic() == casted.isStatic()) { if (otherImplicitReceiver instanceof XAbstractFeatureCall && getImplicitReceiver() instanceof XAbstractFeatureCall) { JvmIdentifiableElement otherImplicitReceiverFeature = ((XAbstractFeatureCall) otherImplicitReceiver).getFeature(); if (otherImplicitReceiverFeature != ((XAbstractFeatureCall) getImplicitReceiver()).getFeature()) return CandidateCompareResult.SUSPICIOUS_OTHER; } } } else { if (isStatic() && casted.isStatic()) { JvmIdentifiableElement otherFeature = casted.getFeature(); if (getFeature().eContainer() != otherFeature.eContainer() && otherFeature.eResource() == getExpression().eResource()) { if (EcoreUtil.isAncestor(otherFeature.eContainer(), getFeature())) { return CandidateCompareResult.SUSPICIOUS_OTHER; } } } } return CandidateCompareResult.OTHER; }
EObject featureOwner = getFeature().eContainer(); String message = String.format("Cannot make a static reference to the non-static %1$s %2$s%3$s", getFeatureTypeName(),