Sorien / silex-idea-plugin

Idea plugin for Silex Framework - plugin is not compatible with PHPStorm 2016.2
MIT License
26 stars 8 forks source link

NullPointerException #8

Closed CarsonF closed 9 years ago

CarsonF commented 9 years ago
java.lang.NullPointerException
    at sk.sorien.silexplugin.pimple.ContainerResolver.getServices(ContainerResolver.java:40)
    at sk.sorien.silexplugin.pimple.ContainerResolver.getService(ContainerResolver.java:34)
    at sk.sorien.silexplugin.pimple.ContainerPhpTypeProvider.resolveElement(ContainerPhpTypeProvider.java:118)
    at sk.sorien.silexplugin.pimple.ContainerPhpTypeProvider.getBySignature(ContainerPhpTypeProvider.java:100)
    at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:398)
    at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:284)
    at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:80)
    at com.jetbrains.php.lang.psi.resolve.types.PhpType.globalLocationAware(PhpType.java:388)
    at com.jetbrains.php.lang.psi.elements.impl.MemberReferenceImpl.resolveGlobal(MemberReferenceImpl.java:153)
    at com.jetbrains.php.lang.psi.elements.impl.PhpReferenceImpl$1.resolve(PhpReferenceImpl.java:107)
    at com.jetbrains.php.lang.psi.elements.impl.PhpReferenceImpl$1.resolve(PhpReferenceImpl.java:104)
    at com.intellij.psi.impl.source.resolve.ResolveCache$3.compute(ResolveCache.java:142)
    at com.intellij.openapi.util.RecursionManager$2.doPreventingRecursion(RecursionManager.java:112)
    at com.intellij.psi.impl.source.resolve.ResolveCache.a(ResolveCache.java:139)
    at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:167)
    at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:159)
    at com.jetbrains.php.lang.psi.elements.impl.PhpReferenceImpl.multiResolve(PhpReferenceImpl.java:99)
    at com.jetbrains.php.lang.psi.elements.impl.PhpReferenceImpl.resolve(PhpReferenceImpl.java:85)
    at com.jetbrains.php.lang.annotator.PhpAnnotatorVisitor.checkAccessModifiers(PhpAnnotatorVisitor.java:380)
    at com.jetbrains.php.lang.annotator.PhpAnnotatorVisitor.visitPhpMethodReference(PhpAnnotatorVisitor.java:362)
    at com.jetbrains.php.lang.psi.elements.impl.MethodReferenceImpl.accept(MethodReferenceImpl.java:31)
    at com.jetbrains.php.lang.annotator.PhpAnnotator.annotate(PhpAnnotator.java:17)
    at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.a(DefaultHighlightVisitor.java:159)
    at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.visit(DefaultHighlightVisitor.java:102)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:340)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.access$100(GeneralHighlightingPass.java:64)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass$3.run(GeneralHighlightingPass.java:269)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:294)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.access$200(GeneralHighlightingPass.java:64)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass$4.run(GeneralHighlightingPass.java:300)
    at com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.analyze(XmlHighlightVisitor.java:751)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:297)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.access$200(GeneralHighlightingPass.java:64)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass$4.run(GeneralHighlightingPass.java:300)
    at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:86)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:297)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:266)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:205)
    at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:97)
    at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:67)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass$1$1.run(PassExecutorService.java:438)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1098)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass$1.run(PassExecutorService.java:429)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:452)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:402)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.a(PassExecutorService.java:426)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:402)
    at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask.exec(JobLauncherImpl.java:202)
    at jsr166e.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at jsr166e.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:858)
    at jsr166e.ForkJoinPool.scan(ForkJoinPool.java:1687)
    at jsr166e.ForkJoinPool.runWorker(ForkJoinPool.java:1642)
    at jsr166e.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:109)
CarsonF commented 9 years ago

Here's the stack trace for 0.9.5:

