oowekyala / intellij-javacc

JavaCC and JJTree grammar support for the IntelliJ Platform
https://plugins.jetbrains.com/plugin/11431-javacc
MIT License
45 stars 6 forks source link

maybe not supported IDEA 2021.1 #19

Closed xiaoma20082008 closed 3 years ago

xiaoma20082008 commented 3 years ago

What steps will reproduce the issue?

  1. git clone https://github.com/apache/tomcat.git
  2. cd tomcat && ant ide-intellij
  3. open tomcat with IntelliJ IDEA
  4. open package org.apache.tomcat.util.json
  5. you will see JSONParser.java and JSONParser.jj

Exception


// In file: file:///Users/cds/workspace/github/tomcat/java/org/apache/tomcat/util/json/JSONParser.java

java.lang.NullPointerException
    at com.github.oowekyala.ijcc.lang.injection.HostSpec.appendSuffixAndDestroy(LinearInjectedStructure.kt:130)
    at com.github.oowekyala.ijcc.lang.injection.TreeLineariserVisitor.startOn(TreeLineariserVisitor.kt:34)
    at com.github.oowekyala.ijcc.lang.injection.TreeLineariserVisitor$Companion.linearise(TreeLineariserVisitor.kt:108)
    at com.github.oowekyala.ijcc.lang.injection.InjectionUtilKt.getLinearStructureFor(InjectionUtil.kt:8)
    at com.github.oowekyala.ijcc.lang.injection.InjectionUtilKt.getLinearInjectedStructure(InjectionUtil.kt:14)
    at com.github.oowekyala.ijcc.lang.injection.JavaccLanguageInjector.injectIntoGrammar(JavaccLanguageInjector.kt:55)
    at com.github.oowekyala.ijcc.lang.injection.JavaccLanguageInjector.getLanguagesToInject(JavaccLanguageInjector.kt:32)
    at com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl.processInPlaceInjectorsFor(InjectedLanguageManagerImpl.java:441)
    at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtilBase.probeElementsUp(InjectedLanguageUtilBase.java:247)
    at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtilBase.enumerate(InjectedLanguageUtilBase.java:177)
    at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtilBase.enumerate(InjectedLanguageUtilBase.java:147)
    at com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl.enumerate(InjectedLanguageManagerImpl.java:323)
    at com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl.getInjectedPsiFiles(InjectedLanguageManagerImpl.java:455)
    at com.github.oowekyala.ijcc.lang.psi.impl.JccFileImpl.getClasses(JccFileImpl.kt:137)
    at com.intellij.core.CoreJavaDirectoryService.getPsiClasses(CoreJavaDirectoryService.java:68)
    at com.intellij.core.CoreJavaDirectoryService.getClasses(CoreJavaDirectoryService.java:54)
    at com.intellij.psi.impl.PsiElementFinderImpl.getClasses(PsiElementFinderImpl.java:103)
    at com.intellij.psi.impl.PsiElementFinderImpl.getClasses(PsiElementFinderImpl.java:95)
    at com.intellij.psi.impl.JavaPsiFacadeImpl.getClasses(JavaPsiFacadeImpl.java:260)
    at com.intellij.psi.impl.file.PsiPackageImpl.getClasses(PsiPackageImpl.java:143)
    at com.intellij.psi.impl.file.PsiPackageImpl.processDeclarations(PsiPackageImpl.java:321)
    at com.intellij.psi.impl.source.PsiJavaFileBaseImpl.processPackageDeclarations(PsiJavaFileBaseImpl.java:437)
    at com.intellij.psi.impl.source.PsiJavaFileBaseImpl.processCurrentPackage(PsiJavaFileBaseImpl.java:381)
    at com.intellij.psi.impl.source.PsiJavaFileBaseImpl.processOnDemandPackages(PsiJavaFileBaseImpl.java:359)
    at com.intellij.psi.impl.source.PsiJavaFileBaseImpl.access$000(PsiJavaFileBaseImpl.java:48)
    at com.intellij.psi.impl.source.PsiJavaFileBaseImpl$MyCacheBuilder.compute(PsiJavaFileBaseImpl.java:566)
    at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:54)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:227)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:42)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:227)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:43)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:228)
    at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
    at com.intellij.psi.impl.source.PsiJavaFileBaseImpl.processDeclarations(PsiJavaFileBaseImpl.java:282)
    at com.intellij.psi.scope.util.PsiScopesUtil.treeWalkUp(PsiScopesUtil.java:61)
    at com.intellij.psi.scope.util.PsiScopesUtil.treeWalkUp(PsiScopesUtil.java:40)
    at com.intellij.psi.scope.util.PsiScopesUtil.resolveAndWalk(PsiScopesUtil.java:207)
    at com.intellij.psi.scope.util.PsiScopesUtil.resolveAndWalk(PsiScopesUtil.java:136)
    at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl.resolve(PsiJavaCodeReferenceElementImpl.java:491)
    at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl.access$100(PsiJavaCodeReferenceElementImpl.java:44)
    at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl$OurGenericsResolver.resolve(PsiJavaCodeReferenceElementImpl.java:377)
    at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl$OurGenericsResolver.resolve(PsiJavaCodeReferenceElementImpl.java:370)
    at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$resolveWithCaching$2(ResolveCache.java:184)
    at com.intellij.openapi.util.Computable.get(Computable.java:17)
    at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$loggingResolver$4(ResolveCache.java:260)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:43)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68)
    at com.intellij.psi.impl.source.resolve.ResolveCache.resolve(ResolveCache.java:237)
    at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:184)
    at com.intellij.psi.impl.PsiImplUtil.multiResolveImpl(PsiImplUtil.java:786)
    at com.intellij.psi.impl.PsiImplUtil.multiResolveImpl(PsiImplUtil.java:778)
    at com.intellij.psi.impl.PsiImplUtil.multiResolveImpl(PsiImplUtil.java:754)
    at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl.multiResolve(PsiJavaCodeReferenceElementImpl.java:425)
    at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl.advancedResolve(PsiJavaCodeReferenceElementImpl.java:419)
    at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl.resolve(PsiJavaCodeReferenceElementImpl.java:354)
    at com.intellij.lang.aspectj.highlight.analysis.ref.PrivateMemberAccessAnnotator.annotate(PrivateMemberAccessAnnotator.java:22)
    at com.intellij.lang.aspectj.highlight.analysis.ref.PrivateMemberAccessAnnotator.annotate(PrivateMemberAccessAnnotator.java:16)
    at com.intellij.lang.aspectj.highlight.analysis.ElementAnnotator.annotate(ElementAnnotator.java:16)
    at com.intellij.lang.aspectj.highlight.AjAnnotatingVisitor.visitReferenceElement(AjAnnotatingVisitor.java:94)
    at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl.accept(PsiJavaCodeReferenceElementImpl.java:1048)
    at com.intellij.lang.aspectj.highlight.AjJavaAnnotator.annotate(AjJavaAnnotator.java:11)
    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:335)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$collectHighlights$5(GeneralHighlightingPass.java:268)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:294)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:297)
    at com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.lambda$analyze$1(HighlightVisitorImpl.java:214)
    at com.intellij.codeInsight.daemon.impl.analysis.RefCountHolder.analyze(RefCountHolder.java:369)
    at com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.analyze(HighlightVisitorImpl.java:213)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:297)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:297)
    at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:96)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:297)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectHighlights(GeneralHighlightingPass.java:265)
    at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:211)
    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:1096)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:393)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
    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:167)
    at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:178)
    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)

IDEA

IntelliJ IDEA 2021.1 (Ultimate Edition)
Build #IU-211.6693.111, built on April 6, 2021
Runtime version: 11.0.10+9-b1341.35 x86_64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
macOS 11.2.3
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 4
Non-Bundled Plugins: com.jetbrains.ChooseRuntime (1.2), org.antlr.intellij.plugin (1.16), com.github.oowekyala.javacc (1.7), idea.plugin.protoeditor (2.3.1)
Kotlin: 211-1.4.32-release-IJ6693.72

JavaCC plugin version

1.7

IDEA's Youtrack Address

oowekyala commented 3 years ago

Thanks for the report! I upgraded the plugin to depend on 2021.1, and couldn't reproduce it... But I hope dce3468b5d90fa49205207b4268eaeca764e26f9 will fix this. I'll try it out and release in a few days