void (@NotNull PsiMethod method) { if (method.hasModifierProperty(PsiModifier.ABSTRACT) || !MethodUtils.methodMatches(method, CommonClassNames.JAVA_UTIL_ITERATOR, null, HardcodedMethodConstants.NEXT)) { return; } for (final PsiType exception : ExceptionUtil.getThrownExceptions(method)) { if (exception.equalsToText("java.util.NoSuchElementException")) { return; } } final CalledMethodsVisitor visitor = new CalledMethodsVisitor(); method.accept(visitor); if (visitor.isNoSuchElementExceptionThrown()) { return; } registerMethodError(method); }