< prev index next >

src/java.base/share/classes/java/lang/classfile/Attributes.java

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

*** 163,10 ***
--- 164,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";

*** 718,10 ***
--- 722,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) {
+                 @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) {
                  @Override
                  public RecordAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {

*** 1014,10 ***
--- 1037,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 >