Inspectopedia Help

Suspicious 'System.arraycopy()' call

Reports suspicious calls to System.arraycopy().

Such calls are suspicious when:

  • the source or destination is not of an array type

  • the source and destination are of different types

  • the copied chunk length is greater than src.length - srcPos

  • the copied chunk length is greater than dest.length - destPos

  • the ranges always intersect when the source and destination are the same array

Example:

void foo() { int[] src = new int[] { 1, 2, 3, 4 }; System.arraycopy(src, 0, src, 1, 2); // warning: Copying to the same array with intersecting ranges }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023