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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to