8373832: Test java/lang/invoke/TestVHInvokerCaching.java tests nothing

Reviewed-by: jvernee, shade
This commit is contained in:
Chen Liang 2025-12-17 20:52:14 +00:00
parent f3a48560b5
commit e75726ee03

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2025, 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
@ -37,7 +37,7 @@ import java.util.ArrayList;
import java.util.List;
import static java.lang.invoke.MethodHandles.lookup;
import static org.testng.Assert.assertSame;
import static org.testng.Assert.*;
public class TestVHInvokerCaching {
@ -74,7 +74,7 @@ public class TestVHInvokerCaching {
MethodHandles.Lookup lookup = lookup();
for (Field field : Holder.class.getFields()) {
for (Field field : Holder.class.getDeclaredFields()) {
String fieldName = field.getName();
Class<?> fieldType = field.getType();
@ -82,6 +82,8 @@ public class TestVHInvokerCaching {
testHandles.add(lookup.findVarHandle(Holder.class, fieldName, fieldType));
}
assertFalse(testHandles.isEmpty());
return testHandles.stream().map(vh -> new Object[]{ vh }).toArray(Object[][]::new);
}
}