Unable to use namespace functions with multiple source folders

Hey all,

Ran into an interesting problem with the Kotlin compiler when using Apache Maven before, the problem arises when trying to use namespace based functions for the same namespace across multiple source paths.

In this instance, I had namespace level functions in both my src/main/kotlin and src/test/kotlin folders, which generates two separate .namespace.class files, of which the JVM only loads one of them…

I raised this as http://youtrack.jetbrains.com/issue/KT-1853 and think the only way around it is to generate .namespace$1.class if the original namespace.class already appears on the classpath.

What do you guys think?

I've hit this too: http://youtrack.jetbrains.com/issue/KT-1381 its pretty painful. The compiler really should warn if its possibly hiding a namespace class.

For now I tend to put tests in a different package (I’ve been using test as the prefix for all tests) which is ugly but works around this issue