08e090bf5e
The problem in KT-19833 is caused by the fact that the application environment instance is shared between consecutive runs of the compiler in one Make action (KotlinCoreEnvironment.ourApplicationEnvironment). If the JDK 8 module is compiled first, the created application environment has no JRT file system, and once the JDK 9 module is compiled later, that environment is not recreated and thus classes from JDK 9 are unresolved. To mitigate this, split the CoreJrtFileSystem implementation into the file system itself which is global per application, and CoreJrtHandler which is bound to a particular JDK home location. CoreJrtVirtualFile paths now consist of the path to the JDK home, the "!/" separator, and the path to the file itself, e.g. "/usr/lib/jvm/java9!/modules/java.base/java/lang/Object.class". The implementation is inspired by CoreJarFileSystem & CoreJarHandler. No tests added because the application environment is _not_ shared in tests. Also, a JDK 9 module is going to be added to the Kotlin project soon, and that will serve as a test #KT-19833 Fixed