In a big project I regularly get a NullPointerException after some time of analyzing MarkLogic XQuery code:
In file: LightVirtualFile: <project path>/ml-modules/src/modules/webapi/services/<redacted>.xqy
java.lang.NullPointerException
at org.intellij.xquery.psi.XQueryUtil.getFileByRelativePath(XQueryUtil.java:71)
at org.intellij.xquery.psi.XQueryUtil.findXQueryFileByName(XQueryUtil.java:49)
at org.intellij.xquery.reference.module.XQueryModuleReference.multiResolve(XQueryModuleReference.java:49)
at org.intellij.xquery.reference.module.XQueryModuleReference.resolve(XQueryModuleReference.java:61)
at org.intellij.xquery.psi.XQueryUtil.addFileIfReferencedAndExists(XQueryUtil.java:129)
at org.intellij.xquery.psi.XQueryUtil.getReferencesToExistingFilesInImport(XQueryUtil.java:122)
at org.intellij.xquery.psi.XQueryFile.getImportedFilesThatExist(XQueryFile.java:360)
at org.intellij.xquery.annotator.duplicateFunction.Determiner.getImportedFileWithDuplicatedDeclaration(Determiner.java:64)
at org.intellij.xquery.annotator.duplicateFunction.ErrorAnnotationCreator.createDuplicateFunctionDeclarationError(ErrorAnnotationCreator.java:36)
at org.intellij.xquery.annotator.XQueryAnnotator.annotate(XQueryAnnotator.java:85)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.runAnnotators(DefaultHighlightVisitor.java:136)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.visit(DefaultHighlightVisitor.java:116)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.runVisitors(GeneralHighlightingPass.java:336)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$collectHighlights$5(GeneralHighlightingPass.java:275)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:295)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:298)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:96)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:298)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectHighlights(GeneralHighlightingPass.java:266)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:212)
at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:56)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:400)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1137)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:393)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:65)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:392)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:368)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:172)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:183)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:366)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:188)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Unfortunately I cannot disclose the source file that is mentioned in the exception message, just can give a few facts about it:
(too) big (~1700 LOC)
module, imports 12 other modules. Some of them with an absolute path, some with a relative path.
the other modules import again various other modules - partly the same as this module does
found "circular imports" so this module is imported from modules it imports itself. (MarkLogic server doesn't care about that)
it imports a module (from the project) that imports another module (functx) that is deployed to the server, but not reachable in the project.
I think it would be OK, if the plugin reported one or more errors about the whole situation, but it is not OK if it crashes. From the exception message or stacktrace one doesn't see, what exactly triggered the NPE, so due to the size of the module, it is nearly impossible to "fix" that or work around it.
In a big project I regularly get a NullPointerException after some time of analyzing MarkLogic XQuery code:
Unfortunately I cannot disclose the source file that is mentioned in the exception message, just can give a few facts about it:
I think it would be OK, if the plugin reported one or more errors about the whole situation, but it is not OK if it crashes. From the exception message or stacktrace one doesn't see, what exactly triggered the NPE, so due to the size of the module, it is nearly impossible to "fix" that or work around it.