Re: BitField#setValue is not a setter

2016-07-04 Thread Nick Burch

On 04/07/16 03:17, Javen O'Neal wrote:

Andi and I noticed a RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT warning
from FindBugs in HWPF. BitField#setValue is not a setter. It returns
the value of the holder if a value was set through the BitMask.

The BitField class should probably probably use a name that doesn't
look like a setter and/or make it extremely clear in the Javadoc that
no state is modified.


I think that the BitField classes are only ever used internally. I can't 
spot any code elsewhere on the internet using it from a google, can't 
spot it used in the usermodel, and I don't recall seeing user code on 
the lists using it.


It's also ancient code IIRC, so don't see why we can't change the name 
or javadocs to something clearer


Nick

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



BitField#setValue is not a setter

2016-07-03 Thread Javen O'Neal
Andi and I noticed a RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT warning
from FindBugs in HWPF. BitField#setValue is not a setter. It returns
the value of the holder if a value was set through the BitMask.

The BitField class should probably probably use a name that doesn't
look like a setter and/or make it extremely clear in the Javadoc that
no state is modified.



BorderCode {
private static final BitField _dptLineWidth =
BitFieldFactory.getInstance(0x00ff);

public void setLineWidth(int lineWidth) {
_dptLineWidth.setValue(_info, lineWidth);
}
}

BitField {
public int setValue(final int holder, final int value)
{
return (holder & ~_mask) | ((value << _shift_count) & _mask);
}
}

Findbugs report:
https://builds.apache.org/job/POI-JDK8/1101/findbugsResult/package.1782819087/

BorderCode: 
https://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java?view=log

BitField: 
https://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/BitField.java?view=log

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org