diff --git a/substratevm/CHANGELOG.md b/substratevm/CHANGELOG.md index a5022d550531..638971acc057 100644 --- a/substratevm/CHANGELOG.md +++ b/substratevm/CHANGELOG.md @@ -15,6 +15,7 @@ This changelog summarizes major changes to GraalVM Native Image. * (GR-45651) Methods, fields and constructors of `Object`, primitive classes and array classes are now registered by default for reflection. * (GR-45651) The Native Image agent now tracks calls to `ClassLoader.findSystemClass`, `ObjectInputStream.resolveClass` and `Bundles.of`, and registers resource bundles as bundle name-locale pairs. * (GR-49807) Before this change the function `System#setSecurityManager` was always halting program execution with a VM error. This was inconvenient as the VM error prints an uncomprehensible error message and prevents further continuation of the program. For cases where the program is expected to throw an exception when `System#setSecurityManager` is called, execution on Native Image was not possible. Now, `System#setSecurityManager` throws an `java.lang.UnsupportedOperationException` by default. If the property `java.security.manager` is set to anything but `disallow` at program startup this function will throw a `java.lang.SecurityException` according to the Java spec. +* (GR-30433) Disallow the deprecated environment variable USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM=false. ## GraalVM for JDK 21 (Internal Version 23.1.0) * (GR-35746) Lower the default aligned chunk size from 1 MB to 512 KB for the serial and epsilon GCs, reducing memory usage and image size in many cases. diff --git a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java index b26900527e60..1bffeeccd3ae 100644 --- a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java +++ b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java @@ -1653,7 +1653,16 @@ protected int buildImage(List javaArgs, LinkedHashSet cp, LinkedHa } environment.put(ModuleSupport.ENV_VAR_USE_MODULE_SYSTEM, Boolean.toString(config.modulePathBuild)); if (!config.modulePathBuild) { - LogUtils.warningDeprecatedEnvironmentVariable(ModuleSupport.ENV_VAR_USE_MODULE_SYSTEM); + /** + * The old mode of running the image generator on the class path, which was deprecated + * in GraalVM 22.2, is no longer allowed. Using the environment variable + * `USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM=false` that used to enable the + * class-path-mode now leads to an early image build error. We really want to report + * this as an error, because just ignoring the environment variable would most likely + * lead to obscure image build errors later on. + */ + throw showError("Running the image generator on the class path is no longer possible. Setting the environment variable " + + ModuleSupport.ENV_VAR_USE_MODULE_SYSTEM + "=false is no longer supported."); } completeCommandList.addAll(0, environment.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).sorted().toList());