Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ getrandom = "0.3.3"
indoc = "2.0.6"
indexmap = "2.10.0"
os_info = "3.12.0"
parking_lot = "0.12.4"
phf = "0.12.1"
phf_codegen = "0.12.1"
proc-macro2 = "1.0.95"
Expand Down
1 change: 1 addition & 0 deletions ristretto_classloader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ version.workspace = true
[dependencies]
flate2 = { workspace = true }
indexmap = { workspace = true }
parking_lot = { workspace = true }
reqwest = { workspace = true, features = ["json"] }
ristretto_classfile = { path = "../ristretto_classfile", version = "0.25.0" }
ristretto_gc = { path = "../ristretto_gc", version = "0.25.0" }
Expand Down
24 changes: 6 additions & 18 deletions ristretto_classloader/src/object.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::Error::{FieldNotFound, InvalidValueType, ParseError, PoisonedLock};
use crate::Error::{FieldNotFound, InvalidValueType, ParseError};
use crate::Reference::{ByteArray, CharArray};
use crate::field::FieldKey;
use crate::{Class, Field, Reference, Result, Value};
Expand Down Expand Up @@ -283,14 +283,8 @@ impl Object {
Value::Object(Some(Reference::Object(self_object))),
Value::Object(Some(Reference::Object(other_object))),
) => {
let self_object = self_object
.read()
.map_err(|error| PoisonedLock(error.to_string()))
.expect("poisoned lock");
let other_object = other_object
.read()
.map_err(|error| PoisonedLock(error.to_string()))
.expect("poisoned lock");
let self_object = self_object.read();
let other_object = other_object.read();
if !self_object.equal_with_visited(&other_object, visited) {
return false;
}
Expand Down Expand Up @@ -522,17 +516,13 @@ impl Object {
let coder = self.value("coder")?.as_i32()?;
if coder == 0 {
// Latin-1 encoded string
let bytes = bytes
.read()
.map_err(|error| PoisonedLock(error.to_string()))?;
let bytes = bytes.read();
#[expect(clippy::cast_sign_loss)]
let value = bytes.iter().map(|&byte| char::from(byte as u8)).collect();
Ok(value)
} else {
// UTF-16 encoded string
let bytes = bytes
.read()
.map_err(|error| PoisonedLock(error.to_string()))?;
let bytes = bytes.read();
#[expect(clippy::cast_sign_loss)]
let code_units = bytes
.chunks(2)
Expand All @@ -544,9 +534,7 @@ impl Object {
}
}
CharArray(bytes) => {
let bytes = bytes
.read()
.map_err(|error| PoisonedLock(error.to_string()))?;
let bytes = bytes.read();
let value =
String::from_utf16(&bytes).map_err(|error| ParseError(error.to_string()))?;
Ok(value)
Expand Down
Loading
Loading