When a class extends a class that implements an interface IC doesn't recognise it implements interface
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)
-
repo owner -
repo owner - changed status to resolved
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.
-
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.
-
repo owner - changed status to open
Reopening and I'll take a look this week.
-
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? -
reporter Hi Scott,
It's a namespace prefix. I haven't tried it without a namespace though.
-
repo owner - marked as minor
- removed version
-
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.
-
repo owner - changed status to resolved
- Log in to comment
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.