HaxeFoundation / intellij-haxe

Haxe plugin for IntelliJ Platform based IDEs (IDEA, Android-Studio)
http://intellij-haxe.org
Apache License 2.0
220 stars 99 forks source link

java.lang.RuntimeException: java.lang.IllegalStateException: @NotNull method #1172

Open Shaunmax opened 1 month ago

Shaunmax commented 1 month ago

I get this error every time, open a Haxe project :

java.lang.RuntimeException: java.lang.IllegalStateException: @NotNull method com/intellij/plugins/haxe/haxelib/HaxeLibrary.getVersionString must not return null
    at com.intellij.openapi.application.impl.LaterInvocator.invokeAndWait(LaterInvocator.java:131)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:471)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:490)
    at com.intellij.plugins.haxe.haxelib.HaxelibProjectUpdater.doWriteAction(HaxelibProjectUpdater.java:1068)
    at com.intellij.plugins.haxe.haxelib.HaxelibProjectUpdater.updateModule(HaxelibProjectUpdater.java:454)
    at com.intellij.plugins.haxe.haxelib.HaxelibProjectUpdater.resolveModuleLibraries(HaxelibProjectUpdater.java:241)
    at com.intellij.plugins.haxe.haxelib.HaxelibProjectUpdater.syncOneModule(HaxelibProjectUpdater.java:559)
    at com.intellij.plugins.haxe.haxelib.HaxelibProjectUpdater.syncModuleClasspaths(HaxelibProjectUpdater.java:753)
    at com.intellij.plugins.haxe.haxelib.HaxelibProjectUpdater.lambda$synchronizeClasspaths$5(HaxelibProjectUpdater.java:763)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:628)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
    at com.intellij.plugins.haxe.haxelib.HaxelibProjectUpdater.synchronizeClasspaths(HaxelibProjectUpdater.java:763)
    at com.intellij.plugins.haxe.haxelib.HaxelibProjectUpdater$ProjectUpdateQueue.doUpdateWork(HaxelibProjectUpdater.java:1619)
    at com.intellij.plugins.haxe.haxelib.HaxelibProjectUpdater$ProjectUpdateQueue$2.run(HaxelibProjectUpdater.java:1603)
    at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:428)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:115)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:478)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:251)
    at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:71)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
    at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:71)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$5(ProgressRunner.java:251)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$18(ProgressRunner.java:465)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.IllegalStateException: @NotNull method com/intellij/plugins/haxe/haxelib/HaxeLibrary.getVersionString must not return null
    at com.intellij.plugins.haxe.haxelib.HaxeLibrary.$$$reportNull$$$0(HaxeLibrary.java)
    at com.intellij.plugins.haxe.haxelib.HaxeLibrary.getVersionString(HaxeLibrary.java:187)
    at com.intellij.plugins.haxe.haxelib.HaxeLibraryReference.getLoadedVersion(HaxeLibraryReference.java:153)
    at com.intellij.plugins.haxe.haxelib.HaxeLibraryReference.getPresentableName(HaxeLibraryReference.java:144)
    at com.intellij.plugins.haxe.haxelib.HaxelibProjectUpdater$2.processEntry(HaxelibProjectUpdater.java:362)
    at com.intellij.plugins.haxe.haxelib.HaxeLibraryList.iterate(HaxeLibraryList.java:270)
    at com.intellij.plugins.haxe.haxelib.HaxelibProjectUpdater.addLibraries(HaxelibProjectUpdater.java:335)
    at com.intellij.plugins.haxe.haxelib.HaxelibProjectUpdater.lambda$updateModule$0(HaxelibProjectUpdater.java:480)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:992)
    at com.intellij.plugins.haxe.haxelib.HaxelibProjectUpdater.lambda$doWriteAction$7(HaxelibProjectUpdater.java:1068)
    at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:208)
    at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
    at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:190)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
    at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:478)
    at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:100)
    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:79)
    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:121)
    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:690)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$10(IdeEventQueue.kt:593)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWithoutImplicitRead(ApplicationImpl.java:1485)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:593)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:67)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:369)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:368)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:368)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:363)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:997)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:997)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:363)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:405)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

