Skip to content

Commit

Permalink
make checkStableLamdaNameForRunnableAndAutoCloseable more robust wrt …
Browse files Browse the repository at this point in the history
…renaming
  • Loading branch information
dougxc committed Oct 23, 2023
1 parent 8f1d3ce commit e83e06b
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e83e06b

Please sign in to comment.