diff --git a/src/builtin.cpp b/src/builtin.cpp index 44209e5f4c..588b006c00 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -108,6 +108,8 @@ Java_java_lang_Object_clone(Thread* t, jclass, jobject o) if (classArrayElementSize(t, class_)) { clone = static_cast(allocate(t, size)); memcpy(clone, *o, size); + // clear any object header flags: + cast(*o, 0) = objectClass(t, *o); } else { clone = make(t, objectClass(t, *o)); memcpy(reinterpret_cast(clone) + 1,