False positive on AvoidArrayLoops for loops converting between types
A source code analyzer
Brought to you by:
adangel,
juansotuyo
The following causes a false positive with the AvoidArrayLoops rule
public static double[] toDoubleArray(float[] array) { double[] result = new double[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i]; } }
If the types of the source and target array don't match, System.arraycopy()
is not an alternative.