boolean (PsiStatement body, PsiVariable variable) { if (body instanceof PsiExpressionStatement exp) { final PsiExpression expression = exp.getExpression(); return expressionIsArrayCopy(expression, variable); } else if (body instanceof PsiBlockStatement blockStatement) { final PsiCodeBlock codeBlock = blockStatement.getCodeBlock(); final PsiStatement[] statements = codeBlock.getStatements(); if (statements.length == 1) { return bodyIsArrayCopy(statements[0], variable); } else if (statements.length == 2) { final PsiStatement statement = statements[0]; if (!(statement instanceof PsiDeclarationStatement declarationStatement)) { return false; } final PsiElement[] declaredElements = declarationStatement.getDeclaredElements(); if (declaredElements.length != 1) { return false; } final PsiElement declaredElement = declaredElements[0]; if (!(declaredElement instanceof PsiVariable localVariable)) { return false; } final PsiExpression initializer = localVariable.getInitializer(); if (!ExpressionUtils.isOffsetArrayAccess(initializer, variable)) { return false; } return bodyIsArrayCopy(statements[1], variable); } } return false; }