-
Notifications
You must be signed in to change notification settings - Fork 542
8240844: Remove dependency on java.desktop from javafx.base #1958
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
base: master
Are you sure you want to change the base?
Conversation
|
👋 Welcome back mhanl! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
Three quick comments before I review.
/reviewers 2 reviewers |
|
@kevinrushforth |
|
@kevinrushforth has indicated that a compatibility and specification (CSR) request is needed for this pull request. @Maran23 please create a CSR request for issue JDK-8240844 with the correct fix version. This pull request cannot be integrated until the CSR request is approved. |
I agree, this change has the biggest 'risk'. Still, I would like to bring this up for discussion, as there is a huge benefit (much higher than I thought). |
While I might not quite go as far as to say "out of the question", it is unlikely that such a proposal would be accepted. This would be an incompatible change, which we very rarely do, especially for features that are still useful (and even then, not without notice, such as deprecating API for removal, followed by later removal). Applications that use JavaFX Printing APIs would stop working in some cases, unpredictably so, since it would work as long as any other module required java.desktop, but would fail at runtime if not (with a confusing error message). The recently-added ImageIO support added to images would also behave differently. Whereas today loading a ".tiff" file will just work (by falling back to the ImageIO TIFF loader shipped with java.desktop), it would fail to load (gracefully, but it would fail nonetheless). The difference between the So, feel free to raise it on the mailing list. In the mean time, either move this to Draft or revert the change in javafx.graphics. |
| * @since 9 | ||
| */ | ||
| module javafx.graphics { | ||
| requires java.desktop; |
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.
As commented on in general comments, this is an incompatible change. A general discussion on the mailing list is needed to determine whether we want to consider this.
|
There was a discussion on this on the mailing list: https://mail.openjdk.org/pipermail/openjfx-dev/2023-November/043731.html. |
Thanks. Is there a way to answer to it, even if I don't have the original email anymore? |
Not sure. I sent an email from that thread now so you can latch onto it. |
This PR makes the
java.desktoprequirement static forjavafx.baseandjavafx.graphics.With this changes, a JavaFX app without
Swingand theWebViewwill be much smaller (results below).Consequences:
java.desktopneed to be loaded (required) when using anything from thejavafx.beans.property.adapterpackage (the property classes fromjava.beans.XXXare used here)java.desktopneed to be loaded (required) when using printing, that is e.g.PrinterJob.createPrinterJob().showPrintDialog(..)Results:
java.desktopgives a huge size boost! I benchmarked the following values when usingjlinkwith: [zip-6,--no-man-pages,--no-header-files,--strip-debug,--strip-java-debug-attributes] to build an own runtimeTried on a real application (here called
myapp) with JDK-25 on Windows 11 that has dependencies to: [javafx-base,javafx-graphics,javafx-fxml,javafx-controls]master70.009.288 BytesThis PR57.266.538 BytesThis PR+ #195757.249.459 BytesSo we save around 13MB. If building a native package, e.g. an
.msiinstaller, this will be even higher.This change however probably need some discussion, if we want to go that direction + add a note in the release notes, that if one of the two things mentioned above are needed, an requirement to
java.desktopis needed (in case of a modular project).Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1958/head:pull/1958$ git checkout pull/1958Update a local copy of the PR:
$ git checkout pull/1958$ git pull https://git.openjdk.org/jfx.git pull/1958/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1958View PR using the GUI difftool:
$ git pr show -t 1958Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1958.diff
Using Webrev
Link to Webrev Comment