void (@NotNull PsiArrayAccessExpression expression) { PsiExpression arrayExpression = deparenthesizeExpression(expression.getArrayExpression()); if (arrayExpression instanceof PsiTypeCastExpression) { PsiTypeElement castTypeElement = ((PsiTypeCastExpression)arrayExpression).getCastType(); PsiExpression operand = ((PsiTypeCastExpression)arrayExpression).getOperand(); if (castTypeElement != null && operand != null) { if (PsiUtil.isAccessedForWriting(expression)) { PsiType castTo = castTypeElement.getType(); PsiType opType = operand.getType(); if (opType != null && TypeConversionUtil.isAssignable(opType, castTo, false) && opType.getArrayDimensions() == castTo.getArrayDimensions()) { addToResults((PsiTypeCastExpression)arrayExpression); } } } } PsiExpression indexExpression = deparenthesizeExpression(expression.getIndexExpression()); if (indexExpression instanceof PsiTypeCastExpression) { PsiExpression operand = ((PsiTypeCastExpression)indexExpression).getOperand(); if (operand != null) { PsiType opType = operand.getType(); if (opType != null) { addIfNarrowing((PsiTypeCastExpression) indexExpression, opType, null); } } } super.visitArrayAccessExpression(expression); }