16#ifndef RPNX_CORTADO_ATTRIBUTES_HPP
17#define RPNX_CORTADO_ATTRIBUTES_HPP
23#include <rpnx/variant.hpp>
34 std::vector< std::byte >
info;
103 using verification_type_info = std::variant< top_variable_info, integer_variable_info, float_variable_info, double_variable_info, long_variable_info, null_variable_info, uninitialized_this_variable_info, object_variable_info, uninitialized_variable_info >;
148 std::vector< verification_type_info >
locals;
156 std::vector< verification_type_info >
locals;
157 std::vector< verification_type_info >
stack;
162 using stack_map_frame = std::variant< same_frame, same_locals_one_stack_item_frame, same_locals_one_stack_item_frame_extended, chop_frame, same_frame_extended, append_frame, full_frame >;
187 RPNX_MEMBER_METADATA(
inner_class_info, inner_class_info_index, outer_class_info_index, inner_name_index, access_flags);
194 std::vector< inner_class_info > classes;
234 std::vector< std::byte > debug_extension;
250 std::vector< line_number_info > lines;
269 std::vector< local_variable_info > variables;
277 std::uint16_t length{};
288 std::vector< local_variable_type_info > variables;
300 enum class annotation_constant_kind : std::uint8_t {
byte =
'B', character =
'C', double_precision =
'D', floating_point =
'F', integer =
'I', long_integer =
'J', short_integer =
'S',
boolean =
'Z',
string =
's' };
303 template < annotation_constant_kind Kind >
332 using value_type = rpnx::variant< annotation_constant_value< annotation_constant_kind::byte >,
annotation_constant_value< annotation_constant_kind::character >,
annotation_constant_value< annotation_constant_kind::double_precision >,
annotation_constant_value< annotation_constant_kind::floating_point >,
annotation_constant_value< annotation_constant_kind::integer >,
annotation_constant_value< annotation_constant_kind::long_integer >,
annotation_constant_value< annotation_constant_kind::short_integer >,
annotation_constant_value< annotation_constant_kind::boolean >,
annotation_constant_value< annotation_constant_kind::string >,
annotation_enum_value,
annotation_class_value,
annotation,
annotation_array_value >;
350 std::vector< annotation_element > elements;
351 RPNX_MEMBER_METADATA(
annotation, type_index, elements);
357 std::vector< annotation_value > values;
365 std::vector< annotation > annotations;
373 std::vector< annotation > annotations;
381 std::vector< std::vector< annotation > > parameters;
389 std::vector< std::vector< annotation > > parameters;
394 enum class type_annotation_target_type : std::uint8_t { class_type_parameter = 0x00, method_type_parameter = 0x01, class_extends = 0x10, class_type_parameter_bound = 0x11, method_type_parameter_bound = 0x12, field = 0x13, method_return = 0x14, method_receiver = 0x15, method_formal_parameter = 0x16, throws_ = 0x17, local_variable = 0x40, resource_variable = 0x41, exception_parameter = 0x42, instanceof_ = 0x43, new_ = 0x44, constructor_reference = 0x45, method_reference = 0x46, cast = 0x47, constructor_invocation_type_argument = 0x48, method_invocation_type_argument = 0x49, constructor_reference_type_argument = 0x4A, method_reference_type_argument = 0x4B };
399 std::uint8_t type_parameter_index{};
406 std::uint16_t supertype_index{};
413 std::uint8_t type_parameter_index{};
414 std::uint8_t bound_index{};
427 std::uint8_t formal_parameter_index{};
434 std::uint16_t throws_type_index{};
442 std::uint16_t length{};
450 std::vector< local_variable_target_range > ranges;
457 std::uint16_t exception_table_index{};
472 std::uint8_t type_argument_index{};
477 template < type_annotation_target_type Type,
typename Info >
486 using type_annotation_target_info = std::variant< type_annotation_target< type_annotation_target_type::class_type_parameter, type_parameter_target_info >,
type_annotation_target< type_annotation_target_type::method_type_parameter, type_parameter_target_info >,
type_annotation_target< type_annotation_target_type::class_extends, supertype_target_info >,
type_annotation_target< type_annotation_target_type::class_type_parameter_bound, type_parameter_bound_target_info >,
type_annotation_target< type_annotation_target_type::method_type_parameter_bound, type_parameter_bound_target_info >,
type_annotation_target< type_annotation_target_type::field, empty_target_info >,
type_annotation_target< type_annotation_target_type::method_return, empty_target_info >,
type_annotation_target< type_annotation_target_type::method_receiver, empty_target_info >,
type_annotation_target< type_annotation_target_type::method_formal_parameter, formal_parameter_target_info >,
type_annotation_target< type_annotation_target_type::throws_, throws_target_info >,
type_annotation_target< type_annotation_target_type::local_variable, local_variable_target_info >,
type_annotation_target< type_annotation_target_type::resource_variable, local_variable_target_info >,
type_annotation_target< type_annotation_target_type::exception_parameter, catch_target_info >,
type_annotation_target< type_annotation_target_type::instanceof_, offset_target_info >,
type_annotation_target< type_annotation_target_type::new_, offset_target_info >,
type_annotation_target< type_annotation_target_type::constructor_reference, offset_target_info >,
type_annotation_target< type_annotation_target_type::method_reference, offset_target_info >,
type_annotation_target< type_annotation_target_type::cast, type_argument_target_info >,
type_annotation_target< type_annotation_target_type::constructor_invocation_type_argument, type_argument_target_info >,
type_annotation_target< type_annotation_target_type::method_invocation_type_argument, type_argument_target_info >,
type_annotation_target< type_annotation_target_type::constructor_reference_type_argument, type_argument_target_info >,
type_annotation_target< type_annotation_target_type::method_reference_type_argument, type_argument_target_info > >;
495 std::uint8_t type_argument_index{};
503 std::vector< type_path_entry > path;
505 std::vector< annotation_element > elements;
506 RPNX_MEMBER_METADATA(
type_annotation, target, path, type_index, elements);
513 std::vector< type_annotation > annotations;
521 std::vector< type_annotation > annotations;
537 std::vector< constant_pool_index > arguments;
545 std::vector< bootstrap_method > methods;
564 std::vector< method_parameter > parameters;
569 enum class module_access_flags : std::uint16_t { none = 0, is_open = 0x0020, is_synthetic = 0x1000, is_mandated = 0x8000 };
572 enum class module_requires_flags : std::uint16_t { none = 0, is_transitive = 0x0020, is_static_phase = 0x0040, is_synthetic = 0x1000, is_mandated = 0x8000 };
591 std::vector< constant_pool_index > exports_to_indexes;
600 std::vector< constant_pool_index > opens_to_indexes;
608 std::vector< constant_pool_index > provides_with_indexes;
619 std::vector< module_requires_info > requires_entries;
620 std::vector< module_exports_info > exports;
621 std::vector< module_opens_info > opens;
622 std::vector< constant_pool_index > uses_indexes;
623 std::vector< module_provides_info > provides;
624 RPNX_MEMBER_METADATA(
module_attribute, name_index, module_name_index, flags, version_index, requires_entries, exports, opens, uses_indexes, provides);
631 std::vector< constant_pool_index > package_indexes;
655 std::vector< constant_pool_index > class_indexes;
663 std::vector< constant_pool_index > class_indexes;
668 using record_component_attribute = std::variant< signature_attribute, runtime_visible_annotations_attribute, runtime_invisible_annotations_attribute, runtime_visible_type_annotations_attribute, runtime_invisible_type_annotations_attribute, unknown_attribute >;
675 std::vector< record_component_attribute > attributes;
683 std::vector< record_component_info > components;
688 using code_nested_attribute = std::variant< stack_map_table_attribute, line_number_table_attribute, local_variable_table_attribute, local_variable_type_table_attribute, runtime_visible_type_annotations_attribute, runtime_invisible_type_annotations_attribute, unknown_attribute >;
718 using field_attribute = std::variant< constant_value_attribute, synthetic_attribute, signature_attribute, deprecated_attribute, runtime_visible_annotations_attribute, runtime_invisible_annotations_attribute, runtime_visible_type_annotations_attribute, runtime_invisible_type_annotations_attribute, unknown_attribute >;
721 using method_attribute = std::variant< code_attribute, exceptions_attribute, synthetic_attribute, signature_attribute, deprecated_attribute, runtime_visible_annotations_attribute, runtime_invisible_annotations_attribute, runtime_visible_parameter_annotations_attribute, runtime_invisible_parameter_annotations_attribute, runtime_visible_type_annotations_attribute, runtime_invisible_type_annotations_attribute, annotation_default_attribute, method_parameters_attribute, unknown_attribute >;
724 using class_attribute = std::variant< inner_classes_attribute, enclosing_method_attribute, synthetic_attribute, signature_attribute, source_file_attribute, source_debug_extension_attribute, deprecated_attribute, runtime_visible_annotations_attribute, runtime_invisible_annotations_attribute, runtime_visible_type_annotations_attribute, runtime_invisible_type_annotations_attribute, bootstrap_methods_attribute, module_attribute, module_packages_attribute, module_main_class_attribute, nest_host_attribute, nest_members_attribute, record_attribute, permitted_subclasses_attribute, unknown_attribute >;
Exact JVM instruction types and code-array serialization APIs.
JVM class-file, bytecode, validation, generation, and JAR APIs.
annotation_constant_kind
Constant-valued annotation element tags.
std::variant< instruction_sequence, raw_code > code_body
Either a decoded instruction sequence or an exact raw tooling payload.
type_path_kind
A type_path component kind.
std::variant< same_frame, same_locals_one_stack_item_frame, same_locals_one_stack_item_frame_extended, chop_frame, same_frame_extended, append_frame, full_frame > stack_map_frame
Any valid StackMapTable frame encoding.
std::variant< signature_attribute, runtime_visible_annotations_attribute, runtime_invisible_annotations_attribute, runtime_visible_type_annotations_attribute, runtime_invisible_type_annotations_attribute, unknown_attribute > record_component_attribute
Attributes valid in a record_component_info structure.
std::variant< constant_value_attribute, synthetic_attribute, signature_attribute, deprecated_attribute, runtime_visible_annotations_attribute, runtime_invisible_annotations_attribute, runtime_visible_type_annotations_attribute, runtime_invisible_type_annotations_attribute, unknown_attribute > field_attribute
Attributes valid on a field_info structure.
field_access_flags
JVM field access flags.
module_exports_opens_flags
JVM module exports and opens flags.
std::variant< type_annotation_target< type_annotation_target_type::class_type_parameter, type_parameter_target_info >, type_annotation_target< type_annotation_target_type::method_type_parameter, type_parameter_target_info >, type_annotation_target< type_annotation_target_type::class_extends, supertype_target_info >, type_annotation_target< type_annotation_target_type::class_type_parameter_bound, type_parameter_bound_target_info >, type_annotation_target< type_annotation_target_type::method_type_parameter_bound, type_parameter_bound_target_info >, type_annotation_target< type_annotation_target_type::field, empty_target_info >, type_annotation_target< type_annotation_target_type::method_return, empty_target_info >, type_annotation_target< type_annotation_target_type::method_receiver, empty_target_info >, type_annotation_target< type_annotation_target_type::method_formal_parameter, formal_parameter_target_info >, type_annotation_target< type_annotation_target_type::throws_, throws_target_info >, type_annotation_target< type_annotation_target_type::local_variable, local_variable_target_info >, type_annotation_target< type_annotation_target_type::resource_variable, local_variable_target_info >, type_annotation_target< type_annotation_target_type::exception_parameter, catch_target_info >, type_annotation_target< type_annotation_target_type::instanceof_, offset_target_info >, type_annotation_target< type_annotation_target_type::new_, offset_target_info >, type_annotation_target< type_annotation_target_type::constructor_reference, offset_target_info >, type_annotation_target< type_annotation_target_type::method_reference, offset_target_info >, type_annotation_target< type_annotation_target_type::cast, type_argument_target_info >, type_annotation_target< type_annotation_target_type::constructor_invocation_type_argument, type_argument_target_info >, type_annotation_target< type_annotation_target_type::method_invocation_type_argument, type_argument_target_info >, type_annotation_target< type_annotation_target_type::constructor_reference_type_argument, type_argument_target_info >, type_annotation_target< type_annotation_target_type::method_reference_type_argument, type_argument_target_info > > type_annotation_target_info
Any valid type-annotation target_info structure.
module_requires_flags
JVM module requires flags.
method_parameter_access_flags
JVM MethodParameters access flags.
std::variant< stack_map_table_attribute, line_number_table_attribute, local_variable_table_attribute, local_variable_type_table_attribute, runtime_visible_type_annotations_attribute, runtime_invisible_type_annotations_attribute, unknown_attribute > code_nested_attribute
Attributes valid within a Code attribute.
std::variant< any_type_argument, exact_type_argument, extends_type_argument, super_type_argument > type_argument
One generic class type argument.
class_access_flags
JVM class access flags.
method_access_flags
JVM method access flags.
type_annotation_target_type
A type-annotation target discriminator.
std::variant< code_attribute, exceptions_attribute, synthetic_attribute, signature_attribute, deprecated_attribute, runtime_visible_annotations_attribute, runtime_invisible_annotations_attribute, runtime_visible_parameter_annotations_attribute, runtime_invisible_parameter_annotations_attribute, runtime_visible_type_annotations_attribute, runtime_invisible_type_annotations_attribute, annotation_default_attribute, method_parameters_attribute, unknown_attribute > method_attribute
Attributes valid on a method_info structure.
std::variant< top_variable_info, integer_variable_info, float_variable_info, double_variable_info, long_variable_info, null_variable_info, uninitialized_this_variable_info, object_variable_info, uninitialized_variable_info > verification_type_info
A StackMapTable verification_type_info structure.
module_access_flags
JVM module declaration flags.
std::variant< inner_classes_attribute, enclosing_method_attribute, synthetic_attribute, signature_attribute, source_file_attribute, source_debug_extension_attribute, deprecated_attribute, runtime_visible_annotations_attribute, runtime_invisible_annotations_attribute, runtime_visible_type_annotations_attribute, runtime_invisible_type_annotations_attribute, bootstrap_methods_attribute, module_attribute, module_packages_attribute, module_main_class_attribute, nest_host_attribute, nest_members_attribute, record_attribute, permitted_subclasses_attribute, unknown_attribute > class_attribute
Attributes valid on a ClassFile structure.
An array-valued annotation element.
A class-valued annotation element.
A constant-valued annotation element.
An AnnotationDefault attribute.
One named annotation element.
An enum-valued annotation element.
Any annotation element_value structure.
A JVM annotation structure.
An append_frame entry retaining its exact frame type.
std::uint8_t frame_type
Exact frame type 252 through 254; must agree with locals.size().
std::uint16_t offset_delta
Encoded offset delta from the preceding frame.
std::vector< verification_type_info > locals
One through three locals appended to the preceding frame.
One BootstrapMethods attribute entry.
A BootstrapMethods attribute.
An exception-parameter annotation target.
A chop_frame entry retaining its exact frame type.
std::uint16_t offset_delta
Encoded offset delta from the preceding frame.
std::uint8_t frame_type
Exact frame type 248 through 250; determines the number of removed locals.
A JVM class-file version pair.
An owning, typed representation of one JVM class file.
constant_pool_index this_class
CONSTANT_Class naming this class or interface.
std::vector< method_info > methods
Declared methods in encoded order.
std::vector< constant_pool_index > interfaces
Direct superinterface CONSTANT_Class indexes in encoded order.
std::vector< constant_pool_entry > constant_pool
Entries in logical order, excluding slot zero and reserved second slots.
constant_pool_index super_class
Direct superclass CONSTANT_Class, or zero only where the format permits.
class_access_flags access_flags
Class, interface, annotation, module, and property flags.
std::vector< field_info > fields
Declared fields in encoded order.
class_file_version version
Minor and major version written after the magic value.
std::vector< class_attribute > attributes
Context-valid class attributes in encoded order.
A fully typed Code attribute.
std::uint16_t max_stack
Maximum operand-stack depth in JVM slots.
std::uint16_t max_locals
Size of the local-variable array in JVM slots.
std::vector< exception_handler > exception_table
Handlers in encoded search order.
std::vector< code_nested_attribute > attributes
Typed nested attributes in encoded order.
code_body code
Exact decoded instructions or a tooling-mode raw payload.
constant_pool_index name_index
UTF-8 constant containing Code.
A byte offset within the code array of a Code attribute.
A type-safe index into a JVM constant pool.
A ConstantValue attribute.
constant_pool_index constant_value_index
Compatible integer, float, long, double, or string constant.
constant_pool_index name_index
UTF-8 constant containing ConstantValue.
A Deprecated marker attribute.
A double verification type.
An empty annotation target.
An EnclosingMethod attribute.
One Code exception-table entry.
code_offset end
Exclusive protected-range end; the code length itself is permitted.
code_offset handler
Handler entry instruction offset.
code_offset start
Inclusive protected-range start at an instruction boundary.
constant_pool_index catch_type
Caught CONSTANT_Class, or zero for a catch-all handler.
constant_pool_index name_index
UTF-8 constant containing Exceptions.
std::vector< constant_pool_index > exception_indexes
Declared exception CONSTANT_Class indexes.
A JVM field_info structure.
std::vector< field_attribute > attributes
Context-valid attributes in encoded order.
constant_pool_index name_index
UTF-8 constant containing the unqualified field name.
constant_pool_index descriptor_index
UTF-8 constant containing a field descriptor.
field_access_flags access_flags
Format-defined field access and property bits.
A float verification type.
std::vector< verification_type_info > locals
Complete local verification state.
std::vector< verification_type_info > stack
Complete operand-stack verification state.
std::uint16_t offset_delta
Encoded offset delta from the preceding frame.
One InnerClasses attribute entry.
An InnerClasses attribute.
An integer verification type.
One LineNumberTable entry.
code_offset start
Instruction offset at which this source line begins.
std::uint16_t line_number
Source-file line number.
A LineNumberTable attribute.
A JVM local-variable-array index.
One LocalVariableTable entry.
constant_pool_index descriptor_index
UTF-8 constant containing the field descriptor.
local_variable_index index
First local-variable-array slot occupied by the value.
code_offset start
Inclusive scope start offset.
constant_pool_index name_index
UTF-8 constant containing the source variable name.
std::uint16_t length
Scope length in code-array bytes; start + length is exclusive.
A LocalVariableTable attribute.
A local-variable annotation target.
One local-variable annotation range.
One LocalVariableTypeTable entry.
A LocalVariableTypeTable attribute.
A long verification type.
A JVM method_info structure.
method_access_flags access_flags
Format-defined method access and property bits.
std::vector< method_attribute > attributes
Context-valid attributes in encoded order.
constant_pool_index name_index
UTF-8 constant containing the method name.
constant_pool_index descriptor_index
UTF-8 constant containing a method descriptor.
One MethodParameters entry.
A MethodParameters attribute.
One exports entry in a Module attribute.
A ModuleMainClass attribute.
One opens entry in a Module attribute.
A ModulePackages attribute.
One provides entry in a Module attribute.
One requires entry in a Module attribute.
A null verification type.
An object or array verification type.
constant_pool_index class_index
CONSTANT_Class for the represented class or array type.
A bytecode-offset annotation target.
A PermittedSubclasses attribute.
One component in a Record attribute.
A RuntimeInvisibleAnnotations attribute.
A RuntimeInvisibleParameterAnnotations attribute.
A RuntimeInvisibleTypeAnnotations attribute.
A RuntimeVisibleAnnotations attribute.
A RuntimeVisibleParameterAnnotations attribute.
A RuntimeVisibleTypeAnnotations attribute.
A same_frame_extended entry.
std::uint16_t offset_delta
Encoded offset delta from the preceding frame.
A same_frame entry retaining its exact compact frame type.
std::uint8_t frame_type
Exact compact frame type in the inclusive range 0 through 63.
A same_locals_1_stack_item_frame_extended entry.
verification_type_info stack
Sole operand-stack entry.
std::uint16_t offset_delta
Encoded offset delta from the preceding frame.
A same_locals_1_stack_item_frame entry.
std::uint8_t frame_type
Exact compact frame type in the inclusive range 64 through 127.
verification_type_info stack
Sole operand-stack entry.
A SourceDebugExtension attribute whose bytes are not modified UTF-8.
A StackMapTable attribute.
constant_pool_index name_index
UTF-8 constant containing StackMapTable.
std::vector< stack_map_frame > entries
Frames in strictly increasing effective bytecode-offset order.
A supertype annotation target.
A Synthetic marker attribute.
A throws annotation target.
A target_info paired with its compile-time target_type discriminator.
A JVM type_annotation structure.
A bytecode-offset and type-argument annotation target.
A type-parameter-bound annotation target.
A type-parameter annotation target.
An uninitialized-this verification type.
An uninitialized value created by a new instruction.
code_offset new_instruction_offset
Offset of the new instruction that created the value.
An unknown standard-extension or vendor attribute retained verbatim.
std::vector< std::byte > info
Exact payload bytes following attribute_length.
constant_pool_index name_index
Attribute-name UTF-8 constant; arbitrary nonstandard names are retained.
Fundamental class-file, constant-pool, and JAR value types.