Bounds constructor validation

Joseph Andresen joseph.andresen at oracle.com
Tue Oct 1 17:59:11 PDT 2013


Kevin and I had this exact conversation years ago. I believe our answer was that anything less than 0 meant uninitialized? 

Maybe he can remember better than I.

-Joe

On Oct 1, 2013, at 4:32 PM, Richard Bair <richard.bair at oracle.com> wrote:

> I see this is not going to work, since isEmpty() defines itself as where one component's max (maxX, maxY, maxZ) is less than the corresponding min. So we make sense, at least, out of -1 (although as far as the implementation is concerned, any negative value works just as well).
> 
> On Oct 1, 2013, at 3:13 PM, Richard Bair <richard.bair at oracle.com> wrote:
> 
>> Hi,
>> 
>> I'm looking at https://javafx-jira.kenai.com/browse/RT-23446, where the argument is made that the width / height of a node (specifically, a Region's prefWidth, minWidth, maxWidth, prefHeight, minHeight, maxHeight) should never be negative. While looking at this, I noticed that in Node, the prefWidth method relies on the layoutBounds.getWidth(). However, the Bounds class itself does not appear to do any validation of the parameters passed to the Bounds. There are no checks for NaN, and no checks for negative width, height, depth.
>> 
>> Is there any reason why we should allow NaN, or negative width / height / depth for Bounds?
>> 
>> Richard
> 


More information about the openjfx-dev mailing list