所以我在eclipse中遇到以下错误,我不明白是什么问题:
错误:
Cannot refer to the non-final local variable minActiveDutyCycles defined in an enclosing scope
B行的代码minActiveDutyCycles[i++];
带有红色
代码:
double[] minActiveDutyCycles = c.getMinActiveDutyCycles(); // LINE A <==== WHY DOES THIS VARIABLE NEED TO BE FINAL for code at LINE B???
ArrayUtils.setIndexesTo(boostInterim, ArrayUtils.where(activeDutyCycles, new Condition.Adapter<Object>() {
int i = 0;
@Override public boolean eval(double d) { return d > minActiveDutyCycles[i++]; } // LINE B
}), 1.0d);