--- create_jar ---
(
input_class_files: &[String],
input_jar_files: &[String],
final_output_jar_path: &str,
main_class_name: Option<&str>,
)
| 369 | fn remap_verification_type( |
| 370 | verification_type: &mut VerificationType, |
| 371 | indexes: &HashMap<u16, u16>, |
| 372 | ) -> io::Result<()> { |
| 373 | if let VerificationType::Object { cpool_index } = verification_type { |
| 374 | *cpool_index = remapped_constant_index(*cpool_index, indexes)?; |
| 375 | } |
| 376 | Ok(()) |
| 377 | } |
| 378 | |
| 379 | fn remap_stack_frame(frame: &mut StackFrame, indexes: &HashMap<u16, u16>) -> io::Result<()> { |
| 380 | match frame { |
| 381 | StackFrame::SameLocals1StackItemFrame { stack, .. } |
| 382 | | StackFrame::SameLocals1StackItemFrameExtended { stack, .. } => { |
| 383 | for item in stack { |
| 384 | remap_verification_type(item, indexes)?; |
| 385 | } |
| 386 | } |
| 387 | StackFrame::AppendFrame { locals, .. } => { |
| 388 | for item in locals { |
| 389 | remap_verification_type(item, indexes)?; |
| 390 | } |
| 391 | } |
| 392 | StackFrame::FullFrame { locals, stack, .. } => { |
| 393 | for item in locals.iter_mut().chain(stack.iter_mut()) { |
| 394 | remap_verification_type(item, indexes)?; |
| 395 | } |
| 396 | } |
| 397 | StackFrame::SameFrame { .. } |
| 398 | | StackFrame::ChopFrame { .. } |
| 399 | | StackFrame::SameFrameExtended { .. } => {} |
| 400 | } |
| 401 | Ok(()) |
| 402 | } |
| 403 | |
| 404 | fn remap_instruction(instruction: &mut Instruction, indexes: &HashMap<u16, u16>) -> io::Result<()> { |
| 405 | match instruction { |
| 406 | Instruction::Ldc(index) => { |
| 407 | let shifted = remapped_constant_index(u16::from(*index), indexes)?; |
| 408 | if let Ok(short_index) = u8::try_from(shifted) { |
| 409 | *index = short_index; |
| 410 | } else { |
| 411 | *instruction = Instruction::Ldc_w(shifted); |
| 412 | } |
| 413 | } |
| 414 | Instruction::Ldc_w(index) |
| 415 | | Instruction::Ldc2_w(index) |
| 416 | | Instruction::Getstatic(index) |
| 417 | | Instruction::Putstatic(index) |
| 418 | | Instruction::Getfield(index) |
| 419 | | Instruction::Putfield(index) |
| 420 | | Instruction::Invokevirtual(index) |
| 421 | | Instruction::Invokespecial(index) |
| 422 | | Instruction::Invokestatic(index) |
| 423 | | Instruction::Invokedynamic(index) |
| 424 | | Instruction::New(index) |
| 425 | | Instruction::Anewarray(index) |
| 426 | | Instruction::Checkcast(index) |
| 427 | | Instruction::Instanceof(index) => *index = remapped_constant_index(*index, indexes)?, |
| 428 | Instruction::Invokeinterface(index, _) | Instruction::Multianewarray(index, _) => { |
no test coverage detected