findbugs


#1

I wondered if you are using findbugs.
I ran it one some of the modules from 1.0.0 release, it threw up some little gems which seem worth looking into. Below are a couple of examples but there are more.

Gary

OG Financial -> PositionTradeScalingFunction line 235, the inner loop should probably be k++ rather than j++

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (final int k = 0; k < l; j++) {
        scaledValues[i][j][k] = values[i][j][k] * scale;
      }
    }
  }

OG Analytics -> KroneckerDeltaFunction, references are compared instead of values.

public Integer evaluate(final Integer i, Integer j) {
Validate.notNull(i, “i”);
Validate.notNull(j, “j”);
return i == j ? 1 : 0;
}


#2

Thanks for pointing those out, we’ll definitely check those out! I’ve added the issue to JIRA as PLAT-2245. I know there’s been some casual use of findbugs internally but we’ll discuss making it part of the standard toolchain at our next developer meeting and I’ll report back.


#3

I’ve asked around internally and confirmed that a few people on the quant team have been using it. The general consensus is that it’s a good thing, so we’ll be adding it to our toolchain, so thanks for the suggestion!


#4

PLAT-2245 is now assigned to an engineer.