RFR: 7904133: jtreg doesn't generate an error when @key tag is used more than once in a test definition

Jaikiran Pai jpai at openjdk.org
Fri Jan 16 11:40:28 UTC 2026


Can I please get a review of this change which proposes to enforce the rule that `@key` in a test definition is expected to be used only once, as noted in the tag spec here https://openjdk.org/jtreg/tag-spec.html:

> The @key tag may be used at most once in a given test.

I decided to make it an error because the tag spec already notes that this isn't expected to be used more than once. So this should fail a test and generate attention instead of its current behaviour of silently using the second `@key`. Generating a warning, I think, doesn't help this case.

A new self test has been added to reproduce the issue and verify the fix.

-------------

Commit messages:
 - 7904133: jtreg doesn't generate an error when @key tag is used more than once in a test definition

Changes: https://git.openjdk.org/jtreg/pull/308/files
  Webrev: https://webrevs.openjdk.org/?repo=jtreg&pr=308&range=00
  Issue: https://bugs.openjdk.org/browse/CODETOOLS-7904133
  Stats: 51 lines in 4 files changed: 43 ins; 2 del; 6 mod
  Patch: https://git.openjdk.org/jtreg/pull/308.diff
  Fetch: git fetch https://git.openjdk.org/jtreg.git pull/308/head:pull/308

PR: https://git.openjdk.org/jtreg/pull/308


More information about the jtreg-dev mailing list