I am using IntelliJ IDEA 2023.2.5 (Ultimate Edition) on masOS Sonoma 14.1.1. Haxe Toolkit Version : 1.5.3

Also, there is no code completion for the project

m0rkeulv commented 1 month ago

Sounds like you have not configure the SDK correctly. The error comes from when the plugin tries to detect and/or set the SDK version info.

m0rkeulv commented 1 month ago

Sorry, i didn't look close enough, its an issue reading version from a library, not the SDK. i can make a fix to get around the problem but it would be nice to know why it fails, best guess is that you got a haxelib with a haxelib.json file that is missing version info

Shaunmax commented 1 month ago

Sorry, i didn't look close enough, its an issue reading version from a library, not the SDK. i can make a fix to get around the problem but it would be nice to know why it fails, best guess is that you got a haxelib with a haxelib.json file that is missing version info

I am sorry, I dint get you! are you asking me to check something from my side ?

m0rkeulv commented 1 month ago

i can make a fix but it will take some time before i can make a new release, in the mean time if you need to get things working you can check your haxelib libraries and look inside each one and check the files named haxelib.json, i expect one of them is missing the version value. you can just add a dummy value like "version" : "1.2.3" to anyone who is missing that line and the plugin should work again

they normally look like this and in your case i think one is missing the "version" line:

{
  "name": "box2d",
  "url": "http://github.com/jgranick/box2d",
  "license": "MIT",
  "tags": [ "physics", "flash", "cpp" ],
  "description": "Box2D is a tremendously popular physics engine for most platforms.",
  "version": "1.2.3",
  "releasenote": "Added TestBed sample, better B2ShapeType, platform fixes",
  "contributors": [ "singmajesty" ],
  "dependencies": {}
}
Shaunmax commented 1 month ago

look inside each one and check the files named haxelib.json, i expect one of them is missing the version value.

I just went through all the haxelib.json files in my system and they all have "version" in it.

m0rkeulv commented 1 month ago

strange.

the stacktrace more or less show the step when the plugin iterate over all libraries to read names, version etc.
it looks like it gets past syncing the overall project but fails when updating library list from each module. Its about to add a library and create the presentable name string, it looks like getting the name is no issue but the exception complains that the returned value for version is a null value. could you check your module dependencies and see if there is any dependencies that does not look like the rest ?

Shaunmax commented 1 month ago

strange.

the stacktrace more or less show the step when the plugin iterate over all libraries to read names, version etc. it looks like it gets past syncing the overall project but fails when updating library list from each module. Its about to add a library and create the presentable name string, it looks like getting the name is no issue but the exception complains that the returned value for version is a null value. could you check your module dependencies and see if there is any dependencies that does not look like the rest ?

I have 2 libraries in the project:-

image

image

m0rkeulv commented 1 month ago

open project structures and then modules and then dependencies. I dont think you can see the issue from the main view

Shaunmax commented 1 month ago

open project structures and then modules and then dependencies. I dont think you can see the issue from the main view

that I did earlier

image

checked all these folders

m0rkeulv commented 1 month ago

is this how your module dependencies look like ? image

Shaunmax commented 1 month ago

is this how your module dependencies look like ? image

Yes!

image

this is the project I am trying to load : https://github.com/SwazLord/Flappy-Starling-Haxe/tree/main

m0rkeulv commented 3 weeks ago

i did some changes in the latest release that i hope remedies some of this issue, could you update to 1.5.4 and test again ?

Shaunmax commented 3 weeks ago

i did some changes in the latest release that i hope remedies some of this issue, could you update to 1.5.4 and test again ?

Yes! The error is gone now, but still no code completion

m0rkeulv commented 3 weeks ago

could you try to do a prune caches and then a reload project from the project structure context menu. image

Shaunmax commented 3 weeks ago

prune caches

I tried that, but nothing happened