New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8258777: SkinBase: add api to un-/register invalidation-/listChange listeners #409
Conversation
|
Webrevs
|
/reviewers 2 |
@kevinrushforth |
@kevinrushforth has indicated that a compatibility and specification (CSR) request is needed for this pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet reviewed. All of the new API methods need to have an @since 17
javadoc tag.
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
wondering about the sequence of next steps: should I create the csr before or after (partial) review of this? Doing before feels like expecting duplicate work (whenever doc changes are required, I'll have to change the code in the pr and the csr draft as well, I assume). If that's the way, I'll go it, naturally :) |
I'll review the API changes in the next day or so. Then you can update the CSR and move to Proposed. I'll also ask Ambarish to be the second reviewer on this. |
The API looks good to me, so go ahead and create a Draft CSR (go to your JBS issue and select "More --> Create CSR"). I don't think it will change much, if any, so you won't be duplicating work. Since you are adding new methods to an existing class, you can use the format from JDK-8259868 for the Specification section, just listing the new methods and their API docs, rather than diffs, which would be needed if changing existing javadoc comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed only the public API methods.
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
* @param observable The observable for which all listeners should be removed. | ||
* @return A single chained {@link Consumer} consisting of all {@link Consumer consumers} registered through | ||
* {@link #registerInvalidationListener(Observable, Consumer)}. If no consumers have been registered on this | ||
* property, null will be returned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"null" --> {@code null}
"property" --> "observable"
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/sun/javafx/scene/control/LambdaMultiplePropertyChangeListenerHandler.java
Outdated
Show resolved
Hide resolved
@nlisker thanks for the detailed doc review - I really like your suggestions, which I think are considerable improvements (I did part of it in the respective methods of the handler) over the original doc :) Because that's what the doc of the new methods are: c&p from the un/registerChangeListener javadoc, adjusted to the specific type of the listener. For consistency, all related method doc should be improved along your lines. How to get there? Options
Last would be doing it right once and for all .. my reluctant (against my lazy self ;) preference would be the last. |
Can you list the other affected methods? |
at line 211 (in the changed skinBase)
and at line 255
|
I see. I recommend that they be improved in this PR. I don't know if this will need to be part of the CSR, though. |
Making this change seems fine to me, and better than using different language in the new methods without fixing the existing.
It would be best to include them. |
@nlisker and @kevin so we agree, thanks :) my plan:
|
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
hmm ... failing checks, why? |
The failure on Windows is because your branch isn't up-to-date with |
I think that the docs are ready for the CSR now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment on the API that should be resolved before submitting the CSR.
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
created a csr draft JDK-8265063 - waiting for all monsters in hell breaking out and heavens falling down ;-) |
The Draft CSR looks good, and should keep the monsters contained. |
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Outdated
Show resolved
Hide resolved
I looked at all the new public docs and they look good (I left one minor comment). I didn't review anything else. |
thanks, done :) Also updated to the most recent state (including Nir's suggestion). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I finished reviewing the API changes, and it all looks good. I noted a follow-up bug that I need to file.
I'll review the CSR (to make sure it matches exactly the latest API docs in the code) in parallel with reviewing the implementation.
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/SkinBase.java
Show resolved
Hide resolved
I filed JDK-8265277 to add the missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix and tests looks good, with one suggestion for the test (and a couple minor comments about formatting and one naming question) left inline.
I'll review the CSR now, you can then move it to Finalized when you are ready.
.../src/main/java/com/sun/javafx/scene/control/LambdaMultiplePropertyChangeListenerHandler.java
Outdated
Show resolved
Hide resolved
|
||
@SuppressWarnings("rawtypes") | ||
private static final Consumer EMPTY_CONSUMER = e -> {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: remove extra space between public
and static
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
Consumer<Change<?>> consumer = change -> changes.add(change); | ||
WeakReference<LambdaMultiplePropertyChangeListenerHandler> ref = | ||
new WeakReference<>(new LambdaMultiplePropertyChangeListenerHandler()); | ||
ref.get().registerListChangeListener(items, consumer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fragile. It is possible, although unlikely, that the referent could be GCed between its construction in the previous statement (after which it goes out of scope), and this statement. If this rare event happened, it would cause an NPE here. I recommend to keep a local reference to the referent and then set it to null after this (and before the attemptGC
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed as suggested. I used a similar pattern in BehaviorMemoryTest - should I file a testbug to change it in the same way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please file a new bug (not high priority, since it is a corner case). I took a look and there are a few other controls tests that use this pattern as well (BehaviorCleanupTest, ListViewTest, TabPaneTest, SkinCleanupTest, SkinLabeledCleanupTest, SkinMemoryLeakTest), so the new bug could cover fixing this for all of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done and taken (should cleanup my own dirt ;) JDK-8265406
...vafx.controls/src/test/java/test/com/sun/javafx/scene/control/LambdaMultipleHandlerTest.java
Outdated
Show resolved
Hide resolved
...ols/src/test/java/test/com/sun/javafx/scene/control/LambdaMultipleObservableHandlerTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Pending a second reviewer. |
@kleopatra This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 57 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
|
/integrate |
@kleopatra Since your change was applied there have been 57 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit cc70cdf. |
Changes in Lambda..Handler:
Changes in SkinBase
Note that the null handling is slightly extended: all methods now can handle both null consumers (as before) and null observables (new) - this allows simplified code on rewiring "path" properties (see reference example in the issue)
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/409/head:pull/409
$ git checkout pull/409
Update a local copy of the PR:
$ git checkout pull/409
$ git pull https://git.openjdk.java.net/jfx pull/409/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 409
View PR using the GUI difftool:
$ git pr show -t 409
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/409.diff