mirror of https://github.com/apache/druid.git
Suppress index-out-of-bounds warning from LGTM about loop unrolling (#8380)
* Suppress index-out-of-bounds warning from LGTM about loop unrolling * Remove space * Patch comments
This commit is contained in:
parent
ec836ae8f8
commit
9fa3407596
|
@ -107,13 +107,15 @@ public class TopNLexicographicResultBuilder implements TopNResultBuilder
|
|||
}
|
||||
for (int i = extra; i < metricVals.length; i += LOOP_UNROLL_COUNT) {
|
||||
metricValues.put(aggFactoryNames[i + 0], metricVals[i + 0]);
|
||||
metricValues.put(aggFactoryNames[i + 1], metricVals[i + 1]);
|
||||
metricValues.put(aggFactoryNames[i + 2], metricVals[i + 2]);
|
||||
metricValues.put(aggFactoryNames[i + 3], metricVals[i + 3]);
|
||||
metricValues.put(aggFactoryNames[i + 4], metricVals[i + 4]);
|
||||
metricValues.put(aggFactoryNames[i + 5], metricVals[i + 5]);
|
||||
metricValues.put(aggFactoryNames[i + 6], metricVals[i + 6]);
|
||||
metricValues.put(aggFactoryNames[i + 7], metricVals[i + 7]);
|
||||
// LGTM.com flags this, but it's safe
|
||||
// because we know "metricVals.length - extra" is a multiple of LOOP_UNROLL_COUNT.
|
||||
metricValues.put(aggFactoryNames[i + 1], metricVals[i + 1]); // lgtm [java/index-out-of-bounds]
|
||||
metricValues.put(aggFactoryNames[i + 2], metricVals[i + 2]); // lgtm [java/index-out-of-bounds]
|
||||
metricValues.put(aggFactoryNames[i + 3], metricVals[i + 3]); // lgtm [java/index-out-of-bounds]
|
||||
metricValues.put(aggFactoryNames[i + 4], metricVals[i + 4]); // lgtm [java/index-out-of-bounds]
|
||||
metricValues.put(aggFactoryNames[i + 5], metricVals[i + 5]); // lgtm [java/index-out-of-bounds]
|
||||
metricValues.put(aggFactoryNames[i + 6], metricVals[i + 6]); // lgtm [java/index-out-of-bounds]
|
||||
metricValues.put(aggFactoryNames[i + 7], metricVals[i + 7]); // lgtm [java/index-out-of-bounds]
|
||||
}
|
||||
|
||||
pQueue.add(new DimValHolder.Builder().withDimValue(dimValue, ValueType.STRING).withMetricValues(metricValues).build());
|
||||
|
|
|
@ -150,13 +150,15 @@ public class TopNNumericResultBuilder implements TopNResultBuilder
|
|||
}
|
||||
for (int i = extra; i < metricVals.length; i += LOOP_UNROLL_COUNT) {
|
||||
metricValues.put(aggFactoryNames[i + 0], metricVals[i + 0]);
|
||||
metricValues.put(aggFactoryNames[i + 1], metricVals[i + 1]);
|
||||
metricValues.put(aggFactoryNames[i + 2], metricVals[i + 2]);
|
||||
metricValues.put(aggFactoryNames[i + 3], metricVals[i + 3]);
|
||||
metricValues.put(aggFactoryNames[i + 4], metricVals[i + 4]);
|
||||
metricValues.put(aggFactoryNames[i + 5], metricVals[i + 5]);
|
||||
metricValues.put(aggFactoryNames[i + 6], metricVals[i + 6]);
|
||||
metricValues.put(aggFactoryNames[i + 7], metricVals[i + 7]);
|
||||
// LGTM.com flags this, but it's safe
|
||||
// because we know "metricVals.length - extra" is a multiple of LOOP_UNROLL_COUNT.
|
||||
metricValues.put(aggFactoryNames[i + 1], metricVals[i + 1]); // lgtm [java/index-out-of-bounds]
|
||||
metricValues.put(aggFactoryNames[i + 2], metricVals[i + 2]); // lgtm [java/index-out-of-bounds]
|
||||
metricValues.put(aggFactoryNames[i + 3], metricVals[i + 3]); // lgtm [java/index-out-of-bounds]
|
||||
metricValues.put(aggFactoryNames[i + 4], metricVals[i + 4]); // lgtm [java/index-out-of-bounds]
|
||||
metricValues.put(aggFactoryNames[i + 5], metricVals[i + 5]); // lgtm [java/index-out-of-bounds]
|
||||
metricValues.put(aggFactoryNames[i + 6], metricVals[i + 6]); // lgtm [java/index-out-of-bounds]
|
||||
metricValues.put(aggFactoryNames[i + 7], metricVals[i + 7]); // lgtm [java/index-out-of-bounds]
|
||||
}
|
||||
|
||||
// Order matters here, do not unroll
|
||||
|
|
Loading…
Reference in New Issue