Skip to content

Go to Implementation on interface method does not work for inherited implementations #9455

Description

@nmatt

Apache NetBeans version

Apache NetBeans 30

What happened

Go to Implementation (Ctrl+Alt+B, or context menu > Navigate > Go to Implementation) does not work on interface methods whose implementations are inherited from classes that themselves aren't declared to implement the interface (but subclasses are). The "Ⓘ" badges in the editor gutter are correspondingly missing.

This makes it more difficult to locate method implementations from a call site that invokes the method from the interface type, and it makes it misleadingly look like there are no implementations of the method.

Language / Project Type / NetBeans Component

Java, Editor

How to reproduce

class Example
{
    interface A
    {
        CharSequence a();
    }
    
    interface B extends A
    {
        @Override
        String a();

        String b();

        String c();
    }
    
    static class AImpl implements A
    {
        @Override
        public String a() { return "a"; }

        public String b() { return "b"; }
    }
    
    static class BImpl extends AImpl implements B
    {
        public String c() { return "c"; }
    }
}

On B::a anb B::b, Go to Implementation (Ctrl+Alt+B, or context menu > Navigate > Go to Implementation) does not work, although these methods are implemented by AImpl (in the context of BImpl).

In addition, no "Ⓘ" badge is shown on B::b, although interface B is fully implemented by BImpl.

Did this work correctly in an earlier version?

No / Don't know

Operating System

Windows

JDK

JDK 21

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

No response

Are you willing to submit a pull request?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    Java[ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)kind:bugBug report or fixneeds:triageRequires attention from one of the committers

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions