-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Overview
As can be seen below, org.junit.jupiter.params.support.ParameterInfo
causes cycles between the jupiter.params.aggregator
and jupiter.params.support
packages in junit-jupiter-params
.
Cycle detected: Slice jupiter.params.aggregator ->
Slice jupiter.params.support ->
Slice jupiter.params.aggregator
1. Dependencies of Slice jupiter.params.aggregator
- Method <org.junit.jupiter.params.aggregator.ArgumentsAggregator.aggregateArguments(org.junit.jupiter.params.aggregator.ArgumentsAccessor, org.junit.jupiter.params.support.FieldContext)> has parameter of type <org.junit.jupiter.params.support.FieldContext> in (ArgumentsAggregator.java:0)
- Method <org.junit.jupiter.params.aggregator.SimpleArgumentsAggregator.aggregateArguments(org.junit.jupiter.params.aggregator.ArgumentsAccessor, org.junit.jupiter.params.support.FieldContext)> has parameter of type <org.junit.jupiter.params.support.FieldContext> in (SimpleArgumentsAggregator.java:0)
- Method <org.junit.jupiter.params.aggregator.SimpleArgumentsAggregator.aggregateArguments(org.junit.jupiter.params.aggregator.ArgumentsAccessor, org.junit.jupiter.params.support.FieldContext)> calls method <org.junit.jupiter.params.support.FieldContext.getField()> in (SimpleArgumentsAggregator.java:44)
- Method <org.junit.jupiter.params.aggregator.SimpleArgumentsAggregator.aggregateArguments(org.junit.jupiter.params.aggregator.ArgumentsAccessor, org.junit.jupiter.params.support.FieldContext)> calls method <org.junit.jupiter.params.support.FieldContext.getParameterIndex()> in (SimpleArgumentsAggregator.java:44)
2. Dependencies of Slice jupiter.params.support
- Method <org.junit.jupiter.params.support.ParameterInfo.getArguments()> has return type <org.junit.jupiter.params.aggregator.ArgumentsAccessor> in (ParameterInfo.java:0)
Since the junit-jupiter-params
artifact is part of the public API for JUnit Jupiter, we have traditionally not allowed package cycles within that artifact.
Thus, in order to reduce package cycles and improve the quality of the code base, we should relocate ParameterInfo
to the org.junit.jupiter.params
package and deprecate the existing class.
Specifically, I am proposing the following.
- Introduce
org.junit.jupiter.params.ParameterInfo
as a copy oforg.junit.jupiter.params.support.ParameterInfo
. - Declare
org.junit.jupiter.params.ParameterInfo
as a sealed type permitting onlyorg.junit.jupiter.params.support.ParameterInfo
as a subtype. - Have
org.junit.jupiter.params.support.ParameterInfo
extendorg.junit.jupiter.params.ParameterInfo
. - Deprecate
org.junit.jupiter.params.support.ParameterInfo
for removal. - Update all APIs that reference
org.junit.jupiter.params.support.ParameterInfo
to referenceorg.junit.jupiter.params.ParameterInfo
instead.
Since org.junit.jupiter.params.support.ParameterInfo
is a relatively new API (introduced in 5.13), we assume that it is not actively used by many projects yet. In light of that, we are considering making these breaking changes for JUnit 6.0.
However, we hope that affected users will only need to change their imports from org.junit.jupiter.params.support.ParameterInfo
to org.junit.jupiter.params.ParameterInfo
to address any issues.