Skip to content

fix: add module opens for all selected test classes#1884

Closed
wenytang-ms wants to merge 2 commits into
mainfrom
fix/1883-multi-package-add-opens
Closed

fix: add module opens for all selected test classes#1884
wenytang-ms wants to merge 2 commits into
mainfrom
fix/1883-multi-package-add-opens

Conversation

@wenytang-ms

Copy link
Copy Markdown
Contributor

Summary

  • pass JDT handles for multi-class JUnit launches
  • let the upstream JDT delegate evaluate the exact selected types so it generates --add-opens for every package
  • preserve the fast single-main-type launch setup and add a modular multi-package regression test

Testing

  • npm test
  • mvn -f java-extension\pom.xml -pl com.microsoft.java.test.target,com.microsoft.java.test.plugin,com.microsoft.java.test.plugin.test -am verify

Fixes #1883

Pass selected class JDT handles to the launch delegate so Eclipse JDT can generate VM arguments for every test package without rediscovering the project.

Fixes #1883

Copilot-Session: c3cd113b-dad4-4d4d-90c2-60abfd204405
@wenytang-ms

Copy link
Copy Markdown
Contributor Author

before
image
after
image

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses JPMS modular-project failures in multi-class JUnit launches by ensuring the upstream JDT delegate can evaluate the full selected test set (not just the first “main type”), so it generates complete --add-opens VM arguments for all involved packages.

Changes:

  • Pass JDT handle identifiers for multi-class (class-level) JUnit selections from the TypeScript client to the Java extension.
  • Override JDT’s evaluateTests to resolve all selected ITypes from handles before VM args are computed, enabling complete --add-opens generation.
  • Add a regression test project + test case covering multi-package modular JUnit selection behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/utils/launchUtils.ts Adds testHandles (JDT handles) to the resolve-JUnit-arguments request for multi-class class-level runs.
java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/launchers/JUnitLaunchUtils.java Extends the argument payload model to accept testHandles.
java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/launchers/JUnitLaunchConfigurationDelegate.java Overrides evaluateTests to resolve all selected ITypes from handles so JDT can emit --add-opens for each selected package.
java-extension/com.microsoft.java.test.plugin.test/src/com/microsoft/java/test/plugin/launchers/JUnitLaunchConfigurationDelegateTest.java Adds regression test asserting --add-opens is present for multiple packages in a modular project.
java-extension/com.microsoft.java.test.plugin.test/projects/modular-junit/src/test/java/p1/FirstTest.java Adds first test class in package p1 for modular regression coverage.
java-extension/com.microsoft.java.test.plugin.test/projects/modular-junit/src/test/java/p2/SecondTest.java Adds second test class in package p2 for modular regression coverage.
java-extension/com.microsoft.java.test.plugin.test/projects/modular-junit/src/main/java/module-info.java Declares a JPMS module to trigger modular launch behavior in tests.
java-extension/com.microsoft.java.test.plugin.test/projects/modular-junit/.project Eclipse project metadata for importing the new modular regression project.
java-extension/com.microsoft.java.test.plugin.test/projects/modular-junit/.classpath Classpath metadata (JRE + JUnit 5) for the modular regression project.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot-Session: c3cd113b-dad4-4d4d-90c2-60abfd204405

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

@wenytang-ms wenytang-ms reopened this Jul 13, 2026
@wenytang-ms

Copy link
Copy Markdown
Contributor Author

Superseded by #1885 to retrigger the missing license/CLA policy check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--add-opens VM args incomplete for modular projects when running a multi-class test suite

3 participants