Overview
As can be seen in #4876 (comment), org.junit.jupiter.api.extension.MediaType causes cycles between the api and api.extension packages in junit-jupiter-api.
Since the junit-jupiter-api artifact constitutes 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 MediaType to the org.junit.jupiter.api package and deprecate the existing class.
Specifically, I am proposing the following.
- Introduce
org.junit.jupiter.api.MediaType as a copy of org.junit.jupiter.api.extension.MediaType.
- Declare
org.junit.jupiter.api.MediaType as a sealed type permitting only org.junit.jupiter.api.extension.MediaType as a subtype.
- Have
org.junit.jupiter.api.extension.MediaType extend org.junit.jupiter.api.MediaType.
- Deprecate
org.junit.jupiter.api.extension.MediaType for removal.
- Update all APIs that reference
org.junit.jupiter.api.extension.MediaType to reference org.junit.jupiter.api.MediaType instead.
Since org.junit.jupiter.api.MediaType is a relatively new API, we assume that it is not actively used by many projects yet. In light of that, we are considering deprecating the current APIs for JUnit 6.0.
However, we hope that affected users will only need to change their imports from org.junit.jupiter.api.extension.MediaType to org.junit.jupiter.api.MediaType to address any issues.
Related Issues
Overview
As can be seen in #4876 (comment),
org.junit.jupiter.api.extension.MediaTypecauses cycles between theapiandapi.extensionpackages injunit-jupiter-api.Since the
junit-jupiter-apiartifact constitutes 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
MediaTypeto theorg.junit.jupiter.apipackage and deprecate the existing class.Specifically, I am proposing the following.
org.junit.jupiter.api.MediaTypeas a copy oforg.junit.jupiter.api.extension.MediaType.org.junit.jupiter.api.MediaTypeas a sealed type permitting onlyorg.junit.jupiter.api.extension.MediaTypeas a subtype.org.junit.jupiter.api.extension.MediaTypeextendorg.junit.jupiter.api.MediaType.org.junit.jupiter.api.extension.MediaTypefor removal.org.junit.jupiter.api.extension.MediaTypeto referenceorg.junit.jupiter.api.MediaTypeinstead.Since
org.junit.jupiter.api.MediaTypeis a relatively new API, we assume that it is not actively used by many projects yet. In light of that, we are considering deprecating the current APIs for JUnit 6.0.However, we hope that affected users will only need to change their imports from
org.junit.jupiter.api.extension.MediaTypetoorg.junit.jupiter.api.MediaTypeto address any issues.Related Issues
Resourcetocommons.iopackage and deprecate existing interface #4885