Skip to content

Commit 5f33aef

Browse files
committed
InputStream minor fix
1 parent 28fd95c commit 5f33aef

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

java_runtime/src/classes/java/io/input_stream.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,24 @@ impl InputStream {
2727
}
2828
}
2929

30-
async fn init(_: &Jvm, _: &mut RuntimeContext, this: ClassInstanceRef<Self>) -> Result<()> {
31-
tracing::warn!("stub java.lang.InputStream::<init>({:?})", &this);
30+
async fn init(jvm: &Jvm, _: &mut RuntimeContext, this: ClassInstanceRef<Self>) -> Result<()> {
31+
tracing::warn!("stub java.io.InputStream::<init>({:?})", &this);
32+
33+
let _: () = jvm.invoke_special(&this, "java/lang/Object", "<init>", "()V", ()).await?;
3234

3335
Ok(())
3436
}
3537

3638
async fn read(jvm: &Jvm, _: &mut RuntimeContext, this: ClassInstanceRef<Self>, b: ClassInstanceRef<Array<i8>>) -> Result<i32> {
37-
tracing::debug!("java.lang.InputStream::read({:?}, {:?})", &this, &b);
39+
tracing::debug!("java.io.InputStream::read({:?}, {:?})", &this, &b);
3840

3941
let array_length = jvm.array_length(&b).await? as i32;
4042

4143
jvm.invoke_virtual(&this, "read", "([BII)I", (b, 0, array_length)).await
4244
}
4345

4446
async fn skip(jvm: &Jvm, _: &mut RuntimeContext, this: ClassInstanceRef<Self>, n: i64) -> Result<i64> {
45-
tracing::debug!("java.lang.InputStream::skip({:?}, {:?})", &this, n);
47+
tracing::debug!("java.io.InputStream::skip({:?}, {:?})", &this, n);
4648

4749
let scratch = jvm.instantiate_array("B", n as _).await?;
4850
let _: i32 = jvm.invoke_virtual(&this, "read", "([BII)I", (scratch.clone(), 0, n as i32)).await?;

0 commit comments

Comments
 (0)