Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Kotlin: [Internal Error]

Ao tentar rodar a aplicação, como mostrada na aula, apenas com a função main(), retorna o segunite erro:

Detalhe: Estou usando jdk-16

Executing pre-compile tasks... Loading Ant configuration... Running Ant tasks... Cleaning output directories... Running 'before' tasks Checking sources Kotlin: connecting to daemon Kotlin: compiling [bytebank] Kotlin: kotlinc-jvm 1.4.31 (JRE 16+36-2231) Kotlin: [Internal Error] java.lang.ExceptionInInitializerError at com.intellij.pom.java.LanguageLevel.(LanguageLevel.java:25) at com.intellij.core.CoreLanguageLevelProjectExtension.(CoreLanguageLevelProjectExtension.java:26) at com.intellij.core.JavaCoreProjectEnvironment.(JavaCoreProjectEnvironment.java:42) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreProjectEnvironment.(KotlinCoreProjectEnvironment.kt:26) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$ProjectEnvironment.(KotlinCoreEnvironment.kt:121) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:425) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:226) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:152) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98) at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1500) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) 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(AccessController.java:691) at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705) at java.base/java.security.AccessController.doPrivileged(AccessController.java:391) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) at java.base/java.lang.Thread.run(Thread.java:831) Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.util.ResourceBundle.setParent(java.util.ResourceBundle) accessible: module java.base does not "opens java.util" to unnamed module @1e7c7811 at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) at java.base/java.lang.reflect.Method.setAccessible(Method.java:193) at com.intellij.util.ReflectionUtil.makeAccessible(ReflectionUtil.java:252) at com.intellij.util.ReflectionUtil.getDeclaredMethod(ReflectionUtil.java:269) at com.intellij.DynamicBundle.(DynamicBundle.java:22) ... 30 more Finished, saving caches... Builder Kotlin Builder requested build stop Executing post-compile tasks... Loading Ant configuration... Running Ant tasks... Synchronizing output directories...

2 respostas
solução!

Tenta usar o jdk-15

Olhando a documentação do kotlin encontrei o seguinte: If you want to make use of optimizations available in newer versions of Java, you can explicitly specify the target Java version from 8 to 15. https://kotlinlang.org/docs/faq.html#which-versions-of-jvm-does-kotlin-target

Te agradeço xará! Utilizei a versão 15 e funcionou!