Panic because of unwrap in rw.rs
Here the stacktrace:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: LazyBsm { inner: UnsafeCell }', C:\Users\ccgauche\.cargo\git\checkouts\coffer-00a025115db79fbc\50f5e5d\bytecode\src\rw.rs:91:57
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/803c60218ffac3384b0063c1b87ae7944163bba7\/library\std\src\panicking.rs:493
1: core::panicking::panic_fmt
at /rustc/803c60218ffac3384b0063c1b87ae7944163bba7\/library\core\src\panicking.rs:92
2: core::option::expect_none_failed
at /rustc/803c60218ffac3384b0063c1b87ae7944163bba7\/library\core\src\option.rs:1268
3: core::result::Result<coffer::dynamic::LazyBsm, alloc::rc::Rc<coffer::dynamic::LazyBsm>>::unwrap<coffer::dynamic::LazyBsm,alloc::rc::Rc<coffer::dynamic::LazyBsm>>
at C:\Users\ccgauche\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\result.rs:973
4: coffer::rw::ConstantPoolWriter::insert_dynamic<coffer::cp::VecCp>
at C:\Users\ccgauche\.cargo\git\checkouts\coffer-00a025115db79fbc\50f5e5d\bytecode\src\rw.rs:91
5: coffer::code::{{impl}}::write_to<coffer::cp::VecCp,std::io::cursor::Cursor<mut alloc::vec::Vec<u8, alloc::alloc::Global>*>>
at C:\Users\ccgauche\.cargo\git\checkouts\coffer-00a025115db79fbc\50f5e5d\bytecode\src\code.rs:1122
6: coffer::member::{{impl}}::write_to<coffer::cp::VecCp,alloc::vec::Vec<u8, alloc::alloc::Global>>
at C:\Users\ccgauche\.cargo\git\checkouts\coffer-00a025115db79fbc\50f5e5d\bytecode\src\member.rs:87
7: coffer::member::{{impl}}::write_to<coffer::cp::VecCp,alloc::vec::Vec<u8, alloc::alloc::Global>>
at C:\Users\ccgauche\.cargo\git\checkouts\coffer-00a025115db79fbc\50f5e5d\bytecode\src\member.rs:107
8: coffer::{{impl}}::write_to<std::fs::File>
at C:\Users\ccgauche\.cargo\git\checkouts\coffer-00a025115db79fbc\50f5e5d\bytecode\src\lib.rs:161
9: CObJava::main
at .\src\main.rs:18
10: core::ops::function::FnOnce::call_once<fn(),tuple<>>
at C:\Users\ccgauche\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:227
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: process didn't exit successfully: `target\debug\CObJava.exe` (exit code: 101)
Steps to reproduce:
fn main() {
let f = File::open("GameEndRequest.class").unwrap();
let mut reader = BufReader::new(f);
let class: Class = ReadWrite::read_from(&mut reader).unwrap();
let mut f1 = OpenOptions::new()
.write(true)
.append(false)
.create(true)
.open("GameEndRequest_1.class")
.unwrap();
class.write_to(&mut f1).unwrap();
}
Here the class file: GameEndRequest.class Here the source if you want to search for the problem: GameEndRequest.java