jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8331051: Add an `@since` checker test for `java.base` module

Open nizarbenalla opened this issue 10 months ago • 5 comments

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 for java.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

Link to Webrev Comment

nizarbenalla avatar Apr 24 '24 14:04 nizarbenalla

: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.

bridgekeeper[bot] avatar Apr 24 '24 14:04 bridgekeeper[bot]

@nizarbenalla This change is no longer ready for integration - check the PR body for details.

openjdk[bot] avatar Apr 24 '24 14:04 openjdk[bot]

@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.

openjdk[bot] avatar Apr 24 '24 14:04 openjdk[bot]

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.

jddarcy avatar Apr 29 '24 16:04 jddarcy

/reviewers 2

lahodaj avatar May 24 '24 13:05 lahodaj

@lahodaj The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

openjdk[bot] avatar May 24 '24 13:05 openjdk[bot]