Bounds constructor validation

Richard Bair richard.bair at
Tue Oct 1 16:32:54 PDT 2013

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> wrote:

> Hi,
> I'm looking at, 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