Skip to content

IndexOutOfBoundsException: Wrong line: -1. from Inspection tool on found problem #1759

Closed
@alisevych

Description

@alisevych

Description

IndexOutOfBoundsException: Wrong line: -1. from Inspection tool on found problem.

To Reproduce

  1. Install one of the latest plugins from main into IntelliJ Idea 2022.2.4
  2. Run the IQue project (please contact author for details)
  3. Use plugin to generate tests for several classes from utils package, including ArrayTools ,
    using Generate and Run
  4. Wait tests are generated

Expected behavior

No exception is supposed to be thrown in IDE.

Actual behavior

IndexOutOfBoundsException: Wrong line: -1. is thrown from Inspection tool.

Visual proofs (screenshots, logs, images)

In file: D:/JavaProjects/IQue/commons/src/main/java/com/expleague/commons/util/ArrayTools.java

java.lang.IndexOutOfBoundsException: Wrong line: -1. Available lines count: 1058
 at com.intellij.openapi.editor.impl.LineSet.checkLineIndex(LineSet.java:200)
 at com.intellij.openapi.editor.impl.LineSet.getLineStart(LineSet.java:181)
 at com.intellij.openapi.editor.impl.DocumentImpl.getLineStartOffset(DocumentImpl.java:1022)
 at org.utbot.intellij.plugin.inspection.UnitTestBotInspectionTool.getTextRange(UnitTestBotInspectionTool.kt:121)
 at org.utbot.intellij.plugin.inspection.UnitTestBotInspectionTool.checkFile(UnitTestBotInspectionTool.kt:73)
 at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.lambda$inspectFile$17(GlobalInspectionContextImpl.java:517)
 at com.intellij.codeInspection.ex.InspectionEventsKt.reportWhenInspectionFinished(inspectionEvents.kt:17)
 at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.lambda$inspectFile$18(GlobalInspectionContextImpl.java:510)
 at com.intellij.concurrency.JobLauncherImpl.lambda$processImmediatelyIfTooFew$2(JobLauncherImpl.java:140)
 at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
 at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
 at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
 at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
 at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
 at com.intellij.concurrency.JobLauncherImpl.lambda$processImmediatelyIfTooFew$3(JobLauncherImpl.java:136)
 at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:915)
 at com.intellij.concurrency.JobLauncherImpl.processImmediatelyIfTooFew(JobLauncherImpl.java:147)
 at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgress(JobLauncherImpl.java:47)
 at com.intellij.concurrency.JobLauncher.invokeConcurrentlyUnderProgress(JobLauncher.java:51)
 at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.lambda$inspectFile$19(GlobalInspectionContextImpl.java:506)
 at com.intellij.codeInspection.ex.InspectionProfileWrapper.runWithCustomInspectionWrapper(InspectionProfileWrapper.java:89)
 at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.inspectFile(GlobalInspectionContextImpl.java:490)
 at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.lambda$runTools$6(GlobalInspectionContextImpl.java:353)
 at com.intellij.openapi.project.DumbService.lambda$runReadActionInSmartMode$0(DumbService.java:113)
 at com.intellij.openapi.project.DumbService.lambda$runReadActionInSmartMode$1(DumbService.java:157)
 at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:941)
 at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:68)
 at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:150)
 at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:113)
 at com.intellij.openapi.project.DumbService.tryRunReadActionInSmartMode(DumbService.java:130)
 at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.lambda$runTools$12(GlobalInspectionContextImpl.java:338)
 at com.intellij.concurrency.JobLauncherImpl$1MyProcessQueueTask.lambda$call$0(JobLauncherImpl.java:297)
 at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
 at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
 at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
 at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
 at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
 at com.intellij.concurrency.JobLauncherImpl$1MyProcessQueueTask.call(JobLauncherImpl.java:282)
 at com.intellij.concurrency.JobLauncherImpl$1MyProcessQueueTask.call(JobLauncherImpl.java:270)
 at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1428)
 at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
 at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
 at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
 at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
 at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

Environment

Windows 10 Pro
IntelliJ IDEA 2022.2.4
Maven, JDK 8

Additional context

Not reproducing when generation is run for a single class or several classes.
Happened once when generation was made for a whole package utils.

Metadata

Metadata

Assignees

Labels

comp-sarifIssue is related to SARIF report or Problems tabctg-bugIssue is a bugspec-internalInternal issuestatus-verifiedBug fix is verified

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions