obfuskator/crates/noxis-classfile
loki5512344 f08bf60635 classfile: intern constant-pool entries on write (fix LVTT/LVT ClassFormatError)
ristretto's ConstantPool never deduplicates: every add_* pushes a new entry.
HotSpot matches each LocalVariableTypeTable entry to a LocalVariableTable
entry by raw name_index, so when a name (e.g. a local's) was interned twice
the two tables got different indices and the class failed to load:
'ClassFormatError: LVTT entry ... does not match any LVT entry'.

The writer now memoizes every pool builder by its semantic key and rebuilds
composite constants (Class/NameAndType/Fieldref/Methodref/MethodHandle/
Dynamic) from our own utf8/class primitives so ristretto never mints a
shadow Utf8. This also shrinks the pool (no more ldc -> ldc_w widening that
changed code length on a pure round-trip).

Split pool.rs into a pool/ module (refs in pool/refs.rs) to respect the
file-size gate. Regression test: tests/pool asserts the written pool has no
duplicate CONSTANT_Utf8. Verified: pure parse->write of the neoforge jar
(92 classes) now loads under java -Xverify:all with 0 errors.
2026-10-08 22:55:49 +02:00
..
src classfile: intern constant-pool entries on write (fix LVTT/LVT ClassFormatError) 2026-10-08 22:55:49 +02:00
tests classfile: intern constant-pool entries on write (fix LVTT/LVT ClassFormatError) 2026-10-08 22:55:49 +02:00
build.rs Initial commit: noxis JVM bytecode obfuscator 2026-10-08 22:01:03 +02:00
Cargo.toml Initial commit: noxis JVM bytecode obfuscator 2026-10-08 22:01:03 +02:00