< prev index next >

src/java.base/share/classes/jdk/internal/classfile/Attributes.java

Print this page
@@ -62,10 +62,11 @@
  import jdk.internal.classfile.attribute.ModuleResolutionAttribute;
  import jdk.internal.classfile.attribute.ModuleTargetAttribute;
  import jdk.internal.classfile.attribute.NestHostAttribute;
  import jdk.internal.classfile.attribute.NestMembersAttribute;
  import jdk.internal.classfile.attribute.PermittedSubclassesAttribute;
+ import jdk.internal.classfile.attribute.PreloadAttribute;
  import jdk.internal.classfile.attribute.RecordAttribute;
  import jdk.internal.classfile.attribute.RecordComponentInfo;
  import jdk.internal.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
  import jdk.internal.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute;
  import jdk.internal.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;

@@ -159,10 +160,13 @@
      public static final String NAME_NEST_MEMBERS = "NestMembers";
  
      /** PermittedSubclasses */
      public static final String NAME_PERMITTED_SUBCLASSES = "PermittedSubclasses";
  
+     /** Preload */
+     public static final String NAME_PRELOAD = "Preload";
+ 
      /** Record */
      public static final String NAME_RECORD = "Record";
  
      /** RuntimeInvisibleAnnotations */
      public static final String NAME_RUNTIME_INVISIBLE_ANNOTATIONS = "RuntimeInvisibleAnnotations";

@@ -714,10 +718,29 @@
                  public AttributeMapper.AttributeStability stability() {
                      return AttributeStability.CP_REFS;
                  }
              };
  
+     /** Attribute mapper for the {@code Preload} attribute */
+     public static final AttributeMapper<PreloadAttribute>
+             PRELOAD = new AbstractAttributeMapper<>(NAME_PRELOAD, Classfile.JAVA_21_VERSION) {
+                 @Override
+                 public PreloadAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
+                     return new BoundAttribute.BoundPreloadAttribute(cf, this, p);
+                 }
+ 
+                 @Override
+                 protected void writeBody(BufWriter buf, PreloadAttribute attr) {
+                     buf.writeListIndices(attr.preloads());
+                 }
+ 
+                 @Override
+                 public AttributeMapper.AttributeStability stability() {
+                     return AttributeStability.CP_REFS;
+                 }
+             };
+ 
      /** Attribute mapper for the {@code Record} attribute */
      public static final AttributeMapper<RecordAttribute>
              RECORD = new AbstractAttributeMapper<>(NAME_RECORD, Classfile.JAVA_16_VERSION) {
                  @Override
                  public RecordAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {

@@ -1010,10 +1033,11 @@
              MODULE_RESOLUTION,
              MODULE_TARGET,
              NEST_HOST,
              NEST_MEMBERS,
              PERMITTED_SUBCLASSES,
+             PRELOAD,
              RECORD,
              RUNTIME_INVISIBLE_ANNOTATIONS,
              RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS,
              RUNTIME_INVISIBLE_TYPE_ANNOTATIONS,
              RUNTIME_VISIBLE_ANNOTATIONS,
< prev index next >