RFR: 8292376: A few Swing methods use inheritDoc on exceptions which are not inherited [v3]

Phil Race prr at openjdk.org
Sat Sep 17 20:07:45 UTC 2022


On Wed, 7 Sep 2022 07:47:59 GMT, Abhishek Kumar <duke at openjdk.org> wrote:

>> Document update for getBaselineResizeBehavior() and getBaseline() method description in JSpinner, AbstractBorder and TitledBorder .
>
> Abhishek Kumar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Review comment fix

Marked as reviewed by prr (Reviewer).

The bug report has no evaluation.
The PR just says "Doc update for Null Pointer Exception"
The bug should always have a proper evaluation and the PR can then refer to that or copy it.
The CSR has a lot of what should have appeared in these places too ..

Here's my take on it

The bug complains of 3 methods incorrectly using inheritdoc for NPE
and the resolution for each case is as follows

- javax.swing.JSpinner.DefaultEditor.getBaselineResizeBehavior()
It is unclear why the inheritdoc appears on this method.
This nested class extends JPanel and so the method is inherited from JComponent
and then in turn from Component and neither of these seems like it will throw NPE
The fix is to remove it - doc only no behavioural change.

- javax.swing.border.TitledBorder.getBaseline(java.awt.Component,int,int)
The superclass (AbstractBorder) method cannot throw NPE so inheritdoc is wrong.
However this method can throw NPE so the fix is to replace it with appropriate
documentation for this method. So also doc only no behavioural change.

- javax.swing.border.TitledBorder.getBaselineResizeBehavior(java.awt.Component)
 This method delegates to the super class method which can throw NPE but omits to specify it.
 The fix is to add the declaration to the super class method and then the inheritdoc
 is appropriate and can be left in place.  Again doc only no behavioural change.

So the changes look correct - it just is better with an explanation.

-------------

PR: https://git.openjdk.org/jdk/pull/9902



More information about the client-libs-dev mailing list