magento / magento/magento2-phpstorm-plugin

java.lang.IllegalArgumentException: offsetInFile

Open
#2,458 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
463
Forks
98
Avg merge
1h 6m
Merged PRs (30d)
3

Description

Describe the bug (*)

A clear and concise description of what the bug is.

java.lang.IllegalArgumentException: offsetInFile(=-941258560) must be >=0
	at com.intellij.util.io.dev.mmapped.MMappedFileStorage.pageIndexByOffset(MMappedFileStorage.java:254)
	at com.intellij.util.io.dev.mmapped.MMappedFileStorage.pageByOffset(MMappedFileStorage.java:208)
	at com.intellij.openapi.vfs.newvfs.persistent.mapped.MappedFileStorageHelper.writeIntField(MappedFileStorageHelper.java:455)
	at com.intellij.openapi.vfs.newvfs.persistent.dev.FastFileAttributes$Int4FileAttribute.write(FastFileAttributes.java:98)
	at com.intellij.psi.stubs.IndexingStampInfoStorageOverFastAttributes.writeStampInfo(IndexingStampInfoStorage.kt:56)
	at com.intellij.psi.stubs.StubTreeLoaderImpl.saveIndexingStampInfo(StubTreeLoaderImpl.java:295)
	at com.intellij.psi.stubs.StubUpdatingIndexStorage.lambda$mapInputAndPrepareUpdate$0(StubUpdatingIndexStorage.java:69)
	at com.intellij.openapi.util.Computable.get(Computable.java:16)
	at com.intellij.indexing.composite.CompositeInvertedIndexBase.lambda$mapInputAndPrepareUpdate$3(CompositeInvertedIndexBase.java:76)
	at com.intellij.util.indexing.IndexInfrastructureExtensionUpdateComputation.compute(IndexInfrastructureExtensionUpdateComputation.java:27)
	at com.intellij.util.indexing.IndexInfrastructureExtensionUpdateComputation.compute(IndexInfrastructureExtensionUpdateComputation.java:11)
	at com.intellij.openapi.util.Computable.get(Computable.java:16)
	at com.intellij.util.indexing.FileBasedIndexImpl.lambda$runUpdateForPersistentData$24(FileBasedIndexImpl.java:1638)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:685)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:641)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$3(CoreProgressManager.java:236)
	at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:57)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:236)
	at com.intellij.util.indexing.FileBasedIndexImpl.lambda$runUpdateForPersistentData$25(FileBasedIndexImpl.java:1638)
	at com.intellij.util.indexing.StorageBufferingHandler.runUpdate(StorageBufferingHandler.java:23)
	at com.intellij.util.indexing.FileBasedIndexImpl.runUpdateForPersistentData(FileBasedIndexImpl.java:1637)
	at com.intellij.util.indexing.SingleIndexValueApplier.doApply(SingleIndexValueApplier.java:62)
	at com.intellij.util.indexing.SingleIndexValueApplier.apply(SingleIndexValueApplier.java:50)
	at com.intellij.util.indexing.FileIndexesValuesApplier.applyModifications(FileIndexesValuesApplier.java:204)
	at com.intellij.util.indexing.FileIndexesValuesApplier.apply(FileIndexesValuesApplier.java:152)
	at com.intellij.util.indexing.FileBasedIndexImpl.processRefreshedFile(FileBasedIndexImpl.java:1317)
	at com.intellij.util.indexing.FileBasedIndexImpl$VirtualFileUpdateTask.doProcess(FileBasedIndexImpl.java:1682)
	at com.intellij.util.indexing.FileBasedIndexImpl$VirtualFileUpdateTask.doProcess(FileBasedIndexImpl.java:1676)
	at com.intellij.util.indexing.UpdateTask.process(UpdateTask.java:63)
	at com.intellij.util.indexing.UpdateTask.processAll(UpdateTask.java:32)
	at com.intellij.util.indexing.FileBasedIndexImpl.forceUpdate(FileBasedIndexImpl.java:1699)
	at com.intellij.util.indexing.FileBasedIndexImpl.ensureUpToDate(FileBasedIndexImpl.java:788)
	at com.intellij.util.indexing.FileBasedIndexEx.processExceptions(FileBasedIndexEx.java:296)
	at com.intellij.util.indexing.FileBasedIndexEx.getContainingFilesIterator(FileBasedIndexEx.java:244)
	at com.intellij.util.indexing.FileBasedIndexEx.getContainingFiles(FileBasedIndexEx.java:220)
	at com.intellij.util.indexing.FileBasedIndexImpl.getContainingFiles(FileBasedIndexImpl.java:1073)
	at com.magento.idea.magento2plugin.reference.provider.ModuleNameReferenceProvider.getReferencesByElement(ModuleNameReferenceProvider.java:42)
	at com.magento.idea.magento2plugin.reference.provider.CompositeReferenceProvider.getReferencesByElement(CompositeReferenceProvider.java:30)
	at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.getReferences(ReferenceProvidersRegistryImpl.java:184)
	at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.mapNotEmptyReferencesFromProviders(ReferenceProvidersRegistryImpl.java:165)
	at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.doGetReferencesFromProviders(ReferenceProvidersRegistryImpl.java:144)
	at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:51)
	at com.intellij.psi.impl.source.xml.XmlAttributeValueImpl.getReferences(XmlAttributeValueImpl.java:80)
	at com.intellij.psi.impl.SharedPsiElementImplUtil.addReferences(SharedPsiElementImplUtil.java:56)
	at com.intellij.psi.impl.SharedPsiElementImplUtil.findReferenceAt(SharedPsiElementImplUtil.java:33)
	at com.intellij.psi.impl.SharedPsiElementImplUtil.findReferenceAt(SharedPsiElementImplUtil.java:50)
	at com.intellij.psi.impl.source.tree.CompositePsiElement.findReferenceAt(CompositePsiElement.java:102)
	at com.intellij.psi.AbstractFileViewProvider.findReferenceAt(AbstractFileViewProvider.java:226)
	at com.intellij.psi.SingleRootFileViewProvider.findReferenceAt(SingleRootFileViewProvider.java:222)
	at com.intellij.psi.impl.source.PsiFileImpl.findReferenceAt(PsiFileImpl.java:525)
	at com.intellij.codeInsight.TargetElementUtilBase.findReference(TargetElementUtilBase.java:189)
	at com.intellij.codeInsight.TargetElementUtil.findReference(TargetElementUtil.java:93)
	at com.intellij.model.psi.impl.TargetsKt.fromTargetEvaluator(targets.kt:167)
	at com.intellij.model.psi.impl.TargetsKt.declarationsOrReferences(targets.kt:136)
	at com.intellij.model.psi.impl.TargetsKt.declaredReferencedData(targets.kt:42)
	at com.intellij.codeInsight.navigation.impl.GtduKt.fromTargetData(gtdu.kt:58)
	at com.intellij.codeInsight.navigation.impl.GtduKt.gotoDeclarationOrUsagesInner(gtdu.kt:54)
	at com.intellij.codeInsight.navigation.impl.GtduKt.access$gotoDeclarationOrUsagesInner(gtdu.kt:1)
	at com.intellij.codeInsight.navigation.impl.GtduKt$gotoDeclarationOrUsages$1.invoke(gtdu.kt:19)
	at com.intellij.codeInsight.navigation.impl.GtduKt$gotoDeclarationOrUsages$1.invoke(gtdu.kt:19)
	at com.intellij.codeInsight.navigation.impl.CommonKt.processInject

To Reproduce (*)

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior (*)

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Please complete the following information: (*)

  • OS: Linux 5.15.0-126-generic
  • PhpStorm/Intellij version: 2023.3.6
  • Plugin Version: 5.1.1

Additional context

Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the plugin entry points named in the trace, especially ModuleNameReferenceProvider.java:42 and CompositeReferenceProvider.java:30, and reproduce the failure in the listed PhpStorm 2023.3.6 and plugin 5.1.1 environment. Trace the reference lookup into the indexing calls and add a regression test or other verification showing that the negative offsetInFile exception no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.