Since Java 9 there are Multi-Release JARs (MRJARS) that allow different classes for different Java versions to be included in one JAR file. I was surprised when a Wildfly 14 running on Java 11 executed Java-8-code in a JAR included in a WAR although the JAR was a MRJAR with code for Java 11. That JAR included as a dependency for a regular Java SE project is running different code depending on the running JRE, but when included in a WAR, the Java-11-code seems to be ignored.
Is that expected behavior for a webserver, as Java EE 8 does not explicitly require Java 9 (which introduced MRJARs) but only Java 8? Are there other webservers that do correctly read the MRJARs when run on a newer Java version? Or are MRJARs just a feature for Java SE?
If I understand the Wildfly documentation correctly, all contents of a WAR a loaded by the same class loader (org.jboss.modules.ModuleClassLoader according to my debugger), so maybe that classloader does not correclty read the included JARs?
Well, my Bug report lead to a fix so now Wildfly does support MRJARs in deployed WARs :)