Open jbduncan opened 7 years ago
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 final
now for backward-compatibility reasons, but at the very least each and every public class and method should be documented appropriately.
We have done so in a few places, e.g.: https://github.com/junit-team/junit5/blob/17d3b440f3b6c3ba4616fc927e7782e74582ea86/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAccessor.java#L35 https://github.com/junit-team/junit5/blob/17d3b440f3b6c3ba4616fc927e7782e74582ea86/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestPlan.java#L52
@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:
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.
Hello @jbduncan , I would to work on this issue. Could you please assign it to me? Thank you!
@Basmalamoustafa Sure, please go right ahead!
As we can't make any backwards-incompatible changes now, I think the best approach is to do the following for as many non-final classes as you can find:
final
or making any other breaking changes.I hope this helps.
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