1 /*
   2  * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package jdk.internal.classfile;
  26 
  27 import java.util.Collections;
  28 import java.util.HashMap;
  29 import java.util.List;
  30 import java.util.Map;
  31 import java.util.Set;
  32 
  33 import jdk.internal.classfile.attribute.AnnotationDefaultAttribute;
  34 import jdk.internal.classfile.attribute.BootstrapMethodsAttribute;
  35 import jdk.internal.classfile.attribute.CharacterRangeInfo;
  36 import jdk.internal.classfile.attribute.CharacterRangeTableAttribute;
  37 import jdk.internal.classfile.attribute.CodeAttribute;
  38 import jdk.internal.classfile.attribute.CompilationIDAttribute;
  39 import jdk.internal.classfile.attribute.ConstantValueAttribute;
  40 import jdk.internal.classfile.attribute.DeprecatedAttribute;
  41 import jdk.internal.classfile.attribute.EnclosingMethodAttribute;
  42 import jdk.internal.classfile.attribute.ExceptionsAttribute;
  43 import jdk.internal.classfile.attribute.InnerClassInfo;
  44 import jdk.internal.classfile.attribute.InnerClassesAttribute;
  45 import jdk.internal.classfile.attribute.LineNumberInfo;
  46 import jdk.internal.classfile.attribute.LineNumberTableAttribute;
  47 import jdk.internal.classfile.attribute.LocalVariableInfo;
  48 import jdk.internal.classfile.attribute.LocalVariableTableAttribute;
  49 import jdk.internal.classfile.attribute.LocalVariableTypeInfo;
  50 import jdk.internal.classfile.attribute.LocalVariableTypeTableAttribute;
  51 import jdk.internal.classfile.attribute.MethodParameterInfo;
  52 import jdk.internal.classfile.attribute.MethodParametersAttribute;
  53 import jdk.internal.classfile.attribute.ModuleAttribute;
  54 import jdk.internal.classfile.attribute.ModuleExportInfo;
  55 import jdk.internal.classfile.attribute.ModuleHashInfo;
  56 import jdk.internal.classfile.attribute.ModuleHashesAttribute;
  57 import jdk.internal.classfile.attribute.ModuleMainClassAttribute;
  58 import jdk.internal.classfile.attribute.ModuleOpenInfo;
  59 import jdk.internal.classfile.attribute.ModulePackagesAttribute;
  60 import jdk.internal.classfile.attribute.ModuleProvideInfo;
  61 import jdk.internal.classfile.attribute.ModuleRequireInfo;
  62 import jdk.internal.classfile.attribute.ModuleResolutionAttribute;
  63 import jdk.internal.classfile.attribute.ModuleTargetAttribute;
  64 import jdk.internal.classfile.attribute.NestHostAttribute;
  65 import jdk.internal.classfile.attribute.NestMembersAttribute;
  66 import jdk.internal.classfile.attribute.PermittedSubclassesAttribute;
  67 import jdk.internal.classfile.attribute.PreloadAttribute;
  68 import jdk.internal.classfile.attribute.RecordAttribute;
  69 import jdk.internal.classfile.attribute.RecordComponentInfo;
  70 import jdk.internal.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
  71 import jdk.internal.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute;
  72 import jdk.internal.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute;
  73 import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
  74 import jdk.internal.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute;
  75 import jdk.internal.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute;
  76 import jdk.internal.classfile.attribute.SignatureAttribute;
  77 import jdk.internal.classfile.attribute.SourceDebugExtensionAttribute;
  78 import jdk.internal.classfile.attribute.SourceFileAttribute;
  79 import jdk.internal.classfile.attribute.SourceIDAttribute;
  80 import jdk.internal.classfile.attribute.StackMapTableAttribute;
  81 import jdk.internal.classfile.attribute.SyntheticAttribute;
  82 import jdk.internal.classfile.constantpool.Utf8Entry;
  83 import jdk.internal.classfile.impl.AbstractAttributeMapper;
  84 import jdk.internal.classfile.impl.BoundAttribute;
  85 import jdk.internal.classfile.impl.CodeImpl;
  86 import jdk.internal.classfile.impl.AbstractPoolEntry;
  87 import jdk.internal.classfile.impl.StackMapDecoder;
  88 
  89 /**
  90  * Attribute mappers for standard classfile attributes.
  91  *
  92  * @see AttributeMapper
  93  */
  94 public class Attributes {
  95 
  96     /** AnnotationDefault */
  97     public static final String NAME_ANNOTATION_DEFAULT = "AnnotationDefault";
  98 
  99     /** BootstrapMethods */
 100     public static final String NAME_BOOTSTRAP_METHODS = "BootstrapMethods";
 101 
 102     /** CharacterRangeTable */
 103     public static final String NAME_CHARACTER_RANGE_TABLE = "CharacterRangeTable";
 104 
 105     /** Code */
 106     public static final String NAME_CODE = "Code";
 107 
 108     /** CompilationID */
 109     public static final String NAME_COMPILATION_ID = "CompilationID";
 110 
 111     /** ConstantValue */
 112     public static final String NAME_CONSTANT_VALUE = "ConstantValue";
 113 
 114     /** Deprecated */
 115     public static final String NAME_DEPRECATED = "Deprecated";
 116 
 117     /** EnclosingMethod */
 118     public static final String NAME_ENCLOSING_METHOD = "EnclosingMethod";
 119 
 120     /** Exceptions */
 121     public static final String NAME_EXCEPTIONS = "Exceptions";
 122 
 123     /** InnerClasses */
 124     public static final String NAME_INNER_CLASSES = "InnerClasses";
 125 
 126     /** LineNumberTable */
 127     public static final String NAME_LINE_NUMBER_TABLE = "LineNumberTable";
 128 
 129     /** LocalVariableTable */
 130     public static final String NAME_LOCAL_VARIABLE_TABLE = "LocalVariableTable";
 131 
 132     /** LocalVariableTypeTable */
 133     public static final String NAME_LOCAL_VARIABLE_TYPE_TABLE = "LocalVariableTypeTable";
 134 
 135     /** MethodParameters */
 136     public static final String NAME_METHOD_PARAMETERS = "MethodParameters";
 137 
 138     /** Module */
 139     public static final String NAME_MODULE = "Module";
 140 
 141     /** ModuleHashes */
 142     public static final String NAME_MODULE_HASHES = "ModuleHashes";
 143 
 144     /** ModuleMainClass */
 145     public static final String NAME_MODULE_MAIN_CLASS = "ModuleMainClass";
 146 
 147     /** ModulePackages */
 148     public static final String NAME_MODULE_PACKAGES = "ModulePackages";
 149 
 150     /** ModuleResolution */
 151     public static final String NAME_MODULE_RESOLUTION = "ModuleResolution";
 152 
 153     /** ModuleTarget */
 154     public static final String NAME_MODULE_TARGET = "ModuleTarget";
 155 
 156     /** NestHost */
 157     public static final String NAME_NEST_HOST = "NestHost";
 158 
 159     /** NestMembers */
 160     public static final String NAME_NEST_MEMBERS = "NestMembers";
 161 
 162     /** PermittedSubclasses */
 163     public static final String NAME_PERMITTED_SUBCLASSES = "PermittedSubclasses";
 164 
 165     /** Preload */
 166     public static final String NAME_PRELOAD = "Preload";
 167 
 168     /** Record */
 169     public static final String NAME_RECORD = "Record";
 170 
 171     /** RuntimeInvisibleAnnotations */
 172     public static final String NAME_RUNTIME_INVISIBLE_ANNOTATIONS = "RuntimeInvisibleAnnotations";
 173 
 174     /** RuntimeInvisibleTypeAnnotations */
 175     public static final String NAME_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = "RuntimeInvisibleParameterAnnotations";
 176 
 177     /**  */
 178     public static final String NAME_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = "RuntimeInvisibleTypeAnnotations";
 179 
 180     /** RuntimeVisibleAnnotations */
 181     public static final String NAME_RUNTIME_VISIBLE_ANNOTATIONS = "RuntimeVisibleAnnotations";
 182 
 183     /** RuntimeVisibleParameterAnnotations */
 184     public static final String NAME_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS = "RuntimeVisibleParameterAnnotations";
 185 
 186     /** RuntimeVisibleTypeAnnotations */
 187     public static final String NAME_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = "RuntimeVisibleTypeAnnotations";
 188 
 189     /** Signature */
 190     public static final String NAME_SIGNATURE = "Signature";
 191 
 192     /** SourceDebugExtension */
 193     public static final String NAME_SOURCE_DEBUG_EXTENSION = "SourceDebugExtension";
 194 
 195     /** SourceFile */
 196     public static final String NAME_SOURCE_FILE = "SourceFile";
 197 
 198     /** SourceID */
 199     public static final String NAME_SOURCE_ID = "SourceID";
 200 
 201     /** StackMapTable */
 202     public static final String NAME_STACK_MAP_TABLE = "StackMapTable";
 203 
 204     /** Synthetic */
 205     public static final String NAME_SYNTHETIC = "Synthetic";
 206 
 207     private Attributes() {
 208     }
 209 
 210     /** Attribute mapper for the {@code AnnotationDefault} attribute */
 211     public static final AttributeMapper<AnnotationDefaultAttribute>
 212             ANNOTATION_DEFAULT = new AbstractAttributeMapper<>(NAME_ANNOTATION_DEFAULT, Classfile.JAVA_5_VERSION) {
 213                 @Override
 214                 public AnnotationDefaultAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 215                     return new BoundAttribute.BoundAnnotationDefaultAttr(cf, this, p);
 216                 }
 217 
 218                 @Override
 219                 protected void writeBody(BufWriter buf, AnnotationDefaultAttribute attr) {
 220                     attr.defaultValue().writeTo(buf);
 221                 }
 222 
 223                 @Override
 224                 public AttributeMapper.AttributeStability stability() {
 225                     return AttributeStability.CP_REFS;
 226                 }
 227             };
 228 
 229     /** Attribute mapper for the {@code BootstrapMethods} attribute */
 230     public static final AttributeMapper<BootstrapMethodsAttribute>
 231             BOOTSTRAP_METHODS = new AbstractAttributeMapper<>(NAME_BOOTSTRAP_METHODS, Classfile.JAVA_17_VERSION) {
 232                 @Override
 233                 public BootstrapMethodsAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 234                     return new BoundAttribute.BoundBootstrapMethodsAttribute(cf, this, p);
 235                 }
 236 
 237                 @Override
 238                 protected void writeBody(BufWriter buf, BootstrapMethodsAttribute attr) {
 239                     buf.writeList(attr.bootstrapMethods());
 240                 }
 241 
 242                 @Override
 243                 public AttributeMapper.AttributeStability stability() {
 244                     return AttributeStability.CP_REFS;
 245                 }
 246             };
 247 
 248     /** Attribute mapper for the {@code CharacterRangeTable} attribute */
 249     public static final AttributeMapper<CharacterRangeTableAttribute>
 250             CHARACTER_RANGE_TABLE = new AbstractAttributeMapper<>(NAME_CHARACTER_RANGE_TABLE, true, Classfile.JAVA_4_VERSION) {
 251                 @Override
 252                 public CharacterRangeTableAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 253                     return new BoundAttribute.BoundCharacterRangeTableAttribute(cf, this, p);
 254                 }
 255 
 256                 @Override
 257                 protected void writeBody(BufWriter buf, CharacterRangeTableAttribute attr) {
 258                     List<CharacterRangeInfo> ranges = attr.characterRangeTable();
 259                     buf.writeU2(ranges.size());
 260                     for (CharacterRangeInfo info : ranges) {
 261                         buf.writeU2(info.startPc());
 262                         buf.writeU2(info.endPc());
 263                         buf.writeInt(info.characterRangeStart());
 264                         buf.writeInt(info.characterRangeEnd());
 265                         buf.writeU2(info.flags());
 266                     }
 267                 }
 268 
 269                 @Override
 270                 public AttributeMapper.AttributeStability stability() {
 271                     return AttributeStability.LABELS;
 272                 }
 273             };
 274 
 275     /** Attribute mapper for the {@code Code} attribute */
 276     public static final AttributeMapper<CodeAttribute>
 277             CODE = new AbstractAttributeMapper<>(NAME_CODE) {
 278                 @Override
 279                 public CodeAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 280                     return new CodeImpl(e, cf, this, p);
 281                 }
 282 
 283                 @Override
 284                 protected void writeBody(BufWriter buf, CodeAttribute attr) {
 285                     throw new UnsupportedOperationException("Code attribute does not support direct write");
 286                 }
 287 
 288                 @Override
 289                 public AttributeMapper.AttributeStability stability() {
 290                     return AttributeStability.CP_REFS;
 291                 }
 292             };
 293 
 294 
 295     /** Attribute mapper for the {@code CompilationID} attribute */
 296     public static final AttributeMapper<CompilationIDAttribute>
 297             COMPILATION_ID = new AbstractAttributeMapper<>(NAME_COMPILATION_ID, true) {
 298                 @Override
 299                 public CompilationIDAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 300                     return new BoundAttribute.BoundCompilationIDAttribute(cf, this, p);
 301                 }
 302 
 303                 @Override
 304                 protected void writeBody(BufWriter buf, CompilationIDAttribute attr) {
 305                     buf.writeIndex(attr.compilationId());
 306                 }
 307 
 308                 @Override
 309                 public AttributeMapper.AttributeStability stability() {
 310                     return AttributeStability.CP_REFS;
 311                 }
 312             };
 313 
 314     /** Attribute mapper for the {@code ConstantValue} attribute */
 315     public static final AttributeMapper<ConstantValueAttribute>
 316             CONSTANT_VALUE = new AbstractAttributeMapper<>(NAME_CONSTANT_VALUE) {
 317                 @Override
 318                 public ConstantValueAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 319                     return new BoundAttribute.BoundConstantValueAttribute(cf, this, p);
 320                 }
 321 
 322                 @Override
 323                 protected void writeBody(BufWriter buf, ConstantValueAttribute attr) {
 324                     buf.writeIndex(attr.constant());
 325                 }
 326 
 327                 @Override
 328                 public AttributeMapper.AttributeStability stability() {
 329                     return AttributeStability.CP_REFS;
 330                 }
 331             };
 332 
 333     /** Attribute mapper for the {@code Deprecated} attribute */
 334     public static final AttributeMapper<DeprecatedAttribute>
 335             DEPRECATED = new AbstractAttributeMapper<>(NAME_DEPRECATED, true) {
 336                 @Override
 337                 public DeprecatedAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 338                     return new BoundAttribute.BoundDeprecatedAttribute(cf, this, p);
 339                 }
 340 
 341                 @Override
 342                 protected void writeBody(BufWriter buf, DeprecatedAttribute attr) {
 343                     // empty
 344                 }
 345 
 346                 @Override
 347                 public AttributeMapper.AttributeStability stability() {
 348                     return AttributeStability.STATELESS;
 349                 }
 350             };
 351 
 352     /** Attribute mapper for the {@code EnclosingMethod} attribute */
 353     public static final AttributeMapper<EnclosingMethodAttribute>
 354             ENCLOSING_METHOD = new AbstractAttributeMapper<>(NAME_ENCLOSING_METHOD, Classfile.JAVA_5_VERSION) {
 355                 @Override
 356                 public EnclosingMethodAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 357                     return new BoundAttribute.BoundEnclosingMethodAttribute(cf, this, p);
 358                 }
 359 
 360                 @Override
 361                 protected void writeBody(BufWriter buf, EnclosingMethodAttribute attr) {
 362                     buf.writeIndex(attr.enclosingClass());
 363                     buf.writeIndexOrZero(attr.enclosingMethod().orElse(null));
 364                 }
 365 
 366                 @Override
 367                 public AttributeMapper.AttributeStability stability() {
 368                     return AttributeStability.CP_REFS;
 369                 }
 370             };
 371 
 372     /** Attribute mapper for the {@code Exceptions} attribute */
 373     public static final AttributeMapper<ExceptionsAttribute>
 374             EXCEPTIONS = new AbstractAttributeMapper<>(NAME_EXCEPTIONS) {
 375                 @Override
 376                 public ExceptionsAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 377                     return new BoundAttribute.BoundExceptionsAttribute(cf, this, p);
 378                 }
 379 
 380                 @Override
 381                 protected void writeBody(BufWriter buf, ExceptionsAttribute attr) {
 382                     buf.writeListIndices(attr.exceptions());
 383                 }
 384 
 385                 @Override
 386                 public AttributeMapper.AttributeStability stability() {
 387                     return AttributeStability.CP_REFS;
 388                 }
 389             };
 390 
 391     /** Attribute mapper for the {@code InnerClasses} attribute */
 392     public static final AttributeMapper<InnerClassesAttribute>
 393             INNER_CLASSES = new AbstractAttributeMapper<>(NAME_INNER_CLASSES) {
 394                 @Override
 395                 public InnerClassesAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 396                     return new BoundAttribute.BoundInnerClassesAttribute(cf, this, p);
 397                 }
 398 
 399                 @Override
 400                 protected void writeBody(BufWriter buf, InnerClassesAttribute attr) {
 401                     List<InnerClassInfo> classes = attr.classes();
 402                     buf.writeU2(classes.size());
 403                     for (InnerClassInfo ic : classes) {
 404                         buf.writeIndex(ic.innerClass());
 405                         buf.writeIndexOrZero(ic.outerClass().orElse(null));
 406                         buf.writeIndexOrZero(ic.innerName().orElse(null));
 407                         buf.writeU2(ic.flagsMask());
 408                     }
 409                 }
 410 
 411                 @Override
 412                 public AttributeMapper.AttributeStability stability() {
 413                     return AttributeStability.CP_REFS;
 414                 }
 415             };
 416 
 417     /** Attribute mapper for the {@code LineNumberTable} attribute */
 418     public static final AttributeMapper<LineNumberTableAttribute>
 419             LINE_NUMBER_TABLE = new AbstractAttributeMapper<>(NAME_LINE_NUMBER_TABLE, true) {
 420                 @Override
 421                 public LineNumberTableAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 422                     return new BoundAttribute.BoundLineNumberTableAttribute(cf, this, p);
 423                 }
 424 
 425                 @Override
 426                 protected void writeBody(BufWriter buf, LineNumberTableAttribute attr) {
 427                     List<LineNumberInfo> lines = attr.lineNumbers();
 428                     buf.writeU2(lines.size());
 429                     for (LineNumberInfo line : lines) {
 430                         buf.writeU2(line.startPc());
 431                         buf.writeU2(line.lineNumber());
 432                     }
 433                 }
 434 
 435                 @Override
 436                 public AttributeMapper.AttributeStability stability() {
 437                     return AttributeStability.LABELS;
 438                 }
 439             };
 440 
 441     /** Attribute mapper for the {@code LocalVariableTable} attribute */
 442     public static final AttributeMapper<LocalVariableTableAttribute>
 443             LOCAL_VARIABLE_TABLE = new AbstractAttributeMapper<>(NAME_LOCAL_VARIABLE_TABLE, true) {
 444                 @Override
 445                 public LocalVariableTableAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 446                     return new BoundAttribute.BoundLocalVariableTableAttribute(e, cf, this, p);
 447                 }
 448 
 449                 @Override
 450                 protected void writeBody(BufWriter buf, LocalVariableTableAttribute attr) {
 451                     List<LocalVariableInfo> infos = attr.localVariables();
 452                     buf.writeU2(infos.size());
 453                     for (LocalVariableInfo info : infos) {
 454                         buf.writeU2(info.startPc());
 455                         buf.writeU2(info.length());
 456                         buf.writeIndex(info.name());
 457                         buf.writeIndex(info.type());
 458                         buf.writeU2(info.slot());
 459                     }
 460                 }
 461 
 462                 @Override
 463                 public AttributeMapper.AttributeStability stability() {
 464                     return AttributeStability.LABELS;
 465                 }
 466             };
 467 
 468     /** Attribute mapper for the {@code LocalVariableTypeTable} attribute */
 469     public static final AttributeMapper<LocalVariableTypeTableAttribute>
 470             LOCAL_VARIABLE_TYPE_TABLE = new AbstractAttributeMapper<>(NAME_LOCAL_VARIABLE_TYPE_TABLE, true, Classfile.JAVA_5_VERSION) {
 471                 @Override
 472                 public LocalVariableTypeTableAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 473                     return new BoundAttribute.BoundLocalVariableTypeTableAttribute(e, cf, this, p);
 474                 }
 475 
 476                 @Override
 477                 protected void writeBody(BufWriter buf, LocalVariableTypeTableAttribute attr) {
 478                     List<LocalVariableTypeInfo> infos = attr.localVariableTypes();
 479                     buf.writeU2(infos.size());
 480                     for (LocalVariableTypeInfo info : infos) {
 481                         buf.writeU2(info.startPc());
 482                         buf.writeU2(info.length());
 483                         buf.writeIndex(info.name());
 484                         buf.writeIndex(info.signature());
 485                         buf.writeU2(info.slot());
 486                     }
 487                 }
 488 
 489                 @Override
 490                 public AttributeMapper.AttributeStability stability() {
 491                     return AttributeStability.LABELS;
 492                 }
 493             };
 494 
 495     /** Attribute mapper for the {@code MethodParameters} attribute */
 496     public static final AttributeMapper<MethodParametersAttribute>
 497             METHOD_PARAMETERS = new AbstractAttributeMapper<>(NAME_METHOD_PARAMETERS, Classfile.JAVA_8_VERSION) {
 498                 @Override
 499                 public MethodParametersAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 500                     return new BoundAttribute.BoundMethodParametersAttribute(cf, this, p);
 501                 }
 502 
 503                 @Override
 504                 protected void writeBody(BufWriter buf, MethodParametersAttribute attr) {
 505                     List<MethodParameterInfo> parameters = attr.parameters();
 506                     buf.writeU1(parameters.size());
 507                     for (MethodParameterInfo info : parameters) {
 508                         buf.writeIndexOrZero(info.name().orElse(null));
 509                         buf.writeU2(info.flagsMask());
 510                     }
 511                 }
 512 
 513                 @Override
 514                 public AttributeMapper.AttributeStability stability() {
 515                     return AttributeStability.CP_REFS;
 516                 }
 517             };
 518 
 519     /** Attribute mapper for the {@code Module} attribute */
 520     public static final AttributeMapper<ModuleAttribute>
 521             MODULE = new AbstractAttributeMapper<>(NAME_MODULE, Classfile.JAVA_9_VERSION) {
 522                 @Override
 523                 public ModuleAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 524                     return new BoundAttribute.BoundModuleAttribute(cf, this, p);
 525                 }
 526 
 527                 @Override
 528                 protected void writeBody(BufWriter buf, ModuleAttribute attr) {
 529                     buf.writeIndex(attr.moduleName());
 530                     buf.writeU2(attr.moduleFlagsMask());
 531                     buf.writeIndexOrZero(attr.moduleVersion().orElse(null));
 532                     buf.writeU2(attr.requires().size());
 533                     for (ModuleRequireInfo require : attr.requires()) {
 534                         buf.writeIndex(require.requires());
 535                         buf.writeU2(require.requiresFlagsMask());
 536                         buf.writeIndexOrZero(require.requiresVersion().orElse(null));
 537                     }
 538                     buf.writeU2(attr.exports().size());
 539                     for (ModuleExportInfo export : attr.exports()) {
 540                         buf.writeIndex(export.exportedPackage());
 541                         buf.writeU2(export.exportsFlagsMask());
 542                         buf.writeListIndices(export.exportsTo());
 543                     }
 544                     buf.writeU2(attr.opens().size());
 545                     for (ModuleOpenInfo open : attr.opens()) {
 546                         buf.writeIndex(open.openedPackage());
 547                         buf.writeU2(open.opensFlagsMask());
 548                         buf.writeListIndices(open.opensTo());
 549                     }
 550                     buf.writeListIndices(attr.uses());
 551                     buf.writeU2(attr.provides().size());
 552                     for (ModuleProvideInfo provide : attr.provides()) {
 553                         buf.writeIndex(provide.provides());
 554                         buf.writeListIndices(provide.providesWith());
 555                     }
 556                 }
 557 
 558                 @Override
 559                 public AttributeMapper.AttributeStability stability() {
 560                     return AttributeStability.CP_REFS;
 561                 }
 562             };
 563 
 564     /** Attribute mapper for the {@code ModuleHashes} attribute */
 565     public static final AttributeMapper<ModuleHashesAttribute>
 566             MODULE_HASHES = new AbstractAttributeMapper<>(NAME_MODULE_HASHES, Classfile.JAVA_9_VERSION) {
 567                 @Override
 568                 public ModuleHashesAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 569                     return new BoundAttribute.BoundModuleHashesAttribute(cf, this, p);
 570                 }
 571 
 572                 @Override
 573                 protected void writeBody(BufWriter buf, ModuleHashesAttribute attr) {
 574                     buf.writeIndex(attr.algorithm());
 575                     List<ModuleHashInfo> hashes = attr.hashes();
 576                     buf.writeU2(hashes.size());
 577                     for (ModuleHashInfo hash : hashes) {
 578                         buf.writeIndex(hash.moduleName());
 579                         buf.writeU2(hash.hash().length);
 580                         buf.writeBytes(hash.hash());
 581                     }
 582                 }
 583 
 584                 @Override
 585                 public AttributeMapper.AttributeStability stability() {
 586                     return AttributeStability.CP_REFS;
 587                 }
 588             };
 589 
 590     /** Attribute mapper for the {@code ModuleMainClass} attribute */
 591     public static final AttributeMapper<ModuleMainClassAttribute>
 592             MODULE_MAIN_CLASS = new AbstractAttributeMapper<>(NAME_MODULE_MAIN_CLASS, Classfile.JAVA_9_VERSION) {
 593                 @Override
 594                 public ModuleMainClassAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 595                     return new BoundAttribute.BoundModuleMainClassAttribute(cf, this, p);
 596                 }
 597 
 598                 @Override
 599                 protected void writeBody(BufWriter buf, ModuleMainClassAttribute attr) {
 600                     buf.writeIndex(attr.mainClass());
 601                 }
 602 
 603                 @Override
 604                 public AttributeMapper.AttributeStability stability() {
 605                     return AttributeStability.CP_REFS;
 606                 }
 607             };
 608 
 609     /** Attribute mapper for the {@code ModulePackages} attribute */
 610     public static final AttributeMapper<ModulePackagesAttribute>
 611             MODULE_PACKAGES = new AbstractAttributeMapper<>(NAME_MODULE_PACKAGES, Classfile.JAVA_9_VERSION) {
 612                 @Override
 613                 public ModulePackagesAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 614                     return new BoundAttribute.BoundModulePackagesAttribute(cf, this, p);
 615                 }
 616 
 617                 @Override
 618                 protected void writeBody(BufWriter buf, ModulePackagesAttribute attr) {
 619                     buf.writeListIndices(attr.packages());
 620                 }
 621 
 622                 @Override
 623                 public AttributeMapper.AttributeStability stability() {
 624                     return AttributeStability.CP_REFS;
 625                 }
 626             };
 627 
 628     /** Attribute mapper for the {@code ModuleResolution} attribute */
 629     public static final AttributeMapper<ModuleResolutionAttribute>
 630             MODULE_RESOLUTION = new AbstractAttributeMapper<>(NAME_MODULE_RESOLUTION, Classfile.JAVA_9_VERSION) {
 631                 @Override
 632                 public ModuleResolutionAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 633                     return new BoundAttribute.BoundModuleResolutionAttribute(cf, this, p);
 634                 }
 635 
 636                 @Override
 637                 protected void writeBody(BufWriter buf, ModuleResolutionAttribute attr) {
 638                     buf.writeU2(attr.resolutionFlags());
 639                 }
 640 
 641                 @Override
 642                 public AttributeMapper.AttributeStability stability() {
 643                     return AttributeStability.STATELESS;
 644                 }
 645             };
 646 
 647     /** Attribute mapper for the {@code ModuleTarget} attribute */
 648     public static final AttributeMapper<ModuleTargetAttribute>
 649             MODULE_TARGET = new AbstractAttributeMapper<>(NAME_MODULE_TARGET, Classfile.JAVA_9_VERSION) {
 650                 @Override
 651                 public ModuleTargetAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 652                     return new BoundAttribute.BoundModuleTargetAttribute(cf, this, p);
 653                 }
 654 
 655                 @Override
 656                 protected void writeBody(BufWriter buf, ModuleTargetAttribute attr) {
 657                     buf.writeIndex(attr.targetPlatform());
 658                 }
 659 
 660                 @Override
 661                 public AttributeMapper.AttributeStability stability() {
 662                     return AttributeStability.CP_REFS;
 663                 }
 664             };
 665 
 666     /** Attribute mapper for the {@code NestHost} attribute */
 667     public static final AttributeMapper<NestHostAttribute>
 668             NEST_HOST = new AbstractAttributeMapper<>(NAME_NEST_HOST, Classfile.JAVA_11_VERSION) {
 669                 @Override
 670                 public NestHostAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 671                     return new BoundAttribute.BoundNestHostAttribute(cf, this, p);
 672                 }
 673 
 674                 @Override
 675                 protected void writeBody(BufWriter buf, NestHostAttribute attr) {
 676                     buf.writeIndex(attr.nestHost());
 677                 }
 678 
 679                 @Override
 680                 public AttributeMapper.AttributeStability stability() {
 681                     return AttributeStability.CP_REFS;
 682                 }
 683             };
 684 
 685     /** Attribute mapper for the {@code NestMembers} attribute */
 686     public static final AttributeMapper<NestMembersAttribute>
 687             NEST_MEMBERS = new AbstractAttributeMapper<>(NAME_NEST_MEMBERS, Classfile.JAVA_11_VERSION) {
 688                 @Override
 689                 public NestMembersAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 690                     return new BoundAttribute.BoundNestMembersAttribute(cf, this, p);
 691                 }
 692 
 693                 @Override
 694                 protected void writeBody(BufWriter buf, NestMembersAttribute attr) {
 695                     buf.writeListIndices(attr.nestMembers());
 696                 }
 697 
 698                 @Override
 699                 public AttributeMapper.AttributeStability stability() {
 700                     return AttributeStability.CP_REFS;
 701                 }
 702             };
 703 
 704     /** Attribute mapper for the {@code PermittedSubclasses} attribute */
 705     public static final AttributeMapper<PermittedSubclassesAttribute>
 706             PERMITTED_SUBCLASSES = new AbstractAttributeMapper<>(NAME_PERMITTED_SUBCLASSES, Classfile.JAVA_15_VERSION) {
 707                 @Override
 708                 public PermittedSubclassesAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 709                     return new BoundAttribute.BoundPermittedSubclassesAttribute(cf, this, p);
 710                 }
 711 
 712                 @Override
 713                 protected void writeBody(BufWriter buf, PermittedSubclassesAttribute attr) {
 714                     buf.writeListIndices(attr.permittedSubclasses());
 715                 }
 716 
 717                 @Override
 718                 public AttributeMapper.AttributeStability stability() {
 719                     return AttributeStability.CP_REFS;
 720                 }
 721             };
 722 
 723     /** Attribute mapper for the {@code Preload} attribute */
 724     public static final AttributeMapper<PreloadAttribute>
 725             PRELOAD = new AbstractAttributeMapper<>(NAME_PRELOAD, Classfile.JAVA_21_VERSION) {
 726                 @Override
 727                 public PreloadAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 728                     return new BoundAttribute.BoundPreloadAttribute(cf, this, p);
 729                 }
 730 
 731                 @Override
 732                 protected void writeBody(BufWriter buf, PreloadAttribute attr) {
 733                     buf.writeListIndices(attr.preloads());
 734                 }
 735 
 736                 @Override
 737                 public AttributeMapper.AttributeStability stability() {
 738                     return AttributeStability.CP_REFS;
 739                 }
 740             };
 741 
 742     /** Attribute mapper for the {@code Record} attribute */
 743     public static final AttributeMapper<RecordAttribute>
 744             RECORD = new AbstractAttributeMapper<>(NAME_RECORD, Classfile.JAVA_16_VERSION) {
 745                 @Override
 746                 public RecordAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 747                     return new BoundAttribute.BoundRecordAttribute(cf, this, p);
 748                 }
 749 
 750                 @Override
 751                 protected void writeBody(BufWriter buf, RecordAttribute attr) {
 752                     List<RecordComponentInfo> components = attr.components();
 753                     buf.writeU2(components.size());
 754                     for (RecordComponentInfo info : components) {
 755                         buf.writeIndex(info.name());
 756                         buf.writeIndex(info.descriptor());
 757                         buf.writeList(info.attributes());
 758                     }
 759                 }
 760 
 761                 @Override
 762                 public AttributeMapper.AttributeStability stability() {
 763                     return AttributeStability.CP_REFS;
 764                 }
 765             };
 766 
 767     /** Attribute mapper for the {@code RuntimeInvisibleAnnotations} attribute */
 768     public static final AttributeMapper<RuntimeInvisibleAnnotationsAttribute>
 769             RUNTIME_INVISIBLE_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_INVISIBLE_ANNOTATIONS, Classfile.JAVA_5_VERSION) {
 770                 @Override
 771                 public RuntimeInvisibleAnnotationsAttribute readAttribute(AttributedElement enclosing, ClassReader cf, int pos) {
 772                     return new BoundAttribute.BoundRuntimeInvisibleAnnotationsAttribute(cf, pos);
 773                 }
 774 
 775                 @Override
 776                 protected void writeBody(BufWriter buf, RuntimeInvisibleAnnotationsAttribute attr) {
 777                     buf.writeList(attr.annotations());
 778                 }
 779 
 780                 @Override
 781                 public AttributeMapper.AttributeStability stability() {
 782                     return AttributeStability.CP_REFS;
 783                 }
 784             };
 785 
 786     /** Attribute mapper for the {@code RuntimeInvisibleParameterAnnotations} attribute */
 787     public static final AttributeMapper<RuntimeInvisibleParameterAnnotationsAttribute>
 788             RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS, Classfile.JAVA_5_VERSION) {
 789                 @Override
 790                 public RuntimeInvisibleParameterAnnotationsAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 791                     return new BoundAttribute.BoundRuntimeInvisibleParameterAnnotationsAttribute(cf, this, p);
 792                 }
 793 
 794                 @Override
 795                 protected void writeBody(BufWriter buf, RuntimeInvisibleParameterAnnotationsAttribute attr) {
 796                     List<List<Annotation>> lists = attr.parameterAnnotations();
 797                     buf.writeU1(lists.size());
 798                     for (List<Annotation> list : lists)
 799                         buf.writeList(list);
 800                 }
 801 
 802                 @Override
 803                 public AttributeMapper.AttributeStability stability() {
 804                     return AttributeStability.CP_REFS;
 805                 }
 806             };
 807 
 808     /** Attribute mapper for the {@code RuntimeInvisibleTypeAnnotations} attribute */
 809     public static final AttributeMapper<RuntimeInvisibleTypeAnnotationsAttribute>
 810             RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS, Classfile.JAVA_8_VERSION) {
 811                 @Override
 812                 public RuntimeInvisibleTypeAnnotationsAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 813                     return new BoundAttribute.BoundRuntimeInvisibleTypeAnnotationsAttribute(e, cf, this, p);
 814                 }
 815 
 816                 @Override
 817                 protected void writeBody(BufWriter buf, RuntimeInvisibleTypeAnnotationsAttribute attr) {
 818                     buf.writeList(attr.annotations());
 819                 }
 820 
 821                 @Override
 822                 public AttributeMapper.AttributeStability stability() {
 823                     return AttributeStability.UNSTABLE;
 824                 }
 825             };
 826 
 827     /** Attribute mapper for the {@code RuntimeVisibleAnnotations} attribute */
 828     public static final AttributeMapper<RuntimeVisibleAnnotationsAttribute>
 829             RUNTIME_VISIBLE_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_VISIBLE_ANNOTATIONS, Classfile.JAVA_5_VERSION) {
 830                 @Override
 831                 public RuntimeVisibleAnnotationsAttribute readAttribute(AttributedElement enclosing, ClassReader cf, int pos) {
 832                     return new BoundAttribute.BoundRuntimeVisibleAnnotationsAttribute(cf, pos);
 833                 }
 834 
 835                 @Override
 836                 protected void writeBody(BufWriter buf, RuntimeVisibleAnnotationsAttribute attr) {
 837                     buf.writeList(attr.annotations());
 838                 }
 839 
 840                 @Override
 841                 public AttributeMapper.AttributeStability stability() {
 842                     return AttributeStability.CP_REFS;
 843                 }
 844             };
 845 
 846     /** Attribute mapper for the {@code RuntimeVisibleParameterAnnotations} attribute */
 847     public static final AttributeMapper<RuntimeVisibleParameterAnnotationsAttribute>
 848             RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS, Classfile.JAVA_5_VERSION) {
 849                 @Override
 850                 public RuntimeVisibleParameterAnnotationsAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 851                     return new BoundAttribute.BoundRuntimeVisibleParameterAnnotationsAttribute(cf, this, p);
 852                 }
 853 
 854                 @Override
 855                 protected void writeBody(BufWriter buf, RuntimeVisibleParameterAnnotationsAttribute attr) {
 856                     List<List<Annotation>> lists = attr.parameterAnnotations();
 857                     buf.writeU1(lists.size());
 858                     for (List<Annotation> list : lists)
 859                         buf.writeList(list);
 860                 }
 861 
 862                 @Override
 863                 public AttributeMapper.AttributeStability stability() {
 864                     return AttributeStability.CP_REFS;
 865                 }
 866             };
 867 
 868     /** Attribute mapper for the {@code RuntimeVisibleTypeAnnotations} attribute */
 869     public static final AttributeMapper<RuntimeVisibleTypeAnnotationsAttribute>
 870             RUNTIME_VISIBLE_TYPE_ANNOTATIONS = new AbstractAttributeMapper<>(NAME_RUNTIME_VISIBLE_TYPE_ANNOTATIONS, Classfile.JAVA_8_VERSION) {
 871                 @Override
 872                 public RuntimeVisibleTypeAnnotationsAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 873                     return new BoundAttribute.BoundRuntimeVisibleTypeAnnotationsAttribute(e, cf, this, p);
 874                 }
 875 
 876                 @Override
 877                 protected void writeBody(BufWriter buf, RuntimeVisibleTypeAnnotationsAttribute attr) {
 878                     buf.writeList(attr.annotations());
 879                 }
 880 
 881                 @Override
 882                 public AttributeMapper.AttributeStability stability() {
 883                     return AttributeStability.UNSTABLE;
 884                 }
 885             };
 886 
 887     /** Attribute mapper for the {@code Signature} attribute */
 888     public static final AttributeMapper<SignatureAttribute>
 889             SIGNATURE = new AbstractAttributeMapper<>(NAME_SIGNATURE, Classfile.JAVA_5_VERSION) {
 890                 @Override
 891                 public SignatureAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 892                     return new BoundAttribute.BoundSignatureAttribute(cf, this, p);
 893                 }
 894 
 895                 @Override
 896                 protected void writeBody(BufWriter buf, SignatureAttribute attr) {
 897                     buf.writeIndex(attr.signature());
 898                 }
 899 
 900                 @Override
 901                 public AttributeMapper.AttributeStability stability() {
 902                     return AttributeStability.CP_REFS;
 903                 }
 904             };
 905 
 906     /** Attribute mapper for the {@code SourceDebugExtension} attribute */
 907     public static final AttributeMapper<SourceDebugExtensionAttribute>
 908             SOURCE_DEBUG_EXTENSION = new AbstractAttributeMapper<>(NAME_SOURCE_DEBUG_EXTENSION, Classfile.JAVA_5_VERSION) {
 909                 @Override
 910                 public SourceDebugExtensionAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 911                     return new BoundAttribute.BoundSourceDebugExtensionAttribute(cf, this, p);
 912                 }
 913 
 914                 @Override
 915                 protected void writeBody(BufWriter buf, SourceDebugExtensionAttribute attr) {
 916                     buf.writeBytes(attr.contents());
 917                 }
 918 
 919                 @Override
 920                 public AttributeMapper.AttributeStability stability() {
 921                     return AttributeStability.STATELESS;
 922                 }
 923             };
 924 
 925     /** Attribute mapper for the {@code SourceFile} attribute */
 926     public static final AttributeMapper<SourceFileAttribute>
 927             SOURCE_FILE = new AbstractAttributeMapper<>(NAME_SOURCE_FILE) {
 928                 @Override
 929                 public SourceFileAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 930                     return new BoundAttribute.BoundSourceFileAttribute(cf, this, p);
 931                 }
 932 
 933                 @Override
 934                 protected void writeBody(BufWriter buf, SourceFileAttribute attr) {
 935                     buf.writeIndex(attr.sourceFile());
 936                 }
 937 
 938                 @Override
 939                 public AttributeMapper.AttributeStability stability() {
 940                     return AttributeStability.CP_REFS;
 941                 }
 942             };
 943 
 944     /** Attribute mapper for the {@code SourceID} attribute */
 945     public static final AttributeMapper<SourceIDAttribute>
 946             SOURCE_ID = new AbstractAttributeMapper<>(NAME_SOURCE_ID) {
 947                 @Override
 948                 public SourceIDAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 949                     return new BoundAttribute.BoundSourceIDAttribute(cf, this, p);
 950                 }
 951 
 952                 @Override
 953                 protected void writeBody(BufWriter buf, SourceIDAttribute attr) {
 954                     buf.writeIndex(attr.sourceId());
 955                 }
 956 
 957                 @Override
 958                 public AttributeMapper.AttributeStability stability() {
 959                     return AttributeStability.CP_REFS;
 960                 }
 961             };
 962 
 963     /** Attribute mapper for the {@code StackMapTable} attribute */
 964     public static final AttributeMapper<StackMapTableAttribute>
 965             STACK_MAP_TABLE = new AbstractAttributeMapper<>(NAME_STACK_MAP_TABLE, Classfile.JAVA_6_VERSION) {
 966                 @Override
 967                 public StackMapTableAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 968                     return new BoundAttribute.BoundStackMapTableAttribute((CodeImpl)e, cf, this, p);
 969                 }
 970 
 971                 @Override
 972                 protected void writeBody(BufWriter b, StackMapTableAttribute attr) {
 973                     StackMapDecoder.writeFrames(b, attr.entries());
 974                 }
 975 
 976                 @Override
 977                 public AttributeMapper.AttributeStability stability() {
 978                     return AttributeStability.LABELS;
 979                 }
 980             };
 981 
 982 
 983     /** Attribute mapper for the {@code Synthetic} attribute */
 984     public static final AttributeMapper<SyntheticAttribute>
 985             SYNTHETIC = new AbstractAttributeMapper<>(NAME_SYNTHETIC, true) {
 986                 @Override
 987                 public SyntheticAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
 988                     return new BoundAttribute.BoundSyntheticAttribute(cf, this, p);
 989                 }
 990 
 991                 @Override
 992                 protected void writeBody(BufWriter buf, SyntheticAttribute attr) {
 993                     // empty
 994                 }
 995 
 996                 @Override
 997                 public AttributeMapper.AttributeStability stability() {
 998                     return AttributeStability.STATELESS;
 999                 }
