RFR: 8339603: Seal the class hierarchy of Node, Camera, LightBase, Shape, Shape3D [v5]

Michael Strauß mstrauss at openjdk.org
Sat Nov 2 05:48:14 UTC 2024


> None of these classes can be extended by user code, and any attempt to do so will fail at runtime with an exception. For this reason, we can seal the class hierarchy and remove the run-time checks to turn this into a compile-time error instead.
> 
> In some cases, `Node` and `Shape` are extended by JavaFX classes in other modules, preventing those derived classes from being permitted subclasses. A non-exported `AbstractNode` and `AbstractShape` class is provided just for these scenarios. Note that introducing a new superclass is a source- and binary-compatible change (see [JLS ch. 13](https://docs.oracle.com/javase/specs/jls/se22/html/jls-13.html)).
> 
> I'm not sure if this change requires a CSR, as it doesn't change the specification in any meaningful way. There can be no valid JavaFX program that is affected by this change.

Michael Strauß has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:

 - Merge branch 'master' into feature/sealed-classes
 - add comment
 - Merge branch 'master' into feature/sealed-classes
 - remove documentation
 - Seal Node, Camera, LightBase, Shape, Shape3D

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

Changes:
  - all: https://git.openjdk.org/jfx/pull/1556/files
  - new: https://git.openjdk.org/jfx/pull/1556/files/8332d7e9..4d3ba394

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jfx&pr=1556&range=04
 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=1556&range=03-04

  Stats: 6598 lines in 205 files changed: 1677 ins; 3490 del; 1431 mod
  Patch: https://git.openjdk.org/jfx/pull/1556.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1556/head:pull/1556

PR: https://git.openjdk.org/jfx/pull/1556


More information about the openjfx-dev mailing list