From 0e500fd0c6990c47a3a3947e0acbc8ece8745832 Mon Sep 17 00:00:00 2001 From: Denis Slynko Date: Sat, 13 Sep 2025 10:05:13 +0300 Subject: [PATCH] [ANI] Remove deprecated mangling Issue: #ICXU1F Change-Id: Id72a649aa8f3057a2ae9ac0146dec9ca257dbaaf Signed-off-by: Denis Slynko --- uitest/ets/ani/src/error_handler.h | 8 ++++---- uitest/ets/ani/src/ui_event_observer_ani.cpp | 4 ++-- uitest/ets/ani/src/uitest_ani.cpp | 6 ++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/uitest/ets/ani/src/error_handler.h b/uitest/ets/ani/src/error_handler.h index d30835da..f89d6120 100644 --- a/uitest/ets/ani/src/error_handler.h +++ b/uitest/ets/ani/src/error_handler.h @@ -27,7 +27,7 @@ namespace OHOS::uitest { using namespace OHOS::HiviewDFX; constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LogType::LOG_CORE, 0xD003100, "UiTestKit"}; - constexpr const char* BUSINESS_ERROR_CLASS = "L@ohos/base/BusinessError;"; + constexpr const char* BUSINESS_ERROR_CLASS = "@ohos.base.BusinessError"; class ErrorHandler { public: static ani_status Throw(ani_env *env, int32_t code, const string &errMsg) @@ -50,12 +50,12 @@ namespace OHOS::uitest { } ani_ref undefRef; env->GetUndefined(&undefRef); - ani_status status = env->FindClass("Lescompat/Error;", &cls); + ani_status status = env->FindClass("escompat.Error", &cls); if (status != ANI_OK) { HiLog::Error(LABEL, "FindClass : %{public}d", status); return nullptr; } - status = env->Class_FindMethod(cls, "", "Lstd/core/String;Lescompat/ErrorOptions;:V", &method); + status = env->Class_FindMethod(cls, "", "C{std.core.String}C{escompat.ErrorOptions}:", &method); if (status != ANI_OK) { HiLog::Error(LABEL, "Class_FindMethod : %{public}d", status); return nullptr; @@ -80,7 +80,7 @@ namespace OHOS::uitest { return ANI_ERROR; } ani_method method; - if (ANI_OK != env->Class_FindMethod(cls, "", "ILescompat/Error;:V", &method)) { + if (ANI_OK != env->Class_FindMethod(cls, "", "iC{escompat.Error}:", &method)) { HiLog::Error(LABEL, "Not found method of BusinessError"); return ANI_ERROR; } diff --git a/uitest/ets/ani/src/ui_event_observer_ani.cpp b/uitest/ets/ani/src/ui_event_observer_ani.cpp index e97f0175..e904bfa9 100644 --- a/uitest/ets/ani/src/ui_event_observer_ani.cpp +++ b/uitest/ets/ani/src/ui_event_observer_ani.cpp @@ -160,7 +160,7 @@ namespace OHOS::uitest { vm->DetachCurrentThread(); return; } - static const char *className = "L@ohos/UiTest/UIElementInfoInner;"; + static const char *className = "@ohos.UiTest.UIElementInfoInner"; ani_class cls; if (ANI_OK != env->FindClass(className, &cls)) { HiLog::Error(LABEL,"Not found class UIElementInfoInner"); @@ -169,7 +169,7 @@ namespace OHOS::uitest { return; } ani_method method; - if (ANI_OK != env->Class_FindMethod(cls, "", ":V", &method)) { + if (ANI_OK != env->Class_FindMethod(cls, "", ":", &method)) { HiLog::Error(LABEL,"Not found method of UIElementInfoInner"); vm->DetachCurrentThread(); return; diff --git a/uitest/ets/ani/src/uitest_ani.cpp b/uitest/ets/ani/src/uitest_ani.cpp index be37141a..7b5366f5 100644 --- a/uitest/ets/ani/src/uitest_ani.cpp +++ b/uitest/ets/ani/src/uitest_ani.cpp @@ -218,7 +218,9 @@ static ani_ref UnmarshalReply(ani_env *env, const ApiCallInfo callInfo_, const A if (ANI_OK != env->Object_New(cls, com_ctor, &com_obj, reinterpret_cast(item))) { HiLog::Error(LABEL, "%{public}s component Object new failed !!!", __func__); } - if (ANI_OK != env->Object_CallMethodByName_Void(arrayObj, "$_set", "ILstd/core/Object;:V", index, com_obj)) { + ani_status status = + env->Object_CallMethodByName_Void(arrayObj, "$_set", "iC{std.core.Object}:", index, com_obj); + if (ANI_OK != status) { HiLog::Error(LABEL, "%{public}s Object_CallMethodByName_Void set Failed", __func__); break; } @@ -606,7 +608,7 @@ static void pushBool(ani_env *env, ani_object input, nlohmann::json ¶ms) if (ret == ANI_FALSE) { ani_boolean param; HiLog::Info(LABEL, "%{public}s ani_boolean !!!", __func__); - env->Object_CallMethodByName_Boolean(input, "unboxed", ":Z", ¶m); + env->Object_CallMethodByName_Boolean(input, "unboxed", ":z", ¶m); HiLog::Info(LABEL, "%{public}d ani_boolean !!!", static_cast(param)); params.push_back(static_cast(param)); } -- Gitee