Skip to content
Commit faeb2419 authored by jeremy's avatar jeremy
Browse files

8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box

This is a second follow-up response to prrace's code review feedback about method modifiers.

This commit more carefully preserves the getBounds2D() method modifiers for all 3 classes: the Path2D.Double, the Path2D.Float, and the Path2D itself.

It is possible (if unlikely) that someone previously extended the Path2D class and overrode getBounds2D(), because the Path2D#getBounds2D() method was *not* final. So with this commit: any such existing code will not break. Meanwhile the subclasses (Double and Float) preserve their previous modifiers (final, synchronized).

This is in response to prrace's code review:

>    You are changing the signature of public API
>    src/java.desktop/share/classes/java/awt/geom/Path2D.java
>    public final synchronized Rectangle2D getBounds2D() => public Rectangle2D getBounds2D() {
>
> So no longer final, and no longer synchronized.
> This means a CSR is required and we need to think about it ..
> the intention was that the subclass not over-ride.
> And why remove synchronized ? I am fairly sure it was there to
> make sure no one was mutating the Path whilst
> bounds are being calculated.
> And you are using getPathIterator(AffineTransform) and the docs
> for that say it isn't thread safe.
> So I think this implementation needs to be thought about very carefully.
parent d79f067d
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment