< prev index next > test/jdk/java/lang/invoke/MethodHandleProxies/WrapperHiddenClassTest.java
Print this page
import static java.lang.constant.ConstantDescs.*;
import static java.lang.invoke.MethodHandleProxies.*;
import static java.lang.invoke.MethodType.methodType;
import static java.lang.classfile.ClassFile.*;
+
+ import jdk.internal.misc.PreviewFeatures;
+
import static org.junit.jupiter.api.Assertions.*;
/*
* @test
* @bug 6983726
* @library /test/lib
+ * @modules java.base/jdk.internal.misc
* @enablePreview
* @summary Tests on implementation hidden classes spinned by MethodHandleProxies
* @build WrapperHiddenClassTest Client jdk.test.lib.util.ForceGC
* @run junit WrapperHiddenClassTest
*/
@SuppressWarnings("unchecked")
private Comparator<Integer> createHostileInstance() throws Throwable {
var cf = ClassFile.of();
var bytes = cf.build(CD_HostileWrapper, clb -> {
clb.withSuperclass(CD_Object);
- clb.withFlags(ACC_FINAL | ACC_SYNTHETIC);
+ clb.withFlags((PreviewFeatures.isEnabled() ? ACC_IDENTITY : 0) | ACC_FINAL | ACC_SYNTHETIC);
clb.withInterfaceSymbols(CD_Comparator);
// static and instance fields
clb.withField(TYPE, CD_Class, ACC_PRIVATE | ACC_STATIC | ACC_FINAL);
clb.withField(TARGET, CD_MethodHandle, ACC_PRIVATE | ACC_FINAL);
< prev index next >