-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Change Java baseline to 17 for 6.0 #4246
Comments
Consider using OpenRewrite's Gradle plugin and Java 17 recipe to find other ways of modernising the codebase. |
Will this also result in a major version change for the JUnit Platform? |
Why (not) upgrade to Java 21? https://www.java.com/releases/fullmatrix/
What's in Java 17 compared to Java 8 (7 years worth of features and bug fixes)? 🤯 What's in Java 21 compared to Java 17 (2 years worth of features and bug fixes)? |
Our strongest argument in AssertJ for targeting Java 17 and not 21 was the compatibility with the Spring Boot generations, as AssertJ is one of the libraries provided by the |
Yes, it will be JUnit 6. As stated in the issue's description:
|
Because major players in the Java ecosystem have all gone with Java 17 as the "new baseline" within the ecosystem, while still supporting later versions of Java, and we do not want JUnit to be the odd one out. |
We will also want to remove any flags that turn on "backward compatibility mode". For example, we should remove support for the |
Although it's a small detail, may I also propose to do #3141 (comment) ? |
We intend to change the major versions of the Platform, Jupiter, and Vintage. It's debatable whether Platform should be bumped to 2.0 or 6.0. Doing latter might simplify dependency management and comprehensibility for some. Thoughts? |
It would definitely simplify things for people and tools. Changing Vintage to align with Jupiter had positive side effects, and moving all 3 submodules to the same version number would take that a step farther. So, I think I'm in favor of 3 * 6.0 for Platform, Jupiter, and Vintage. |
For everything where we intend to change the default behavior (e.g. the |
Would it make sense to skip version 6 and go straight to JUnit 7? The alignment of Java 17 and JUnit 7 creates a simple association for users. |
If we skipped some versions, we should target JUnit 17 right away. |
I personally don't create a association between that. |
It depends I suppose. Unlike Vintage, the JUnit Platform is not user facing. And tools using the JUnit platform have a comparatively slow development pace. So there is value in being able to communicate that there are no breaking changes in the Platform, even if there are in JUnit. Though if you do not expect to make breaking changes to JUnit without also making breaking changes to the Platform then it doesn't matter and keeping the version numbers synced would simplify things. |
Added to the task list in the issue description. 👍 |
The thing is: we have never released JUnit Jupiter without releasing the Platform (and bumping its version number) along with it, even if there were no changes to the Platform JARs. We originally thought that we may at some point release them out of sync, but ever since JUnit 5.0 GA we have never done that. In addition, we sometimes make changes to the Platform (for example changes in In summary, having different version numbers for the Platform and Jupiter/Vintage seems to cause more problems than it was intended to solve. |
Might be a strange question, but I mean it really serious. And the answer might also affect the JUnit Pioneer extension library. The user guide says
In this ticket you speak of JUnit 6 so the left part of this "equation". You also noticed that you want to raise versions of platform and vintage (so I guess you keep the names). I'm confused about Jupiter, because I have in mind that it's named after the fifth planet of earth's solar system. Will this part of JUnit renamed to Saturn? Where will this lead with JUnit 9+? Why it affects JUnit Pioneer? Because Pioneer 10 was the first space probe that flew close to Jupiter... |
Yes, we will keep the names. We chose "names" over version "numbers" on purpose: to ensure that we don't have any issues with package or type names when we release a new generation or JUnit. For example, we originally had So, for JUnit 6, we are currently considering aligning all 3 versions as follows. JUnit 6.0 = JUnit Platform 6.0 + JUnit Jupiter 6.0 + JUnit Vintage 6.0
Indeed, we did pick "Jupiter" for JUnit 5, because it starts with "Ju" and is the 5th planet from our sun.
No.
I don't know if I'll even still be alive by that point in time, and I cannot predict the (potentially) distant future. 😇 But the plan is to keep using the Jupiter and Vintage module names as long as it makes sense.
🚀 |
I take your word for it ...
... and use this opportunity to present some JUnit Platform (breaking??) changes that LazyParams harnesses for the purpose of achieving combinatorial parameterization. - To summarize there are two new JUnit Platform features made available for an ongoing test execution:
- Number 1 is reasonably easy to achieve but its full value only shows if IDEs and other test runners are aware of how a test-name can change during test-execution. E.g. then an IDE debugger would be able to display test-name snapshot on each breakpoint etc. - Number 2 will require some significant effort, however. Today LazyParams makes it happen by having a NodeTestTask.DefaultDynamicTestExecutor instance execute its test-descriptor. But it is complicated ... Not only because it is non-public API but also because it is necessary to get hold of the test-execution NodeTestTask and TestDescriptor and make sure they don't have a state that prevents a repeated test execution. Also it is desirable to have the above platform features available for 3rd-party test-features without implementing an engine or relying on its engine to expose it. From the top of my head I would suggest a service-loader mechanism (similar to how test engines are registered) for registering a public interface LifecycleListener {
void executionStarted (LifecycleListenerContext context);
void executionFinished(LifecycleListenerContext context, TestExecutionResult result);
} ... where the public interface LifecycleListenerContext {
/** @return Mutable list of test-name appendums */
List<Object> testNameAppendums();
void repeatTestExecution(boolean allowConcurrentFork);
/*
* ... plus additional context methods beyond the above ...
* An idea for the future is to communicate some kind
* of RepetitionId (on top of UniqueId) that the IDE can use
* to relaunch a test for specific parameter values.
*/
} |
I think it doesn't really matter, which version Platform uses: users need to use |
For Maven that's certainly true unless one uses a parent POM that manages the JUnit version such as the one from Spring Boot. For Gradle, depending on any Platform/Jupiter/Vintage artifact will pull in the BOM which will cause versions to be aligned. |
Do you have a link that explains this behavior? Anyway this would mean that Gradle users also don't care about the version number of used in Platform. |
Sure, it's explained in this blog post: |
Follow up question: Does that mean the |
Renaming the repo is one of the todos. GitHub will redirect from the old to the new name. Why do you ask? |
Ah didn't know about the redirect. Thank you. Was only asking due personal interest to learn |
Motivation
Java 8 is the current baseline of JUnit 5. It was released over 10 years ago and recent versions of Java have introduced many enhancements that make moving to a more recent JDK as the baseline for JUnit alluring. Moreover, there is movement in the ecosystem regarding this issue. For example, Spring has changed their baseline to JDK 17+ with 6.x and free support for 5.x will end in 2024. Similarly, AssertJ will move to Java 17. Therefore, we should consider making a similar move. Doing so would mean bumping the major version number and would allow us to clean up and simplify a number of things. This issue serves as a starting point for collecting those topics and tasks. For users stuck on Java 8 we will extend support for the last 5.x release for at least a year and backport security and important bug fixes to 5.x.
Todos
ConsoleLauncher
CLI (remove single-dash long options and mode without subcommand)type: breaking change
and decide whether they can be addressed in 6.0junit.platform.reflection.search.useLegacySemantics
) and potentially log a warning if they're used@TempDir
per context mode?AutoCloseable
instead ofCloseableResource
inStore
?TestInstancePostProcessor
and similar extensions wrt. method-levelExtensionContext
?junit-platform-jfr
and move listeners tojunit-platform-launcher
The text was updated successfully, but these errors were encountered: