When --add-exports is specified with "java -XX:AOTMode=create", AOTClassLinking is disabled:
=================================
$ java -cp HelloWorld.jar -XX:AOTMode=record \
-XX:AOTConfiguration=hw.aotconfig HelloWorld
Hello World
AOTConfiguration recorded: hw.aotconfig
$ java -Xlog:cds -XX:+AOTClassLinking --add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
-cp HelloWorld.jar -XX:AOTMode=create -XX:AOTCache=hw.aot \
-XX:AOTConfiguration=hw.aotconfig
[...]
[0.000s][info][cds] optimized module handling: disabled due to incompatible property: jdk.module.addexports=java.base/jdk.internal.misc=ALL-UNNAMED
[...]
[0.456s][info][cds] Number of classes 1043
[0.456s][info][cds] instance classes = 891, aot-linked = 0, inited = 0
=================================
Proposal:
We should support --add-exports for AOT cache, and allow the AOT cache to be used as long as the exact same set of options --add-exports are used during assembly phase and production run.
=================================
$ java -cp HelloWorld.jar -XX:AOTMode=record \
-XX:AOTConfiguration=hw.aotconfig HelloWorld
Hello World
AOTConfiguration recorded: hw.aotconfig
$ java -Xlog:cds -XX:+AOTClassLinking --add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
-cp HelloWorld.jar -XX:AOTMode=create -XX:AOTCache=hw.aot \
-XX:AOTConfiguration=hw.aotconfig
[...]
[0.000s][info][cds] optimized module handling: disabled due to incompatible property: jdk.module.addexports=java.base/jdk.internal.misc=ALL-UNNAMED
[...]
[0.456s][info][cds] Number of classes 1043
[0.456s][info][cds] instance classes = 891, aot-linked = 0, inited = 0
=================================
Proposal:
We should support --add-exports for AOT cache, and allow the AOT cache to be used as long as the exact same set of options --add-exports are used during assembly phase and production run.
- blocks
- 
                    JDK-8352528 Move CDS WhiteBox APIs to jdk.internal.test.cds.WhiteBox -           
- Open
 
-         
- relates to
- 
                    JDK-8354083 Support --add-reads with -XX:+AOTClassLinking -           
- Resolved
 
-         
- 
                    JDK-8352003 Support --add-opens with -XX:+AOTClassLinking -           
- Resolved
 
-         
- links to
- 
                     Commit(master)
        openjdk/jdk/096e70de Commit(master)
        openjdk/jdk/096e70de
- 
                     Review(master)
        openjdk/jdk/24124 Review(master)
        openjdk/jdk/24124