Add a point about invalidated state between inspection checks and quick-fix run
This commit is contained in:
@@ -35,6 +35,10 @@ requires multiple resolve calls in a row.
|
||||
- Prefer `resolveToDescriptorIfAny()` over `resolveToDesciptor()` because of exceptions that are thrown from latter
|
||||
function when descriptor is absent.
|
||||
|
||||
- Any checks about code state and resolve that were made during reporting an inspection problem an registering a quick fix might be
|
||||
invalidated by the moment of the actual quick fix execution. Avoid the code that can throw exceptions because of that. Re-checks with early
|
||||
exit from the quick fix can be used to workaround it.
|
||||
|
||||
- There shouldn't be PSI elements stored in QuickFix classes (`val psi: PsiElement`) as such elements might be invalidated and can lead
|
||||
to memory leaks. Smart pointer (check `SmartPsiElementPointer` class and `createSmartPointer()` function) can be used when such storage
|
||||
is absolutely necessary.
|
||||
|
||||
Reference in New Issue
Block a user