From f9b7d04a45322956da1032415bb9375a5804bf4f Mon Sep 17 00:00:00 2001 From: KyuubiRan Date: Wed, 10 Mar 2021 15:46:59 +0800 Subject: [PATCH] Update Utils --- app/src/main/java/me/kyuubiran/qqcleaner/utils/Utils.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/utils/Utils.kt b/app/src/main/java/me/kyuubiran/qqcleaner/utils/Utils.kt index d6f3b48..d1c3f06 100644 --- a/app/src/main/java/me/kyuubiran/qqcleaner/utils/Utils.kt +++ b/app/src/main/java/me/kyuubiran/qqcleaner/utils/Utils.kt @@ -259,6 +259,7 @@ fun viewCpy(srcView: T): T? { } } +//仅限构造无参的类型 fun objCpy(srcObj: T): T? { return try { var clz: Class<*> = srcObj!!::class.java @@ -292,7 +293,7 @@ fun fieldCpy(srcObj: T, newObj: T): T? { } clz = clz.superclass } - newObj as T + newObj } catch (e: Exception) { loge(e) null