-
Notifications
You must be signed in to change notification settings - Fork 505
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
8349373: Support JavaFX preview features #1359
Closed
+91
−2
Closed
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2ee0332
Preview features
mstr2 195e717
Merge branch 'master' into feature/previewfeature
mstr2 925875b
Use enum constants instead of feature names
mstr2 2fa3560
move enum field to top
mstr2 fd9114d
initialize PreviewFeature early
mstr2 41d9c16
warning can't be suppressed
mstr2 b97d9eb
remove supporting documentation
mstr2 0a2a48b
javadoc
mstr2 8ed7896
warning can be suppressed
mstr2 cffad4a
rename system property
mstr2 2eb715b
banner -> warning
mstr2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 JDK requires that you opt into preview features for a specific version. That is, rather than a boolean, the JDK uses an integer feature release value that must match the current release. They do this by using the
--release
option (in connection with the--enable-preview
), and compiling that into the class file, which we can't directly use. Maybe we can do something similar, though?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 only done at compilation time, not at runtime. JEP 12 elaborates on this:
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.
Yeah, that's what I came to realize as well. So our property should remain boolean.
The only other thing I could think of is for us to provide a new utility method (in some class in javafx.base) that an application must call to register the version of JavaFX API that are compiling against. For example, imagine a
java.javafx.util.PreviewFeatures
class with the following method:An application would need to call
PreviewFeatures.setVersion(25)
to use JavaFX preview features from JavaFX 25. That method would unlock preview features only if the version passed in matches the runtime feature version. This would be in addition to the boolean system property.The question is whether it is worth the additional complexity (not for us to implement, that's trivial unless I'm missing something), but rather than documentation and burden on the app developer using a preview feature. The docs for each new preview feature would need to link to the PreviewFeatures utility class to describe how to unlock the features. On the plus side, it would provide a common place to document how to unlock preview features -- "call this method from the application and set that system property on the command line when running the app".
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 wouldn't be in favor of requiring application developers to call a method to unlock a preview API. It seems a bit too cumbersome and intrusive to me, since it requires you to embed build information into your source code. I've also never seen this in other libraries or frameworks.
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.
That seems reason enough to abandon this idea.
True. Significantly, I didn't propose anything like this for the incubator modules, which can have the same problem.
So I think this is a good minimal solution that provide a clue to the developer that they are relying on API that is unstable and will change in the future (meaning that using such API is a risk they need to be willing to take).