Larry Garfield
06/13/2024, 11:18 PMfun fakeThingie() = object : AThingieInterface {
override fun doSomething(): Boolean = false
}
The documentation says this is the correct syntax for an anonymous class: https://kotlinlang.org/docs/object-declarations.html
However, my IDE is yelling at me that “object” is not a valid keyword in Kotlin and I should use Any. Er, what?
And yet the code does run; the IDE is just yelling at me, and there’s a bunch of warnings when running tests, but the relevant tests all pass. What is going on?
Edit: Wow, never mind. The mock class was missing a method from the interface. So of course the IDE was reporting it as a keyword issue. Because that makes total sense. /sDavid Kubecka
06/14/2024, 7:15 AMCLOVIS
06/14/2024, 7:43 AMJoffrey
06/14/2024, 11:54 AMLarry Garfield
06/14/2024, 1:40 PMJoffrey
06/14/2024, 1:41 PMLarry Garfield
06/14/2024, 1:44 PMLarry Garfield
06/14/2024, 1:44 PMJoffrey
06/14/2024, 1:48 PMObject
), but to no avail 😞 If one day you run into this again, please let me know how 🙏