void (@NotNull PsiSynchronizedStatement statement) { super.visitSynchronizedStatement(statement); if (!reportLocalVariables && !reportMethodParameters) { return; } final PsiExpression lockExpression = PsiUtil.skipParenthesizedExprDown(statement.getLockExpression()); if (!(lockExpression instanceof PsiReferenceExpression referenceExpression)) { return; } if (referenceExpression.isQualified()) { return; } boolean localVariable = false; final PsiElement target = referenceExpression.resolve(); if (target instanceof PsiLocalVariable variable) { if (!reportLocalVariables || isSynchronizedCollection(variable, referenceExpression) || canBeEscaped(variable, referenceExpression)) { return; } localVariable = true; } else if (target instanceof PsiParameter parameter) { final PsiElement scope = parameter.getDeclarationScope(); if (scope instanceof PsiMethod) { if (!reportMethodParameters) { return; } } else { if (!reportLocalVariables) { return; } localVariable = true; } } else { return; } final PsiElement statementScope = getScope(statement); final PsiElement targetScope = getScope(target); if (statementScope != targetScope || isEscaping((PsiVariable)target)) { return; } registerError(referenceExpression, Boolean.valueOf(localVariable)); }