Cannot initialize Polygot Sampler in `--module-path` mode

@JaroslavTulach

Description

  • There is a problem initializing VisualVM 2.2 Polyglot Sampler with Truffle 25.0.0 when the application is running in module path mode.
  • this is caused by GR-54300 changes that modified the ENGINES field from Map to Set which remained unnoticed for a while

Reproduce

  • I've created a sample project https://github.com/jtulach/graaljs/tree/GraalJsDemo
  • when executed in module path mode: mvn -Pmodulepath package exec:exec the VisualVM Polyglot Sampler can't connect
    • everything works in classpath mode
    • everything also works when one --add-opens access for the access to findActiveEngines method...

Fix

CCing @thurka, @tzezula