Skip to content
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

Add selectClass()/selectMethod() variants in DiscoverySelectors that take a ClassLoader #2107

Merged
merged 1 commit into from
May 12, 2023

Conversation

kriegfrj
Copy link
Contributor

@kriegfrj kriegfrj commented Nov 20, 2019

@juliette-derancourt

This comment was marked as outdated.

@juliette-derancourt juliette-derancourt added this to the 5.6 M2 milestone Nov 20, 2019
@sbrannen sbrannen changed the title [DiscoverySelectors] Add selectClass()/selectMethod() variants that take a classloader [DiscoverySelectors] Add selectClass()/selectMethod() variants that take a ClassLoader Nov 20, 2019
@marcphilipp

This comment was marked as outdated.

@kriegfrj

This comment was marked as outdated.

@marcphilipp marcphilipp modified the milestones: 5.6 M2, 5.7 Backlog Nov 21, 2019
@marcphilipp marcphilipp changed the base branch from master to main June 21, 2020 16:57
@stale

This comment was marked as outdated.

@stale stale bot added the status: stale label May 13, 2021
@stale

This comment was marked as outdated.

@stale stale bot closed this Jun 3, 2021
@marcphilipp marcphilipp removed this from the 5.8 Backlog milestone Jun 19, 2021
@sbrannen sbrannen changed the title [DiscoverySelectors] Add selectClass()/selectMethod() variants that take a ClassLoader Add selectClass()/selectMethod() variants in DiscoverySelectors that take a ClassLoader May 5, 2023
@sbrannen sbrannen reopened this May 6, 2023
@sbrannen sbrannen marked this pull request as draft May 6, 2023 15:06
@sbrannen sbrannen self-assigned this May 6, 2023
@kriegfrj kriegfrj force-pushed the 1987-explicit-classloader branch 3 times, most recently from 0f17c78 to 85ef61b Compare May 8, 2023 11:01
@sbrannen sbrannen linked an issue May 8, 2023 that may be closed by this pull request
@kriegfrj kriegfrj force-pushed the 1987-explicit-classloader branch 2 times, most recently from 3e0c756 to 8f5e832 Compare May 9, 2023 00:49
@kriegfrj kriegfrj marked this pull request as ready for review May 9, 2023 00:59
@sbrannen
Copy link
Member

sbrannen commented May 9, 2023

Hi @kriegfrj,

It looks like you're almost done with this PR (rebased on main and updated). 👍

So, it appears that only an entry in the release notes is missing.

Do you think you'll have time to finish this PR this week?

If not, someone in the team can take merge the PR and add an entry in the release notes.

Please just let us know about your availability for completing this issue.

Thanks!

Copy link
Member

@sbrannen sbrannen left a comment

Choose a reason for hiding this comment

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

Whenever we introduce an overloaded constructor or method, we do our best to append optional arguments to the formal parameter list instead of prepending them.

This aligns with conventional best practices for API design.

In light of that, please modify all constructors/methods in this PR to accept the ClassLoader last in the formal parameter list (unless there is a compelling reason not to do so).

Thanks

@kriegfrj
Copy link
Contributor Author

Whenever we introduce an overloaded constructor or method, we do our best to append optional arguments to the formal parameter list instead of prepending them.

This aligns with conventional best practices for API design.

In light of that, please modify all constructors/methods in this PR to accept the ClassLoader last in the formal parameter list (unless there is a compelling reason not to do so).

I think the reason I put them first (it's been a while!) was that, from a domain perspective, all the other argument lists go from least specific selector segment to most specific (eg, (class, method) or (class, method, parameters) ). In keeping with that style seemed to make the most sense to put the class loader first.

I started putting it last, and realised that it causes a source-level compatibility as some of the tests started to fail to compile due to the ambiguous overloads when supplied with a null parameter (this may also be part of the reason I put them first). Having looked at it though, I think in practice that this will be ok because the preconditions all insist that the String arguments are non-null, so there should be no existing code out in the wild that could run afoul of this newly-introduced source ambiguity. So I think in practice only the test cases that are testing the preconditions (attempting to pass in a null) are affected.

I've also updated the release notes.

I also realised that, since I submitted the original PR, we also have the NestedClassSelector and NestedMethodSelector which might need similar treatment... I'm not sure if I'll have time for that too.

@kriegfrj kriegfrj force-pushed the 1987-explicit-classloader branch 2 times, most recently from 2540d35 to 2f312af Compare May 10, 2023 07:03
@kriegfrj kriegfrj requested a review from sbrannen May 10, 2023 12:09
@sbrannen
Copy link
Member

Thanks for making the requested changes and updating the release notes. 👍

I also realised that, since I submitted the original PR, we also have the NestedClassSelector and NestedMethodSelector which might need similar treatment... I'm not sure if I'll have time for that too.

Good catch.

I opened #3298 to track that.

Copy link
Member

@sbrannen sbrannen left a comment

Choose a reason for hiding this comment

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

I think this PR looks good now.

I'll make any additional changes after merging.

@sbrannen sbrannen merged commit c12634c into junit-team:main May 12, 2023
14 checks passed
sbrannen added a commit that referenced this pull request May 12, 2023
@sbrannen
Copy link
Member

This has been merged into main in c12634c and revised in 142476c.

Thanks

@kriegfrj kriegfrj deleted the 1987-explicit-classloader branch May 31, 2023 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support explicit ClassLoader in ClassSelector and MethodSelector
4 participants