NoClassDefFoundError when interface & object names differ only by case-sensitivity

OS: Mac
IDE: IntelliJ CE

When we have an interface Foo and an object foo: Foo - with the names foo and Foo, on Mac, this fails with the following error -

Exception in thread "main" java.lang.NoClassDefFoundError: foo (wrong name: Foo)

When I tried the same code in the playground, it works. However, changing one of the names, say foo to foo1 would work on my Mac. Is this behaviour because of the Mac OS’ case-insensitive filesystem - where class files that are generated for object foo and interface Foo overwrite one another?


interface Foo {
    val x: String

object foo: Foo {
    override val x: String = "asdf"

fun main() {
1 Like

Yes, see