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