Skip to content

Issues 938-document inheritance support#5708

Open
swatichauhan814 wants to merge 2 commits into
junit-team:mainfrom
swatichauhan814:issues/938-document-inheritance-support
Open

Issues 938-document inheritance support#5708
swatichauhan814 wants to merge 2 commits into
junit-team:mainfrom
swatichauhan814:issues/938-document-inheritance-support

Conversation

@swatichauhan814
Copy link
Copy Markdown

@swatichauhan814 swatichauhan814 commented May 28, 2026

issue: Document which classes support inheritance and which do not #938

I hereby agree to the terms of the JUnit Contributor License Agreement.

Signed-off-by: Swati Chauhan <swati.chauhan814@gmail.com>
@swatichauhan814 swatichauhan814 force-pushed the issues/938-document-inheritance-support branch from c4743d5 to b9cd9a1 Compare May 28, 2026 14:04
@mpkorstanje
Copy link
Copy Markdown
Member

mpkorstanje commented May 29, 2026

I'd be very happy to review your work!

@jbduncan all yours.

@testlens-app

This comment has been minimized.

Copy link
Copy Markdown
Contributor

@jbduncan jbduncan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great start! I have some thoughts on how it could be improved further; see below.

@mpkorstanje, I was wondering if I could have your input on these too as a JUnit maintainer?

* <p>Using this builder ensures consistency in how failure message are formatted
* within JUnit Jupiter and for custom user-defined assertions.
*
* <p>This class is not intended to be extended by clients.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I think it would be even better with wording and a header like this (inspired by Assertions.java) to make things more prominent:

 * <h2>Extensibility</h2>
 *
 * <p>Although it is technically possible to extend this class, extension is
 * strongly discouraged.

* {@link ArgumentsAccessor} if an error occurs while accessing
* or converting an argument.
*
* <p>This class is not intended to be extended by clients.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exceptions are a bit unusual. The base JUnitException is definitely designed for extension (as is RuntimeException for that matter), and I think it's fair to say that the JUnit maintainers may want to extend ArgumentAccessException in the future too, so we should give users the same right.

How about a header like this (inspired by Assertions.java) to make the wording on extension more prominent?

 * <h2>Extensibility</h2>
 *
 * <p>This class is designed for extension.

@mpkorstanje, do you have any thoughts on all this?

* {@link ArgumentsAggregator} when an error occurs while aggregating
* arguments.
*
* <p>This class is not intended to be extended by clients.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like my other comment on ArgumentAccessException, I think we should allow users to extend this class and we should use wording like this:

 * <h2>Extensibility</h2>
 *
 * <p>This class is designed for extension.

* {@link ArgumentsProvider} implementations that also need to consume an
* annotation in order to provide the arguments.
*
* <p>This class is designed for extension.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Like my other comments, I think it would be even better with a header like this:

 * <h2>Extensibility</h2>
 *
 * <p>This class is designed for extension.

Signed-off-by: Swati Chauhan <swati.chauhan814@gmail.com>
@swatichauhan814 swatichauhan814 requested a review from jbduncan May 30, 2026 05:13
Copy link
Copy Markdown
Contributor

@jbduncan jbduncan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swatichauhan814 LGTM! Consider it approved on my end. Great work. 👍

I believe we need a review from a JUnit maintainer to get this merged in, so now we wait.

@mpkorstanje mpkorstanje self-requested a review May 31, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants