void (@NotNull PsiExpression src, @NotNull PsiExpression srcPos, @NotNull PsiExpression dest, @NotNull PsiExpression destPos, @NotNull PsiExpression length, @NotNull PsiMethodCallExpression call) { CommonDataflow.DataflowResult result = CommonDataflow.getDataflowResult(src); if (result == null) return; LongRangeSet srcLengthSet = DfIntType.extractRange(SpecialField.ARRAY_LENGTH.getFromQualifier(result.getDfType(src))); LongRangeSet destLengthSet = DfIntType.extractRange(SpecialField.ARRAY_LENGTH.getFromQualifier(result.getDfType(dest))); LongRangeSet srcPosSet = DfIntType.extractRange(result.getDfType(srcPos)); LongRangeSet destPosSet = DfIntType.extractRange(result.getDfType(destPos)); LongRangeSet lengthSet = DfIntType.extractRange(result.getDfType(length)); LongRangeSet srcPossibleLengthToCopy = srcLengthSet.minus(srcPosSet, LongRangeType.INT32); LongRangeSet destPossibleLengthToCopy = destLengthSet.minus(destPosSet, LongRangeType.INT32); long lengthMin = lengthSet.min(); if (lengthMin > destPossibleLengthToCopy.max()) { registerError(length, InspectionGadgetsBundle .message("suspicious.system.arraycopy.problem.descriptor.length.bigger.dest", lengthSet.toString())); return; } if (lengthMin > srcPossibleLengthToCopy.max()) { registerError(length, InspectionGadgetsBundle .message("suspicious.system.arraycopy.problem.descriptor.length.bigger.src", lengthSet.toString())); return; } if (!PsiEquivalenceUtil.areElementsEquivalent(src, dest)) return; LongRangeSet srcRange = getDefiniteRange(srcPosSet, lengthSet); LongRangeSet destRange = getDefiniteRange(destPosSet, lengthSet); if (srcRange.intersects(destRange)) { PsiElement name = call.getMethodExpression().getReferenceNameElement(); PsiElement elementToHighlight = name == null ? call : name; registerError(elementToHighlight, InspectionGadgetsBundle.message("suspicious.system.arraycopy.problem.descriptor.ranges.intersect")); } }