Field not recognized

Issue #1535 resolved
Justin Julicher created an issue

I have a field that is on the server have done multiple regenerations of the OST but it was still not resolving properly.

I had the associated Ida_Hearing__c .object file in my local file system (which didn’t have the Courtroom_Name__c) but the sandbox did.

Observations:

  • I regenerated multiple times but the field never resolved.
  • Once I added the field into the .object file and saved - expected it to resolve but it didn’t.
  • Once I added the field into the .object file and regenerated - expected it to resolve but it didn’t.
  • Invalidated Caches - Rebuilt OST (Full) - expected it to resolve but it hasn’t.

ScreenShots:

Also after the regeneration after adding the definition into the .object file I had this error which resulted in continuous indexing.

ad.run(ForkJoinWorkerThread.java:177)
2020-02-13 16:50:13,190 [184205667]  ERROR - aemon.impl.PassExecutorService - WebStorm 2019.3.2  Build #WS-193.6015.40 
2020-02-13 16:50:13,190 [184205667]  ERROR - aemon.impl.PassExecutorService - JDK: 14-ea; VM: OpenJDK 64-Bit Server VM; Vendor: Private Build 
2020-02-13 16:50:13,190 [184205667]  ERROR - aemon.impl.PassExecutorService - OS: Linux 
2020-02-13 16:50:13,190 [184205667]  ERROR - aemon.impl.PassExecutorService - Plugin to blame: Illuminated Cloud 2 version: 2.1.0.2 
2020-02-13 16:50:13,191 [184205668]  ERROR - aemon.impl.PassExecutorService - Last Action: EditorEnter 
2020-02-13 16:50:13,191 [184205668]  ERROR - aemon.impl.PassExecutorService - Element class com.intellij.psi.impl.source.tree.CompositeElement of type METHOD_DECLARATION (class com.illuminatedcloud.intellij.psi.stub.ApexMethodDeclarationElementType) 
com.intellij.psi.PsiInvalidElementAccessException: Element class com.intellij.psi.impl.source.tree.CompositeElement of type METHOD_DECLARATION (class com.illuminatedcloud.intellij.psi.stub.ApexMethodDeclarationElementType)
    at com.intellij.psi.PsiInvalidElementAccessException.createByNode(PsiInvalidElementAccessException.java:96)
    at com.intellij.psi.impl.source.SubstrateRef$2.getContainingFile(SubstrateRef.java:101)
    at com.intellij.extapi.psi.StubBasedPsiElementBase.getContainingFile(StubBasedPsiElementBase.java:253)
    at com.intellij.psi.impl.smartPointers.SmartPointerManagerImpl.createSmartPsiElementPointer(SmartPointerManagerImpl.java:56)
    at com.illuminatedcloud.intellij.psi.impl.ApexExpressionType.lambda$createSmartPsiElementPointer$0(SourceFile:118)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:807)
    at com.illuminatedcloud.intellij.psi.impl.ApexExpressionType.createSmartPsiElementPointer(SourceFile:117)
    at com.illuminatedcloud.intellij.psi.impl.ApexExpressionType.<init>(SourceFile:83)
    at com.illuminatedcloud.intellij.ApexLanguage.lambda$getObjectClassDeclaration$1(SourceFile:768)
    at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:54)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$1(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:113)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:71)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
    at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:64)
    at com.illuminatedcloud.intellij.ApexLanguage.getObjectClassDeclaration(SourceFile:767)
    at com.illuminatedcloud.intellij.inspection.modifierAgreement.ApexModifierAgreementInspection.checkMethodDeclaration(SourceFile:213)
    at com.illuminatedcloud.intellij.inspection.modifierAgreement.ApexModifierAgreementInspection.access$100(SourceFile:64)
    at com.illuminatedcloud.intellij.inspection.modifierAgreement.ApexModifierAgreementInspection$1.visitElement(SourceFile:124)
    at com.intellij.psi.impl.PsiElementBase.accept(PsiElementBase.java:274)
    at com.illuminatedcloud.intellij.psi.impl.ApexMethodDeclarationImpl.accept(SourceFile:31)
    at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:77)
    at com.intellij.codeInspection.InspectionEngine.createVisitorAndAcceptElements(InspectionEngine.java:64)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.runToolOnElements(LocalInspectionsPass.java:306)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$null$3(LocalInspectionsPass.java:274)
    at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:154)
    at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:146)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$null$4(LocalInspectionsPass.java:271)
    at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:125) 

