This commit fixes a ClassCastException in that method.
See the contract of Collection.toArray(): "The returned array's runtime component type is Object." That is because of the type erasure.
Thus casting Object[] to Class[] will result in ClassCastException.
java.lang.ClassCastException: class [Ljava.lang.Object; cannot be cast to class [Ljava.lang.Class; ([Ljava.lang.Object; and [Ljava.lang.Class; are in module java.base of loader 'bootstrap')
at com.rits.cloning.Cloner.setExtraStaticFields(Cloner.java:224)
This commit fixes a
ClassCastException
in that method.See the contract of Collection.toArray(): "The returned array's runtime component type is Object." That is because of the type erasure.
Thus casting
Object[]
toClass[]
will result inClassCastException.