-
Notifications
You must be signed in to change notification settings - Fork 511
8251353: Many javafx scenegraph classes have implicit no-arg constructors #283
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
Conversation
👋 Welcome back bchoudhary! A progress list of the required criteria for merging this PR into |
Webrevs
|
/reviewers 2 |
@nlisker |
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've completed a partial review. I think that just mechanically adding a constructor with the same doc everywhere is not a good approach. The classes should be inspected to see if one is needed and if its doc is suitable. See my comments on some of the classes I've looked at.
modules/javafx.controls/src/main/java/javafx/scene/control/TableFocusModel.java
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/TableSelectionModel.java
Show resolved
Hide resolved
*/ | ||
public Selector() { | ||
} | ||
|
||
private static class UniversalSelector { |
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.
Is a public constructor suitable in this class? createSelector(String)
is the factory. There are public abstract methods here, on the other hand, so I don't know what the design idea is. The class docs should be updated too to say how to use this class.
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 one does not look like it should be public. It seems quite by accident, since the only two classes that subclass Selector
are in the same package and are constructed by factory methods (their constructors are package-scope).
This seems like a good candidate for removal (via the deprecate-for-removal, remove route).
*/ | ||
public ShapeConverter() { | ||
} | ||
|
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 like a singleton class.
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.
Agreed. This is another candidate for removal.
modules/javafx.graphics/src/main/java/javafx/scene/input/ClipboardContent.java
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.
@nlisker raises some good issues, so they should be addressed
This is an excellent point. One of the main reasons for not relying on implicit, no-arg constructors is that you might get a public constructor where one isn't intended. See JDK-8229472 and JDK-8240688 for what is needed if we determine that there should not be a public constructor. To that end, I'll go through it more carefully and comment on this specific question. |
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 think that two of the classes have implicit constructors that are there by accident. Once we get agreement, I'll file a follow-on bug for those, and those changes should be reverted.
As for the other comments, I would prefer a follow-up bug for any doc cleanup that isn't part of adding in an explicit constructor. Tempting as it might be to fix it, it seems out of scope.
That leaves the question about the wording. The more I think about it the more I like what the JDK did as opposed to what we did. The question then becomes: if we agree that it's a better pattern, do we adopt it here and then clean it up for the other two batches or just leave it as is for now, and file one cleanup bug for later. I'd like to hear from @aghaisas and @nlisker
modules/javafx.controls/src/main/java/javafx/scene/control/TableFocusModel.java
Show resolved
Hide resolved
*/ | ||
public Selector() { | ||
} | ||
|
||
private static class UniversalSelector { |
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 one does not look like it should be public. It seems quite by accident, since the only two classes that subclass Selector
are in the same package and are constructed by factory methods (their constructors are package-scope).
This seems like a good candidate for removal (via the deprecate-for-removal, remove route).
*/ | ||
public ShapeConverter() { | ||
} | ||
|
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.
Agreed. This is another candidate for removal.
@bhaweshkc You can't deprecate the constructors in this PR since it will need a separate CSR. You should revert the changes on these classes completely and file a new bug (and CSR) dealing with deprecations. |
I finished reviewing the rest of the classes and I had no additional comments about them, so I agree about deprecating for removal those 2 classes' constructors.
That's fine. I left inline comments about those.
Since it will require an additional cleanup issue anyway, I don't think it matters when we do it, but since we're here I see no reason not to start already. |
Agreed. Let's adopt the same language as the JDK. If there are configurable parameters, we can indicate the default by adding an |
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 except for the one you missed to update, StringStore
.
/** | ||
* Creates a default {@code StringStore}. | ||
*/ | ||
public StringStore() { |
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.
You missed updating the wording for this one.
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. I also verified that the only two class without an explicit constructor are the two we identified as needing to be deprecated for removal in a follow-up issue: Selector
and SshapeConverter
I filed the following two follow-up issues:
I also added the note about the PseudoClass docs to:
|
@bhaweshkc This change now passes all automated pre-integration checks. When the change also fulfills all project specific requirements, type
Since the source branch of this PR was last updated there have been 7 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 automatic rebasing, please merge As you do not have Committer status in this project, an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@kevinrushforth, @nlisker) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
@bhaweshkc |
/sponsor |
@nlisker @bhaweshkc The following commits have been pushed to master since your change was applied:
Your commit was automatically rebased without conflicts. Pushed as commit 23ad8f4. |
Added missing explicit no-arg constructors to classes in package javafx.scene, javafx.css and javafx.stage.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jfx pull/283/head:pull/283
$ git checkout pull/283