Skip to content

[BUG] SqlNativeSpringQueryLanguageInjector reads stale PSI/stub (file text mismatch / outdated stub) #235

@imuromtsev

Description

@imuromtsev

Summary

SQL language injection for JdbcTemplate-like calls reads stale/outdated PSI, producing several related exceptions. ~22 events across 4 Sentry issues.

Where

  • SqlNativeSpringQueryLanguageInjector.isJdbcTemplateLikeSqlNativeSpringQueryLanguageInjector.kt:83 (:36)
  • SqlNativeSpringQueryLanguageInjector.isNotSqlStringSqlNativeSpringQueryLanguageInjector.kt:74

Exceptions seen

  • RuntimeExceptionWithAttachments: file text mismatch
  • Throwable: Stub index points to a file ...
  • Exception: Outdated stub in index ...
  • Throwable: psiElement is not instance of requiredClass

Sentry

Suggested direction (hypothesis)

Re-resolve against current PSI/stub inside a read action; avoid caching PSI across document changes; guard isJdbcTemplateLike / isNotSqlString against stale stub access.

Filed from Sentry (project 4 / spring-plugin), last 30 days. Auto-triaged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in:spring-coreSpring Core or Spring Boot Core issues

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions