1 /*
2 * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
182 // the side of safety and revert all such references.
183 .shouldMatch(AOTLINK_ONLY("method.*: ResolvedConstantsApp java/io/PrintStream.println:"))
184 .shouldMatch(AOTLINK_ONLY("method.*: ResolvedConstantsBar java/lang/Class.getName:"))
185
186 // Resolve method references to child classes ONLY when using -XX:+AOTClassLinking
187 .shouldMatch(AOTLINK_ONLY("method.* ResolvedConstantsFoo ResolvedConstantsBar.static_doit"))
188 .shouldMatch(AOTLINK_ONLY("method.* ResolvedConstantsFoo ResolvedConstantsBar.doit2"))
189
190 // Resolve methods in unrelated classes ONLY when using -XX:+AOTClassLinking
191 .shouldMatch(AOTLINK_ONLY("method.*: ResolvedConstantsApp ResolvedConstantsBar.static_doit:"))
192 .shouldMatch(AOTLINK_ONLY("method.*: ResolvedConstantsApp ResolvedConstantsBar.doit:"))
193
194 // End ---
195 ;
196
197
198 // Indy References ---
199 if (aotClassLinking) {
200 testGroup("Indy References", out)
201 .shouldContain("Cannot aot-resolve Lambda proxy of interface type InterfaceWithClinit")
202 .shouldMatch("klasses.* app *NormalClass[$][$]Lambda/.* hidden aot-linked inited")
203 .shouldMatch("archived indy *CP entry.*StringConcatTest .* => java/lang/invoke/StringConcatFactory.makeConcatWithConstants");
204 }
205 }
206
207 static String ALWAYS(String s) {
208 return ",resolve.*archived " + s;
209 }
210
211 static String AOTLINK_ONLY(String s) {
212 if (aotClassLinking) {
213 return ALWAYS(s);
214 } else {
215 return ",resolve.*reverted " + s;
216 }
217 }
218
219 static OutputAnalyzer testGroup(String name, OutputAnalyzer out) {
220 System.out.println("Checking for: " + name);
221 return out;
222 }
|
1 /*
2 * Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
182 // the side of safety and revert all such references.
183 .shouldMatch(AOTLINK_ONLY("method.*: ResolvedConstantsApp java/io/PrintStream.println:"))
184 .shouldMatch(AOTLINK_ONLY("method.*: ResolvedConstantsBar java/lang/Class.getName:"))
185
186 // Resolve method references to child classes ONLY when using -XX:+AOTClassLinking
187 .shouldMatch(AOTLINK_ONLY("method.* ResolvedConstantsFoo ResolvedConstantsBar.static_doit"))
188 .shouldMatch(AOTLINK_ONLY("method.* ResolvedConstantsFoo ResolvedConstantsBar.doit2"))
189
190 // Resolve methods in unrelated classes ONLY when using -XX:+AOTClassLinking
191 .shouldMatch(AOTLINK_ONLY("method.*: ResolvedConstantsApp ResolvedConstantsBar.static_doit:"))
192 .shouldMatch(AOTLINK_ONLY("method.*: ResolvedConstantsApp ResolvedConstantsBar.doit:"))
193
194 // End ---
195 ;
196
197
198 // Indy References ---
199 if (aotClassLinking) {
200 testGroup("Indy References", out)
201 .shouldContain("Cannot aot-resolve Lambda proxy of interface type InterfaceWithClinit")
202 .shouldMatch("klasses.* app *NormalClass[$][$]Lambda/.* hidden aot-linked early inited")
203 .shouldMatch("archived indy *CP entry.*StringConcatTest .* => java/lang/invoke/StringConcatFactory.makeConcatWithConstants");
204 }
205 }
206
207 static String ALWAYS(String s) {
208 return ",resolve.*archived " + s;
209 }
210
211 static String AOTLINK_ONLY(String s) {
212 if (aotClassLinking) {
213 return ALWAYS(s);
214 } else {
215 return ",resolve.*reverted " + s;
216 }
217 }
218
219 static OutputAnalyzer testGroup(String name, OutputAnalyzer out) {
220 System.out.println("Checking for: " + name);
221 return out;
222 }
|