The IDEA is repeatedly crashing when I try to start a debug session with the following exception (I also reported this bug automatically from IDEA but I thought I'd mention it here as well).
4:25:28 PM Throwable
java.lang.IllegalStateException: Internal error: (5,47) java.lang.NullPointerException
@IntrinsicMethods.java:277
at org.jetbrains.jet.codegen.CompilationErrorHandler$1.reportException(CompilationErrorHandler.java:27)
at org.jetbrains.jet.codegen.GenerationState.compileCorrectFiles(GenerationState.java:120)
at org.jetbrains.jet.compiler.CompileSession.generate(CompileSession.java:161)
at org.jetbrains.jet.compiler.CompileEnvironment.compileModule(CompileEnvironment.java:156)
at org.jetbrains.jet.compiler.CompileEnvironment.compileModuleScript(CompileEnvironment.java:107)
at org.jetbrains.jet.cli.KotlinCompiler.exec(KotlinCompiler.java:144)
at org.jetbrains.jet.cli.KotlinCompiler.exec(KotlinCompiler.java:90)
at sun.reflect.GeneratedMethodAccessor184.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jetbrains.jet.plugin.compiler.JetCompiler.execInProcess(JetCompiler.java:276)
at org.jetbrains.jet.plugin.compiler.JetCompiler.runInProcess(JetCompiler.java:243)
at org.jetbrains.jet.plugin.compiler.JetCompiler.doCompile(JetCompiler.java:148)
at org.jetbrains.jet.plugin.compiler.JetCompiler.compile(JetCompiler.java:104)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:1931)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:1254)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:986)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:747)
at com.intellij.compiler.impl.CompileDriver.access$1000(CompileDriver.java:104)
at com.intellij.compiler.impl.CompileDriver$8.run(CompileDriver.java:665)
at com.intellij.compiler.progress.CompilerTask.run(CompilerTask.java:155)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:469)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:218)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:169)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:378)
at com.intellij.openapi.application.impl.ApplicationImpl$6.run(ApplicationImpl.java:434)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:145)
Caused by: Internal error: (5,47) java.lang.NullPointerException
@IntrinsicMethods.java:277
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:156)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:161)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:165)
at org.jetbrains.jet.codegen.ExpressionCodegen.invokeAppend(ExpressionCodegen.java:2020)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitStringTemplateExpression(ExpressionCodegen.java:704)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitStringTemplateExpression(ExpressionCodegen.java:58)
at org.jetbrains.jet.lang.psi.JetStringTemplateExpression.accept(JetStringTemplateExpression.java:37)
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:147)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:161)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:165)
at org.jetbrains.jet.codegen.ExpressionCodegen.pushMethodArguments(ExpressionCodegen.java:1492)
at org.jetbrains.jet.codegen.ExpressionCodegen.pushMethodArguments(ExpressionCodegen.java:1545)
at org.jetbrains.jet.codegen.ExpressionCodegen.invokeMethodWithArguments(ExpressionCodegen.java:1359)
at org.jetbrains.jet.codegen.ExpressionCodegen.invokeFunction(ExpressionCodegen.java:1289)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitCallExpression(ExpressionCodegen.java:1255)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitCallExpression(ExpressionCodegen.java:58)
at org.jetbrains.jet.lang.psi.JetCallExpression.accept(JetCallExpression.java:45)
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:147)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:161)
at org.jetbrains.jet.codegen.ExpressionCodegen.generateBlock(ExpressionCodegen.java:853)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitBlockExpression(ExpressionCodegen.java:722)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitBlockExpression(ExpressionCodegen.java:58)
at org.jetbrains.jet.lang.psi.JetBlockExpression.accept(JetBlockExpression.java:45)
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:147)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:161)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:165)
at org.jetbrains.jet.codegen.ImplementationBodyCodegen.generateInitializers(ImplementationBodyCodegen.java:960)
at org.jetbrains.jet.codegen.ImplementationBodyCodegen.generatePrimaryConstructor(ImplementationBodyCodegen.java:693)
at org.jetbrains.jet.codegen.ImplementationBodyCodegen.generateSyntheticParts(ImplementationBodyCodegen.java:268)
at org.jetbrains.jet.codegen.ClassBodyCodegen.generate(ClassBodyCodegen.java:65)
at org.jetbrains.jet.codegen.ClassCodegen.generateImplementation(ClassCodegen.java:68)
at org.jetbrains.jet.codegen.ClassCodegen.generate(ClassCodegen.java:58)
at org.jetbrains.jet.codegen.NamespaceCodegen.generate(NamespaceCodegen.java:80)
at org.jetbrains.jet.codegen.GenerationState.generateNamespace(GenerationState.java:131)
at org.jetbrains.jet.codegen.GenerationState.compileCorrectFiles(GenerationState.java:114)
... 32 more
Caused by: java.lang.NullPointerException
at org.jetbrains.jet.codegen.intrinsics.IntrinsicMethods.getIntrinsic(IntrinsicMethods.java:277)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitSimpleNameExpression(ExpressionCodegen.java:973)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitSimpleNameExpression(ExpressionCodegen.java:58)
at org.jetbrains.jet.lang.psi.JetSimpleNameExpression.accept(JetSimpleNameExpression.java:135)
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:147)
... 66 more
I actually had this yesterday when trying to use Cedric's JCommander library, it looked like it was being triggered by using varargs and calling a Java method that takes ... varargs:
fun main(varargs args : String) {
val options = Options()
JCommander(options, args)
…
JCommander’s constructor is (Object o, String… args).
The crash happens consistently whenever I run the following:
import kotlin.util.arrayList
fun main(argv: Array<String>)
{
var args = Args()
Hello(args).parse(argv)
println("Parsed")
}
class Args {
}
class Hello(varargs args: Any) {
fun parse(argv: Array<String>) {
println(“Parse”)
}
}
Here is the exception again:
8:06:58 AM Throwable
java.lang.IllegalStateException: Internal error: (5,47) java.lang.NullPointerException
@IntrinsicMethods.java:277
at org.jetbrains.jet.codegen.CompilationErrorHandler$1.reportException(CompilationErrorHandler.java:27)
at org.jetbrains.jet.codegen.GenerationState.compileCorrectFiles(GenerationState.java:120)
at org.jetbrains.jet.compiler.CompileSession.generate(CompileSession.java:161)
at org.jetbrains.jet.compiler.CompileEnvironment.compileModule(CompileEnvironment.java:156)
at org.jetbrains.jet.compiler.CompileEnvironment.compileModuleScript(CompileEnvironment.java:107)
at org.jetbrains.jet.cli.KotlinCompiler.exec(KotlinCompiler.java:144)
at org.jetbrains.jet.cli.KotlinCompiler.exec(KotlinCompiler.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jetbrains.jet.plugin.compiler.JetCompiler.execInProcess(JetCompiler.java:276)
at org.jetbrains.jet.plugin.compiler.JetCompiler.runInProcess(JetCompiler.java:243)
at org.jetbrains.jet.plugin.compiler.JetCompiler.doCompile(JetCompiler.java:148)
at org.jetbrains.jet.plugin.compiler.JetCompiler.compile(JetCompiler.java:104)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:1931)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:1254)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:986)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:747)
at com.intellij.compiler.impl.CompileDriver.access$1000(CompileDriver.java:104)
at com.intellij.compiler.impl.CompileDriver$8.run(CompileDriver.java:665)
at com.intellij.compiler.progress.CompilerTask.run(CompilerTask.java:155)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:469)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:218)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:169)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:378)
at com.intellij.openapi.application.impl.ApplicationImpl$6.run(ApplicationImpl.java:434)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:145)
Caused by: Internal error: (5,47) java.lang.NullPointerException
@IntrinsicMethods.java:277
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:156)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:161)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:165)
at org.jetbrains.jet.codegen.ExpressionCodegen.invokeAppend(ExpressionCodegen.java:2020)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitStringTemplateExpression(ExpressionCodegen.java:704)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitStringTemplateExpression(ExpressionCodegen.java:58)
at org.jetbrains.jet.lang.psi.JetStringTemplateExpression.accept(JetStringTemplateExpression.java:37)
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:147)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:161)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:165)
at org.jetbrains.jet.codegen.ExpressionCodegen.pushMethodArguments(ExpressionCodegen.java:1492)
at org.jetbrains.jet.codegen.ExpressionCodegen.pushMethodArguments(ExpressionCodegen.java:1545)
at org.jetbrains.jet.codegen.ExpressionCodegen.invokeMethodWithArguments(ExpressionCodegen.java:1359)
at org.jetbrains.jet.codegen.ExpressionCodegen.invokeFunction(ExpressionCodegen.java:1289)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitCallExpression(ExpressionCodegen.java:1255)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitCallExpression(ExpressionCodegen.java:58)
at org.jetbrains.jet.lang.psi.JetCallExpression.accept(JetCallExpression.java:45)
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:147)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:161)
at org.jetbrains.jet.codegen.ExpressionCodegen.generateBlock(ExpressionCodegen.java:853)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitBlockExpression(ExpressionCodegen.java:722)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitBlockExpression(ExpressionCodegen.java:58)
at org.jetbrains.jet.lang.psi.JetBlockExpression.accept(JetBlockExpression.java:45)
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:147)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:161)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:165)
at org.jetbrains.jet.codegen.ImplementationBodyCodegen.generateInitializers(ImplementationBodyCodegen.java:960)
at org.jetbrains.jet.codegen.ImplementationBodyCodegen.generatePrimaryConstructor(ImplementationBodyCodegen.java:693)
at org.jetbrains.jet.codegen.ImplementationBodyCodegen.generateSyntheticParts(ImplementationBodyCodegen.java:268)
at org.jetbrains.jet.codegen.ClassBodyCodegen.generate(ClassBodyCodegen.java:65)
at org.jetbrains.jet.codegen.ClassCodegen.generateImplementation(ClassCodegen.java:68)
at org.jetbrains.jet.codegen.ClassCodegen.generate(ClassCodegen.java:58)
at org.jetbrains.jet.codegen.NamespaceCodegen.generate(NamespaceCodegen.java:80)
at org.jetbrains.jet.codegen.GenerationState.generateNamespace(GenerationState.java:131)
at org.jetbrains.jet.codegen.GenerationState.compileCorrectFiles(GenerationState.java:114)
... 33 more
Caused by: java.lang.NullPointerException
at org.jetbrains.jet.codegen.intrinsics.IntrinsicMethods.getIntrinsic(IntrinsicMethods.java:277)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitSimpleNameExpression(ExpressionCodegen.java:973)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitSimpleNameExpression(ExpressionCodegen.java:58)
at org.jetbrains.jet.lang.psi.JetSimpleNameExpression.accept(JetSimpleNameExpression.java:135)
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:147)
... 67 more
I'm not sure of the ticket off hand, but from memory, the problem lies in part in your signature:
class Hello(varargs args: Any)
When you pass the argv: Array<String> to this constructor, you're passing a single argument which is an array, not an exploded list of arguments ( javac silently does this transformation for us ). I believe there is new syntax coming in to explode the args, so that Hello(*argv) would explode the array to individual arguments.
Not sure I actually like the *arg syntax tho, kinda feels like “pointer to arg”.
If you initially instealled the plugin from the central repo, you'll need to uninstall it and then install from the nightly repo in order to get nightly updates.