Menu

#1368 False positive on AvoidArrayLoops for loops converting between types

New Tickets
open
nobody
None
PMD
3-Major
Bug
2015-06-08
2015-06-08
No

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.

Discussion


Log in to post a comment.