8342466: Improve API documentation for java.lang.classfile.attribute

Reviewed-by: darcy, asotona
This commit is contained in:
Chen Liang 2025-01-15 02:04:01 +00:00
parent 9782bfdd27
commit 973c630777
70 changed files with 2443 additions and 967 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,11 @@
package java.lang.classfile.attribute;
import java.lang.classfile.Attribute;
import java.lang.classfile.AttributeMapper;
import java.lang.classfile.AttributeMapper.AttributeStability;
import java.lang.classfile.Attributes;
import java.lang.classfile.ClassElement;
import java.lang.classfile.ClassModel;
import java.lang.classfile.constantpool.Utf8Entry;
import java.util.List;
@ -35,13 +39,11 @@ import jdk.internal.classfile.impl.TemporaryConstantPool;
import jdk.internal.classfile.impl.UnboundAttribute;
/**
* Models the {@code ModuleHashes} attribute, which can
* appear on classes that represent module descriptors. This is a JDK-specific
* attribute, which captures the hashes of a set of co-delivered modules.
* Delivered as a {@link java.lang.classfile.ClassElement} when
* traversing the elements of a {@link java.lang.classfile.ClassModel}.
*
* <p>The specification of the {@code ModuleHashes} attribute is:
* Models the {@link Attributes#moduleHashes() ModuleHashes} attribute, which
* appears on classes that {@linkplain ClassModel#isModuleInfo() represent}
* module descriptors to capture the hashes of a set of co-delivered modules.
* <p>
* The specification of the {@code ModuleHashes} attribute is:
* <pre> {@code
*
* ModuleHashes_attribute {
@ -63,12 +65,20 @@ import jdk.internal.classfile.impl.UnboundAttribute;
* }
* } </pre>
* <p>
* The attribute does not permit multiple instances in a given location.
* Subsequent occurrence of the attribute takes precedence during the attributed
* element build or transformation.
* This attribute only appears on classes, and does not permit {@linkplain
* AttributeMapper#allowMultiple multiple instances} in a class. It has a
* data dependency on the {@linkplain AttributeStability#CP_REFS constant pool}.
* <p>
* This attribute is not predefined in the Java SE Platform. This is a
* JDK-specific nonstandard attribute produced by the {@linkplain jdk.jlink/
* jlink and jmod tools} and used by the implementation.
*
* @see Attributes#moduleHashes()
* @see ModuleResolutionAttribute
* @see ModuleTargetAttribute
* @since 24
*/
@SuppressWarnings("doclint:reference")
public sealed interface ModuleHashesAttribute
extends Attribute<ModuleHashesAttribute>, ClassElement
permits BoundAttribute.BoundModuleHashesAttribute, UnboundAttribute.UnboundModuleHashesAttribute {