When a class extends a class that implements an interface IC doesn't recognise it implements interface

Issue #1335 resolved
Justin Julicher created an issue

When you have:

public interface A {}

public class B implements A {}

public class C extends B {}

public class D {
     public static void doSomething(A intefaceA);
}

// if you try to call doSomething with class C, IC doesn't recognise it.
// e.g. 

D.doSomething(new C());  //IC marks new C() as invalid.

Let me know if that doesn’t make sense.

I can save the above scenario fine.

thanks

Comments (9)

  1. Scott Wells repo owner

    FYI, I'm pretty sure that this is resolved either from changes since the issue was logged or with the changes I've made for the next build (2.1.0.1). I'm unable to reproduce the problem as-stated now.

  2. Scott Wells repo owner

    The changes in 2.1.0.1 (or perhaps some prior fix) seem to address this. Resolving, but if you still see it, please feel free to reopen.

  3. Justin Julicher reporter

    Hi @Scott Wells

    I’m having an issue where I have the following:

    public interface prefix.A {}
    
    public interface prefix.B extends prefix.A{}
    
    public class TestClass implements B {}
    ...
    
    
    public class SomeClass {
      public static void runMethod(prefix.A paramA)
      {
      ...
      }
    }
    
    
    
    //in the code if I call runMethod with B it will give an:
    //Expected argument of type prefix.A; found prefix.B
    //e.g
    
    
    TestClass myClass = new TestClass();
    
    
    SomeClass.runMethod(myClass); //IC will highlight this as an issue but saves to the sandbox fine.
    

  4. Scott Wells repo owner

    Justin, can you clarify whether prefix in your most recent post is a namespace prefix or a top-level class? Or does it matter?

  5. Scott Wells repo owner

    Justin, I’m not able to reproduce this even with a namespace. I’ve created a scratch org with namespace base_dev and added the following types and IC doesn’t show an errors anywhere at all:

    I’m going to resolve this as unreproducible, but if you’re able to come up with a reproduction, please reopen and provide the details.

  6. Log in to comment