ArrayIndexOutOfBoundsException: 446


#1

Hello
Please I’m beginner in Kotlin and I get this error in first try to code by intellig IDEA and my operating system is Fedora 27

my code is

fun main(args:Array){

print("Hossam")

}

and this is the error

Kotlin: [Internal Error] java.lang.ArrayIndexOutOfBoundsException: 446 at org.jetbrains.org.objectweb.asm.ClassReader.readUnsignedShort(ClassReader.java:2464) at org.jetbrains.org.objectweb.asm.ClassReader.readUTF8(ClassReader.java:2525) at org.jetbrains.org.objectweb.asm.ClassReader.readModule(ClassReader.java:761) at org.jetbrains.org.objectweb.asm.ClassReader.accept(ClassReader.java:646) at org.jetbrains.org.objectweb.asm.ClassReader.accept(ClassReader.java:507) at org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleInfo$Companion.read(JavaModuleInfo.kt:67) at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder.findSystemModule(CliJavaModuleFinder.kt:44) at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder.access$findSystemModule(CliJavaModuleFinder.kt:25) at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder$systemModules$1.invoke(CliJavaModuleFinder.kt:37) at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder$systemModules$1.invoke(CliJavaModuleFinder.kt:25) at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:148) at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:108) at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:132) at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:253) at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:240) at kotlin.sequences.SequencesKt___SequencesKt.none(_Sequences.kt:1239) at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.addModularRoots(ClasspathRootsResolver.kt:227) at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.computeRoots(ClasspathRootsResolver.kt:124) at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.convertClasspathRoots(ClasspathRootsResolver.kt:79) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:223) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:114) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:401) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:282) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createEnvironmentWithScriptingSupport(K2JVMCompiler.kt:272) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:151) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:61) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:107) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:51) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92) at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$1.invoke(CompileServiceImpl.kt:380) at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$1.invoke(CompileServiceImpl.kt:96) at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:892) at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:96) at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137) at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:919) at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:891) at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:378) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359) at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:844)

#3

You missed the type argument for class Array<T>:

fun main(args: Array<String>) {
    print("Hossam")
}

#4

@SackCastellon
thanks for reply
No I wrote it in my code but I don’t know why it isn’t appear here in my qustion


#5

Oh :sweat_smile:

  1. Is that the only code you have?
  2. You are using Java 9, right?
  3. Which version of Kotlin are you using?
  4. Are you using Maven/Gradle?

#6

Same error someone had here yesterday. He was using intellij and it worked fine after reinstalling it. Seems to be some kind of problem with the newest kotlin version in idea if @hossam992 also is using idea with the newest kotlin version.


#7

This issue has been fixed in Kotlin 1.2.30: https://youtrack.jetbrains.com/issue/KT-21303

Please update Kotlin to the latest version. Also, in the future, please provide the Kotlin version you’re using in your reports. Thanks!