classfile: model RuntimeVisible/InvisibleParameterAnnotations (fixes ASM AIOOBE on write)
Parameter annotations were unmodeled and fell through to Raw with stale constant-pool indices after the pool rebuild. ASM (Paper converter, Fabric mixin transformer) then failed with ArrayIndexOutOfBoundsException in readParameterAnnotations. Now parsed and rewritten like class-level annotations.
This commit is contained in:
parent
045cd3ed9c
commit
b73c72d56d
5 changed files with 80 additions and 1 deletions
|
|
@ -193,6 +193,38 @@ pub(super) fn convert(attr: &Attribute, pool: &mut Pool) -> Result<RtAttr, Class
|
|||
.map(|anno| annotation(anno, pool))
|
||||
.collect::<Result<_, _>>()?,
|
||||
},
|
||||
Attribute::RuntimeVisibleParameterAnnotations(params) => {
|
||||
RtAttr::RuntimeVisibleParameterAnnotations {
|
||||
name_index: pool.utf8("RuntimeVisibleParameterAnnotations")?,
|
||||
parameter_annotations: params
|
||||
.iter()
|
||||
.map(|param| {
|
||||
Ok(ristretto_classfile::attributes::ParameterAnnotation {
|
||||
annotations: param
|
||||
.iter()
|
||||
.map(|anno| annotation(anno, pool))
|
||||
.collect::<Result<_, _>>()?,
|
||||
})
|
||||
})
|
||||
.collect::<Result<_, _>>()?,
|
||||
}
|
||||
}
|
||||
Attribute::RuntimeInvisibleParameterAnnotations(params) => {
|
||||
RtAttr::RuntimeInvisibleParameterAnnotations {
|
||||
name_index: pool.utf8("RuntimeInvisibleParameterAnnotations")?,
|
||||
parameter_annotations: params
|
||||
.iter()
|
||||
.map(|param| {
|
||||
Ok(ristretto_classfile::attributes::ParameterAnnotation {
|
||||
annotations: param
|
||||
.iter()
|
||||
.map(|anno| annotation(anno, pool))
|
||||
.collect::<Result<_, _>>()?,
|
||||
})
|
||||
})
|
||||
.collect::<Result<_, _>>()?,
|
||||
}
|
||||
}
|
||||
Attribute::Raw { name, data } => RtAttr::Unknown {
|
||||
name_index: pool.utf8(name)?,
|
||||
info: data.clone(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue