FULL PRODUCT VERSION :
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
This issue does not depend on the OS.
A DESCRIPTION OF THE PROBLEM :
Multi-Release JARs specification describes the structure and location of the classes for different Java versions.
The problem is that MRJars work only when they are packed as Jar files. When MRJar is exploded (the content is simply extracted and put on the classpath), MRJars are **not** working. Users are forced to create a jar file.
There is a huge impact of this bug: 1) we can **not** run tests, 2) we cannot run WARs application in Tomcat and so on.
Developers are almost always running tests _before_ the code is packed into the jar! If you are building such MRJar, tests will not run for Java9, simply because there is no jar file.
Up to now, Jars were _always_ transparent. One could extract jars and put it on the classpath, and everything would still working. Not anymore with MRJArs.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
+ create a simple Gradle Java8 project
+ make a MR Jar structure, but adding Java9 classes in the "resources" folder, as per MRJar specification
+ add simple test that tests the code that is different for Java8 and Java9.
Run the tests on Java8 and Java9. Running tests on Java9 will not work (i.e. the java9 classes are not picked up).
EXPECTED VERSUS ACTUAL BEHAVIOR :
I am expecting that Java9 classes are picked up even they are **not** in the jar.
Java9 classes are not picked up.
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Workaround would be to force users to create an artifact *before* it is tested, install it locally to local maven folder and then test it; which is totally unacceptable.