Skip to content
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

8306021: Add event handler management to EventTarget #1090

Closed
wants to merge 12 commits into from

Conversation

mstr2
Copy link
Collaborator

@mstr2 mstr2 commented Apr 12, 2023

This PR adds the following methods to the EventTarget interface:

  1. addEventHandler
  2. removeEventHandler
  3. addEventFilter
  4. removeEventFilter

Progress

  • Change requires CSR request JDK-8306035 to be approved
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (3 reviews required, with at least 1 Reviewer, 2 Authors)

Issues

  • JDK-8306021: Add event handler management to EventTarget (Enhancement - P4)
  • JDK-8306035: Add event handler management to EventTarget (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1090/head:pull/1090
$ git checkout pull/1090

Update a local copy of the PR:
$ git checkout pull/1090
$ git pull https://git.openjdk.org/jfx.git pull/1090/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1090

View PR using the GUI difftool:
$ git pr show -t 1090

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1090.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 12, 2023

👋 Welcome back mstrauss! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@mstr2 mstr2 changed the title Add event handler management to EventTarget 8306021: Add event handler management to EventTarget Apr 14, 2023
@kevinrushforth
Copy link
Member

If we proceed with this, we will need a CSR that documents the incompatibilities that are mentioned in the thread on openjfx-dev.

/reviewers 3
/csr

@kevinrushforth kevinrushforth self-requested a review April 14, 2023 23:59
@openjdk
Copy link

openjdk bot commented Apr 15, 2023

@kevinrushforth
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 3 (with at least 1 Reviewer, 2 Authors).

@openjdk openjdk bot added the csr Need approved CSR to integrate pull request label Apr 15, 2023
@openjdk
Copy link

openjdk bot commented Apr 15, 2023

@kevinrushforth has indicated that a compatibility and specification (CSR) request is needed for this pull request.

@mstr2 please create a CSR request for issue JDK-8306021 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.

@mstr2
Copy link
Collaborator Author

mstr2 commented Apr 15, 2023

This PR assumes that changing the first method signature to the second is a binary-compatible change:

1. <E extends Event> void addEventHandler(EventType<E>, EventHandler<E>)
2. <E extends Event> void addEventHandler(EventType<E>, EventHandler<? super E>)

To verify this, I've created the following test:

import java.util.function.Consumer;

// Test.java
public class Test {
    public static <T> void test(Consumer<T> c) {
        System.out.println("it works");
    }
}

// Main.java
public class Main {
    public static void main(String[] args) {
        Consumer<String> c = param -> {};
        Test.test(c);
    }
}

Note that Consumer, like EventHandler, only uses the generic type parameter as an input argument.
After compiling both files, I changed the signature of the test method to void test(Consumer<? super T>).
Then I made sure to only recompile the Test.java file and ran the Main program, which succeeded.

@mstr2 mstr2 marked this pull request as ready for review April 15, 2023 04:50
@openjdk openjdk bot added the rfr Ready for review label Apr 15, 2023
@mlbridge
Copy link

mlbridge bot commented Apr 15, 2023

Webrevs

Copy link
Collaborator

@hjohn hjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked everything, and didn't see any problems; looks good!

@mstr2
Copy link
Collaborator Author

mstr2 commented Apr 15, 2023

I've reverted a change that caused a unit test failure.

Copy link
Collaborator

@nlisker nlisker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall.

@Maran23
Copy link
Member

Maran23 commented Apr 17, 2023

Looks good to me too! Maybe we can also add some parameterized tests. Not necessary needed for this ticket but probably a good idea to do still.

Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a logical change.
Limited testing on Mac shows no ill effects.

Copy link
Member

@Maran23 Maran23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andy-goryachev-oracle
Copy link
Contributor

I think CSR needs to be out of Draft status to move this PR along.

@mstr2
Copy link
Collaborator Author

mstr2 commented May 12, 2023

I think CSR needs to be out of Draft status to move this PR along.

I changed the status to Proposed.

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec looks fine except for a few missing @since tags that need to be restored, a suggestion on adding @implSpec (from Joe), and a couple unrelated doc changes that should be reverted. See inline.

As for the implementation, the event handling methods in the Dialog and Tab classes are new (although they just delegate to an existing instance of EventHandlerManager). Would it be possible to provide a test?

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'll Review the CSR and then you can Finalize it.

@openjdk
Copy link

openjdk bot commented Jun 13, 2023

@mstr2 This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8306021: Add event handler management to EventTarget

Reviewed-by: jhendrikx, nlisker, angorya, mhanl, kcr

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 59 new commits pushed to the master branch:

  • bd24fc7: 8309508: Possible memory leak in JPEG image loader
  • 9913b23: 8306648: Update the JavaDocs to show the NEW section and DEPRECATED versions
  • 9ad0e90: 8309470: Potential performance improvements in VirtualFlow
  • 6a159e9: 8194704: Text/TextFlow hitTest() javadoc
  • 883c4e0: 8309001: Allow building JavaFX on Linux/riscv64
  • 17ed2e7: 8307538: Memory leak in TreeTableView when calling refresh
  • 05548ac: 8301312: Create implementation of NSAccessibilityButton protocol
  • 10f41b7: 8293836: Rendering performance degradation at bottom of TableView with many rows
  • 1a0f6c7: 8306447: Adding an element to a long existing list may cause the first visible element to jump
  • 8fc1a25: 8308308: Update to Visual Studio 2022 version 17.5.0 on Windows
  • ... and 49 more: https://git.openjdk.org/jfx/compare/f28896aa63592a37e7f78263548f3b2d4f2bc381...master

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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added ready Ready to be integrated and removed csr Need approved CSR to integrate pull request labels Jun 13, 2023
@mstr2
Copy link
Collaborator Author

mstr2 commented Jun 13, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Jun 13, 2023

Going to push as commit 614dc55.
Since your change was applied there have been 59 commits pushed to the master branch:

  • bd24fc7: 8309508: Possible memory leak in JPEG image loader
  • 9913b23: 8306648: Update the JavaDocs to show the NEW section and DEPRECATED versions
  • 9ad0e90: 8309470: Potential performance improvements in VirtualFlow
  • 6a159e9: 8194704: Text/TextFlow hitTest() javadoc
  • 883c4e0: 8309001: Allow building JavaFX on Linux/riscv64
  • 17ed2e7: 8307538: Memory leak in TreeTableView when calling refresh
  • 05548ac: 8301312: Create implementation of NSAccessibilityButton protocol
  • 10f41b7: 8293836: Rendering performance degradation at bottom of TableView with many rows
  • 1a0f6c7: 8306447: Adding an element to a long existing list may cause the first visible element to jump
  • 8fc1a25: 8308308: Update to Visual Studio 2022 version 17.5.0 on Windows
  • ... and 49 more: https://git.openjdk.org/jfx/compare/f28896aa63592a37e7f78263548f3b2d4f2bc381...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jun 13, 2023
@openjdk openjdk bot closed this Jun 13, 2023
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review labels Jun 13, 2023
@openjdk
Copy link

openjdk bot commented Jun 13, 2023

@mstr2 Pushed as commit 614dc55.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@mstr2 mstr2 deleted the feature/eventtarget branch June 27, 2023 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
6 participants