Kotlin compiler isn't happy about class and package name clash in a jar


#1

Hi,

We are using an obfuscated third party library which has class structure like:

  • a.java
  • a/b.java

There’s a class in this library:

class LocationClient extends a.b.c {...}

Where a.b.c is an inner class of a.b. Before kotlin 1.0.6, the code can be compiled successfully, but since kotlin 1.0.6, we get this error:

Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class LocationClient, unresolved supertypes: c

I understand in the source code, this kind of name clash (package name = class name) is not allowed. But I googled and someone suggested this name clash is legal in a jar file. Java compiler seems to be happy about this, but not kotlin 1.0.6.

My question is: is there a switch in kotlin compiler to skip this check? Since we can’t really modify the third party library.

Thanks.


#2

Thanks for the report. This is a known problem that has been fixed in 1.0.7: https://youtrack.jetbrains.com/issue/KT-15464. Please try the Kotlin 1.0.7 EAP, more information here: https://discuss.kotlinlang.org/t/kotlin-1-0-7-eap/