diff --git a/tests/test_data/TrivialCast.java b/tests/test_data/TrivialCast.java index e6830477..3e2e87d2 100644 --- a/tests/test_data/TrivialCast.java +++ b/tests/test_data/TrivialCast.java @@ -12,6 +12,9 @@ public static void main(String[] args) { Object o2 = new long[] { 1, 2, 3 }; var longArray = (long[]) o2; + Object o3 = new String[10]; + var stringArray = (String[]) o3; + int result = 1337; } } diff --git a/tests/test_data/samples/javacore/cast/trivial/TrivialCast.class b/tests/test_data/samples/javacore/cast/trivial/TrivialCast.class index d774a220..58c73a85 100644 Binary files a/tests/test_data/samples/javacore/cast/trivial/TrivialCast.class and b/tests/test_data/samples/javacore/cast/trivial/TrivialCast.class differ diff --git a/vm/src/execution_engine/engine.rs b/vm/src/execution_engine/engine.rs index 0f6a51b3..66a8a7ab 100644 --- a/vm/src/execution_engine/engine.rs +++ b/vm/src/execution_engine/engine.rs @@ -1513,6 +1513,7 @@ impl Engine { "Error getting class name by index {class_constpool_index}" )) })?; + let class_of_array = format!("[L{class_of_array};"); let arrayref = with_heap_write_lock(|heap| heap.create_array(&class_of_array, length)); stack_frame.push(arrayref);