jdk
jdk copied to clipboard
8331051: Add an `@since` checker test for `java.base` module
This checker checks the values of the @since
tag found in the documentation comment for an element against the release in which the element first appeared.
Real since value of an API element is computed as the oldest release in which the given API element was introduced. That is:
- for modules, classes and interfaces, the release in which the element with the given qualified name was introduced
- for constructors, the release in which the constructor with the given VM descriptor was introduced
- for methods and fields, the release in which the given method or field with the given VM descriptor became a member of its enclosing class or interface, whether direct or inherited
Effective since value of an API element is computed as follows:
- if the given element has a
@since
tag in its javadoc, it is used - in all other cases, return the effective since value of the enclosing element
The since checker verifies that for every API element, the real since value and the effective since value are the same, and reports an error if they are not.
Preview method are handled as per JEP 12, if @PreviewFeature
is used consistently going forward then the checker doesn't need to be updated with every release. The checker has explicit knowledge of preview elements that came before JDK 14
because they weren't marked in a machine understandable way and preview elements that came before JDK 17
that didn't have @PreviewFeature
.
Important note : We only check code written since JDK 9
as the releases used to determine the expected value of @since
tags are taken from the historical data built into javac
which only goes back that far
The intial comment at the beginning of SinceChecker.java
holds more information into the program.
I already have filed issues and fixed some wrong tags like in #18640, #18032, #18030, #18055, #18373, #18954, #18972.
Progress
- [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
Issue
-
JDK-8331051: Add an
@<!---->since
checker test forjava.base
module (Sub-task - P4)
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18934/head:pull/18934
$ git checkout pull/18934
Update a local copy of the PR:
$ git checkout pull/18934
$ git pull https://git.openjdk.org/jdk.git pull/18934/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18934
View PR using the GUI difftool:
$ git pr show -t 18934
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18934.diff
Webrev
:wave: Welcome back nizarbenalla! A progress list of the required criteria for merging this PR into master
will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.
@nizarbenalla This change is no longer ready for integration - check the PR body for details.
@nizarbenalla The following label will be automatically applied to this pull request:
-
core-libs
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.
Webrevs
- 06: Full - Incremental (fc10107a)
- 05: Full - Incremental (e82dfbf0)
- 04: Full - Incremental (48c87814)
- 03: Full - Incremental (3f226ef9)
- 02: Full - Incremental (5df2151e)
- 01: Full - Incremental (1bdb25d9)
- 00: Full (599477bf)
If not already planned, I recommend a much broader discussion/announcement of this test before it goes back. For example, a message to jdk-dev stating "The value of @since
tags will be tested now by a tier $N test. This is how you run the test before a push. Here are rules for some tricky cases like introducing a covariant override." etc.
/reviewers 2