message.append(getDeclaratorName(resolvedOperation)); message.append('.'); message.append(exceptionMismatch.get(i).getSimpleSignature());
if(needsNewLine) errorMsg.append("\n- "); errorMsg.append(operation.getSimpleSignature());
EnumSet<OverrideCheckDetails> details = inherited.getOverrideCheckResult().getDetails(); if (details.contains(OverrideCheckDetails.IS_FINAL)) { error("Attempt to override final method " + inherited.getSimpleSignature(), sourceElement, nameFeature(sourceElement), OVERRIDDEN_FINAL); } else if (details.contains(OverrideCheckDetails.REDUCED_VISIBILITY)) { error("Cannot reduce the visibility of the overridden method " + inherited.getSimpleSignature(), sourceElement, nameFeature(sourceElement), OVERRIDE_REDUCES_VISIBILITY); } else if (details.contains(OverrideCheckDetails.EXCEPTION_MISMATCH)) { exceptionMismatch.add(inherited); } else if (details.contains(OverrideCheckDetails.RETURN_MISMATCH)) { error("The return type is incompatible with " + inherited.getSimpleSignature(), sourceElement, returnTypeFeature(sourceElement), INCOMPATIBLE_RETURN_TYPE); } else if (details.contains(OverrideCheckDetails.SYNCHRONIZED_MISMATCH)) { XtendFunction function = (XtendFunction) sourceElement; if (!overrideProblems && !function.isOverride() && !function.isStatic()) { error("The method " + resolved.getSimpleSignature() + " of type " + getDeclaratorName(resolved) + " must use override keyword since it actually overrides a supertype method.", function, XTEND_FUNCTION__NAME, MISSING_OVERRIDE); error("The method " + resolved.getSimpleSignature() + " of type " + getDeclaratorName(resolved) + " shadows the method " + resolved.getSimpleSignature() + " of type " + getDeclaratorName(inherited) + ", but does not override it.", function, XTEND_FUNCTION__NAME, function.getModifiers().indexOf("override"), OBSOLETE_OVERRIDE);
protected void doCheckFunctionOverrides(IResolvedOperation operation, Set<EObject> flaggedOperations) { EObject sourceElement = findPrimarySourceElement(operation); if (sourceElement != null) { List<IResolvedOperation> allInherited = operation.getOverriddenAndImplementedMethods(); if (allInherited.isEmpty()) { if (sourceElement instanceof XtendFunction && flaggedOperations.add(sourceElement)) { XtendFunction function = (XtendFunction) sourceElement; if (function.isOverride()) { error("The method "+ operation.getSimpleSignature() +" of type "+getDeclaratorName(operation.getDeclaration())+" must override a superclass method.", function, XTEND_MEMBER__MODIFIERS, function.getModifiers().indexOf("override"), OBSOLETE_OVERRIDE); } else { for (XAnnotation anno : function.getAnnotations()) { if (anno != null && anno.getAnnotationType() != null && Override.class.getName().equals(anno.getAnnotationType().getIdentifier())) { error("Superfluous @Override annotation", anno, null, OBSOLETE_ANNOTATION_OVERRIDE); } } } } } else if (flaggedOperations.add(sourceElement)) { doCheckFunctionOverrides(sourceElement, operation, allInherited); } } }
final EnumSet<OverrideCheckDetails> details = inherited.getOverrideCheckResult().getDetails(); if (details.contains(OverrideCheckDetails.IS_FINAL)) { error(MessageFormat.format(Messages.SARLValidator_43, inherited.getSimpleSignature()), sourceElement, nameFeature(sourceElement), OVERRIDDEN_FINAL); } else if (details.contains(OverrideCheckDetails.REDUCED_VISIBILITY)) { error(MessageFormat.format(Messages.SARLValidator_44, inherited.getSimpleSignature()), sourceElement, nameFeature(sourceElement), OVERRIDE_REDUCES_VISIBILITY); } else if (details.contains(OverrideCheckDetails.EXCEPTION_MISMATCH)) { final JvmTypeReference inheritedReturnType = inherited.getOverrideCheckResult().getGivenOperation().getReturnType(); final LightweightTypeReference resolvedReturnType = inherited.getOverrideCheckResult().getThisOperation().getResolvedReturnType(); final String signature = inherited.getSimpleSignature(); final EStructuralFeature sourceReturnTypeFeature = returnTypeFeature(sourceElement); error(MessageFormat.format(Messages.SARLValidator_45, && !isIgnored(MISSING_OVERRIDE, sourceElement)) { warning(MessageFormat.format(Messages.SARLValidator_47, resolved.getSimpleSignature(), getDeclaratorName(resolved)), function, for (final IResolvedOperation inherited: allInherited) { error(MessageFormat.format(Messages.SARLValidator_48, resolved.getSimpleSignature(), getDeclaratorName(resolved), resolved.getSimpleSignature(), getDeclaratorName(inherited)),
if (operation.getDeclaration().isStatic() && !localOperation.getDeclaration().isStatic()) { error("The instance method " + localOperation.getSimpleSignature() + " cannot override the static method " + operation.getSimpleSignature() + " of type " + getDeclaratorName(operation.getDeclaration()) + ".", source, nameFeature(source), DUPLICATE_METHOD); } else { error("Name clash: The method " + localOperation.getSimpleSignature() + " of type " + inferredType.getSimpleName() + " has the same erasure as " operation.getSimpleSignature() + " of type " + getDeclaratorName(operation.getDeclaration()) + " but does not override it.", source, nameFeature(source), DUPLICATE_METHOD); if (!operation.getDeclaration().isAbstract() && !conflictingOperation.getDeclaration().isAbstract()) { error("The type " + inferredType.getSimpleName() + " inherits multiple implementations of the method " + conflictingOperation.getSimpleSignature() + " from " + getDeclaratorName(conflictingOperation.getDeclaration()) + " and " + getDeclaratorName(operation.getDeclaration()) + ".", error("The non-abstract method " + nonabstractOp.getSimpleSignature() + " inherited from " + getDeclaratorName(nonabstractOp.getDeclaration()) + " conflicts with the method " + abstractOp.getSimpleSignature() + " inherited from " + getDeclaratorName(abstractOp.getDeclaration()) + ".", xtendType, XtendPackage.Literals.XTEND_TYPE_DECLARATION__NAME,