From e83e06baba31a28a715b23b12ae5ba804add7aa8 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Sun, 22 Oct 2023 15:29:51 +0200 Subject: [PATCH] make checkStableLamdaNameForRunnableAndAutoCloseable more robust wrt renaming --- .../graal/compiler/hotspot/test/LambdaStableNameTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/LambdaStableNameTest.java b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/LambdaStableNameTest.java index 02543526e2567..5d4a1c851abd4 100644 --- a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/LambdaStableNameTest.java +++ b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/LambdaStableNameTest.java @@ -56,19 +56,20 @@ private String findStableLambdaName(ResolvedJavaType type) { @Test public void checkStableLamdaNameForRunnableAndAutoCloseable() { - Runnable r = this::checkStableLamdaNameForRunnableAndAutoCloseable; + String s = "a string"; + Runnable r = s::hashCode; ResolvedJavaType rType = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess().lookupJavaType(r.getClass()); String name = findStableLambdaName(rType); assertLambdaName(name); - AutoCloseable ac = this::checkStableLamdaNameForRunnableAndAutoCloseable; + AutoCloseable ac = s::hashCode; ResolvedJavaType acType = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess().lookupJavaType(ac.getClass()); String acName = findStableLambdaName(acType); assertEquals("Both stable lambda names are the same as they reference the same method", name, acName); String myName = Type.getInternalName(getClass()); - assertEquals("The name known in 19.3 version is computed", "L" + myName + "$$Lambda$b3eecdea57538cc530ec63a3f2a3564b121557a6;", name); + assertEquals("The name known in 19.3 version is computed", "L" + myName + "$$Lambda$0a7a1b7da3e20b4eff3f548c6ba3e47a0c3be612;", name); } private static void assertLambdaName(String name) {