void (@NotNull PsiForeachStatement statement) { final PsiExpression iteratedValue = statement.getIteratedValue(); if (iteratedValue == null) { expectedType = null; return; } final PsiType iteratedValueType = iteratedValue.getType(); if (!(iteratedValueType instanceof PsiClassType classType)) { expectedType = null; return; } final PsiType[] parameters = classType.getParameters(); final PsiClass iterableClass = ClassUtils.findClass(CommonClassNames.JAVA_LANG_ITERABLE, statement); if (iterableClass == null) { expectedType = null; } else { expectedType = JavaPsiFacade.getElementFactory(statement.getProject()).createType(iterableClass, parameters); } }