diff --git a/src/java.base/share/classes/java/lang/invoke/GenerateJLIClassesHelper.java b/src/java.base/share/classes/java/lang/invoke/GenerateJLIClassesHelper.java index ca652d8d29d14..19a193a924a0a 100644 --- a/src/java.base/share/classes/java/lang/invoke/GenerateJLIClassesHelper.java +++ b/src/java.base/share/classes/java/lang/invoke/GenerateJLIClassesHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ import jdk.internal.org.objectweb.asm.ClassWriter; import jdk.internal.org.objectweb.asm.Opcodes; import sun.invoke.util.Wrapper; +import sun.util.logging.PlatformLogger; import java.util.ArrayList; import java.util.HashSet; @@ -136,9 +137,7 @@ Map build() { for (String invokerType : invokerTypes) { MethodType mt = asMethodType(invokerType); final int lastParam = mt.parameterCount() - 1; - if (mt.parameterCount() < 2 || - mt.parameterType(0) != Object.class || - mt.parameterType(lastParam) != Object.class) { + if (!checkInvokerTypeParams(mt)) { throw new RuntimeException( "Invoker type parameter must start and end with Object: " + invokerType); } @@ -190,7 +189,7 @@ Map build() { return result; } - private static MethodType asMethodType(String basicSignatureString) { + public static MethodType asMethodType(String basicSignatureString) { String[] parts = basicSignatureString.split("_"); assert (parts.length == 2); assert (parts[1].length() == 1); @@ -207,6 +206,13 @@ private static MethodType asMethodType(String basicSignatureString) { } } + public static boolean checkInvokerTypeParams(MethodType mt) { + final int lastParam = mt.parameterCount() - 1; + return (mt.parameterCount() >= 2 && + mt.parameterType(0) == Object.class && + mt.parameterType(lastParam) == Object.class); + } + private void addDMHMethodType(String dmh, String methodType) { validateMethodType(methodType); Set methodTypes = dmhMethods.get(dmh); @@ -315,7 +321,14 @@ static Map generateHolderClasses(Stream traces) { "linkToCallSite".equals(parts[2])) { builder.addCallSiteType(methodType); } else { - builder.addInvokerType(methodType); + MethodType mt = HolderClassBuilder.asMethodType(methodType); + // Work around JDK-8327499 + if (HolderClassBuilder.checkInvokerTypeParams(mt)) { + builder.addInvokerType(methodType); + } else { + PlatformLogger.getLogger("java.lang.invoke") + .warning("Invalid LF_RESOLVE " + parts[1] + " " + parts[2] + " " + parts[3]); + } } } else if (parts[1].contains("DirectMethodHandle")) { String dmh = parts[2]; diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/CDSMHTest_generate.sh b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/CDSMHTest_generate.sh index be4fab7794d08..9c1ceec911986 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/CDSMHTest_generate.sh +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/CDSMHTest_generate.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ do fname="$i$name_suffix" cat << EOF > $fname /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,6 +81,7 @@ import org.junit.Test; import java.io.File; import java.nio.file.Path; import jdk.test.lib.Platform; +import jdk.test.lib.process.OutputAnalyzer; public class $i extends DynamicArchiveTestBase { @Test @@ -98,6 +99,12 @@ public class $i extends DynamicArchiveTestBase { private static final String lambdaLoadedFromArchive = ".class.load. test.java.lang.invoke.$i[$][$]Lambda.*/0x.*source:.*shared.*objects.*file.*(top)"; + static void checkError(OutputAnalyzer output) throws Exception { + if (testClassName.equals("MethodHandlesInvokersTest")) { + output.shouldNotContain("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?"); + } + } + static void testImpl() throws Exception { String topArchiveName = getNewArchiveName(); String appJar = JarBuilder.build("MH", new File(classDir), null); @@ -111,6 +118,7 @@ public class $i extends DynamicArchiveTestBase { String className = testPackageName + "." + testClassName; dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className) + .assertNormalExit(output -> checkError(output)) .assertNormalExit(output -> { output.shouldContain("Written dynamic archive 0x"); }); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesAsCollectorTest.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesAsCollectorTest.java index 5971e3d1f2e9d..0abb20a5ad64d 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesAsCollectorTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesAsCollectorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. * */ -// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually. +// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually. /* * @test @@ -49,6 +49,7 @@ import java.io.File; import java.nio.file.Path; import jdk.test.lib.Platform; +import jdk.test.lib.process.OutputAnalyzer; public class MethodHandlesAsCollectorTest extends DynamicArchiveTestBase { @Test @@ -66,6 +67,12 @@ public void test() throws Exception { private static final String lambdaLoadedFromArchive = ".class.load. test.java.lang.invoke.MethodHandlesAsCollectorTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file.*(top)"; + static void checkError(OutputAnalyzer output) throws Exception { + if (testClassName.equals("MethodHandlesInvokersTest")) { + output.shouldNotContain("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?"); + } + } + static void testImpl() throws Exception { String topArchiveName = getNewArchiveName(); String appJar = JarBuilder.build("MH", new File(classDir), null); @@ -79,6 +86,7 @@ static void testImpl() throws Exception { String className = testPackageName + "." + testClassName; dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className) + .assertNormalExit(output -> checkError(output)) .assertNormalExit(output -> { output.shouldContain("Written dynamic archive 0x"); }); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesCastFailureTest.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesCastFailureTest.java index 085bc8b339203..bbc230f04d0a1 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesCastFailureTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesCastFailureTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. * */ -// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually. +// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually. /* * @test @@ -49,6 +49,7 @@ import java.io.File; import java.nio.file.Path; import jdk.test.lib.Platform; +import jdk.test.lib.process.OutputAnalyzer; public class MethodHandlesCastFailureTest extends DynamicArchiveTestBase { @Test @@ -66,6 +67,12 @@ public void test() throws Exception { private static final String lambdaLoadedFromArchive = ".class.load. test.java.lang.invoke.MethodHandlesCastFailureTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file.*(top)"; + static void checkError(OutputAnalyzer output) throws Exception { + if (testClassName.equals("MethodHandlesInvokersTest")) { + output.shouldNotContain("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?"); + } + } + static void testImpl() throws Exception { String topArchiveName = getNewArchiveName(); String appJar = JarBuilder.build("MH", new File(classDir), null); @@ -79,6 +86,7 @@ static void testImpl() throws Exception { String className = testPackageName + "." + testClassName; dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className) + .assertNormalExit(output -> checkError(output)) .assertNormalExit(output -> { output.shouldContain("Written dynamic archive 0x"); }); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesGeneralTest.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesGeneralTest.java index f833f8f6d54f9..f20dd67baf208 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesGeneralTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesGeneralTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. * */ -// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually. +// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually. /* * @test @@ -49,6 +49,7 @@ import java.io.File; import java.nio.file.Path; import jdk.test.lib.Platform; +import jdk.test.lib.process.OutputAnalyzer; public class MethodHandlesGeneralTest extends DynamicArchiveTestBase { @Test @@ -66,6 +67,12 @@ public void test() throws Exception { private static final String lambdaLoadedFromArchive = ".class.load. test.java.lang.invoke.MethodHandlesGeneralTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file.*(top)"; + static void checkError(OutputAnalyzer output) throws Exception { + if (testClassName.equals("MethodHandlesInvokersTest")) { + output.shouldNotContain("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?"); + } + } + static void testImpl() throws Exception { String topArchiveName = getNewArchiveName(); String appJar = JarBuilder.build("MH", new File(classDir), null); @@ -79,6 +86,7 @@ static void testImpl() throws Exception { String className = testPackageName + "." + testClassName; dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className) + .assertNormalExit(output -> checkError(output)) .assertNormalExit(output -> { output.shouldContain("Written dynamic archive 0x"); }); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesInvokersTest.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesInvokersTest.java index 06116753ec618..2adf0736156af 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesInvokersTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesInvokersTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. * */ -// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually. +// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually. /* * @test @@ -49,6 +49,7 @@ import java.io.File; import java.nio.file.Path; import jdk.test.lib.Platform; +import jdk.test.lib.process.OutputAnalyzer; public class MethodHandlesInvokersTest extends DynamicArchiveTestBase { @Test @@ -66,6 +67,12 @@ public void test() throws Exception { private static final String lambdaLoadedFromArchive = ".class.load. test.java.lang.invoke.MethodHandlesInvokersTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file.*(top)"; + static void checkError(OutputAnalyzer output) throws Exception { + if (testClassName.equals("MethodHandlesInvokersTest")) { + output.shouldNotContain("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?"); + } + } + static void testImpl() throws Exception { String topArchiveName = getNewArchiveName(); String appJar = JarBuilder.build("MH", new File(classDir), null); @@ -79,6 +86,7 @@ static void testImpl() throws Exception { String className = testPackageName + "." + testClassName; dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className) + .assertNormalExit(output -> checkError(output)) .assertNormalExit(output -> { output.shouldContain("Written dynamic archive 0x"); }); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesPermuteArgumentsTest.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesPermuteArgumentsTest.java index 19db0f1e1a8e0..92054fe615c5c 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesPermuteArgumentsTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesPermuteArgumentsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. * */ -// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually. +// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually. /* * @test @@ -49,6 +49,7 @@ import java.io.File; import java.nio.file.Path; import jdk.test.lib.Platform; +import jdk.test.lib.process.OutputAnalyzer; public class MethodHandlesPermuteArgumentsTest extends DynamicArchiveTestBase { @Test @@ -66,6 +67,12 @@ public void test() throws Exception { private static final String lambdaLoadedFromArchive = ".class.load. test.java.lang.invoke.MethodHandlesPermuteArgumentsTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file.*(top)"; + static void checkError(OutputAnalyzer output) throws Exception { + if (testClassName.equals("MethodHandlesInvokersTest")) { + output.shouldNotContain("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?"); + } + } + static void testImpl() throws Exception { String topArchiveName = getNewArchiveName(); String appJar = JarBuilder.build("MH", new File(classDir), null); @@ -79,6 +86,7 @@ static void testImpl() throws Exception { String className = testPackageName + "." + testClassName; dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className) + .assertNormalExit(output -> checkError(output)) .assertNormalExit(output -> { output.shouldContain("Written dynamic archive 0x"); }); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesSpreadArgumentsTest.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesSpreadArgumentsTest.java index ae67716a852ae..0d7d3f84f4137 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesSpreadArgumentsTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/methodHandles/MethodHandlesSpreadArgumentsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. * */ -// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually. +// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually. /* * @test @@ -49,6 +49,7 @@ import java.io.File; import java.nio.file.Path; import jdk.test.lib.Platform; +import jdk.test.lib.process.OutputAnalyzer; public class MethodHandlesSpreadArgumentsTest extends DynamicArchiveTestBase { @Test @@ -66,6 +67,12 @@ public void test() throws Exception { private static final String lambdaLoadedFromArchive = ".class.load. test.java.lang.invoke.MethodHandlesSpreadArgumentsTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file.*(top)"; + static void checkError(OutputAnalyzer output) throws Exception { + if (testClassName.equals("MethodHandlesInvokersTest")) { + output.shouldNotContain("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?"); + } + } + static void testImpl() throws Exception { String topArchiveName = getNewArchiveName(); String appJar = JarBuilder.build("MH", new File(classDir), null); @@ -79,6 +86,7 @@ static void testImpl() throws Exception { String className = testPackageName + "." + testClassName; dump(topArchiveName, loggingOpts, "-cp", jars, verifyOpt, mainClass, className) + .assertNormalExit(output -> checkError(output)) .assertNormalExit(output -> { output.shouldContain("Written dynamic archive 0x"); }); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/CDSMHTest_generate.sh b/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/CDSMHTest_generate.sh index a593fcffc0310..562d9ef0ef5cf 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/CDSMHTest_generate.sh +++ b/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/CDSMHTest_generate.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ do fname="$i$name_suffix" cat << EOF > $fname /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -121,7 +121,10 @@ public class $i { "-cp", jars, "-Xlog:class+load,cds") .setArchiveName(archiveName); - CDSTestUtils.createArchiveAndCheck(opts); + OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts); + if (testClassName.equals("MethodHandlesInvokersTest")) { + output.shouldNotContain("Failed to generate LambdaForm holder classes. Is your classlist out of date?"); + } // run with archive CDSOptions runOpts = (new CDSOptions()) @@ -129,7 +132,7 @@ public class $i { .setArchiveName(archiveName) .setUseVersion(false) .addSuffix(mainClass, testPackageName + "." + testClassName); - OutputAnalyzer output = CDSTestUtils.runWithArchive(runOpts); + output = CDSTestUtils.runWithArchive(runOpts); output.shouldMatch(".class.load. test.java.lang.invoke.$i[$][$]Lambda.*/0x.*source:.*shared.*objects.*file") .shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesAsCollectorTest.java b/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesAsCollectorTest.java index 605f0d4c72b33..dbfa2d56e6afb 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesAsCollectorTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesAsCollectorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. * */ -// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually. +// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually. /* * @test @@ -89,7 +89,10 @@ static void testImpl() throws Exception { "-cp", jars, "-Xlog:class+load,cds") .setArchiveName(archiveName); - CDSTestUtils.createArchiveAndCheck(opts); + OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts); + if (testClassName.equals("MethodHandlesInvokersTest")) { + output.shouldNotContain("Failed to generate LambdaForm holder classes. Is your classlist out of date?"); + } // run with archive CDSOptions runOpts = (new CDSOptions()) @@ -97,7 +100,7 @@ static void testImpl() throws Exception { .setArchiveName(archiveName) .setUseVersion(false) .addSuffix(mainClass, testPackageName + "." + testClassName); - OutputAnalyzer output = CDSTestUtils.runWithArchive(runOpts); + output = CDSTestUtils.runWithArchive(runOpts); output.shouldMatch(".class.load. test.java.lang.invoke.MethodHandlesAsCollectorTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file") .shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesCastFailureTest.java b/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesCastFailureTest.java index f46fa10dc0440..bccc787709b20 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesCastFailureTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesCastFailureTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. * */ -// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually. +// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually. /* * @test @@ -89,7 +89,10 @@ static void testImpl() throws Exception { "-cp", jars, "-Xlog:class+load,cds") .setArchiveName(archiveName); - CDSTestUtils.createArchiveAndCheck(opts); + OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts); + if (testClassName.equals("MethodHandlesInvokersTest")) { + output.shouldNotContain("Failed to generate LambdaForm holder classes. Is your classlist out of date?"); + } // run with archive CDSOptions runOpts = (new CDSOptions()) @@ -97,7 +100,7 @@ static void testImpl() throws Exception { .setArchiveName(archiveName) .setUseVersion(false) .addSuffix(mainClass, testPackageName + "." + testClassName); - OutputAnalyzer output = CDSTestUtils.runWithArchive(runOpts); + output = CDSTestUtils.runWithArchive(runOpts); output.shouldMatch(".class.load. test.java.lang.invoke.MethodHandlesCastFailureTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file") .shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesGeneralTest.java b/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesGeneralTest.java index fdd0257df3787..3577d07f3075b 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesGeneralTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesGeneralTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. * */ -// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually. +// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually. /* * @test @@ -89,7 +89,10 @@ static void testImpl() throws Exception { "-cp", jars, "-Xlog:class+load,cds") .setArchiveName(archiveName); - CDSTestUtils.createArchiveAndCheck(opts); + OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts); + if (testClassName.equals("MethodHandlesInvokersTest")) { + output.shouldNotContain("Failed to generate LambdaForm holder classes. Is your classlist out of date?"); + } // run with archive CDSOptions runOpts = (new CDSOptions()) @@ -97,7 +100,7 @@ static void testImpl() throws Exception { .setArchiveName(archiveName) .setUseVersion(false) .addSuffix(mainClass, testPackageName + "." + testClassName); - OutputAnalyzer output = CDSTestUtils.runWithArchive(runOpts); + output = CDSTestUtils.runWithArchive(runOpts); output.shouldMatch(".class.load. test.java.lang.invoke.MethodHandlesGeneralTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file") .shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesInvokersTest.java b/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesInvokersTest.java index bb31ff1f66f04..f500b568f5016 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesInvokersTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesInvokersTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. * */ -// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually. +// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually. /* * @test @@ -89,7 +89,10 @@ static void testImpl() throws Exception { "-cp", jars, "-Xlog:class+load,cds") .setArchiveName(archiveName); - CDSTestUtils.createArchiveAndCheck(opts); + OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts); + if (testClassName.equals("MethodHandlesInvokersTest")) { + output.shouldNotContain("Failed to generate LambdaForm holder classes. Is your classlist out of date?"); + } // run with archive CDSOptions runOpts = (new CDSOptions()) @@ -97,7 +100,7 @@ static void testImpl() throws Exception { .setArchiveName(archiveName) .setUseVersion(false) .addSuffix(mainClass, testPackageName + "." + testClassName); - OutputAnalyzer output = CDSTestUtils.runWithArchive(runOpts); + output = CDSTestUtils.runWithArchive(runOpts); output.shouldMatch(".class.load. test.java.lang.invoke.MethodHandlesInvokersTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file") .shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesPermuteArgumentsTest.java b/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesPermuteArgumentsTest.java index 1ca3f2882f0c2..b2e2a834c364e 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesPermuteArgumentsTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesPermuteArgumentsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. * */ -// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually. +// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually. /* * @test @@ -89,7 +89,10 @@ static void testImpl() throws Exception { "-cp", jars, "-Xlog:class+load,cds") .setArchiveName(archiveName); - CDSTestUtils.createArchiveAndCheck(opts); + OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts); + if (testClassName.equals("MethodHandlesInvokersTest")) { + output.shouldNotContain("Failed to generate LambdaForm holder classes. Is your classlist out of date?"); + } // run with archive CDSOptions runOpts = (new CDSOptions()) @@ -97,7 +100,7 @@ static void testImpl() throws Exception { .setArchiveName(archiveName) .setUseVersion(false) .addSuffix(mainClass, testPackageName + "." + testClassName); - OutputAnalyzer output = CDSTestUtils.runWithArchive(runOpts); + output = CDSTestUtils.runWithArchive(runOpts); output.shouldMatch(".class.load. test.java.lang.invoke.MethodHandlesPermuteArgumentsTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file") .shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesSpreadArgumentsTest.java b/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesSpreadArgumentsTest.java index 514e118e95d62..a0d7d0f994912 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesSpreadArgumentsTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/methodHandles/MethodHandlesSpreadArgumentsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. * */ -// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually. +// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually. /* * @test @@ -89,7 +89,10 @@ static void testImpl() throws Exception { "-cp", jars, "-Xlog:class+load,cds") .setArchiveName(archiveName); - CDSTestUtils.createArchiveAndCheck(opts); + OutputAnalyzer output = CDSTestUtils.createArchiveAndCheck(opts); + if (testClassName.equals("MethodHandlesInvokersTest")) { + output.shouldNotContain("Failed to generate LambdaForm holder classes. Is your classlist out of date?"); + } // run with archive CDSOptions runOpts = (new CDSOptions()) @@ -97,7 +100,7 @@ static void testImpl() throws Exception { .setArchiveName(archiveName) .setUseVersion(false) .addSuffix(mainClass, testPackageName + "." + testClassName); - OutputAnalyzer output = CDSTestUtils.runWithArchive(runOpts); + output = CDSTestUtils.runWithArchive(runOpts); output.shouldMatch(".class.load. test.java.lang.invoke.MethodHandlesSpreadArgumentsTest[$][$]Lambda.*/0x.*source:.*shared.*objects.*file") .shouldHaveExitValue(0); }