PsiExpression (PsiExpression expression, int dimensions) { for (int i = 0; i < dimensions; i++) { final PsiArrayInitializerExpression arrayInitializer; if ((expression instanceof PsiNewExpression newExpression)) { arrayInitializer = newExpression.getArrayInitializer(); } else if (expression instanceof PsiArrayInitializerExpression) { arrayInitializer = (PsiArrayInitializerExpression)expression; } else { return null; } if (arrayInitializer == null) return null; PsiExpression[] initializers = arrayInitializer.getInitializers(); if (initializers.length != 1) return null; expression = initializers[0]; } return expression; }