1000             };
1001 
1002     /**
1003      * {@return the attribute mapper for a standard attribute}
1004      *
1005      * @param name the name of the attribute to find
1006      */
1007     public static AttributeMapper<?> standardAttribute(Utf8Entry name) {
1008         return _ATTR_MAP.get(name);
1009     }
1010 
1011     /**
1012      * All standard attribute mappers.
1013      */
1014     public static final Set<AttributeMapper<?>> PREDEFINED_ATTRIBUTES = Set.of(
1015             ANNOTATION_DEFAULT,
1016             BOOTSTRAP_METHODS,
1017             CHARACTER_RANGE_TABLE,
1018             CODE,
1019             COMPILATION_ID,
1020             CONSTANT_VALUE,
1021             DEPRECATED,
1022             ENCLOSING_METHOD,
1023             EXCEPTIONS,
1024             INNER_CLASSES,
1025             LINE_NUMBER_TABLE,
1026             LOCAL_VARIABLE_TABLE,
1027             LOCAL_VARIABLE_TYPE_TABLE,
1028             METHOD_PARAMETERS,
1029             MODULE,
1030             MODULE_HASHES,
1031             MODULE_MAIN_CLASS,
1032             MODULE_PACKAGES,
1033             MODULE_RESOLUTION,
1034             MODULE_TARGET,
1035             NEST_HOST,
1036             NEST_MEMBERS,
1037             PERMITTED_SUBCLASSES,
1038             PRELOAD,
1039             RECORD,
1040             RUNTIME_INVISIBLE_ANNOTATIONS,
1041             RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS,
1042             RUNTIME_INVISIBLE_TYPE_ANNOTATIONS,
1043             RUNTIME_VISIBLE_ANNOTATIONS,
1044             RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS,
1045             RUNTIME_VISIBLE_TYPE_ANNOTATIONS,
1046             SIGNATURE,
1047             SOURCE_DEBUG_EXTENSION,
1048             SOURCE_FILE,
1049             SOURCE_ID,
1050             STACK_MAP_TABLE,
1051             SYNTHETIC);
1052 
1053     private static final Map<Utf8Entry, AttributeMapper<?>> _ATTR_MAP;
1054     //no lambdas here as this is on critical JDK boostrap path
1055     static {
1056         var map = new HashMap<Utf8Entry, AttributeMapper<?>>(64);
1057         for (var am : PREDEFINED_ATTRIBUTES) {
1058             map.put(AbstractPoolEntry.rawUtf8EntryFromStandardAttributeName(am.name()), am);
1059         }
1060         _ATTR_MAP = Collections.unmodifiableMap(map);
1061     }
1062 }