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
Document which classes support inheritance and which do not #938
Comments
slated for RC1 for team discussion |
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. Thank you for your contribution. |
I'd still like for this to be addressed at some point. |
That being said, I understand if some classes/methods can't be made |
We have done so in a few places, e.g.: junit5/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAccessor.java Line 35 in 17d3b44
junit5/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestPlan.java Line 52 in 17d3b44
@jbduncan Is this something you think you could contribute via a PR? |
@marcphilipp Oh, excellent! I've also seen that this file has some inheritance-related info: junit5/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assertions.java Lines 82 to 84 in 419ddb1
Yes, I'd love to raise a PR, but I'm currently juggling a PR for junit-pioneer and some real life commitments, so I've put this issue on my TODO list. :) |
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. Thank you for your contribution. |
I'm still interested in contributing this eventually. |
Overview
Currently, AFAICT, no classes (apart from utilities classes) document their support for inheritance (that is, whether they are designed to be subclassed or not). Effective Java 2nd edition, Item 16 describes the dangers of allowing users and extension writers to subclass JUnit 5 classes that aren't designed for inheritance. Therefore we should follow Item 17's advice to prevent this.
Specifically, each class should meet the following criteria (more or less ripped from the book):
Cloneable
orSerializable
, neitherclone
norreadObject
may invoke an overridable method, directly or indirectly.Deliverables
The text was updated successfully, but these errors were encountered: