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

Jeremy duke at openjdk.java.net
Sun May 22 09:15:15 UTC 2022


This resolves an occasional unit test failure in Path2D.UnitTest.

The previous Path2D#getBounds2D(PathIterator) implementation assumed that after a SEG_CLOSE the next segment would always be a SEG_MOVETO to start a new clearly defined segment. But the Path2D.UnitTest created random paths that didn't follow this expectation.

This commit updates #getBounds2D(PathIterator) so it will move the cursor back to the (moveX, moveY) point for the sake of calculating future segments. This appears to resolve the unit test failures.

This commit also modifies the unit test so it logs random seeds. This may help developers isolate/reproduce specific failures with more certainty.

-------------

Commit messages:
 - Merge branch 'master' into JDK-8176501
 - Merge pull request #1 from openjdk/master
 - 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
 - 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
 - 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
 - 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
 - 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
 - 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
 - 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
 - 8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
 - ... and 16 more: https://git.openjdk.java.net/jdk/compare/c156bcc5...5aebb1b7

Changes: https://git.openjdk.java.net/jdk/pull/8828/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8828&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8176501
  Stats: 68 lines in 2 files changed: 37 ins; 5 del; 26 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8828.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8828/head:pull/8828

PR: https://git.openjdk.java.net/jdk/pull/8828



More information about the client-libs-dev mailing list