import type { Entry, Pool, UTF8Entry } from "../pool"; import { AttributeType, ElementTag } from "../spec"; import { type Type } from "../type"; import type { Attribute } from "./"; export interface ElementValue { tag: ElementTag; } export interface ConstElementValue extends ElementValue { tag: ElementTag.BYTE | ElementTag.CHAR | ElementTag.DOUBLE | ElementTag.FLOAT | ElementTag.INT | ElementTag.LONG | ElementTag.SHORT | ElementTag.BOOLEAN | ElementTag.STRING; value: number; valueEntry?: Entry; } export interface EnumElementValue extends ElementValue { tag: ElementTag.ENUM; typeName: number; constName: number; typeNameEntry?: UTF8Entry; constNameEntry?: UTF8Entry; } export interface ClassElementValue extends ElementValue { tag: ElementTag.CLASS; classInfo: number; classInfoEntry?: UTF8Entry; } export interface AnnotationElementValue extends ElementValue { tag: ElementTag.ANNOTATION; annotation: Annotation; } export interface ArrayElementValue extends ElementValue { tag: ElementTag.ARRAY; values: ElementValue[]; } export interface ElementValuePair { name: number; nameEntry?: UTF8Entry; value: ElementValue; } export interface Annotation { type: number; typeEntry?: UTF8Entry; values: ElementValuePair[]; } export interface AnnotationsAttribute extends Attribute { type: AttributeType.RUNTIME_VISIBLE_ANNOTATIONS | AttributeType.RUNTIME_INVISIBLE_ANNOTATIONS; annotations: Annotation[]; } export interface ParameterAnnotationsAttribute extends Attribute { type: AttributeType.RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS | AttributeType.RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS; parameters: Annotation[][]; } export interface AnnotationDefaultAttribute extends Attribute { type: AttributeType.ANNOTATION_DEFAULT; defaultValue: ElementValue; } export declare const readAnnotations: (attr: Attribute, pool: Pool) => AnnotationsAttribute; export declare const readParameterAnnotations: (attr: Attribute, pool: Pool) => ParameterAnnotationsAttribute; export declare const readAnnotationDefault: (attr: Attribute, pool: Pool) => AnnotationDefaultAttribute; export declare const writeAnnotations: (attr: AnnotationsAttribute) => Uint8Array; export declare const writeParameterAnnotations: (attr: ParameterAnnotationsAttribute) => Uint8Array; export declare const writeAnnotationDefault: (attr: AnnotationDefaultAttribute) => Uint8Array; export declare const typeOfElementValue: (value: ElementValue) => Type;