- HashMap.java:122 Nullcheck of map at line 124 of value previously
dereferenced
public HashMap(Map<K, V> map) {
this(Math.max((int)((float)map.getCount() /
DEFAULT_LOAD_FACTOR) + 1, DEFAULT_CAPACITY));
if (map != null) {
=> we can move at the start of the method the check for not null, or
drop it (from the bottom). Suggestions ?
We'll just drop it. The call to this() has to be the first line in the
constructor.
- Dead local store: mainly to ensure that there aren't fields not
handled in these classes, or handled in a wrong way ...
Drawing: bounds is not used after calculation, is it really needed ?
public void regionUpdated(Canvas canvas, int x, int y, int
width, int height) {
Bounds bounds = new Bounds(0, 0, Drawing.this.width,
Drawing.this.height);
bounds = bounds.intersect(new Bounds(x, y, width, height));
imageListeners.regionUpdated(Drawing.this, x, y, width,
height);
}
I believe the bounds values were supposed to be used in the call to
regionUpdated(). Fixed.
TerraActivityIndicatorSkin: increment is not used after calculation
final double increment = (2 * Math.PI) / 360 * 30;
That's odd - it *is* actually used after the calculation, on line 94.
TerraPanoramaSkin: scrollTop and scrollLeft are not used after
calculation ...change the assignment moving one line over and use the
new value in the set, instead of the related max ?
int scrollTop = panorama.getScrollTop();
int maxScrollTop = getMaxScrollTop();
if (scrollTop > maxScrollTop) {
panorama.setScrollTop(maxScrollTop);
scrollTop = maxScrollTop;
}
int scrollLeft = panorama.getScrollLeft();
int maxScrollLeft = getMaxScrollLeft();
if (scrollLeft > maxScrollLeft) {
panorama.setScrollLeft(maxScrollLeft);
scrollLeft = maxScrollLeft;
}
Ah, I see - the warning is just saying that the variable is only used
once (same as above). This is intentional. I often do this to assist
in debugging. You can ignore these.