When a JAR file used in the creation of an AOT cache has been modified, the JVM should not used this AOT cache anymore.
Reproducer:
Actual: the last command doesn't fail.
Expected: the last command should fail with the error:
[0.011s][error][aot] This file is not the one used while building the AOT cache: '/home/iklam/tmp/HelloWorld.jar', timestamp has changed
====================
$ java -cp HelloWorld.jar -XX:AOTCacheOutput=hw.aot HelloWorld
Hello World
Temporary AOTConfiguration recorded: hw.aot.config
Launching child process java to assemble AOT cache hw.aot using configuration hw.aot.config
Picked up JAVA_TOOL_OPTIONS: -Djava.class.path=HelloWorld.jar -XX:AOTCacheOutput=hw.aot -XX:AOTConfiguration=hw.aot.config -XX:AOTMode=create
Reading AOTConfiguration hw.aot.config and writing AOTCache hw.aot
AOTCache creation is complete: hw.aot 10194944 bytes
Removed temporary AOT configuration file hw.aot.config
$ java -cp HelloWorld.jar -XX:AOTCache=hw.aot -XX:AOTMode=on HelloWorld
Hello World
$ touch HelloWorld.jar
$ java -cp HelloWorld.jar -XX:AOTCache=hw.aot -XX:AOTMode=on HelloWorld
Hello World
Reproducer:
Actual: the last command doesn't fail.
Expected: the last command should fail with the error:
[0.011s][error][aot] This file is not the one used while building the AOT cache: '/home/iklam/tmp/HelloWorld.jar', timestamp has changed
====================
$ java -cp HelloWorld.jar -XX:AOTCacheOutput=hw.aot HelloWorld
Hello World
Temporary AOTConfiguration recorded: hw.aot.config
Launching child process java to assemble AOT cache hw.aot using configuration hw.aot.config
Picked up JAVA_TOOL_OPTIONS: -Djava.class.path=HelloWorld.jar -XX:AOTCacheOutput=hw.aot -XX:AOTConfiguration=hw.aot.config -XX:AOTMode=create
Reading AOTConfiguration hw.aot.config and writing AOTCache hw.aot
AOTCache creation is complete: hw.aot 10194944 bytes
Removed temporary AOT configuration file hw.aot.config
$ java -cp HelloWorld.jar -XX:AOTCache=hw.aot -XX:AOTMode=on HelloWorld
Hello World
$ touch HelloWorld.jar
$ java -cp HelloWorld.jar -XX:AOTCache=hw.aot -XX:AOTMode=on HelloWorld
Hello World
- caused by
-
JDK-8348426 Generate binary file for -XX:AOTMode=record -XX:AOTConfiguration=file
-
- Resolved
-
- relates to
-
JDK-8376576 NPE when using AOTCache when jar run from a different folder
-
- Open
-
- links to
-
Review(master)
openjdk/jdk/29728