Error in SonarLint for IDE: IntelliJ IDEA 2023.1.5

Environment:

  • Java: JetBrains s.r.o. 17.0.7
  • OS: Mac OS X aarch64
  • IDE: IntelliJ IDEA 2023.1.5
  • SonarLint: 9.1.0.75538

Exceptions occurred on invoking the intention ‘SonarLint: Inline expression’ on a copy of the file.

java.lang.IndexOutOfBoundsException: Wrong endOffset: 4385; documentLength: 4372
	at c.ij.oa.editor.impl.DocumentImpl.assertBounds(DocumentImpl.java:674)
	at c.ij.oa.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:607)
	at c.ij.oa.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:601)
	at o.sl.ij.editor.ApplyQuickFixIntentionAction.invoke(ApplyQuickFixIntentionAction.kt:73)
	at c.ij.codeInsight.intention.IntentionAction.generatePreview(IntentionAction.java:124)
	at c.ij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.generatePreview(IntentionActionWithTextCaching.java:240)
	at c.ij.codeInsight.intention.impl.preview.IntentionPreviewComputable.invokePreview$lambda$3$lambda$2$lambda$1(IntentionPreviewComputable.kt:121)
	at c.ij.model.SideEffectGuard.computeWithAllowedSideEffects(SideEffectGuard.java:25)
	at c.ij.model.SideEffectGuard.computeWithoutSideEffects(SideEffectGuard.java:18)
	at c.ij.codeInsight.intention.impl.preview.IntentionPreviewComputable.invokePreview$lambda$3$lambda$2(IntentionPreviewComputable.kt:120)
	at c.ij.psi.impl.source.PostprocessReformattingAspect.lambda$postponeFormattingInside$2(PostprocessReformattingAspect.java:140)
	at c.ij.psi.impl.source.PostprocessReformattingAspect.postponeFormattingInside(PostprocessReformattingAspect.java:148)

Hi @Petro_P, thank you for your report!

It’s a bug we have fixed for the upcoming releases of SonarLint version 10.0, which is happening next week.