Hi
I have JDK 17-based project that uses Gradle Kotlin build scripts and STS 4.13 as primary IDE. The project is built successfully using command-line.
I installed Eclipse Kotlin plugin 0.8.22 in STS. However when I opened any Kotlin script in STS, I received the error message:
java.lang.ExceptionInInitializerError
at org.jetbrains.kotlin.idea.intentions.ConvertToStringTemplateIntention.<init>(ConvertToStringTemplateIntention.kt:29)
at org.jetbrains.kotlin.idea.j2k.J2KPostProcessingRegistrarImpl$ConvertToStringTemplateProcessing.<init>(J2KPostProcessingRegistrarImpl.kt:252)
at org.jetbrains.kotlin.idea.j2k.J2KPostProcessingRegistrarImpl.<clinit>(J2KPostProcessingRegistrarImpl.kt:57)
at org.jetbrains.kotlin.core.model.KotlinCommonEnvironmentKt.createKotlinCoreApplicationEnvironment(KotlinCommonEnvironment.kt:257)
at org.jetbrains.kotlin.core.model.KotlinCommonEnvironmentKt.access$createKotlinCoreApplicationEnvironment(KotlinCommonEnvironment.kt:1)
at org.jetbrains.kotlin.core.model.KotlinCommonEnvironment$Companion$kotlinCoreApplicationEnvironment$2.invoke(KotlinCommonEnvironment.kt:240)
at org.jetbrains.kotlin.core.model.KotlinCommonEnvironment$Companion$kotlinCoreApplicationEnvironment$2.invoke(KotlinCommonEnvironment.kt:239)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at org.jetbrains.kotlin.core.model.KotlinCommonEnvironment$Companion.getKotlinCoreApplicationEnvironment(KotlinCommonEnvironment.kt:239)
at org.jetbrains.kotlin.core.model.KotlinCommonEnvironment.<init>(KotlinCommonEnvironment.kt:118)
at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment.<init>(KotlinEnvironment.kt:118)
at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment.<init>(KotlinEnvironment.kt)
at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment$Companion$getEnvironment$1.invoke(KotlinEnvironment.kt:179)
at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment$Companion$getEnvironment$1.invoke(KotlinEnvironment.kt:178)
at org.jetbrains.kotlin.core.model.CachedEnvironment.getOrCreateEnvironment(CachedEnvironment.kt:37)
at org.jetbrains.kotlin.core.model.KotlinScriptEnvironment$Companion.getEnvironment(KotlinEnvironment.kt:178)
at org.jetbrains.kotlin.core.model.KotlinEnvironmentKt.getEnvironment(KotlinEnvironment.kt:90)
at org.jetbrains.kotlin.ui.editors.highlighting.KotlinTokenScanner.createKtFile(KotlinTokenScanner.java:104)
at org.jetbrains.kotlin.ui.editors.highlighting.KotlinTokenScanner.setRange(KotlinTokenScanner.java:62)
at org.eclipse.jface.text.rules.DefaultDamagerRepairer.createPresentation(DefaultDamagerRepairer.java:176)
at org.eclipse.jface.text.presentation.PresentationReconciler.createPresentation(PresentationReconciler.java:436)
at org.eclipse.jface.text.presentation.PresentationReconciler.processDamage(PresentationReconciler.java:549)
at org.eclipse.jface.text.presentation.PresentationReconciler$InternalListener.inputDocumentChanged(PresentationReconciler.java:121)
at org.eclipse.jface.text.TextViewer.fireInputDocumentChanged(TextViewer.java:2845)
at org.eclipse.jface.text.TextViewer.setDocument(TextViewer.java:2886)
at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:663)
at org.eclipse.jface.text.source.projection.ProjectionViewer.setDocument(ProjectionViewer.java:368)
at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:613)
at org.eclipse.ui.texteditor.AbstractTextEditor.initializeSourceViewer(AbstractTextEditor.java:3981)
at org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl(AbstractTextEditor.java:3473)
at org.eclipse.ui.texteditor.StatusTextEditor.createPartControl(StatusTextEditor.java:64)
at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.createPartControl(AbstractDecoratedTextEditor.java:454)
at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.createPartControl(JavaEditor.java:3093)
at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.createPartControl(CompilationUnitEditor.java:1521)
at org.jetbrains.kotlin.ui.editors.KotlinCommonEditor.createPartControl(KotlinCommonEditor.kt:95)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:158)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPartControl(CompatibilityEditor.java:96)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:365)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:995)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:960)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:140)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:403)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:330)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:202)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:91)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:60)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:42)
at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:132)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:994)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:658)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:762)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:727)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:711)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.lambda$0(PartServiceImpl.java:105)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler.lambda$0(UIEventHandler.java:38)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:236)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:133)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4779)
at org.eclipse.e4.ui.workbench.swt.DisplayUISynchronize.syncExec(DisplayUISynchronize.java:34)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:205)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:203)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:228)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:133)
at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:75)
at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:44)
at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:55)
at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:63)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424)
at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElementGen(ElementContainerImpl.java:170)
at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:188)
at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:660)
at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:624)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:787)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:401)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1261)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3208)
at org.eclipse.ui.internal.WorkbenchPage.lambda$9(WorkbenchPage.java:3112)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3110)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3080)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3071)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:569)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:524)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:367)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor_aroundBody0(EditorUtility.java:172)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility$AjcClosure1.run(EditorUtility.java:1)
at org.jetbrains.kotlin.aspects.navigation.KotlinOpenEditorAspect.ajc$around$org_jetbrains_kotlin_aspects_navigation_KotlinOpenEditorAspect$1$d64491c4proceed(KotlinOpenEditorAspect.aj:16)
at org.jetbrains.kotlin.aspects.navigation.KotlinOpenEditorAspect.ajc$around$org_jetbrains_kotlin_aspects_navigation_KotlinOpenEditorAspect$1$d64491c4(KotlinOpenEditorAspect.aj:29)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:169)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:288)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:254)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:274)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:252)
at org.eclipse.jdt.internal.ui.navigator.OpenAndExpand.run(OpenAndExpand.java:53)
at org.eclipse.ui.actions.RetargetAction.run(RetargetAction.java:215)
at org.eclipse.ui.navigator.CommonNavigatorManager$1.open(CommonNavigatorManager.java:183)
at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:800)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:797)
at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1116)
at org.eclipse.ui.navigator.CommonViewer.handleOpen(CommonViewer.java:454)
at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:296)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:331)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4243)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1060)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4060)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3632)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1154)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1045)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
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 @69924070
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
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.<clinit>(DynamicBundle.java:22)
... 140 more
I tried to add these flags in Preferences → Kotlin → Compiler → Additional compiler flags but it didn’t help:
-Dkotlin.daemon.jvm.options=--illegal-access=permit
--add-opens java.base/java.lang=ALL-UNNAMED
--illegal-access=permit