Skip to content

Relocate MediaType to jupiter.api package and deprecate existing class #4886

@sbrannen

Description

@sbrannen

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.

  1. Introduce org.junit.jupiter.api.MediaType as a copy of org.junit.jupiter.api.extension.MediaType.
  2. Declare org.junit.jupiter.api.MediaType as a sealed type permitting only org.junit.jupiter.api.extension.MediaType as a subtype.
  3. Have org.junit.jupiter.api.extension.MediaType extend org.junit.jupiter.api.MediaType.
  4. Deprecate org.junit.jupiter.api.extension.MediaType for removal.
  5. 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

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions