RFR: 8313651: Add 'final' keyword to public property methods in controls [v6]

Kevin Rushforth kcr at openjdk.org
Fri Sep 8 13:09:56 UTC 2023


On Thu, 7 Sep 2023 23:32:15 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> In the Control hierarchy, all property accessor methods must be declared `final`.
>> 
>> Added a test to check for missing `final` keyword and added the said keyword where required.
>
> Andy Goryachev 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 10 additional commits since the last revision:
> 
>  - Merge remote-tracking branch 'origin/master' into 8313651.final
>  - review comments
>  - review comments
>  - review comments
>  - review comments
>  - Merge remote-tracking branch 'origin/master' into 8313651.final
>  - review comments
>  - whitespace
>  - added final keyword
>  - test

modules/javafx.controls/src/test/java/test/javafx/scene/control/ControlPropertiesTest.java line 177:

> 175: 
> 176:     private void check(Class cls) {
> 177:         Method[] methods = cls.getMethods();

This will only return public methods. Since you modified `checkModifiers` to check protected methods, you will need to use `getDeclaredMethods` instead. This will return protected (and package scope) methods as well as public methods. It won't return any method in a superclass, but since the set of classes you are checking includes intermediate classes (such as `ButtonBase` and `Labeled`), you will still get the coverage (and without redundantly checking the same method in those classes multiple times).

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1213#discussion_r1319843979


More information about the openjfx-dev mailing list