Clones the current copy creating a shallow copy of it if Cloneable is implemented, unless this method is overridden to perform class specific cloning. @throws CloneNotSupportedException If cloning is not supported by the current class, the default implementation always throws this if the {@
()
| 46 | * @since 2016/02/08 |
| 47 | */ |
| 48 | protected Object clone() |
| 49 | throws CloneNotSupportedException |
| 50 | { |
| 51 | // If this is an array copy elements around |
| 52 | Class<?> cl = this.getClass(); |
| 53 | if (cl.isArray()) |
| 54 | { |
| 55 | // Need length of this array to recreate! |
| 56 | int len = ObjectAccess.arrayLength(this); |
| 57 | |
| 58 | // Allocate new array |
| 59 | Object dest = ObjectAccess.arrayNew(cl, len); |
| 60 | |
| 61 | // Copy everything over |
| 62 | System.arraycopy(this, 0, dest, 0, len); |
| 63 | |
| 64 | // This array was cloned |
| 65 | return this; |
| 66 | } |
| 67 | |
| 68 | // {@squirreljme.error ZZ0u This object does not support being clone.} |
| 69 | throw new CloneNotSupportedException("ZZ0u"); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Checks for equality between this object and another. Equality should be |
nothing calls this directly
no test coverage detected