protected < T > T performCloneForCloneableMethod ( T object , CloneDriver context ) { Class < ? > clazz = object . getClass ( ) ; final T result ; try { MethodHandle handle = context . getCloneMethod ( clazz ) ; result = ( T ) handle . invoke ( object ) ; } catch ( Throwable e ) { throw new IllegalStateException ( "Could not invoke clone() for instance of: " + clazz . getName ( ) , e ) ; } return result ; }
Helper method for performing cloning for objects of classes implementing java . lang . Cloneable