Since my Dropwizard project isn't entirely working at the moment, I decided to try out a different library: libgdx.
This code runes my project flawlessly in Java:
public class DesktopStarter { public static void main(String[] args) { LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); cfg.title = "Title"; cfg.useGL20 = true; cfg.width = 800; cfg.height = 480; new LwjglApplication(new MyLibgdxGame(), cfg);
}
}
The corresponding Kotlin code:
fun main(args: Array<String>) { val cfg = LwjglApplicationConfiguration() cfg.title = "Title" cfg.useGL20 = true cfg.width = 800 cfg.height = 480LwjglApplication(MyLibgdxGame(), cfg)
}
Does not. It fails with this huge exception:
Kotlin: [Internal Error] org.jetbrains.jet.codegen.CompilationException: Back-end (JVM) Internal error: Error types are not allowed when classBuilderMode = FULL. For declaration null:null in null:null
Cause: Error types are not allowed when classBuilderMode = FULL. For declaration null:null in null:null
File being compiled and position: (13,5) in C:UsersSoulBeaverworkspaceLwjglKotlinTestDesktopsrccomexamplemylibgdxgameKotlinStarter.kt
PsiElement: LwjglApplication(MyLibgdxGame(), cfg)
The root cause was thrown at: JetTypeMapper.java:274
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:242)
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:214)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:248)
at org.jetbrains.jet.codegen.ExpressionCodegen.generateBlock(ExpressionCodegen.java:1363)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitBlockExpression(ExpressionCodegen.java:1220)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitBlockExpression(ExpressionCodegen.java:81)
at org.jetbrains.jet.lang.psi.JetBlockExpression.accept(JetBlockExpression.java:47)
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:232)
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:214)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:248)
at org.jetbrains.jet.codegen.ExpressionCodegen.returnExpression(ExpressionCodegen.java:1489)
at org.jetbrains.jet.codegen.FunctionGenerationStrategy$FunctionDefault.doGenerateBody(FunctionGenerationStrategy.java:82)
at org.jetbrains.jet.codegen.FunctionGenerationStrategy$CodegenBased.generateBody(FunctionGenerationStrategy.java:104)
at org.jetbrains.jet.codegen.FunctionCodegen.generateMethodBody(FunctionCodegen.java:185)
at org.jetbrains.jet.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:130)
at org.jetbrains.jet.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:95)
at org.jetbrains.jet.codegen.FunctionCodegen.gen(FunctionCodegen.java:80)
at org.jetbrains.jet.codegen.MemberCodegen.genFunctionOrProperty(MemberCodegen.java:46)
at org.jetbrains.jet.codegen.NamespaceCodegen.generate(NamespaceCodegen.java:154)
at org.jetbrains.jet.codegen.NamespaceCodegen.generate(NamespaceCodegen.java:97)
at org.jetbrains.jet.codegen.KotlinCodegenFacade.generateNamespace(KotlinCodegenFacade.java:73)
at org.jetbrains.jet.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:62)
at org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.java:361)
at org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyzeAndGenerate(KotlinToJVMBytecodeCompiler.java:300)
at org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyzeAndGenerate(KotlinToJVMBytecodeCompiler.java:273)
at org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModule(KotlinToJVMBytecodeCompiler.java:107)
at org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules(KotlinToJVMBytecodeCompiler.java:128)
at org.jetbrains.jet.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.java:141)
at org.jetbrains.jet.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.java:52)
at org.jetbrains.jet.cli.common.CLICompiler.exec(CLICompiler.java:128)
at org.jetbrains.jet.cli.common.CLICompiler.exec(CLICompiler.java:114)
at org.jetbrains.jet.cli.jvm.K2JVMCompiler.exec(K2JVMCompiler.java:185)
at org.jetbrains.jet.cli.jvm.K2JVMCompiler.exec(K2JVMCompiler.java:52)
at org.jetbrains.jet.cli.common.CLICompiler.exec(CLICompiler.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jetbrains.jet.compiler.runner.CompilerRunnerUtil.invokeExecMethod(CompilerRunnerUtil.java:116)
at org.jetbrains.jet.compiler.runner.KotlinCompilerRunner.execInProcess(KotlinCompilerRunner.java:78)
at org.jetbrains.jet.compiler.runner.KotlinCompilerRunner.access$000(KotlinCompilerRunner.java:40)
at org.jetbrains.jet.compiler.runner.KotlinCompilerRunner$1.fun(KotlinCompilerRunner.java:63)
at org.jetbrains.jet.compiler.runner.KotlinCompilerRunner$1.fun(KotlinCompilerRunner.java:60)
at org.jetbrains.jet.compiler.runner.CompilerRunnerUtil.outputCompilerMessagesAndHandleExitCode(CompilerRunnerUtil.java:125)
at org.jetbrains.jet.compiler.runner.KotlinCompilerRunner.runInProcess(KotlinCompilerRunner.java:60)
at org.jetbrains.jet.compiler.runner.KotlinCompilerRunner.runCompiler(KotlinCompilerRunner.java:52)
at org.jetbrains.jet.jps.build.KotlinBuilder.build(KotlinBuilder.java:113)
at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:998)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:739)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:770)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:702)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:523)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:314)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:179)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:129)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:220)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:112)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:132)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:41)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.IllegalStateException: Error types are not allowed when classBuilderMode = FULL. For declaration null:null in null:null
at org.jetbrains.jet.codegen.state.JetTypeMapper.mapType(JetTypeMapper.java:274)
at org.jetbrains.jet.codegen.state.JetTypeMapper.mapType(JetTypeMapper.java:221)
at org.jetbrains.jet.codegen.state.JetTypeMapper.writeParameter(JetTypeMapper.java:781)
at org.jetbrains.jet.codegen.state.JetTypeMapper.mapConstructorSignature(JetTypeMapper.java:871)
at org.jetbrains.jet.codegen.state.JetTypeMapper.mapToCallableMethod(JetTypeMapper.java:915)
at org.jetbrains.jet.codegen.state.JetTypeMapper.mapToCallableMethod(JetTypeMapper.java:910)
at org.jetbrains.jet.codegen.ExpressionCodegen.generateConstructorCall(ExpressionCodegen.java:3209)
at org.jetbrains.jet.codegen.ExpressionCodegen.generateNewCall(ExpressionCodegen.java:3182)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitCallExpression(ExpressionCodegen.java:1782)
at org.jetbrains.jet.codegen.ExpressionCodegen.visitCallExpression(ExpressionCodegen.java:81)
at org.jetbrains.jet.lang.psi.JetCallExpression.accept(JetCallExpression.java:59)
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:232)
… 64 more
Sadly, my brief google searches haven’t come up with anything recent or entirely relevant pertaining to this problem. I would be grateful for any help in resolving this issue.
Additional information from the compile:
Kotlin: Invoking in-process compiler org.jetbrains.jet.cli.jvm.K2JVMCompiler with arguments [-module, C:UsersSoulBeaverworkspaceLwjglKotlinTestoutproductionDesktopscript.xml, -output, C:UsersSoulBeaverworkspaceLwjglKotlinTestoutproductionDesktop, -tags, -verbose, -version, -notNullAssertions, -notNullParamAssertions, -noStdlib, -noJdkAnnotations, -noJdk]
Kotlin: Kotlin Compiler version 0.5.748
Using javac 1.7.0_13 to compile java sources