private static boolean isIllegalReference(PsiVariable array, PsiExpression expr) {
    return SyntaxTraverser.psiTraverser(expr).filter(PsiReferenceExpression.class)
             .find(ref -> {
               PsiElement target = ref.resolve();
               return target == array ||
                      target instanceof PsiField && HighlightUtil.isIllegalForwardReferenceToField(ref, (PsiField)target, true) != null;
             }) != null;
  }
private static boolean isIllegalReference(PsiVariable array, PsiExpression expr)