< prev index next >

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

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2008, 2024, 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
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this

@@ -50,10 +50,11 @@
  import jdk.internal.access.SharedSecrets;
  import java.lang.classfile.ClassHierarchyResolver;
  import java.lang.classfile.ClassFile;
  import java.lang.classfile.CodeBuilder;
  import java.lang.classfile.TypeKind;
+ 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;

@@ -368,11 +369,11 @@
      private static byte[] createTemplate(ClassLoader loader, ClassDesc proxyDesc, ClassDesc ifaceDesc,
                                           String methodName, List<MethodInfo> methods) {
          return ClassFile.of(ClassHierarchyResolverOption.of(ClassHierarchyResolver.ofClassLoading(loader)))
                          .build(proxyDesc, clb -> {
              clb.withSuperclass(CD_Object);
-             clb.withFlags(ACC_FINAL | ACC_SYNTHETIC);
+             clb.withFlags((PreviewFeatures.isEnabled() ? ACC_IDENTITY  : 0) | ACC_FINAL | ACC_SYNTHETIC);
              clb.withInterfaceSymbols(ifaceDesc);
  
              // static and instance fields
              clb.withField(TYPE_NAME, CD_Class, ACC_PRIVATE | ACC_STATIC | ACC_FINAL);
              clb.withField(TARGET_NAME, CD_MethodHandle, ACC_PRIVATE | ACC_FINAL);
< prev index next >