@DisabledForJreRange and @EnabledForJreRange using source target rather what java version being used

Open
#1,758 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java, typescript, vscode

Research direction

Reproduce the annotation example in VS Code with Java 17 while sourceCompatibility and targetCompatibility remain 8, then compare the VS Code Java test runner result with Gradle. Trace how the runner determines the Java version for @DisabledForJreRange and @EnabledForJreRange; done means tests are skipped or included based on the runtime JRE rather than the source or target setting.

Written by the indexing model from the issue text.

Description

ai-triaged bug gradle junit test-execution

I have tests with:

@DisabledForJreRange(min = JRE.JAVA_8, max = JRE.JAVA_8, disabledReason = "JSH is not supported on Java 8")

and even though I'm running with Java 17 all tests are ignored in vscode but run when running with gradle.

Only way I can get them to be included is to change:

sourceCompatibility = '8'
targetCompatibility = '8'

to

sourceCompatibility = '17'
targetCompatibility = '17'

but it is not consistent.

In any case vscode-java testrunner auto ignore tests that shouldn't be ignored compared to gradle command line.

Dominant language
TypeScript
Stars
340
Forks
173
Avg merge
1d 2h
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode-java-test

All issues in microsoft/vscode-java-test

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.