vscode intellisense failing when 2 jdks are on system, despite env var or java.home

There seems to be a clash between vscode and multiple jdks. When having both jdk8 and jdk9, and having set JAVA_HOME to point jdk9 dir AND vscode's user setting java.home to point to jdk9 dir, intellisense fails. Compilation succeeds, can use java 9 features. Below for details.

Environment
  • Operating System: Win10
  • JDK version: 8 and 9
  • Visual Studio Code version: latest
  • Java extension version: latest
Steps To Reproduce
  1. Have latest maven and jdk 9.0.1 installed along with jdk 8
  2. Set env var and vscode's user setting java.home to point to jdk9 dir
  3. Use maven's maven-compiler-plugin
  4. element accepts , , or tags. We just use tag
  5. When is set to 9, the whole intellisense fails. Not even java.lang.String is found
  6. Set to 8, intellisense works again, but java 9 features are not recognized
  7. When compiling, and doing mvn package, every time the manifest file shows that jdk8 is used, even though we have a working java 9 compiled program with java 9 features

  1. Uninstall jdk8 from system
  2. Now set to 9 and intellisense will work as expected and recognize java 9 features
  3. When compiling and packaging, the manifest file will correctly show that java 9 was used