11/*
2- * Copyright (c) 2022, 2024 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2022, 2025 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
3131import jdk .internal .classfile .impl .UnboundAttribute ;
3232
3333/**
34- * Models a classfile attribute (JVMS {@jvms 4.7}). Many, though not all, subtypes of
35- * {@linkplain Attribute} will implement {@link ClassElement}, {@link
36- * MethodElement}, {@link FieldElement}, or {@link CodeElement}; attributes that
37- * are also elements will be delivered when traversing the elements of the
38- * corresponding model type. Additionally, all attributes are accessible
39- * directly from the corresponding model type through {@link
40- * AttributedElement#findAttribute(AttributeMapper)}.
41- * @param <A> the attribute type
34+ * Models an attribute (JVMS {@jvms 4.7}) in the {@code class} file format.
35+ * Attributes exist on certain {@code class} file structures modeled by {@link
36+ * AttributedElement}, which provides basic read access to the attributes.
37+ * <p>
38+ * This sealed interface hierarchy includes attributes predefined in the JVMS
39+ * and JDK-specific nonstandard attributes. Their {@linkplain #attributeMapper()
40+ * mappers} are available in {@link Attributes}. Two special subtypes of {@code
41+ * Attribute} are {@link CustomAttribute}, which all user-defined attributes
42+ * should extend from, and {@link UnknownAttribute}, representing attributes
43+ * read from {@code class} file but are not recognized by the {@link
44+ * ClassFile.AttributeMapperOption}.
45+ * <p>
46+ * Attributes are read through {@link AttributedElement} or element traversal of
47+ * a {@link CompoundElement}; they are written through {@link ClassFileBuilder}.
48+ * See {@linkplain java.lang.classfile.attribute##reading Reading Attributes}
49+ * and {@linkplain java.lang.classfile.attribute##writing Writing Attributes}
50+ * for more details.
4251 *
52+ * @param <A> the attribute type
53+ * @see java.lang.classfile.attribute
54+ * @see AttributeMapper
55+ * @see AttributedElement
56+ * @see CustomAttribute
57+ * @see UnknownAttribute
58+ * @jvms 4.7 Attributes
4359 * @sealedGraph
4460 * @since 24
4561 */
@@ -62,7 +78,13 @@ public sealed interface Attribute<A extends Attribute<A>>
6278 StackMapTableAttribute , SyntheticAttribute ,
6379 UnknownAttribute , BoundAttribute , UnboundAttribute , CustomAttribute {
6480 /**
65- * {@return the name of the attribute}
81+ * {@return the name of the attribute} The {@linkplain
82+ * Utf8Entry#stringValue() string value} of the name is equivalent to the
83+ * value of {@link AttributeMapper#name() attributeMapper().name()}.
84+ * <p>
85+ * If this attribute is read from a {@code class} file, this method returns
86+ * the {@link Utf8Entry} indicating the attribute name in the {@code class}
87+ * file.
6688 */
6789 Utf8Entry attributeName ();
6890
0 commit comments