< prev index next >

src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java

Print this page
@@ -53,10 +53,11 @@
  import java.lang.classfile.CodeBuilder;
  import java.lang.classfile.TypeKind;
  
  import jdk.internal.constant.ConstantUtils;
  import jdk.internal.loader.ClassLoaders;
+ import jdk.internal.misc.PreviewFeatures;
  import jdk.internal.module.Modules;
  import jdk.internal.reflect.CallerSensitive;
  import jdk.internal.reflect.Reflection;
  import jdk.internal.util.ClassFileDumper;
  import sun.reflect.misc.ReflectUtil;

@@ -374,11 +375,11 @@
                                           String methodName, List<MethodInfo> methods) {
          return ClassFile.of(ClassHierarchyResolverOption.of(ClassHierarchyResolver.ofClassLoading(loader == null ?
                          ClassLoaders.platformClassLoader() : loader)))
                          .build(proxyDesc, clb -> {
              clb.withSuperclass(CD_Object)
-                .withFlags(ACC_FINAL | ACC_SYNTHETIC)
+                .withFlags((PreviewFeatures.isEnabled() ? ACC_IDENTITY  : 0) | ACC_FINAL | ACC_SYNTHETIC)
                 .withInterfaceSymbols(ifaceDesc)
                 // static and instance fields
                 .withField(TYPE_NAME, CD_Class, ACC_PRIVATE | ACC_STATIC | ACC_FINAL)
                 .withField(TARGET_NAME, CD_MethodHandle, ACC_PRIVATE | ACC_FINAL);
              for (var mi : methods) {
< prev index next >