void (@NotNull PsiMethodCallExpression expression) { super.visitMethodCallExpression(expression); final PsiReferenceExpression methodExpression = expression.getMethodExpression(); @NonNls final String name = methodExpression.getReferenceName(); if (!"current".equals(name)) { return; } final PsiMethod method = expression.resolveMethod(); if (method == null) { return; } final PsiClass aClass = method.getContainingClass(); if (!InheritanceUtil.isInheritor(aClass, "java.util.concurrent.ThreadLocalRandom")) { return; } if (isArgumentToMethodCall(expression)) { registerMethodCallError(expression); } else { final PsiVariable variable = assignedToVariable(expression); if (variable instanceof PsiField) { registerMethodCallError(expression); } else if (variable instanceof PsiLocalVariable) { final PsiCodeBlock context = PsiTreeUtil.getParentOfType(variable, PsiCodeBlock.class); final boolean passed = VariableAccessUtils.variableIsPassedAsMethodArgument(variable, context, myMethodMatcher::matches); if (passed || VariableAccessUtils.variableIsUsedInInnerClass(variable, context)) { registerMethodCallError(expression); } } } }