I am using Kotlin 0.6.33 and tried as a test to automatically convert following class https://github.com/robovm/robovm-sample-jfx-app/blob/master/src/main/java/org/robovm/sample/jfx/RoboVMJFXLauncher.java to Kotlin.
The result is as follows (which looks not perfect, but ok IMO) :
package sample
import javafx.application.Application
import org.robovm.cocoatouch.foundation.NSAutoreleasePool
import org.robovm.cocoatouch.foundation.NSDictionary
import org.robovm.cocoatouch.uikit.UIApplication
import org.robovm.cocoatouch.uikit.UIApplicationDelegate
public open class RoboVMJFXLauncher() : UIApplicationDelegate.Adapter() {
public override fun didFinishLaunching(application: UIApplication?, launchOptions: NSDictionary<NSObject?, NSObject?>?): Boolean {
var launchThread: Thread? = object : Thread() {
public override fun run(): Unit {
Application.launch(getJavaClass<RoboVMSampleJFXApp?>)
}
}
launchThread?.setDaemon(true)
launchThread?.start()
return true
}
class object {
public open fun main(args: Array<String?>?): Unit {
System.setProperty(“glass.platform”, “ios”)
System.setProperty(“prism.text”, “native”)
var pool: NSAutoreleasePool? = NSAutoreleasePool()
UIApplication.main(args, null, getJavaClass<RoboVMJFXLauncher?>)
pool?.drain()
}
}
}
fun main(args: Array<String?>?) = RoboVMJFXLauncher.main(args)
But the whole file is indicated as an error in the IDE and I get following error when I try to compile the class.
Kotlin: [Internal Error] java.lang.AssertionError: name=org valuenull
at com.intellij.psi.impl.compiled.ClsAnnotationParameterListImpl.<init>(ClsAnnotationParameterListImpl.java:36)
at com.intellij.psi.impl.compiled.ClsParsingUtil$2.createParameterList(ClsParsingUtil.java:109)
at com.intellij.psi.impl.compiled.ClsAnnotationValueImpl.<init>(ClsAnnotationValueImpl.java:42)
at com.intellij.psi.impl.compiled.ClsParsingUtil$2.<init>(ClsParsingUtil.java:100)
at com.intellij.psi.impl.compiled.ClsParsingUtil.getMemberValue(ClsParsingUtil.java:100)
at com.intellij.psi.impl.compiled.ClsParsingUtil.getMemberValue(ClsParsingUtil.java:91)
at com.intellij.psi.impl.compiled.ClsNameValuePairImpl.<init>(ClsNameValuePairImpl.java:36)
at com.intellij.psi.impl.compiled.ClsAnnotationParameterListImpl.<init>(ClsAnnotationParameterListImpl.java:37)
at com.intellij.psi.impl.compiled.ClsAnnotationImpl$2.compute(ClsAnnotationImpl.java:56)
at com.intellij.psi.impl.compiled.ClsAnnotationImpl$2.compute(ClsAnnotationImpl.java:51)
at com.intellij.openapi.util.AtomicNotNullLazyValue.getValue(AtomicNotNullLazyValue.java:37)
at com.intellij.psi.impl.compiled.ClsAnnotationImpl.getParameterList(ClsAnnotationImpl.java:94)
at org.jetbrains.jet.lang.resolve.java.resolver.JavaAnnotationResolver.resolveAnnotation(JavaAnnotationResolver.java:112)
at org.jetbrains.jet.lang.resolve.java.resolver.JavaAnnotationResolver.resolveAnnotations(JavaAnnotationResolver.java:62)
at org.jetbrains.jet.lang.resolve.java.resolver.JavaClassResolver.doCreateClassDescriptor(JavaClassResolver.java:274)
at org.jetbrains.jet.lang.resolve.java.resolver.JavaClassResolver.createJavaClassDescriptor(JavaClassResolver.java:227)
at org.jetbrains.jet.lang.resolve.java.resolver.JavaClassResolver.doResolveClass(JavaClassResolver.java:194)
at org.jetbrains.jet.lang.resolve.java.resolver.JavaClassResolver.resolveClass(JavaClassResolver.java:178)
at org.jetbrains.jet.lang.resolve.java.resolver.JavaClassResolver.resolveClass(JavaClassResolver.java:141)
at org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver.resolveClass(JavaDescriptorResolver.java:185)
at org.jetbrains.jet.lang.resolve.java.JavaTypeTransformer$3.visitClassType(JavaTypeTransformer.java:159)
at org.jetbrains.jet.lang.resolve.java.JavaTypeTransformer$3.visitClassType(JavaTypeTransformer.java:114)
at com.intellij.psi.PsiClassType.accept(PsiClassType.java:218)
at org.jetbrains.jet.lang.resolve.java.JavaTypeTransformer.transformToType(JavaTypeTransformer.java:114)
at org.jetbrains.jet.lang.resolve.java.resolver.JavaSupertypeResolver.transformSupertypeList(JavaSupertypeResolver.java:189)
at org.jetbrains.jet.lang.resolve.java.resolver.JavaSupertypeResolver.getSupertypes(JavaSupertypeResolver.java:92)
at org.jetbrains.jet.lang.resolve.java.resolver.JavaClassResolver.doCreateClassDescriptor(JavaClassResolver.java:266)
at org.jetbrains.jet.lang.resolve.java.resolver.JavaClassResolver.createJavaClassDescriptor(JavaClassResolver.java:227)
at org.jetbrains.jet.lang.resolve.java.resolver.JavaClassResolver.doResolveClass(JavaClassResolver.java:194)
at org.jetbrains.jet.lang.resolve.java.resolver.JavaClassResolver.resolveClass(JavaClassResolver.java:178)
at org.jetbrains.jet.lang.resolve.java.resolver.JavaClassResolver.resolveClass(JavaClassResolver.java:141)
at org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver.resolveClass(JavaDescriptorResolver.java:185)
at org.jetbrains.jet.lang.resolve.java.scope.JavaPackageScope.getClassifier(JavaPackageScope.java:51)
at org.jetbrains.jet.lang.resolve.QualifiedExpressionResolver.lookupSimpleNameReference(QualifiedExpressionResolver.java:257)
at org.jetbrains.jet.lang.resolve.QualifiedExpressionResolver.lookupSelectorDescriptors(QualifiedExpressionResolver.java:208)
at org.jetbrains.jet.lang.resolve.QualifiedExpressionResolver.lookupDescriptorsForQualifiedExpression(QualifiedExpressionResolver.java:197)
at org.jetbrains.jet.lang.resolve.QualifiedExpressionResolver.processImportReference(QualifiedExpressionResolver.java:78)
at org.jetbrains.jet.lang.resolve.ImportsResolver.processImportsInFile(ImportsResolver.java:125)
at org.jetbrains.jet.lang.resolve.ImportsResolver.processImportsInFile(ImportsResolver.java:94)
at org.jetbrains.jet.lang.resolve.ImportsResolver.processImports(ImportsResolver.java:85)
at org.jetbrains.jet.lang.resolve.ImportsResolver.processTypeImports(ImportsResolver.java:75)
at org.jetbrains.jet.lang.resolve.TypeHierarchyResolver.process(TypeHierarchyResolver.java:129)
at org.jetbrains.jet.lang.resolve.TopDownAnalyzer.doProcess(TopDownAnalyzer.java:124)
at org.jetbrains.jet.lang.resolve.TopDownAnalyzer.analyzeFiles(TopDownAnalyzer.java:260)
at org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(AnalyzerFacadeForJVM.java:198)
at org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$1.invoke(KotlinToJVMBytecodeCompiler.java:318)
at org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$1.invoke(KotlinToJVMBytecodeCompiler.java:313)
at org.jetbrains.jet.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.java:233)
at org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.java:312)
at org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyzeAndGenerate(KotlinToJVMBytecodeCompiler.java:292)
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:116)
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)
As far as I can trace back the problem, it seems to be related to the import statement:
import org.robovm.cocoatouch.uikit.UIApplicationDelegate
And extending the ‘Adapter’ static class in it.
Are there any known issues with static classes in interfaces and extending them?
regards,
Sven