RFR: 8339603: Seal the class hierarchy of Node, Camera, LightBase, Shape, Shape3D [v8]
Michael Strauß
mstrauss at openjdk.org
Wed Nov 27 12:26:46 UTC 2024
On Tue, 26 Nov 2024 21:29:38 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> Michael Strauß has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:
>>
>> - Merge branch 'master' into feature/sealed-classes
>> - Merge branch 'master' into feature/sealed-classes
>> - Merge branch 'master' into feature/sealed-classes
>> - Merge branch 'master' into feature/sealed-classes
>> - add comment
>> - Merge branch 'master' into feature/sealed-classes
>> - remove documentation
>> - Seal Node, Camera, LightBase, Shape, Shape3D
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/scene/NodeHelper.java line 66:
>
>> 64:
>> 65: protected static NodeHelper getHelper(Node node) {
>> 66: return nodeAccessor.getHelper(node);
>
> Is it worth checking for null and throwing an internal error if it is?
I think that would be unnecessarily verbose, and it doesn't seem like it would offer a benefit: as of now, this can't happen. Let's assume that the class hierarchy is changed in the future, such that `null` might be returned. This wouldn't result in a compile-time error. The exception would only be thrown when someone tries to acquire the `NodeHelper`, but in this case, we'd most likely get a NPE anyway.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1556#discussion_r1860568698
More information about the openjfx-dev
mailing list