Windows 7 64-bit Eclipse Oxygen convert Java to Kotlin fails


#1

Running Eclipse Oxygen for JavaEE Developers on Windows 7 64-bit, learning Kotlin by converting existing Java code. In Package Explorer, if I right click on a Java file (containing an interface definition) and select “Convert Java to Kotlin”, nothing appears to happen. However, if I open Windows-Show View-Others-General-Error Log, I see that a message has been created in the error log. Opening that reveals a large stack trace; here’s the top part of it:

org.eclipse.e4.core.di.InjectionException: kotlin.UninitializedPropertyAccessException: lateinit property index has not been initialized
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:65)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:305)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:239)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)

Further down is a Caused by section that may be more relevant:

Caused by: kotlin.UninitializedPropertyAccessException: lateinit property index has not been initialized
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCliJavaFileManagerImpl.findVirtualFileForTopLevelClass(KotlinCliJavaFileManagerImpl.kt:74)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCliJavaFileManagerImpl.access$findVirtualFileForTopLevelClass(KotlinCliJavaFileManagerImpl.kt:46)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCliJavaFileManagerImpl$findPsiClass$1.invoke(KotlinCliJavaFileManagerImpl.kt:68)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCliJavaFileManagerImpl$findPsiClass$1.invoke(KotlinCliJavaFileManagerImpl.kt:46)
at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:91)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCliJavaFileManagerImpl.findPsiClass(KotlinCliJavaFileManagerImpl.kt:67)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCliJavaFileManagerImpl.findClass(KotlinCliJavaFileManagerImpl.kt:129)

Underneath the stack trace is Session Data. Here’s the interesting info:
eclipse.buildId=4.7.3.M20180330-0640
java.version=1.8.0_74

Kotlin plugin version is 0.8.4

I installed IntelliJ, and Convert Java to Kotlin works over there.

Thanks.


#2

I think you should file a new issue here? Maybe check that it does not exist first, but I could not find a related issue.


#3

Thank you, I appreciate your suggestion. I will follow-up with a bug report as you suggest. From my experience with other software, I’m assuming the proper procedure is to start here to see if the community has any quick remedies. If not, then submit a bug report.


#4

For problems with the language you are right, but this looks like a bug to me. As long as you have the latest version of the plugin installed I can’t see why this should not work as intended, especially if the feature is working in intellij idea.


#5

Found a similar issue, so I added a comment to that one:

https://youtrack.jetbrains.com/issue/KE-108

Thanks for your help.