void ( @NotNull PsiMethodCallExpression expression) { if (enumerationMethodCalled) { return; } super.visitMethodCallExpression(expression); final PsiReferenceExpression methodExpression = expression.getMethodExpression(); @NonNls final String methodName = methodExpression.getReferenceName(); if (!"hasMoreElements".equals(methodName) && !"nextElement".equals(methodName)) { return; } final PsiExpression qualifierExpression = methodExpression.getQualifierExpression(); if (!(qualifierExpression instanceof PsiReferenceExpression referenceExpression)) { return; } final PsiElement element = referenceExpression.resolve(); if (!(element instanceof PsiVariable variable)) { return; } enumerationMethodCalled = this.variable.equals(variable); }