microsoft / microsoft/vscode-java-test

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

ai-triaged bug gradle junit test-execution
Dominant language
TypeScript
Stars
340
Forks
173
Avg merge
1d 19h
Merged PRs (30d)
18

Description

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.

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.