-
-
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
Support arbitrary Java feature versions with JRE conditions #3931
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
|
||
package org.junit.jupiter.api.condition; | ||
|
||
import static org.apiguardian.api.API.Status.EXPERIMENTAL; | ||
import static org.apiguardian.api.API.Status.STABLE; | ||
|
||
import java.lang.annotation.Documented; | ||
|
@@ -90,6 +91,7 @@ | |
* supported JRE version. | ||
* | ||
* @see JRE | ||
* @see #minFeatureVersion() | ||
*/ | ||
JRE min() default JRE.JAVA_8; | ||
|
||
|
@@ -102,9 +104,36 @@ | |
* possible version. | ||
* | ||
* @see JRE | ||
* @see #maxFeatureVersion() | ||
*/ | ||
JRE max() default JRE.OTHER; | ||
|
||
/** | ||
* Java Runtime Environment feature version which should be used as the lower | ||
* boundary for the version range that determines if the annotated class or | ||
* method should be enabled. | ||
* | ||
* <p>Defaults to {@code -1} to signal that {@link #min()} should be used instead. | ||
* | ||
* @since 5.12 | ||
* @see #min() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be useful to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed. I'll improve the Javadoc once we've determined if we want to implement this feature. |
||
*/ | ||
@API(status = EXPERIMENTAL, since = "5.12") | ||
int minFeatureVersion() default -1; | ||
|
||
/** | ||
* Java Runtime Environment feature version which should be used as the upper | ||
* boundary for the version range that determines if the annotated class or | ||
* method should be enabled. | ||
* | ||
* <p>Defaults to {@code -1} to signal that {@link #max()} should be used instead. | ||
* | ||
* @since 5.12 | ||
* @see #max() | ||
*/ | ||
@API(status = EXPERIMENTAL, since = "5.12") | ||
int maxFeatureVersion() default -1; | ||
|
||
/** | ||
* Custom reason to provide if the test or container is disabled. | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linking "feature version" to
java.lang.Runtime.Version.feature()
would help to connect some dots. Perhaps you can't given your Java baseline?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was planning on documenting that more thoroughly, though I'm glad you made the connection.
We're currently invoking the deprecated
major()
method defensively via reflection for support on Java 9+, and I picked the "feature" terminology because of the newfeature()
method in Java 10+.So I plan to explain that to some extent.
As for linking to the newer API, I think that actually might not be an issue, because I believe we are generating Javadoc with a JDK version later than JDK 8 (perhaps JDK 11 or later -- I'll have to check).