classfile,passes: model runtime-visible annotations, rewrite their descriptors

This commit is contained in:
Loki 2026-10-11 13:02:26 +02:00
parent 4b14eeb40f
commit 48a5bc23a9
Signed by: boba
GPG key ID: 253067914055423B
13 changed files with 527 additions and 4 deletions

View file

@ -8,6 +8,7 @@ use ristretto_classfile::attributes::{
LocalVariableTypeTable as RtLocalType, Record as RtRecord,
};
use super::annotations::annotation;
use super::helpers;
use super::pool::Pool;
use crate::error::ClassfileError;
@ -178,6 +179,20 @@ pub(super) fn convert(attr: &Attribute, pool: &mut Pool) -> Result<RtAttr, Class
.map(|param| helpers::method_param(param, pool))
.collect::<Result<_, _>>()?,
},
Attribute::RuntimeVisibleAnnotations(annos) => RtAttr::RuntimeVisibleAnnotations {
name_index: pool.utf8("RuntimeVisibleAnnotations")?,
annotations: annos
.iter()
.map(|anno| annotation(anno, pool))
.collect::<Result<_, _>>()?,
},
Attribute::RuntimeInvisibleAnnotations(annos) => RtAttr::RuntimeInvisibleAnnotations {
name_index: pool.utf8("RuntimeInvisibleAnnotations")?,
annotations: annos
.iter()
.map(|anno| annotation(anno, pool))
.collect::<Result<_, _>>()?,
},
Attribute::Raw { name, data } => RtAttr::Unknown {
name_index: pool.utf8(name)?,
info: data.clone(),