mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8342466: Improve API documentation for java.lang.classfile.attribute
Reviewed-by: darcy, asotona
This commit is contained in:
parent
9782bfdd27
commit
973c630777
70 changed files with 2443 additions and 967 deletions
|
@ -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
|
||||
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.lang.classfile.attribute.SignatureAttribute;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.classfile.impl.SignaturesImpl;
|
||||
|
@ -31,27 +32,53 @@ import jdk.internal.classfile.impl.SignaturesImpl;
|
|||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
/**
|
||||
* Models the generic signature of a class file, as defined by JVMS {@jvms 4.7.9}.
|
||||
* Models the generic signature of a class or interface, as defined by JVMS
|
||||
* {@jvms 4.7.9.1}.
|
||||
*
|
||||
* @see Class
|
||||
* @see SignatureAttribute
|
||||
* @jls 8.1 Class Declarations
|
||||
* @jls 9.1 Interface Declarations
|
||||
* @jvms 4.7.9.1 Signatures
|
||||
* @since 24
|
||||
*/
|
||||
public sealed interface ClassSignature
|
||||
permits SignaturesImpl.ClassSignatureImpl {
|
||||
|
||||
/** {@return the type parameters of this class} */
|
||||
/**
|
||||
* {@return the type parameters of this class or interface, may be empty}
|
||||
*
|
||||
* @see Class#getTypeParameters()
|
||||
* @jls 8.1.2 Generic Classes and Type Parameters
|
||||
* @jls 9.1.2 Generic Interfaces and Type Parameters
|
||||
*/
|
||||
List<Signature.TypeParam> typeParameters();
|
||||
|
||||
/** {@return the instantiation of the superclass in this signature} */
|
||||
/**
|
||||
* {@return the instantiation of the superclass in this signature}
|
||||
* Interfaces return a signature representing the {@link Object} class.
|
||||
*
|
||||
* @see Class#getGenericSuperclass()
|
||||
* @jls 8.1.4 Superclasses and Subclasses
|
||||
*/
|
||||
Signature.ClassTypeSig superclassSignature();
|
||||
|
||||
/** {@return the instantiation of the interfaces in this signature} */
|
||||
/**
|
||||
* {@return the instantiation of the interfaces in this signature, may be
|
||||
* empty}
|
||||
*
|
||||
* @see Class#getGenericInterfaces()
|
||||
* @jls 8.1.5 Superinterfaces
|
||||
* @jls 9.1.3 Superinterfaces and Subinterfaces
|
||||
*/
|
||||
List<Signature.ClassTypeSig> superinterfaceSignatures();
|
||||
|
||||
/** {@return the raw signature string} */
|
||||
String signatureString();
|
||||
|
||||
/**
|
||||
* {@return a class signature}
|
||||
* {@return a class signature with no type parameter declaration}
|
||||
*
|
||||
* @param superclassSignature the superclass
|
||||
* @param superinterfaceSignatures the interfaces
|
||||
*/
|
||||
|
@ -62,7 +89,7 @@ public sealed interface ClassSignature
|
|||
|
||||
/**
|
||||
* {@return a class signature}
|
||||
* @param typeParameters the type parameters
|
||||
* @param typeParameters the type parameters, may be empty
|
||||
* @param superclassSignature the superclass
|
||||
* @param superinterfaceSignatures the interfaces
|
||||
*/
|
||||
|
@ -76,9 +103,11 @@ public sealed interface ClassSignature
|
|||
}
|
||||
|
||||
/**
|
||||
* Parses a raw class signature string into a {@linkplain Signature}
|
||||
* Parses a raw class signature string into a {@linkplain Signature}.
|
||||
*
|
||||
* @param classSignature the raw class signature string
|
||||
* @return class signature
|
||||
* @throws IllegalArgumentException if the string is not a valid class signature string
|
||||
*/
|
||||
public static ClassSignature parseFrom(String classSignature) {
|
||||
return new SignaturesImpl(classSignature).parseClassSignature();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue