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
6201035: Document NPE for passing null insets to constructors and methods of several javax.swing.border.* classes #10740
Conversation
👋 Welcome back psadhukhan! A progress list of the required criteria for merging this PR into |
Webrevs
|
It seems the same issue exists in other methods, like getBorderInsets? |
OK. javadoc updated for that method too |
src/java.desktop/share/classes/javax/swing/border/MatteBorder.java
Outdated
Show resolved
Hide resolved
src/java.desktop/share/classes/javax/swing/border/MatteBorder.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.
In addition to the comments in the code, could you please update the copyright year and remove Rectangle
from imports in EmptyBorder
?
src/java.desktop/share/classes/javax/swing/border/AbstractBorder.java
Outdated
Show resolved
Hide resolved
src/java.desktop/share/classes/javax/swing/border/EmptyBorder.java
Outdated
Show resolved
Hide resolved
Does it make sense to update the subject to “Document NPE for passing null insets” or a similar? It would carry more meaning. At this time, “underfined behavior” sounds frightening. |
Changed subject and added more border classes/methods |
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.
TitledBorder
is to be updated as well.
I wonder why none of the classes uses {@inheritDoc}
instead of copying the entire text without modification. And you don't want to use {@inheritDoc}
either for the @throws
clause without explaining why.
@@ -142,6 +142,8 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int he | |||
* Reinitialize the insets parameter with this Border's current Insets. |
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.
To be consistent with the superclass:
* Reinitialize the insets parameter with this Border's current Insets. | |
* Reinitializes the insets parameter with this Border's current Insets. |
I guess the entire javadoc can be inherited with {@inheritdoc}, it adds nothing to the text in AbstractBorder
.
@@ -137,6 +137,8 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int he | |||
* Reinitialize the insets parameter with this Border's current Insets. |
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.
* Reinitialize the insets parameter with this Border's current Insets. | |
* Reinitializes the insets parameter with this Border's current Insets. |
The same: the verb at start of a javadoc is in third person singular.
@@ -85,6 +85,8 @@ public Insets getBorderInsets(Component c) { | |||
* @param c the component for which this border insets value applies | |||
* @param insets the object to be reinitialized | |||
* @return the <code>insets</code> object |
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.
* @return the <code>insets</code> object | |
* @return the {@code insets} object |
It makes sense to replace <code>
with {@code}
as the throws
clause uses the new syntax.
@@ -102,6 +104,8 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int he | |||
* Reinitialize the insets parameter with this Border's current Insets. |
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.
* Reinitialize the insets parameter with this Border's current Insets. | |
* Reinitializes the insets parameter with this Border's current Insets. |
@@ -210,6 +210,8 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int he | |||
* |
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.
Also add “-s” ending to the verb in the line above.
@@ -174,6 +174,8 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int he | |||
* |
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.
Also add “-s” ending to the verb in the line above.
@@ -152,6 +152,8 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int he | |||
* Reinitialize the insets parameter with this Border's current Insets. |
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.
* Reinitialize the insets parameter with this Border's current Insets. | |
* Reinitializes the insets parameter with this Border's current Insets. |
jdk/src/java.desktop/share/classes/javax/swing/border/TitledBorder.java Lines 373 to 378 in 1a58cb1
This hasn't been addressed yet. It requires the CSR to be updated. |
Before I can approve this PR, I would like to see the javadoc for border classes (those that are modified) updated so that all of them use “Reinitializes” as the first word in the description instead of “Reinitialize”, which aligns with the javadoc style guide:
|
@prsadhuk 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:
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 425 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. ➡️ To integrate this PR with the above commit message to the |
Per the comment in JBS, addressing this is deferred to a separate issue… However, I still think it would've been more efficient to handle it here. Anyway, it's approved now. |
/integrate |
Going to push as commit 412b436.
Your commit was automatically rebased without conflicts. |
The behavior of MatteBorder constructors taking Insets object as a parameter is undocumented. It would throw NPE if null object is passed to it, which should be documented in the spec.
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10740/head:pull/10740
$ git checkout pull/10740
Update a local copy of the PR:
$ git checkout pull/10740
$ git pull https://git.openjdk.org/jdk pull/10740/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10740
View PR using the GUI difftool:
$ git pr show -t 10740
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10740.diff