java.lang.NullPointerException
    at sk.sorien.silexplugin.pimple.ContainerResolver.getServices(ContainerResolver.java:40)
    at sk.sorien.silexplugin.pimple.ContainerResolver.getService(ContainerResolver.java:34)
    at sk.sorien.silexplugin.pimple.ContainerPhpTypeProvider.resolveElement(ContainerPhpTypeProvider.java:115)
    at sk.sorien.silexplugin.pimple.ContainerPhpTypeProvider.getBySignature(ContainerPhpTypeProvider.java:100)
    at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:398)
    at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:284)
    at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:80)
    at com.jetbrains.php.lang.psi.resolve.types.PhpType.globalLocationAware(PhpType.java:388)
    at com.jetbrains.php.lang.psi.elements.impl.MemberReferenceImpl.resolveGlobal(MemberReferenceImpl.java:153)
    at com.jetbrains.php.lang.psi.elements.impl.PhpReferenceImpl$1.resolve(PhpReferenceImpl.java:107)
    at com.jetbrains.php.lang.psi.elements.impl.PhpReferenceImpl$1.resolve(PhpReferenceImpl.java:104)
    at com.intellij.psi.impl.source.resolve.ResolveCache$3.compute(ResolveCache.java:142)
    at com.intellij.openapi.util.RecursionManager$2.doPreventingRecursion(RecursionManager.java:112)
    at com.intellij.psi.impl.source.resolve.ResolveCache.a(ResolveCache.java:139)
    at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:167)
    at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:159)
    at com.jetbrains.php.lang.psi.elements.impl.PhpReferenceImpl.multiResolve(PhpReferenceImpl.java:99)
    at com.jetbrains.php.lang.psi.elements.impl.PhpReferenceImpl.resolve(PhpReferenceImpl.java:85)
    at com.jetbrains.php.lang.annotator.PhpAnnotatorVisitor.checkAccessModifiers(PhpAnnotatorVisitor.java:380)
    at com.jetbrains.php.lang.annotator.PhpAnnotatorVisitor.visitPhpMethodReference(PhpAnnotatorVisitor.java:362)
    at com.jetbrains.php.lang.psi.elements.impl.MethodReferenceImpl.accept(MethodReferenceImpl.java:31)
    at com.jetbrains.php.lang.annotator.PhpAnnotator.annotate(PhpAnnotator.java:17)
    at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.a(DefaultHighlightVisitor.java:159)
    at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.visit(DefaultHighlightVisitor.java:102)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:340)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.access$100(GeneralHighlightingPass.java:64)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass$3.run(GeneralHighlightingPass.java:269)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:294)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.access$200(GeneralHighlightingPass.java:64)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass$4.run(GeneralHighlightingPass.java:300)
    at com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.analyze(XmlHighlightVisitor.java:751)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:297)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.access$200(GeneralHighlightingPass.java:64)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass$4.run(GeneralHighlightingPass.java:300)
    at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:86)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:297)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:266)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:205)
    at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:97)
    at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:67)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass$1$1.run(PassExecutorService.java:438)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1098)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass$1.run(PassExecutorService.java:429)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:452)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:402)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.a(PassExecutorService.java:426)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:402)
    at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask.exec(JobLauncherImpl.java:202)
    at jsr166e.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at jsr166e.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:858)
    at jsr166e.ForkJoinPool.scan(ForkJoinPool.java:1687)
    at jsr166e.ForkJoinPool.runWorker(ForkJoinPool.java:1642)
    at jsr166e.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:109)
Sorien commented 9 years ago

it should happen when it can't find/open/process pimple.json file ... i'm trying to find better way hot to deal with pimple.json loading

CarsonF commented 9 years ago

Can an empty Container be returned if the json file isn't found?

Sorien commented 9 years ago

yes its the easy solution, i'd like to try some loading at background/watching for changes or something like it, problem is that my java skills are not so good, last time i coded in Java was like 6/7 years ago :)

CarsonF commented 9 years ago

It's been around 2/3 years for me. I'm looking at your code and I'm like oh gosh, this shouldn't look that foreign haha. Maybe it's just jetbrains/intellji SDK that I'm unfamiliar with.

I was wondering how these classes are connected? Like I would expect the CompletionContributor to be created in SilexPluginComponent but it's not. How does the SDK know about this class?

Sorien commented 9 years ago

https://github.com/Sorien/silex-idea-plugin/blob/master/META-INF/plugin.xml#L32 its based on https://confluence.jetbrains.com/display/PhpStorm/PHP+Open+API, symfony2 plugin and few articles from net and the most with help from https://plugins.jetbrains.com/plugin/227

we have another problem there is just one instance of plugin when multiple projects are open ... so i'll need to find way how to deal with loading pimple.json per project

CarsonF commented 9 years ago

Yeah I've been looking the symfony2 plugin. There is so much there though.

How hard is this to develop? Can you run from source or do you have to build and restart phpstorm? or?

Can an instance be created with projectOpened()?

Sorien commented 9 years ago

its relative easy you need idea ultimate ... download http://www.sorien.sk/.idea.rar (my .idea dir) or create new plugin copy src and META-INF dir inside and setup sdks image

image

image

image

image

you can run/debug from idea ... it will run sandboxed phpstorm

Can an instance be created with projectOpened()? donno

Sorien commented 9 years ago

re: Can an instance be created with projectOpened()?

we can try it https://github.com/Sorien/silex-idea-plugin/commit/20064c5de34a433fb3f5e9c3ee2aed2ecfcb9607

Sorien commented 9 years ago

should be fixed at master

CarsonF commented 9 years ago

Sorry I've been busy busy. I'm in a wedding this weekend, but want to get back to this next week and see if I can build/debug/dev this. So far so good on the project setup :)