11/*
2- * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@ static void positiveTests() throws Exception {
5959 out .shouldContain ("Hello World" );
6060 out .shouldHaveExitValue (0 );
6161
62- // (2) Assembly Phase
62+ // (2) Assembly Phase (AOTClassLinking unspecified -> should be enabled by default)
6363 pb = ProcessTools .createLimitedTestJavaProcessBuilder (
6464 "-XX:AOTMode=create" ,
6565 "-XX:AOTConfiguration=" + aotConfigFile ,
@@ -77,6 +77,7 @@ static void positiveTests() throws Exception {
7777 "-Xlog:cds" ,
7878 "-cp" , appJar , helloClass );
7979 out = CDSTestUtils .executeAndLog (pb , "prod" );
80+ out .shouldContain ("Using AOT-linked classes: true (static archive: has aot-linked classes)" );
8081 out .shouldContain ("Opened archive hello.aot." );
8182 out .shouldContain ("Hello World" );
8283 out .shouldHaveExitValue (0 );
@@ -107,7 +108,7 @@ static void positiveTests() throws Exception {
107108 out .shouldContain ("Hello World" );
108109 out .shouldHaveExitValue (0 );
109110
110- // (5 ) AOTMode=on
111+ // (6 ) AOTMode=on
111112 pb = ProcessTools .createLimitedTestJavaProcessBuilder (
112113 "-XX:AOTCache=" + aotCacheFile ,
113114 "--show-version" ,
@@ -119,6 +120,30 @@ static void positiveTests() throws Exception {
119120 out .shouldContain ("Opened archive hello.aot." );
120121 out .shouldContain ("Hello World" );
121122 out .shouldHaveExitValue (0 );
123+
124+ // (7) Assembly Phase with -XX:-AOTClassLinking
125+ pb = ProcessTools .createLimitedTestJavaProcessBuilder (
126+ "-XX:AOTMode=create" ,
127+ "-XX:-AOTClassLinking" ,
128+ "-XX:AOTConfiguration=" + aotConfigFile ,
129+ "-XX:AOTCache=" + aotCacheFile ,
130+ "-Xlog:cds" ,
131+ "-cp" , appJar );
132+ out = CDSTestUtils .executeAndLog (pb , "asm" );
133+ out .shouldContain ("Dumping shared data to file:" );
134+ out .shouldMatch ("cds.*hello[.]aot" );
135+ out .shouldHaveExitValue (0 );
136+
137+ // (8) Production Run with AOTCache, which was created with -XX:-AOTClassLinking
138+ pb = ProcessTools .createLimitedTestJavaProcessBuilder (
139+ "-XX:AOTCache=" + aotCacheFile ,
140+ "-Xlog:cds" ,
141+ "-cp" , appJar , helloClass );
142+ out = CDSTestUtils .executeAndLog (pb , "prod" );
143+ out .shouldContain ("Using AOT-linked classes: false (static archive: no aot-linked classes)" );
144+ out .shouldContain ("Opened archive hello.aot." );
145+ out .shouldContain ("Hello World" );
146+ out .shouldHaveExitValue (0 );
122147 }
123148
124149 static void negativeTests () throws Exception {
0 commit comments