javaarraysclasskotlinlinkageerror

Kotlin LinkageError while loading main class - Illegal class name "Ljava/lang/String;" in class file (8th dimensional array)


When making an array with 8 dimensions (7 works fine), Kotlin throws this error:

Error: LinkageError occurred while loading main class ArraysKt
    java.lang.ClassFormatError: Illegal class name "Ljava/lang/String;" in class file ArraysKt

Arrays.kt (or ArraysKt, as output to console) is my main file. I haven't found anything online about this, and I'm not really sure any solution exists because why would you need an array with 8 dimensions, but for this project, the more dimensions the better. If there's a solution out there, I'd love to know it.

Edit: I realize after posting that I should probably put my code, here it is (as stupid as it is):

fun main() {
    val array = Array(3)
    {o ->
        Array(3)
        { p ->
            Array(3)
            { q ->
                Array(3)
                { v ->
                    Array(3)
                    { w ->
                        Array(3)
                        { z ->
                            Array(3)
                            { y ->
                                Array(3)
                                {  }
                            }
                        }
                    }
                }
            }
        }
    }
}

This might not even be the best way to accomplish what I'm trying to do, so if theres a better way, I'm open to that as well.


Solution

  • It looks like a bug. I've created an issue in Kotlin issuetracker — https://youtrack.jetbrains.com/issue/KT-36112