diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/OverrideIndicatorTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/OverrideIndicatorTest.java index b342ef35058..c416534f360 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/OverrideIndicatorTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/OverrideIndicatorTest.java @@ -250,4 +250,18 @@ public class OverrideIndicatorTest extends AnnotationTestCase { checkImplementsAnnotationLines(25, 26); checkOverridesAnnotationLines(27); } + + // struct Foo { + // virtual void waldo(int) = 0; + // virtual void waldo(float) = 0; + // }; + // + // struct Bar : Foo { + // void waldo(int) override; + // void waldo(float) override; + // }; + public void testMultipleOverloadsOverridden_479142() throws Exception { + loadCodeAndRun(getAboveComment()); + checkImplementsAnnotationLines(7, 8); + } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java index 1b2e30b8d60..153d1aad276 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java @@ -255,29 +255,35 @@ public class OverrideIndicatorManager implements ICReconcilingListener { methodsCache.put(aClass, allInheritedMethods); } + boolean foundOverridden = false; + ICPPMethod result = null; for (ICPPMethod method : allInheritedMethods) { if (method.getName().equals(testedMethodName)) { if (method.isVirtual()) { if (ClassTypeHelper.isOverrider(testedMethod, method)) { if (method.isPureVirtual()) { annotationKind = ANNOTATION_IMPLEMENTS; + result = method; } else { annotationKind = ANNOTATION_OVERRIDES; + result = method; } - } else { + foundOverridden = true; + } else if (!foundOverridden) { // The method has same name as virtual method in base, but does not override // it (e.g. because it has a different signature), it shadows it. annotationKind = ANNOTATION_SHADOWS; + result = method; } - } else { + } else if (!foundOverridden) { // The method has same name and is not virtual, it hides/shadows the method // in the base class. annotationKind = ANNOTATION_SHADOWS; + result = method; } - return method; } } - return null; + return result; } /**