mirror of
https://github.com/corda/corda.git
synced 2025-01-03 19:54:13 +00:00
throw CloneNotSupportedException if Object.clone called on non-Cloneable
This commit is contained in:
parent
e0ceaa5f43
commit
63ee3ab0a2
@ -260,11 +260,14 @@ clone(Thread* t, object o)
|
|||||||
memcpy(clone, o, size);
|
memcpy(clone, o, size);
|
||||||
// clear any object header flags:
|
// clear any object header flags:
|
||||||
setObjectClass(t, o, objectClass(t, o));
|
setObjectClass(t, o, objectClass(t, o));
|
||||||
} else {
|
} else if (instanceOf(t, type(t, Machine::CloneableType), o)) {
|
||||||
clone = make(t, class_);
|
clone = make(t, class_);
|
||||||
memcpy(reinterpret_cast<void**>(clone) + 1,
|
memcpy(reinterpret_cast<void**>(clone) + 1,
|
||||||
reinterpret_cast<void**>(o) + 1,
|
reinterpret_cast<void**>(o) + 1,
|
||||||
size - BytesPerWord);
|
size - BytesPerWord);
|
||||||
|
} else {
|
||||||
|
throwNew(t, Machine::CloneNotSupportedExceptionType, "%s",
|
||||||
|
&byteArrayBody(t, className(t, objectClass(t, o)), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return clone;
|
return clone;
|
||||||
|
@ -226,6 +226,8 @@
|
|||||||
|
|
||||||
(type negativeArraySizeException java/lang/NegativeArraySizeException)
|
(type negativeArraySizeException java/lang/NegativeArraySizeException)
|
||||||
|
|
||||||
|
(type cloneNotSupportedException java/lang/CloneNotSupportedException)
|
||||||
|
|
||||||
(type reflectiveOperationException java/lang/ReflectiveOperationException)
|
(type reflectiveOperationException java/lang/ReflectiveOperationException)
|
||||||
|
|
||||||
(type classCastException java/lang/ClassCastException)
|
(type classCastException java/lang/ClassCastException)
|
||||||
|
1
vm.pro
1
vm.pro
@ -54,6 +54,7 @@
|
|||||||
-keep public class java.lang.ArrayIndexOutOfBoundsException
|
-keep public class java.lang.ArrayIndexOutOfBoundsException
|
||||||
-keep public class java.lang.ArrayStoreException
|
-keep public class java.lang.ArrayStoreException
|
||||||
-keep public class java.lang.NegativeArraySizeException
|
-keep public class java.lang.NegativeArraySizeException
|
||||||
|
-keep public class java.lang.CloneNotSupportedException
|
||||||
-keep public class java.lang.ClassCastException
|
-keep public class java.lang.ClassCastException
|
||||||
-keep public class java.lang.ClassNotFoundException
|
-keep public class java.lang.ClassNotFoundException
|
||||||
-keep public class java.lang.NullPointerException
|
-keep public class java.lang.NullPointerException
|
||||||
|
Loading…
Reference in New Issue
Block a user