classfile,passes: model Nest attributes as IR (fix ClassFormatError)
NestHost/NestMembers were carried as Attribute::Raw with constant-pool indices baked in. During writing the pool is rebuilt in a different order, so those indices pointed at the wrong entries and the JVM rejected the class: ClassFormatError: Nest member/host class_info_index N has bad constant type. Model them explicitly in the IR, convert on parse and write (resolving class names through the new pool), and remap their class names during rename. Add a NestMembers round-trip regression test. Verified on a real jar: all Nest ClassFormatErrors gone.
This commit is contained in:
parent
8b107cf1b3
commit
2674d7fc89
7 changed files with 145 additions and 66 deletions
|
|
@ -19,6 +19,10 @@ pub enum Attribute {
|
|||
Deprecated,
|
||||
Synthetic,
|
||||
InnerClasses(Vec<InnerClass>),
|
||||
/// `NestHost`: класс, служащий nest-хостом (JVMS §4.7.28).
|
||||
NestHost(String),
|
||||
/// `NestMembers`: классы-члены этого nest-хоста (JVMS §4.7.29).
|
||||
NestMembers(Vec<String>),
|
||||
/// `ConstantValue` поля (`static final`): значение из пула.
|
||||
ConstantValue(Const),
|
||||
/// `BootstrapMethods` для `invokedynamic` (лямбды): метод + аргументы.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue