void ( @NotNull PsiMethodCallExpression expression) { super.visitMethodCallExpression(expression); if (!isLockAcquireMethod(expression)) { return; } final PsiReferenceExpression methodExpression = expression.getMethodExpression(); final PsiExpression qualifierExpression = methodExpression.getQualifierExpression(); final PsiVariable boundVariable; final PsiReferenceExpression referenceExpression; final LockType type; if (qualifierExpression instanceof PsiReferenceExpression) { referenceExpression = (PsiReferenceExpression)qualifierExpression; final PsiElement target = referenceExpression.resolve(); if (!(target instanceof PsiVariable)) { return; } boundVariable = (PsiVariable)target; type = LockType.REGULAR; } else if (qualifierExpression instanceof PsiMethodCallExpression methodCallExpression) { final PsiReferenceExpression methodExpression1 = methodCallExpression.getMethodExpression(); @NonNls final String methodName = methodExpression1.getReferenceName(); if ("readLock".equals(methodName)) { type = LockType.READ; } else if ("writeLock".equals(methodName)) { type = LockType.WRITE; } else { return; } final PsiExpression qualifierExpression1 = methodExpression1.getQualifierExpression(); if (!(qualifierExpression1 instanceof PsiReferenceExpression)) { return; } referenceExpression = (PsiReferenceExpression)qualifierExpression1; final PsiElement target = referenceExpression.resolve(); if (!(target instanceof PsiVariable)) { return; } boundVariable = (PsiVariable)target; } else { return; } final PsiStatement statement = PsiTreeUtil.getParentOfType(expression, PsiStatement.class); if (statement == null) { return; } PsiStatement nextStatement = PsiTreeUtil.getNextSiblingOfType(statement, PsiStatement.class); while (nextStatement != null && !isSignificant(nextStatement)) { nextStatement = PsiTreeUtil.getNextSiblingOfType(nextStatement, PsiStatement.class); } if (!(nextStatement instanceof PsiTryStatement tryStatement)) { registerError(expression, referenceExpression); return; } if (lockIsUnlockedInFinally(tryStatement, boundVariable, type)) { return; } registerError(expression, referenceExpression); }