Next thing I tried was I checked my System Admin profile field-level security and found that a number of fields that I didn’t have access to - I updated the profile for this field and regenerated the OST (SObject only). Upon regeneration I expereinced the index looping again with this error now in the log:

anceWatcher - Indexable file iteration took 1794ms; general responsiveness: ok; EDT responsiveness: ok 
2020-02-14 11:11:49,473 [1505092]   INFO - indexing.UnindexedFilesUpdater - Unindexed files update started: 50504 files to update 
2020-02-14 11:12:04,626 [1520245]   INFO - .diagnostic.PerformanceWatcher - Unindexed files update took 15153ms; general responsiveness: ok; EDT responsiveness: ok 
2020-02-14 11:12:04,739 [1520358]   INFO - ndex.IlluminatedCloudIndexUtil - Rebuild of stub index complete. 
2020-02-14 11:12:04,848 [1520467]   INFO - ndex.IlluminatedCloudIndexUtil - Rebuilding the stub index due to exception: Element: class com.illuminatedcloud.intellij.psi.impl.ApexVariableDeclarationImpl 
2020-02-14 11:12:04,853 [1520472]   INFO - il.indexing.FileBasedIndexImpl - Rebuild requested for index Stubs 
com.intellij.psi.PsiInvalidElementAccessException: Element: class com.illuminatedcloud.intellij.psi.impl.ApexVariableDeclarationImpl
    at com.intellij.psi.impl.source.SubstrateRef$1.getNode(SubstrateRef.java:65)
    at com.intellij.extapi.psi.StubBasedPsiElementBase.getNode(StubBasedPsiElementBase.java:148)
    at com.intellij.extapi.psi.StubBasedPsiElementBase.getParentByStub(StubBasedPsiElementBase.java:320)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:807)
    at com.illuminatedcloud.intellij.psi.impl.ApexDeclarationMixin.getParent(SourceFile:104)
    at com.intellij.psi.PsiInvalidElementAccessException.findOutInvalidationReason(PsiInvalidElementAccessException.java:182)
    at com.intellij.psi.PsiInvalidElementAccessException.getMessageWithReason(PsiInvalidElementAccessException.java:132)
    at com.intellij.psi.PsiInvalidElementAccessException.<init>(PsiInvalidElementAccessException.java:78)
    at com.intellij.psi.PsiInvalidElementAccessException.<init>(PsiInvalidElementAccessException.java:49)
    at com.intellij.psi.impl.source.SubstrateRef$1.getContainingFile(SubstrateRef.java:76)
    at com.intellij.extapi.psi.StubBasedPsiElementBase.getContainingFile(StubBasedPsiElementBase.java:253)
    at com.intellij.psi.impl.smartPointers.SmartPointerManagerImpl.createSmartPsiElementPointer(SmartPointerManagerImpl.java:56)
    at com.illuminatedcloud.intellij.psi.impl.ApexExpressionType.lambda$createSmartPsiElementPointer$0(SourceFile:118)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:807)
    at com.illuminatedcloud.intellij.psi.impl.ApexExpressionType.createSmartPsiElementPointer(SourceFile:117)
    at com.illuminatedcloud.intellij.psi.impl.ApexExpressionType.<init>(SourceFile:83)
    at com.illuminatedcloud.intellij.ApexLanguage.lambda$getObjectClassDeclaration$1(SourceFile:768)
    at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:54)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$1(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:113)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:71)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
    at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:64)
    at com.illuminatedcloud.intellij.ApexLanguage.getObjectClassDeclaration(SourceFile:767)

Added logs with Trace enabled for OST Generation.

Comments (3)

  1. Scott Wells repo owner

    All of those PsiInvalidElementAccessExceptions indicate to me that your caches/indices have gotten into a bad state. They're (mostly) rebuilt when you rebuild the OST, please try to things to rebuild them explicitly:

    1. In Illuminated Cloud>Configure Project, click Rebuild Caches and Indices, then allow the project to close and reopen.
    2. If that doesn't do it, try File>Invalidate Caches / Restart which is the nuclear option that rebuilds ALL file-based indices and the dependent caches.

    If that doesn't do it and you're still seeing these types of errors in your log, something is quickly putting the indices into a bad state and I'll need to investigate what that might be.

  2. Log in to comment