From 16a1f6467411ab090da93ff87a7450a921dfedeb Mon Sep 17 00:00:00 2001 From: Martin Sajti Date: Wed, 28 May 2025 12:52:24 +0200 Subject: [PATCH] [cherry-pick 0603] Fix invlid code after primitive type refactor Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICJ8GH Cherry-pick of: https://gitee.com/openharmony/ability_ability_runtime/pulls/14571 Change-Id: I0615ceabceb8503b09b036dbbb595fe63eda1bc7 Signed-off-by: Martin Sajti --- .../ets/ets/@ohos.app.ability.InsightIntentContext.ets | 10 +++++----- .../ets/@ohos.app.ability.InsightIntentExecutor.ets | 8 ++++---- .../ets/@ohos.app.ability.ServiceExtensionAbility.ets | 10 +++++----- .../ets/ets/@ohos.app.ability.UIExtensionAbility.ets | 2 +- frameworks/ets/ets/application/AbilityDelegator.ets | 6 +++--- frameworks/ets/ets/application/UIAbilityContext.ets | 10 +++++----- frameworks/ets/ets/caller/Caller.ets | 4 ++-- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/frameworks/ets/ets/@ohos.app.ability.InsightIntentContext.ets b/frameworks/ets/ets/@ohos.app.ability.InsightIntentContext.ets index 7f459c698a9..33dc951b5df 100644 --- a/frameworks/ets/ets/@ohos.app.ability.InsightIntentContext.ets +++ b/frameworks/ets/ets/@ohos.app.ability.InsightIntentContext.ets @@ -28,8 +28,8 @@ export default class InsightIntentContext { p1.then((e: NullishType) => { let retError = e as BusinessError; callback(retError, undefined); - }, (err: BusinessError): void => { - callback(err, undefined); + }, (err: Error): void => { + callback(err as BusinessError, undefined); }); } @@ -45,10 +45,10 @@ export default class InsightIntentContext { } else { reject(retError); } - }).catch((err: BusinessError): void => { - reject(err); + }).catch((err: Error): void => { + reject(err as BusinessError); }); }); return p; } -} \ No newline at end of file +} diff --git a/frameworks/ets/ets/@ohos.app.ability.InsightIntentExecutor.ets b/frameworks/ets/ets/@ohos.app.ability.InsightIntentExecutor.ets index d65b013d97a..dca81b8dad3 100644 --- a/frameworks/ets/ets/@ohos.app.ability.InsightIntentExecutor.ets +++ b/frameworks/ets/ets/@ohos.app.ability.InsightIntentExecutor.ets @@ -46,7 +46,7 @@ export default class InsightIntentExecutor { insightIntent.ExecuteResult { let p = this.onExecuteInUIAbilityBackgroundModeAsync(name, param); if (this.isOnExecuteInUIAbilityBackgroundModeAsync) { - p.then((result: insightIntent.ExecuteResult): void => { + p.then((result: insightIntent.ExecuteResult): void => { this.nativeOnExecuteResult(result); }); let ret: insightIntent.ExecuteResult = {}; @@ -60,7 +60,7 @@ export default class InsightIntentExecutor { pageLoader: UIExtensionContentSession): insightIntent.ExecuteResult { let p = this.onExecuteInUIExtensionAbilityAsync(name, param, pageLoader); if (this.isOnExecuteInUIExtensionAbilityAsync) { - p.then((result: insightIntent.ExecuteResult): void => { + p.then((result: insightIntent.ExecuteResult): void => { this.nativeOnExecuteResult(result); }); let ret: insightIntent.ExecuteResult = {}; @@ -74,7 +74,7 @@ export default class InsightIntentExecutor { insightIntent.ExecuteResult { let p = this.onExecuteInServiceExtensionAbilityAsync(name, param); if (this.isOnExecuteInServiceExtensionAbilityAsync) { - p.then((result: insightIntent.ExecuteResult): void => { + p.then((result: insightIntent.ExecuteResult): void => { this.nativeOnExecuteResult(result); }); let ret: insightIntent.ExecuteResult = {}; @@ -144,4 +144,4 @@ export default class InsightIntentExecutor { reject: (err: Error) => void): void => { }); } -} \ No newline at end of file +} diff --git a/frameworks/ets/ets/@ohos.app.ability.ServiceExtensionAbility.ets b/frameworks/ets/ets/@ohos.app.ability.ServiceExtensionAbility.ets index 3f2442868be..267a46bf7a9 100644 --- a/frameworks/ets/ets/@ohos.app.ability.ServiceExtensionAbility.ets +++ b/frameworks/ets/ets/@ohos.app.ability.ServiceExtensionAbility.ets @@ -55,7 +55,7 @@ export default class ServiceExtensionAbility { private callOnDisconnect(want: Want): void { let p = this.onDisconnectAsync(want); if (this.isOnDisconnectAsync) { - p.then((a:undefined): void => { + p.then((): void => { this.nativeOnDisconnectCallback(); }); } else { @@ -82,9 +82,9 @@ export default class ServiceExtensionAbility { onConnectAsync(want: Want): Promise { console.log("onConnectAsync"); this.isOnConnectAsync = false; - return new Promise((resolve, reject) => { - resolve(new MyService("onConnectAsync")); - }); + return new Promise((resolve, reject) => { + resolve(new MyService("onConnectAsync")); + }); } onDisconnect(want: Want): void { console.log("onDisconnect"); @@ -97,4 +97,4 @@ export default class ServiceExtensionAbility { onConfigurationUpdate(newConfig: Configuration): void { console.log("onConfigurationUpdate"); } -} \ No newline at end of file +} diff --git a/frameworks/ets/ets/@ohos.app.ability.UIExtensionAbility.ets b/frameworks/ets/ets/@ohos.app.ability.UIExtensionAbility.ets index 8f2edb1093a..5c22e51bb92 100644 --- a/frameworks/ets/ets/@ohos.app.ability.UIExtensionAbility.ets +++ b/frameworks/ets/ets/@ohos.app.ability.UIExtensionAbility.ets @@ -28,7 +28,7 @@ export default class UIExtensionAbility extends ExtensionAbility { private callOnDestroy(): boolean { let p = this.onDestroyAsync(); if (this.isOnDestroyAsync) { - p.then((a:undefined): void => { + p.then((): void => { this.nativeOnDestroyCallback(); }); } else { diff --git a/frameworks/ets/ets/application/AbilityDelegator.ets b/frameworks/ets/ets/application/AbilityDelegator.ets index 42d696d01c8..5457602859d 100644 --- a/frameworks/ets/ets/application/AbilityDelegator.ets +++ b/frameworks/ets/ets/application/AbilityDelegator.ets @@ -469,9 +469,9 @@ class AbilityDelegatorInner implements AbilityDelegator { let error: BusinessError = { code: resultCode, data: undefined }; callback(error, ability); console.log("getCurrentTopAbility callback2_06"); - }).catch((err: BusinessError): void => { + }).catch((err: Error): void => { console.log("getCurrentTopAbility callback2_0606 err end"); - callback(err, {}); + callback(err as BusinessError, {}); }); } getCurrentTopAbility(): Promise { @@ -484,7 +484,7 @@ class AbilityDelegatorInner implements AbilityDelegator { console.log("getCurrentTopAbility promise1_04"); let r: UIAbility = e as UIAbility; resolve(r); - }).catch((err: BusinessError): void => { + }).catch((err: Error): void => { reject(err); console.log("getCurrentTopAbility promise1 end"); }); diff --git a/frameworks/ets/ets/application/UIAbilityContext.ets b/frameworks/ets/ets/application/UIAbilityContext.ets index 6c40b91fe56..1b8360a5dd4 100644 --- a/frameworks/ets/ets/application/UIAbilityContext.ets +++ b/frameworks/ets/ets/application/UIAbilityContext.ets @@ -239,8 +239,8 @@ export default class UIAbilityContext extends Context { p1.then((e: NullishType) => { let retError = e as BusinessError; callback(retError, undefined); - },(err: BusinessError): void => { - callback(err, undefined); + },(err: Error): void => { + callback(err as BusinessError, undefined); }); } @@ -256,8 +256,8 @@ export default class UIAbilityContext extends Context { } else { reject(retError); } - }).catch((err: BusinessError): void => { - reject(err); + }).catch((err: Error): void => { + reject(err as BusinessError); }); }); return p; @@ -355,4 +355,4 @@ export default class UIAbilityContext extends Context { }); }); } -} \ No newline at end of file +} diff --git a/frameworks/ets/ets/caller/Caller.ets b/frameworks/ets/ets/caller/Caller.ets index 4493e3c6348..668debeae4a 100644 --- a/frameworks/ets/ets/caller/Caller.ets +++ b/frameworks/ets/ets/caller/Caller.ets @@ -67,7 +67,7 @@ export class CallerImpl implements Caller { } call(method: string, data: rpc.Parcelable): Promise { - return new Promise((resolve: (data: undefined)=>void, reject: (error: Object) => void): void => { + return new Promise((resolve: (data: undefined)=>void, reject: (error: Error) => void): void => { hilog.info(domainID, TAG, 'Caller call'); resolve(undefined); return; @@ -95,4 +95,4 @@ export class CallerImpl implements Caller { hilog.info(domainID, TAG, 'onRelease called'); this.nativeOnReleaseSync(new ReleaseCallback(callback)); } -} \ No newline at end of file +} -- Gitee