< prev index next >

src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java

Print this page
@@ -47,12 +47,12 @@
  import jdk.internal.access.SharedSecrets;
  import java.lang.classfile.ClassFile;
  import java.lang.classfile.Label;
  import java.lang.classfile.instruction.SwitchCase;
  
+ import jdk.internal.constant.ClassDescImpl;
  import jdk.internal.constant.ConstantUtils;
- import jdk.internal.constant.ReferenceClassDescImpl;
  import jdk.internal.misc.PreviewFeatures;
  import jdk.internal.vm.annotation.Stable;
  
  import static java.lang.invoke.MethodHandles.Lookup.ClassOption.NESTMATE;
  import static java.lang.invoke.MethodHandles.Lookup.ClassOption.STRONG;

@@ -90,11 +90,11 @@
      private static final MethodTypeDesc TYPES_SWITCH_DESCRIPTOR =
              MethodTypeDesc.ofDescriptor("(Ljava/lang/Object;ILjava/util/function/BiPredicate;Ljava/util/List;)I");
      private static final MethodTypeDesc CHECK_INDEX_DESCRIPTOR =
              MethodTypeDesc.ofDescriptor("(II)I");
  
-     private static final ClassDesc CD_Objects = ReferenceClassDescImpl.ofValidated("Ljava/util/Objects;");
+     private static final ClassDesc CD_Objects = ClassDescImpl.ofValidated("Ljava/util/Objects;");
  
      private static class StaticHolders {
          private static final MethodHandle NULL_CHECK;
          private static final MethodHandle IS_ZERO;
          private static final MethodHandle MAPPED_ENUM_LOOKUP;

@@ -632,11 +632,11 @@
          List<EnumDesc<?>> enumDescs = new ArrayList<>();
          List<Class<?>> extraClassLabels = new ArrayList<>();
  
          byte[] classBytes = ClassFile.of().build(ConstantUtils.binaryNameToDesc(typeSwitchClassName(caller.lookupClass())),
                  clb -> {
-                     clb.withFlags(AccessFlag.FINAL, AccessFlag.SUPER, AccessFlag.SYNTHETIC)
+                     clb.withFlags(AccessFlag.FINAL, (PreviewFeatures.isEnabled())  ? AccessFlag.IDENTITY : AccessFlag.SUPER, AccessFlag.SYNTHETIC)
                         .withMethodBody("typeSwitch",
                                         TYPES_SWITCH_DESCRIPTOR,
                                         ClassFile.ACC_FINAL | ClassFile.ACC_PUBLIC | ClassFile.ACC_STATIC,
                                         generateTypeSwitchSkeleton(selectorType, labelConstants, enumDescs, extraClassLabels));
          });
< prev index next >