Subclass that extends super class and implements interface inspector error - false negative

Issue #1162 resolved
Eric Kintzer created an issue
public virtual class ICInspectorBase {

    public virtual String getFoo() {return '';}

    interface IICInspector {
        String getFoo();
    }

    public class IcInspectorSubClass extends ICInspectorBase implements IICINspector {

    }
}

This simple example is valid APEX as the subclass need not implement the interface methods if its super class has such implementation.

Inspector error on subclass with interface.png

Comments (4)

  1. Scott Wells repo owner

    Ah, this is interesting...very easy to reproduce, and the root cause issue is in the screenshot you provided. Notice that the interface method declaration of getFoo() doesn't have a gutter icon showing that it's properly implemented (albeit indirectly) in IcInspectorSubClass via the implementation provided by ICInspectorBase. The bug here isn't with the code inspection but rather with the core code that wires together inheritance relationships. I guess this indirection is a corner case that it's not handling properly. Thanks for reporting! I'll get it all working properly...

  2. Scott Wells repo owner

    Well, I take that back. I verified the corresponding behavior in Java and it does not mark the indirect implementation of the interface method. The gutters look the same in Java and Apex. So this is an inspection bug. Either way I'll get a fix together...fun, fun...

  3. Log in to comment