Skip to content

Commit

Permalink
jdescription test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hextriclosan committed Sep 21, 2024
1 parent 26e37d8 commit 0bf6d2a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions jdescriptor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ mod tests {
#[test]
fn should_return_error_for_object_without_closing_symbol() {
assert_eq!(
str::parse::<TypeDescriptor>("["),
Err("Unexpected end of input".to_string())
str::parse::<TypeDescriptor>("Ljava/lang/String"),
Err("Missing ';' in class name descriptor".to_string())
);
}
#[test]
Expand Down
9 changes: 6 additions & 3 deletions vm/src/class_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ impl ClassLoader {
get_cpool_string(class_file, method.descriptor_index() as usize).ok_or(
Error::new_constant_pool("Error getting method method_signature"),
)?;
let (max_stack, max_locals, code) =
Self::get_cpool_code_attribute(method.attributes())
.ok_or(Error::new_constant_pool(format!("Error getting method code: {class_name}.{method_name}(...)").as_str()))?;
let (max_stack, max_locals, code) = Self::get_cpool_code_attribute(
method.attributes(),
)
.ok_or(Error::new_constant_pool(
format!("Error getting method code: {class_name}.{method_name}(...)").as_str(),
))?;
let key_signature = method_name + ":" + method_signature.as_str();

method_by_signature.insert(
Expand Down

0 comments on commit 0bf6d2a

Please sign in to comment.