From f6ea78b7439233e54266ab3c1fece8f64f2f2360 Mon Sep 17 00:00:00 2001 From: ZhongNing Date: Tue, 22 Jul 2025 19:15:57 +0800 Subject: [PATCH 1/2] Add for SdkCommonDeprecatedApi Issue:https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICONQH Test scenarios: update Require Signed-off-by: ZhongNing --- ets2panda/linter/package.json | 7 +- ets2panda/linter/rule-config.json | 5 +- ets2panda/linter/src/lib/CookBookMsg.ts | 3 + ets2panda/linter/src/lib/FaultAttrs.ts | 3 + ets2panda/linter/src/lib/FaultDesc.ts | 3 + ets2panda/linter/src/lib/Problems.ts | 3 + ets2panda/linter/src/lib/TypeScriptLinter.ts | 781 +- .../linter/src/lib/data/SdkCommonList.json | 6450 +++++++++++++++++ .../consts/SdkCommonDeprecateWhiteList.ts | 64 + .../deprecatedapi/swiper_api.ets.arkts2.json | 16 +- .../test/sdkcommonapi/@ohos.convertxml.d.ts | 44 + .../sdkcommonapi/@ohos.util.ArrayList.d.ts | 22 + .../test/sdkcommonapi/@ohos.util.Vector.d.ts | 338 + .../linter/test/sdkcommonapi/@ohos.util.d.ts | 1191 +++ .../sdkcommonapi/api/@arkts.collections.d.ts | 38 + .../test/sdkcommonapi/api/@ohos.buffer.d.ts | 32 + .../test/sdkcommonapi/api/@ohos.url.d.ts | 54 + .../api/@ohos.util.LinkedList.d.ts | 23 + .../api/@ohos.util.PlainArray.d.ts | 27 + .../sdkcommonapi/api/@ohos.util.Queue.d.ts | 22 + .../sdkcommonapi/api/@ohos.util.Stack.d.ts | 18 + .../sdkcommonapi/api/@ohos.util.TreeMap.d.ts | 18 + .../sdkcommonapi/api/@ohos.util.json.d.ts | 21 + .../sdkcommonapi/collections_no_array_sdk.ets | 26 + .../collections_no_array_sdk.ets.args.json | 19 + .../collections_no_array_sdk.ets.arkts2.json | 248 + .../collections_no_array_sdk.ets.json | 17 + .../linter/test/sdkcommonapi/sdk_buffer.ets | 37 + .../sdkcommonapi/sdk_buffer.ets.args.json | 19 + .../sdkcommonapi/sdk_buffer.ets.arkts2.json | 98 + .../test/sdkcommonapi/sdk_buffer.ets.json | 28 + .../linter/test/sdkcommonapi/sdk_index.ets | 39 + .../test/sdkcommonapi/sdk_index.ets.args.json | 19 + .../sdkcommonapi/sdk_index.ets.arkts2.json | 68 + .../test/sdkcommonapi/sdk_index.ets.json | 17 + .../linter/test/sdkcommonapi/sdk_json.ets | 29 + .../test/sdkcommonapi/sdk_json.ets.args.json | 19 + .../sdkcommonapi/sdk_json.ets.arkts2.json | 78 + .../test/sdkcommonapi/sdk_json.ets.json | 17 + .../linter/test/sdkcommonapi/sdk_list.ets | 66 + .../test/sdkcommonapi/sdk_list.ets.args.json | 19 + .../sdkcommonapi/sdk_list.ets.arkts2.json | 158 + .../test/sdkcommonapi/sdk_list.ets.json | 48 + .../linter/test/sdkcommonapi/sdk_url.ets | 77 + .../test/sdkcommonapi/sdk_url.ets.args.json | 19 + .../test/sdkcommonapi/sdk_url.ets.arkts2.json | 438 ++ .../linter/test/sdkcommonapi/sdk_url.ets.json | 17 + .../linter/test/sdkcommonapi/sdk_util.ets | 137 + .../test/sdkcommonapi/sdk_util.ets.args.json | 19 + .../sdkcommonapi/sdk_util.ets.arkts2.json | 668 ++ .../test/sdkcommonapi/sdk_util.ets.json | 28 + .../linter/test/sdkcommonapi/sdk_util2.ets | 100 + .../test/sdkcommonapi/sdk_util2.ets.args.json | 19 + .../sdkcommonapi/sdk_util2.ets.arkts2.json | 448 ++ .../test/sdkcommonapi/sdk_util2.ets.json | 17 + .../linter/test/sdkcommonapi/sdk_vector.ets | 71 + .../sdkcommonapi/sdk_vector.ets.args.json | 19 + .../sdkcommonapi/sdk_vector.ets.arkts2.json | 428 ++ .../test/sdkcommonapi/sdk_vector.ets.json | 17 + .../linter/test/sdkcommonapi/sdk_xml.ets | 64 + .../test/sdkcommonapi/sdk_xml.ets.args.json | 19 + .../test/sdkcommonapi/sdk_xml.ets.arkts2.json | 508 ++ .../linter/test/sdkcommonapi/sdk_xml.ets.json | 58 + .../test/sdkcommonapi/symbol_iterator.ets | 18 + .../symbol_iterator.ets.args.json | 19 + .../symbol_iterator.ets.arkts2.json | 38 + .../sdkcommonapi/symbol_iterator.ets.json | 17 + 67 files changed, 13422 insertions(+), 93 deletions(-) create mode 100644 ets2panda/linter/src/lib/data/SdkCommonList.json create mode 100644 ets2panda/linter/src/lib/utils/consts/SdkCommonDeprecateWhiteList.ts create mode 100644 ets2panda/linter/test/sdkcommonapi/@ohos.convertxml.d.ts create mode 100644 ets2panda/linter/test/sdkcommonapi/@ohos.util.ArrayList.d.ts create mode 100644 ets2panda/linter/test/sdkcommonapi/@ohos.util.Vector.d.ts create mode 100644 ets2panda/linter/test/sdkcommonapi/@ohos.util.d.ts create mode 100644 ets2panda/linter/test/sdkcommonapi/api/@arkts.collections.d.ts create mode 100644 ets2panda/linter/test/sdkcommonapi/api/@ohos.buffer.d.ts create mode 100644 ets2panda/linter/test/sdkcommonapi/api/@ohos.url.d.ts create mode 100644 ets2panda/linter/test/sdkcommonapi/api/@ohos.util.LinkedList.d.ts create mode 100644 ets2panda/linter/test/sdkcommonapi/api/@ohos.util.PlainArray.d.ts create mode 100644 ets2panda/linter/test/sdkcommonapi/api/@ohos.util.Queue.d.ts create mode 100644 ets2panda/linter/test/sdkcommonapi/api/@ohos.util.Stack.d.ts create mode 100644 ets2panda/linter/test/sdkcommonapi/api/@ohos.util.TreeMap.d.ts create mode 100644 ets2panda/linter/test/sdkcommonapi/api/@ohos.util.json.d.ts create mode 100644 ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets create mode 100755 ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets.args.json create mode 100755 ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets.arkts2.json create mode 100755 ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets.args.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets.arkts2.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_index.ets create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_index.ets.args.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_index.ets.arkts2.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_index.ets.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_json.ets create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_json.ets.args.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_json.ets.arkts2.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_json.ets.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_list.ets create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_list.ets.args.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_list.ets.arkts2.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_list.ets.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_url.ets create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_url.ets.args.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_url.ets.arkts2.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_url.ets.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_util.ets create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_util.ets.args.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_util.ets.arkts2.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_util.ets.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_util2.ets create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_util2.ets.args.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_util2.ets.arkts2.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_util2.ets.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_vector.ets create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_vector.ets.args.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_vector.ets.arkts2.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_vector.ets.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_xml.ets create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.args.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.arkts2.json create mode 100755 ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.json create mode 100755 ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets create mode 100755 ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets.args.json create mode 100755 ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets.arkts2.json create mode 100755 ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets.json diff --git a/ets2panda/linter/package.json b/ets2panda/linter/package.json index 0db61d9e69..c31c058543 100644 --- a/ets2panda/linter/package.json +++ b/ets2panda/linter/package.json @@ -20,12 +20,13 @@ "pack:linter": "rimraf bundle && mkdir bundle && npm pack && mv panda-tslinter-*.tgz bundle", "pretest": " npm run fix", "test": "npm run test_all && npm run test_ts_import_ets", - "test_all": "npm run testrunner -- -d test/main,test/rules,test/regression,test/extended_features,test/migration,test/ohmurl,test/interop,test/sdkwhite,test/concurrent,test/builtin,test/deprecatedapi", + "test_all": "npm run testrunner -- -d test/main,test/rules,test/regression,test/extended_features,test/migration,test/ohmurl,test/interop,test/sdkwhite,test/concurrent,test/builtin,test/deprecatedapi,test/sdkcommonapi", "test_main": "npm run testrunner -- -d test/main", "test_ohmurl": "npm run testrunner -- -d test/ohmurl", "test_interop": "npm run testrunner -- -d test/interop", "test_sdk": "npm run testrunner -- -d test/sdkwhite", "test_deprecatedapi": "npm run testrunner -- -d test/deprecatedapi", + "test_sdkcommonapi": "npm run testrunner -- -d test/sdkcommonapi", "test_concurrent": "npm run testrunner -- -d test/concurrent", "test_rules": "npm run testrunner -- -d test/rules", "test_regression": "npm run testrunner -- -d test/regression", @@ -37,7 +38,7 @@ "test_ts_import_ets": "npm run testrunner -- -d test/ts_import_ets/ts --sdk --interop-mode", "test_migration": "npm run testrunner -- -d test/migration", "testrunner": "npm run compile && node build/testRunner/TestRunner.js", - "update-tests": "node scripts/update-test-results.mjs test/main test/rules test/regression test/extended_features test/ts_import_ets/ts test/migration test/ohmurl test/interop test/sdkwhite test/concurrent test/builtin test/deprecatedapi", + "update-tests": "node scripts/update-test-results.mjs test/main test/rules test/regression test/extended_features test/ts_import_ets/ts test/migration test/ohmurl test/interop test/sdkwhite test/concurrent test/builtin test/deprecatedapi test/sdkcommonapi", "eslint-check": "npx eslint .", "eslint-fix": "npm run eslint-check -- --fix", "prettier-fix": "npx prettier --write .", @@ -45,7 +46,7 @@ "coverage": "npm run coverage-prepare && npm run coverage-instrument && npm run coverage-test && npm run coverage-collect && npm run coverage-report", "coverage-prepare": "npm run build && node scripts/testRunner/coverage_prepare.js", "coverage-instrument": "nyc --compact false instrument build coverage/build_instrument", - "coverage-test": "node coverage/build_instrument/testRunner/TestRunner.js -d test/main,test/rules,test/regression,test/extended_features,test/migration,test/ohmurl,test/interop,test/sdkwhite,test/concurrent,test/builtin,test/deprecatedapi", + "coverage-test": "node coverage/build_instrument/testRunner/TestRunner.js -d test/main,test/rules,test/regression,test/extended_features,test/migration,test/ohmurl,test/interop,test/sdkwhite,test/concurrent,test/builtin,test/deprecatedapi,test/sdkcommonapi", "coverage-collect": "node scripts/testRunner/coverage_collect.js", "coverage-report": "node scripts/testRunner/coverage_report.js" }, diff --git a/ets2panda/linter/rule-config.json b/ets2panda/linter/rule-config.json index 611a033828..e89808b662 100644 --- a/ets2panda/linter/rule-config.json +++ b/ets2panda/linter/rule-config.json @@ -133,7 +133,10 @@ "arkui-no-deprecated-api", "arkui-buildernode-generic-no-tuple", "arkui-buildernode-update-no-literal", - "arkui-buildernode-no-nestingbuildersupported" + "arkui-buildernode-no-nestingbuildersupported", + "arkui-sdk-common-deprecated-api", + "arkui-sdk-common-whitelist-api", + "arkui-sdk-common-behaviorchange-api" ], "builtin": [ "arkts-builtin-thisArgs", diff --git a/ets2panda/linter/src/lib/CookBookMsg.ts b/ets2panda/linter/src/lib/CookBookMsg.ts index f0b8e41253..5daab2724c 100644 --- a/ets2panda/linter/src/lib/CookBookMsg.ts +++ b/ets2panda/linter/src/lib/CookBookMsg.ts @@ -407,6 +407,9 @@ cookBookTag[381] = cookBookTag[382] = 'Promiseconstructor only supports using resolve (undefined) (arkts-promise-with-void-type-need-undefined-as-resolve-arg)'; cookBookTag[399] = 'ArkUI deprecated api check (arkui-no-deprecated-api)'; +cookBookTag[400] = 'ArkUI sdk common deprecated api check (arkui-sdk-common-deprecated-api)'; +cookBookTag[401] = 'ArkUI sdk common whitelist api check (arkui-sdk-common-whitelist-api)'; +cookBookTag[402] = 'ArkUI sdk common behavior change api check (arkui-sdk-common-behaviorchange-api)'; for (let i = 0; i <= cookBookTag.length; i++) { cookBookMsg[i] = ''; diff --git a/ets2panda/linter/src/lib/FaultAttrs.ts b/ets2panda/linter/src/lib/FaultAttrs.ts index 8ace468f16..2518ad5306 100644 --- a/ets2panda/linter/src/lib/FaultAttrs.ts +++ b/ets2panda/linter/src/lib/FaultAttrs.ts @@ -286,3 +286,6 @@ faultsAttrs[FaultID.UnsupportOperator] = new FaultAttributes(378); faultsAttrs[FaultID.StateStylesBlockNeedArrowFunc] = new FaultAttributes(381); faultsAttrs[FaultID.PromiseVoidNeedResolveArg] = new FaultAttributes(382); faultsAttrs[FaultID.NoDeprecatedApi] = new FaultAttributes(399); +faultsAttrs[FaultID.SdkCommonApiDeprecated] = new FaultAttributes(400); +faultsAttrs[FaultID.SdkCommonApiWhiteList] = new FaultAttributes(401); +faultsAttrs[FaultID.SdkCommonApiBehaviorChange] = new FaultAttributes(402); diff --git a/ets2panda/linter/src/lib/FaultDesc.ts b/ets2panda/linter/src/lib/FaultDesc.ts index d812eab323..edff8a207c 100644 --- a/ets2panda/linter/src/lib/FaultDesc.ts +++ b/ets2panda/linter/src/lib/FaultDesc.ts @@ -275,3 +275,6 @@ faultDesc[FaultID.BuilderNodeGenericNoTuple] = 'Generic of "BuilderNode" does no faultDesc[FaultID.BuilderNodeUpdateNoLiteral] = '"update" interface of "BuilderNode" cannot pass an object literal'; faultDesc[FaultID.BuilderNodeNoNestingBuilderSupported] = '"nestingBuilderSupported" is not supported'; faultDesc[FaultID.NoESObjectSupport] = 'ESObject type cannot be used'; +faultDesc[FaultID.SdkCommonApiDeprecated] = 'ArkUI sdk common deprecated api check'; +faultDesc[FaultID.SdkCommonApiWhiteList] = 'ArkUI sdk common whiteList api check'; +faultDesc[FaultID.SdkCommonApiBehaviorChange] = 'ArkUI sdk common behavior change api check'; diff --git a/ets2panda/linter/src/lib/Problems.ts b/ets2panda/linter/src/lib/Problems.ts index dd700b4ed5..364df2a5c4 100644 --- a/ets2panda/linter/src/lib/Problems.ts +++ b/ets2panda/linter/src/lib/Problems.ts @@ -275,6 +275,9 @@ export enum FaultID { BuilderNodeGenericNoTuple, BuilderNodeUpdateNoLiteral, BuilderNodeNoNestingBuilderSupported, + SdkCommonApiDeprecated, + SdkCommonApiWhiteList, + SdkCommonApiBehaviorChange, // this should always be last enum LAST_ID } diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index fb73dd0e1c..f1da2a31d5 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -130,7 +130,24 @@ import { ApiList, SdkProblem, SdkNameInfo } from './utils/consts/SdkWhitelist'; import * as apiWhiteList from './data/SdkWhitelist.json'; import * as builtinWhiteList from './data/BuiltinList.json'; import * as deprecatedApiList from './data/DeprecatedApiList.json'; -import { DEPRECATE_CHECK_KEY, DEPRECATE_UNNAMED } from './utils/consts/DeprecateWhiteList'; +import * as sdkCommonList from './data/SdkCommonList.json'; +import { + SdkCommonApiProblemInfos, + SDK_COMMON_TRANSFORMER, + SDK_COMMON_CONSTRUCTOR, + SDK_COMMON_VOID, + SDK_COMMON_SYMBOL_ITERATOR, + SDK_COMMON_SYMBOL_ITERATOR_APINAME, + sdkCommonAllDeprecatedFullTypeName, + sdkCommonAllDeprecatedTypeName, + SDK_COMMON_INDEX_CLASS, + SDK_COMMON_BUFFER_API, + SDK_COMMON_FUNCTIONLIKE, + SDK_COMMON_PROPERTYLIKE, + SDK_COMMON_CONSTRUCTORLIKE, + SDK_COMMON_TYPEKEY +} from './utils/consts/SdkCommonDeprecateWhiteList'; +import { DeprecateProblem, DEPRECATE_CHECK_KEY, DEPRECATE_UNNAMED } from './utils/consts/DeprecateWhiteList'; import { BuiltinProblem, SYMBOL_ITERATOR, @@ -175,6 +192,7 @@ import type { BaseClassConstructorInfo, ConstructorParameter, ExtendedIdentifier import { ExtendedIdentifierType } from './utils/consts/Types'; import { STRING_ERROR_LITERAL } from './utils/consts/Literals'; import { ES_OBJECT } from './utils/consts/ESObject'; +import { cookBookMsg } from './CookBookMsg'; export class TypeScriptLinter extends BaseTypeScriptLinter { supportedStdCallApiChecker: SupportedStdCallApiChecker; @@ -190,11 +208,16 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { static nameSpaceFunctionCache: Map>; private readonly constVariableInitCache: Map = new Map(); static funcMap: Map>> = new Map>>(); + static sdkCommonFuncMap: Map>>; private interfaceMap: Map> = new Map>(); static pathMap: Map>; static indexedTypeSet: Set; static globalApiInfo: Map>; static deprecatedApiInfo: Set; + static sdkCommonApiInfo: Set; + static sdkCommonSymbotIterSet: Set; + static sdkCommonAllDeprecatedTypeNameSet: Set; + static sdkCommonIndexClassSet: Map; static symbotIterSet: Set; static missingAttributeSet: Set; static literalAsPropertyNameTypeSet: Set; @@ -208,13 +231,19 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { TypeScriptLinter.pathMap = new Map>(); TypeScriptLinter.globalApiInfo = new Map>(); TypeScriptLinter.deprecatedApiInfo = new Set(); + TypeScriptLinter.sdkCommonApiInfo = new Set(); TypeScriptLinter.funcMap = new Map>>(); + TypeScriptLinter.sdkCommonFuncMap = new Map>>(); TypeScriptLinter.symbotIterSet = new Set(); + TypeScriptLinter.sdkCommonSymbotIterSet = new Set(); + TypeScriptLinter.sdkCommonAllDeprecatedTypeNameSet = new Set(); + TypeScriptLinter.sdkCommonIndexClassSet = new Map(); TypeScriptLinter.missingAttributeSet = new Set(); TypeScriptLinter.initSdkWhitelist(); TypeScriptLinter.initSdkBuiltinInfo(); TypeScriptLinter.initBuiltinlist(); TypeScriptLinter.initDeprecatedApiList(); + TypeScriptLinter.initSdkCommonApilist(); } initSdkInfo(): void { @@ -333,6 +362,41 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } + private static initSdkCommonApilist(): void { + const list: ApiList = new ApiList(sdkCommonList); + if (list?.api_list?.length > 0) { + for (const item of list.api_list) { + const parent_api_name = item.api_info.parent_api[0].api_name; + if (item.api_info.problem === BuiltinProblem.LimitedThisArg) { + TypeScriptLinter.initSdkCommonThisArgsWhitelist(item); + } else if (item.api_info.api_name === SDK_COMMON_SYMBOL_ITERATOR_APINAME) { + TypeScriptLinter.sdkCommonSymbotIterSet.add(item); + } else if (sdkCommonAllDeprecatedTypeName.has(parent_api_name)) { + TypeScriptLinter.sdkCommonAllDeprecatedTypeNameSet.add(item); + } else { + this.sdkCommonApiInfo.add(item); + if (SDK_COMMON_INDEX_CLASS.has(parent_api_name)) { + const combinedPaths = [...item.import_path, item.file_path]; + TypeScriptLinter.sdkCommonIndexClassSet.set(parent_api_name, combinedPaths); + } + } + } + } + } + + static initSdkCommonThisArgsWhitelist(item: ApiListItem): void { + if (item.file_path === '' || !item.api_info.api_name || item.api_info.parent_api?.length <= 0) { + return; + } + const key = item.api_info.api_name + '_' + item.api_info.parent_api[0].api_name; + let funcApiInfos: Map> | undefined = TypeScriptLinter.sdkCommonFuncMap.get(key); + if (!funcApiInfos) { + funcApiInfos = new Map>(); + TypeScriptLinter.sdkCommonFuncMap.set(key, funcApiInfos); + } + TypeScriptLinter.addOrUpdateData(funcApiInfos, path.basename(item.file_path), item.api_info); + } + private static initDeprecatedApiList(): void { const list: ApiList = new ApiList(deprecatedApiList); if (list?.api_list?.length > 0) { @@ -4836,6 +4900,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.fixJsImportElementAccessExpression(tsElementAccessExpr); this.checkInterOpImportJsIndex(tsElementAccessExpr); this.checkEnumGetMemberValue(tsElementAccessExpr); + this.handleNoDeprecatedApi(tsElementAccessExpr); } private checkPropertyAccessByIndex( @@ -5178,8 +5243,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (!this.options.arkts2) { this.handleStdlibAPICall(tsCallExpr, calleeSym, name, parName); this.handleFunctionApplyBindPropCall(tsCallExpr, calleeSym); - } else { - this.handleBuiltinThisArgs(tsCallExpr, calleeSym, name, parName); + } else if (parName) { + this.handleSdkApiThisArgs(tsCallExpr, calleeSym, name, parName); + this.handleSdkApiThisArgs(tsCallExpr, calleeSym, name, parName, true); } if (TsUtils.symbolHasEsObjectType(calleeSym)) { const faultId = this.options.arkts2 ? FaultID.EsValueTypeError : FaultID.EsValueType; @@ -5929,27 +5995,22 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } - private handleBuiltinThisArgs( + private handleSdkApiThisArgs( callExpr: ts.CallExpression, calleeSym: ts.Symbol, name: string, - parName: string | undefined + parName: string | undefined, + isSdkCommon?: boolean ): void { - if (parName === undefined) { - return; - } - - const builtinThisArgsInfos = TypeScriptLinter.funcMap.get(name); + const builtinThisArgsInfos = isSdkCommon ? + TypeScriptLinter.sdkCommonFuncMap.get(name + '_' + parName) : + TypeScriptLinter.funcMap.get(name); if (!builtinThisArgsInfos) { return; } const sourceFile = calleeSym?.declarations?.[0]?.getSourceFile(); - if (!sourceFile) { - return; - } - - const fileName = path.basename(sourceFile.fileName); + const fileName = path.basename(sourceFile?.fileName + ''); const builtinInfos = builtinThisArgsInfos.get(fileName); if (!(builtinInfos && builtinInfos.size > 0)) { return; @@ -8138,14 +8199,12 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } else if (ts.isIdentifier(expr)) { this.fixJsImportExtendsClass(node.parent, expr); } - if (ts.isIdentifier(expr)) { - this.handleNoDeprecatedApi(expr); - } }); this.handleInterfaceFieldImplementation(node); this.handleMissingSuperCallInExtendedClass(node); this.handleFieldTypesMatchingBetweenDerivedAndBaseClass(node); this.checkReadonlyOverridesFromBase(node); + this.handleNoDeprecatedApi(node); } } @@ -8406,19 +8465,24 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (!parent) { return; } - - if (ts.isPropertyAccessExpression(parent)) { - this.checkCollectionsForPropAccess(parent, parent.name); - - return; - } - - if (ts.isQualifiedName(parent)) { - this.checkCollectionsForPropAccess(parent, parent.right); - - return; + const shouldSkipFix = TypeScriptLinter.shouldSkipFixForCollectionsArray(node); + if (shouldSkipFix) { + if (ts.isPropertyAccessExpression(parent)) { + this.incrementCounters(node, FaultID.NoNeedStdLibSendableContainer); + } + if (ts.isQualifiedName(parent)) { + this.incrementCounters(node, FaultID.NoNeedStdLibSendableContainer); + } + } else { + if (ts.isPropertyAccessExpression(parent)) { + this.checkCollectionsForPropAccess(parent, parent.name); + return; + } + if (ts.isQualifiedName(parent)) { + this.checkCollectionsForPropAccess(parent, parent.right); + return; + } } - if (ts.isImportSpecifier(parent) && ts.isIdentifier(node)) { const bitVectorUsed = this.checkBitVector(node.getSourceFile()); @@ -8441,6 +8505,36 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.checkNodeForUsage(node, COLLECTIONS_TEXT, COLLECTIONS_MODULES, cb); } + private static shouldSkipFixForCollectionsArray(node: ts.Node): boolean { + const isArrayWithNumericArg = (n: ts.Node | undefined): boolean => { + return !!( + n && + ts.isNewExpression(n) && + ts.isPropertyAccessExpression(n.expression) && + n.expression.name.text === 'Array' && + n.arguments?.some((arg) => { + return ts.isNumericLiteral(arg); + }) + ); + }; + if (isArrayWithNumericArg(node.parent)) { + return true; + } + + let currentNode: ts.Node | undefined = node; + while (currentNode) { + if (ts.isVariableDeclaration(currentNode)) { + if (isArrayWithNumericArg(currentNode.initializer)) { + return true; + } + break; + } + currentNode = currentNode.parent; + } + + return false; + } + private checkWorkerSymbol(symbol: ts.Symbol, node: ts.Node): void { const cb = (): void => { this.incrementCounters(node, FaultID.NoNeedStdlibWorker); @@ -8581,7 +8675,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { returnType, fileName ); - return this.isMatchedDeprecatedApi(node.getText(), deprecatedApiCheckMap); + return this.getFaultIdWithMatchedDeprecatedApi(node.getText(), deprecatedApiCheckMap).length > 0; } private static isWrappedByExtendDecorator(node: ts.Identifier): boolean { @@ -9837,7 +9931,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (set.size === 0 || decl.getText() !== name) { return false; } - const symbol = this.tsUtils.trueSymbolAtLocation(decl); const sourceFile = symbol?.declarations?.[0]?.getSourceFile(); if (!sourceFile) { @@ -10410,20 +10503,20 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return; } - this.handleExtendCustomClass(node.parent, extendedClassInfo); + this.handleExtendCustomClass(node.parent, extendedClassInfo, identInfo.decl.name?.text + ''); } } private handleExtendCustomClass( classDecl: ts.ClassDeclaration, - extendedClassInfo: Set + extendedClassInfo: Set, + extendedClassName: string ): void { const superCall = TypeScriptLinter.checkIfSuperCallExists(classDecl); if (!superCall) { this.incrementCounters(classDecl, FaultID.MissingSuperCall); return; } - outer: for (const ctorParams of extendedClassInfo) { const matches: boolean[] = []; if (superCall.arguments.length > ctorParams.length) { @@ -10444,6 +10537,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { ) { continue; } + this.handleExtendCustomClassForSdkCommonApiDeprecated(extendedClassName, superCall); return; } @@ -10495,6 +10589,34 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { ); } + private handleExtendCustomClassForSdkCommonApiDeprecated( + extendedClassName: string, + superCall: ts.CallExpression + ): void { + const problemStr = TypeScriptLinter.getFaultIdSdkCommonApiInfoWithConstructorDecl(extendedClassName); + if (problemStr) { + const faultID = sdkCommonAllDeprecatedTypeName.has(extendedClassName) ? + FaultID.SdkCommonApiDeprecated : + TypeScriptLinter.getFinalSdkFaultIdByProblem(problemStr); + this.incrementCounters( + superCall, + faultID, + undefined, + TypeScriptLinter.getErrorMsgForSdkCommonApi(extendedClassName, faultID) + ); + } + } + + private static getErrorMsgForSdkCommonApi(name: string, faultID: number): string { + let errorMsg = cookBookMsg[faultID]; + if (faultID === FaultID.SdkCommonApiDeprecated || faultID === FaultID.SdkCommonApiWhiteList) { + errorMsg = `The "${name}" in SDK is no longer supported.(sdk-method-not-supported)`; + } else if (faultID === FaultID.SdkCommonApiBehaviorChange) { + errorMsg = `The "${name}" in SDK has been changed.(sdk-method-changed)`; + } + return errorMsg; + } + private checkIfArgumentAndParamMatches(param: ConstructorParameter, argument: ts.Expression): boolean { const typeNode = this.tsTypeChecker.getTypeAtLocation(argument); const typeString = this.tsTypeChecker.typeToString(typeNode); @@ -12967,6 +13089,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { | ts.MethodDeclaration | ts.PropertyAssignment | ts.PropertyAccessExpression + | ts.ElementAccessExpression + | ts.HeritageClause ): void { if (!this.options.arkts2) { return; @@ -12975,7 +13099,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { case ts.SyntaxKind.TypeReference: this.checkTypeReferenceForDeprecatedApi(node); break; - case ts.SyntaxKind.Identifier: + case ts.SyntaxKind.HeritageClause: this.checkHeritageClauseForDeprecatedApi(node); break; case ts.SyntaxKind.PropertyDeclaration: @@ -12995,6 +13119,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { case ts.SyntaxKind.CallExpression: case ts.SyntaxKind.BinaryExpression: case ts.SyntaxKind.PropertyAccessExpression: + case ts.SyntaxKind.ElementAccessExpression: this.handleNoDeprecatedApiForExpression(node); break; default: @@ -13002,7 +13127,12 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } handleNoDeprecatedApiForExpression( - node: ts.NewExpression | ts.CallExpression | ts.BinaryExpression | ts.PropertyAccessExpression + node: + | ts.NewExpression + | ts.CallExpression + | ts.BinaryExpression + | ts.PropertyAccessExpression + | ts.ElementAccessExpression ): void { switch (node.kind) { case ts.SyntaxKind.NewExpression: @@ -13017,16 +13147,77 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { case ts.SyntaxKind.PropertyAccessExpression: this.checkPropertyAccessExpressionForDeprecatedApi(node); break; + case ts.SyntaxKind.ElementAccessExpression: + this.checkSdkCommonOnElementAccess(node); + break; default: } } + private checkSdkCommonOnElementAccess(elemAccessExp: ts.ElementAccessExpression): void { + const indexAccess = elemAccessExp.argumentExpression; + if (!indexAccess || !ts.isNumericLiteral(indexAccess)) { + return; + } + let express = elemAccessExp.expression; + const isNewExpression = ts.isNewExpression(elemAccessExp.expression); + if (isNewExpression) { + express = elemAccessExp.expression.expression; + } + const exprSym = this.tsUtils.trueSymbolAtLocation(express); + const exprDecl = TsUtils.getDeclaration(exprSym); + if (!exprDecl) { + return; + } + if (exprSym && isNewExpression) { + this.reportForSdkCommonOnElementAccess( + elemAccessExp, + exprSym.name, + path.basename(exprDecl.getSourceFile().fileName) + ); + return; + } + if (!ts.isVariableDeclaration(exprDecl)) { + return; + } + const initializer = exprDecl.initializer; + + if (!initializer || !ts.isNewExpression(initializer)) { + return; + } + const constructorIdentifier = initializer.expression; + if (!constructorIdentifier || !ts.isIdentifier(constructorIdentifier)) { + return; + } + const decl = this.tsUtils.getDeclarationNode(constructorIdentifier); + this.reportForSdkCommonOnElementAccess( + elemAccessExp, + constructorIdentifier.text, + path.basename(decl?.getSourceFile().fileName + '') + ); + } + + private reportForSdkCommonOnElementAccess(node: ts.Node, importName: string, filePath: string): void { + if (TypeScriptLinter.isImportedFromOhos(importName, filePath)) { + this.incrementCounters( + node, + FaultID.SdkCommonApiWhiteList, + undefined, + TypeScriptLinter.getErrorMsgForSdkCommonApi(importName, FaultID.SdkCommonApiWhiteList) + ); + } + } + private checkTypeReferenceForDeprecatedApi(node: ts.TypeReferenceNode): void { let typeName = node.typeName; if (ts.isQualifiedName(node.typeName)) { typeName = node.typeName.right; } - const decl = this.tsUtils.getDeclarationNode(typeName); + const sym = this.tsUtils.trueSymbolAtLocation(typeName); + const decl = TsUtils.getDeclaration(sym); + if (sym) { + this.hanldeSdkCommonTypeName(node, sym, sym.name, decl); + } if (decl && (ts.isInterfaceDeclaration(decl) || ts.isClassDeclaration(decl))) { let parentName = decl.name ? decl.name.text : 'unnamed'; if (ts.isQualifiedName(node.typeName)) { @@ -13044,6 +13235,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private checkNewExpressionForDeprecatedApi(node: ts.NewExpression): void { const expression = node.expression; + this.checkNewExpressionForSdkCommonApi(node); if (ts.isIdentifier(expression)) { const decl = this.tsUtils.getDeclarationNode(expression); if (decl && ts.isClassDeclaration(decl)) { @@ -13058,16 +13250,101 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } - private checkHeritageClauseForDeprecatedApi(node: ts.Identifier): void { + private checkNewExpressionForSdkCommonApi(newExpr: ts.NewExpression): void { + const type = this.tsTypeChecker.getTypeAtLocation(newExpr.expression); + const resolvedSignature = this.tsTypeChecker.getResolvedSignature(newExpr); + if (!resolvedSignature) { + return; + } + const constructorDeclaration = resolvedSignature.declaration; + const parentName = type.symbol ? + this.tsTypeChecker.getFullyQualifiedName(type.symbol) : + newExpr.expression.getText(); + if (constructorDeclaration) { + const deprecatedApiCheckMap = TypeScriptLinter.updateDeprecatedApiCheckMap( + parentName, + constructorDeclaration.parameters as ts.NodeArray, + SDK_COMMON_VOID, + path.basename(constructorDeclaration.getSourceFile().fileName + '') + ); + this.processApiNodeDeprecatedApi( + SDK_COMMON_CONSTRUCTOR, + newExpr.expression, + deprecatedApiCheckMap, + undefined, + true + ); + } + } + + private checkHeritageClauseForDeprecatedApi(node: ts.HeritageClause): void { + node.types.forEach((type) => { + let expr = type.expression; + if (ts.isIdentifier(expr)) { + this.checkHeritageClauseForDeprecatedApiOnIdentifier(expr); + } + if (ts.isPropertyAccessExpression(type.expression) && ts.isIdentifier(type.expression.name)) { + expr = type.expression.name; + } + const decl = this.tsUtils.getDeclarationNode(expr); + this.checkHeritageClauseForSdkCommonApiDeprecated(node, decl); + }); + } + + private checkHeritageClauseForSdkCommonApiDeprecated(node: ts.HeritageClause, decl: ts.Node | undefined): void { + if ( + decl && + (ts.isClassDeclaration(decl) || ts.isInterfaceDeclaration(decl)) && + ts.isClassDeclaration(node.parent) && + decl.name + ) { + const extendClassName = decl.name.text; + if (TypeScriptLinter.checkIsSameAsParenName(extendClassName)) { + const sourceFunlikeArrs = node.parent.members.filter(ts.isFunctionLike); + const sourceProDeclArrs = node.parent.members.filter(ts.isPropertyDeclaration); + this.checkSdkCommonApiInfoWithClassMember(sourceFunlikeArrs, extendClassName, SDK_COMMON_TYPEKEY[0]); + this.checkSdkCommonApiInfoWithClassMember(sourceProDeclArrs, extendClassName, SDK_COMMON_TYPEKEY[1]); + } + } + } + + private checkSdkCommonApiInfoWithClassMember( + sourceMembers: ts.ClassElement[] | ts.PropertyDeclaration[], + extendClassName: string, + typeKey: string + ): void { + sourceMembers.some((func) => { + const funcName = func.name?.getText(); + if (!funcName) { + return; + } + const problemStr = TypeScriptLinter.getFaultIdSdkCommonApiInfoWithClassMember(extendClassName, funcName, typeKey); + if (problemStr) { + const faultID = sdkCommonAllDeprecatedTypeName.has(extendClassName) ? + FaultID.SdkCommonApiDeprecated : + TypeScriptLinter.getFinalSdkFaultIdByProblem(problemStr); + this.incrementCounters( + func, + faultID, + undefined, + TypeScriptLinter.getErrorMsgForSdkCommonApi(extendClassName, faultID) + ); + } + }); + } + + private checkHeritageClauseForDeprecatedApiOnIdentifier(node: ts.Identifier): void { + const sym = this.tsUtils.trueSymbolAtLocation(node); const decl = this.tsUtils.getDeclarationNode(node); - if (decl && ts.isInterfaceDeclaration(decl)) { + if (decl && (ts.isInterfaceDeclaration(decl) || ts.isClassDeclaration(decl))) { const deprecatedApiCheckMap = TypeScriptLinter.updateDeprecatedApiCheckMap( - decl.name.text, + decl.name?.getText() + '', undefined, undefined, path.basename(decl.getSourceFile().fileName + '') ); this.processApiNodeDeprecatedApi(node.getText(), node, deprecatedApiCheckMap); + this.hanldeSdkCommonTypeName(node, sym, decl.name?.getText() + '', decl); } } @@ -13120,36 +13397,97 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (!funSymbol && ts.isPropertyAccessExpression(node.expression)) { funSymbol = this.tsTypeChecker.getSymbolAtLocation(node.expression.expression); } + const isNeedGetResolvedSignature = funSymbol?.declarations && funSymbol.declarations.length > 1; const decl = TsUtils.getDeclaration(funSymbol); const parName = this.tsUtils.getParentSymbolName(funSymbol); + this.handleCallExpressionBufferIndexOf(node, name, parName + '', funSymbol, decl); + const deprecatedApiCheckMap = TypeScriptLinter.getDeprecatedApiCheckMapForCallExpression(decl, parName); + this.reportDeprecatedApi(node, name, deprecatedApiCheckMap); + this.checkCallExpressionForSdkCommonApi(node, name, parName, !!isNeedGetResolvedSignature, deprecatedApiCheckMap); + this.checkSpecialApiForDeprecatedApi(node, name, decl); + } + + private static getDeprecatedApiCheckMapForCallExpression( + decl: ts.Node | undefined, + parName: string | undefined + ): Map> | undefined { if (decl && (ts.isFunctionLike(decl) || ts.isVariableDeclaration(decl))) { - const returnType = decl.type?.getText() === undefined ? 'any' : decl.type?.getText() + ''; const deprecatedApiCheckMap = TypeScriptLinter.updateDeprecatedApiCheckMap( parName === undefined ? DEPRECATE_UNNAMED : parName + '', ts.isFunctionLike(decl) ? decl.parameters : undefined, - returnType, + decl.type?.getText() === undefined ? 'any' : decl.type?.getText() + '', path.basename(decl.getSourceFile().fileName) ); - this.reportDeprecatedApi(node, name, deprecatedApiCheckMap); + return deprecatedApiCheckMap; } - this.checkSpecialApiForDeprecatedApi(node, name, decl); + return undefined; + } + + private checkCallExpressionForSdkCommonApi( + node: ts.CallExpression, + name: ts.Identifier, + parName: string | undefined, + isNeedGetResolvedSignature: boolean, + deprecatedApiCheckMap: Map> | undefined + ): void { + if (isNeedGetResolvedSignature) { + this.checkCallExpressionForSdkCommonApiWithSignature(node, name, parName); + } else { + this.reportDeprecatedApi(node, name, deprecatedApiCheckMap, true); + } + } + + private checkCallExpressionForSdkCommonApiWithSignature( + node: ts.CallExpression, + name: ts.Identifier, + parName: string | undefined + ): void { + const signature = this.tsTypeChecker.getResolvedSignature(node); + if (!signature?.declaration) { + return; + } + const functionSymbol = this.getFunctionSymbol(signature.declaration); + const functionDeclaration = functionSymbol?.valueDeclaration; + if (!functionDeclaration) { + return; + } + const returnType = this.tsTypeChecker.typeToString(signature.getReturnType()); + const deprecatedApiCheckMap = TypeScriptLinter.updateDeprecatedApiCheckMap( + parName === undefined ? '' : parName + '', + TypeScriptLinter.getParameterDeclarationsBySignature(signature), + returnType, + path.basename(functionDeclaration.getSourceFile().fileName) + ); + this.reportDeprecatedApi(node, name, deprecatedApiCheckMap, true); } private reportDeprecatedApi( node: ts.CallExpression, name: ts.Identifier, - deprecatedApiCheckMap?: Map> + deprecatedApiCheckMap?: Map>, + isSdkCommon?: boolean ): void { - const isMatched = this.isMatchedDeprecatedApi(name.text, deprecatedApiCheckMap); - if (isMatched) { + const problemStr = this.getFaultIdWithMatchedDeprecatedApi(name.text, deprecatedApiCheckMap, isSdkCommon); + if (problemStr.length > 0) { const autofix = this.autofixer?.fixDeprecatedApiForCallExpression(node); if (autofix) { this.interfacesNeedToImport.add('getUIContext'); } - this.incrementCounters(name, FaultID.NoDeprecatedApi, autofix); + const faultID = isSdkCommon ? TypeScriptLinter.getFinalSdkFaultIdByProblem(problemStr) : FaultID.NoDeprecatedApi; + this.incrementCounters( + name, + faultID, + isSdkCommon ? undefined : autofix, + isSdkCommon ? TypeScriptLinter.getErrorMsgForSdkCommonApi(name.text, faultID) : undefined + ); } } + private static getFinalSdkFaultIdByProblem(problem: string): number { + const sdkFaultId = SdkCommonApiProblemInfos.get(problem); + return sdkFaultId ? sdkFaultId : FaultID.SdkCommonApiWhiteList; + } + private checkSpecialApiForDeprecatedApi( node: ts.CallExpression, name: ts.Identifier, @@ -13239,12 +13577,20 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.processApiNodeDeprecatedApi( expression.getText(), expression, - TypeScriptLinter.getPropertyTypeForPropertyAssignment(node, contextualType) + this.getPropertyTypeForPropertyAssignment(node, contextualType) + ); + this.processApiNodeDeprecatedApi( + expression.getText(), + expression, + this.getPropertyTypeForPropertyAssignment(node, contextualType, true), + undefined, + true ); } } private checkPropertyAccessExpressionForDeprecatedApi(node: ts.PropertyAccessExpression): void { + this.handleSymbolIteratorForSdkCommon(node); node.forEachChild((expression) => { if (!ts.isIdentifier(expression)) { return; @@ -13252,14 +13598,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const funSymbol = this.tsUtils.trueSymbolAtLocation(expression); const decl = TsUtils.getDeclaration(funSymbol); let parName = this.tsUtils.getParentSymbolName(funSymbol); - if ( - decl && - (ts.isPropertyDeclaration(decl) || - ts.isPropertySignature(decl) || - ts.isEnumMember(decl) || - ts.isEnumDeclaration(decl)) && - decl.parent - ) { + this.hanldeSdkCommonTypeName(expression, funSymbol, parName ? parName : expression.text, decl); + if (decl && TypeScriptLinter.checkIsAppropriateTypeWithNode(decl)) { let returnType: string | undefined = this.tsTypeChecker.typeToString( this.tsTypeChecker.getTypeAtLocation(decl) ); @@ -13278,10 +13618,149 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { path.basename(decl.getSourceFile().fileName) ); this.processApiNodeDeprecatedApi(expression.text, expression, deprecatedApiCheckMap); + this.processApiNodeDeprecatedApi(expression.text, expression, deprecatedApiCheckMap, undefined, true); } }); } + private static checkIsAppropriateTypeWithNode(decl: ts.Node): boolean { + return ( + ts.isPropertyDeclaration(decl) || + ts.isPropertySignature(decl) || + ts.isEnumMember(decl) || + ts.isEnumDeclaration(decl) + ); + } + + private hanldeSdkCommonTypeName( + node: ts.Node, + symbol: ts.Symbol | undefined, + parentName: string, + decl?: ts.Declaration | undefined + ): void { + const filePath = decl?.getSourceFile().fileName; + const newName = sdkCommonAllDeprecatedFullTypeName.has(symbol?.name + '') ? symbol?.name + '' : parentName; + const isParentNameMatch = sdkCommonAllDeprecatedFullTypeName.has(newName); + const newFilePath = path.basename(filePath + ''); + let isFilePathMatch = false; + for (const item of TypeScriptLinter.sdkCommonAllDeprecatedTypeNameSet) { + isFilePathMatch = path.basename(item.file_path) === newFilePath; + if (isFilePathMatch) { + break; + } + } + const isMatch = isParentNameMatch && isFilePathMatch; + if (isMatch || TypeScriptLinter.isJsonTransformer(decl)) { + this.incrementCounters( + node, + FaultID.SdkCommonApiDeprecated, + undefined, + TypeScriptLinter.getErrorMsgForSdkCommonApi(newName, FaultID.SdkCommonApiDeprecated) + ); + } + } + + private handleCallExpressionBufferIndexOf( + callExpr: ts.CallExpression, + node: ts.Node, + parentName: string, + symbol?: ts.Symbol, + decl?: ts.Declaration + ): void { + if (!symbol || !decl) { + return; + } + + const isIndexOfWithEmptyString = TypeScriptLinter.checkIsIndexOfWithEmptyString(callExpr); + if (!isIndexOfWithEmptyString) { + return; + } + const isNameMatch = symbol.name === SDK_COMMON_BUFFER_API.indexof && parentName === SDK_COMMON_BUFFER_API.full_api; + const isPathMatch = TypeScriptLinter.isImportedFromOhos( + SDK_COMMON_BUFFER_API.apiName, + path.basename(decl.getSourceFile().fileName) + ); + if (isNameMatch && isPathMatch) { + this.incrementCounters( + node, + FaultID.SdkCommonApiBehaviorChange, + undefined, + TypeScriptLinter.getErrorMsgForSdkCommonApi(SDK_COMMON_BUFFER_API.indexof, FaultID.SdkCommonApiBehaviorChange) + ); + } + } + + private static checkIsIndexOfWithEmptyString(callExpr: ts.CallExpression): boolean { + const isIndexOfCall = + ts.isPropertyAccessExpression(callExpr.expression) && + SDK_COMMON_BUFFER_API.indexof === callExpr.expression.name.text; + const hasEmptyStringArgument = + callExpr.arguments.length === 1 && ts.isStringLiteral(callExpr.arguments[0]) && callExpr.arguments[0].text === ''; + + const hasNoArguments = callExpr.arguments.length === 0; + + return isIndexOfCall && (hasEmptyStringArgument || hasNoArguments); + } + + private static isJsonTransformer(decl: ts.Declaration | undefined): boolean { + if ( + decl && + ts.isTypeAliasDeclaration(decl) && + ts.isFunctionTypeNode(decl.type) && + decl.name.getText() === SDK_COMMON_TRANSFORMER + ) { + return decl.type.parameters.length > 0 && decl.type.parameters[0].name.getText() === 'this'; + } + return false; + } + + private handleSymbolIteratorForSdkCommon(decl: ts.PropertyAccessExpression): boolean { + if ( + this.checkPropertyAccessExpressionForSdkCommonSymbotIter( + decl, + SDK_COMMON_SYMBOL_ITERATOR, + TypeScriptLinter.sdkCommonSymbotIterSet + ) + ) { + this.incrementCounters( + decl, + FaultID.SdkCommonApiWhiteList, + undefined, + TypeScriptLinter.getErrorMsgForSdkCommonApi(SDK_COMMON_SYMBOL_ITERATOR, FaultID.SdkCommonApiWhiteList) + ); + return true; + } + return false; + } + + private checkPropertyAccessExpressionForSdkCommonSymbotIter( + node: ts.PropertyAccessExpression, + name: string, + set: Set + ): boolean { + if (set.size === 0 || node.getText() !== name) { + return false; + } + let isFileMatch = false; + if (node.parent && ts.isElementAccessExpression(node.parent)) { + let decl = this.tsUtils.getDeclarationNode(node.parent.expression); + if (decl && ts.isVariableDeclaration(decl) && decl.initializer && ts.isNewExpression(decl.initializer)) { + decl = this.tsUtils.getDeclarationNode(decl.initializer.expression); + } + if (ts.isNewExpression(node.parent.expression)) { + decl = this.tsUtils.getDeclarationNode(node.parent.expression.expression); + } + const fileName = path.basename(decl?.getSourceFile().fileName + ''); + for (const item of set) { + isFileMatch = path.basename(item.file_path) === fileName; + if (isFileMatch) { + break; + } + } + } + return isFileMatch; + } + private checkPropertyDeclarationForDeprecatedApi(node: ts.PropertyDeclaration): void { const expression = node.name; if (ts.isIdentifier(expression)) { @@ -13293,34 +13772,49 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { apiName: string, errorNode: ts.Node, deprecatedApiCheckMap?: Map>, - autofix?: Autofix[] + autofix?: Autofix[], + isSdkCommon?: boolean ): void { - const matchedApi = this.isMatchedDeprecatedApi(apiName, deprecatedApiCheckMap); - if (matchedApi) { - this.incrementCounters(errorNode, FaultID.NoDeprecatedApi, autofix); + const problemStr = this.getFaultIdWithMatchedDeprecatedApi(apiName, deprecatedApiCheckMap, isSdkCommon); + if (problemStr.length > 0) { + const faultID = isSdkCommon ? TypeScriptLinter.getFinalSdkFaultIdByProblem(problemStr) : FaultID.NoDeprecatedApi; + this.incrementCounters( + errorNode, + faultID, + isSdkCommon ? undefined : autofix, + isSdkCommon ? TypeScriptLinter.getErrorMsgForSdkCommonApi(apiName, faultID) : undefined + ); } } - private isMatchedDeprecatedApi( + private getFaultIdWithMatchedDeprecatedApi( apiName: string, - deprecatedApiCheckMap?: Map> - ): boolean { + deprecatedApiCheckMap?: Map>, + isSdkCommon?: boolean + ): string { void this; - const setApiListItem = TypeScriptLinter.deprecatedApiInfo; + let setApiListItem = TypeScriptLinter.deprecatedApiInfo; + if (isSdkCommon) { + setApiListItem = TypeScriptLinter.sdkCommonApiInfo; + } if (!setApiListItem || !deprecatedApiCheckMap) { - return false; + return ''; } const apiNamesArr = [...setApiListItem]; - const matchedApi = apiNamesArr.some((apiInfoItem) => { + let problem = ''; + apiNamesArr.some((apiInfoItem) => { if (apiInfoItem.api_info.parent_api?.length <= 0) { return false; } let isSameApi = apiInfoItem.api_info.api_name === apiName; - isSameApi &&= - apiInfoItem.api_info.parent_api[0].api_name === deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.PARENT_NAME); - isSameApi &&= - this.normalizeTypeString(apiInfoItem.api_info.method_return_type) === - this.normalizeTypeString(deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.RETURN_TYPE)); + isSameApi &&= TypeScriptLinter.checkParentNameUnderSdkList( + apiInfoItem, + deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.PARENT_NAME) + '', + isSdkCommon + ); + const return_type = this.getReturnTypeByApiInfoItem(apiInfoItem, isSdkCommon); + const actual_return_type = this.normalizeTypeString(deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.RETURN_TYPE)); + isSameApi &&= return_type === actual_return_type; const api_func_args = apiInfoItem.api_info.api_func_args; const params = deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.PARAM_SET); if (api_func_args && params) { @@ -13332,30 +13826,74 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } const fileName = deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.FILE_NAME) + ''; const isSameFile = fileName.endsWith(path.basename(apiInfoItem.file_path)); - return isSameFile && isSameApi; + const res = isSameApi && isSameFile; + if (res) { + problem = isSdkCommon ? apiInfoItem.api_info.problem : DeprecateProblem.NoDeprecatedApi; + } + return res; }); - return matchedApi; + return problem; } - private static getPropertyTypeForPropertyAssignment( + private getReturnTypeByApiInfoItem( + apiInfoItem: ApiListItem, + isSdkCommon: boolean | undefined + ): string | ts.NodeArray | undefined { + let return_type = this.normalizeTypeString(apiInfoItem.api_info.method_return_type); + if (isSdkCommon) { + return_type = apiInfoItem.api_info.method_return_type ? + this.normalizeTypeString(apiInfoItem.api_info.method_return_type) : + this.normalizeTypeString(apiInfoItem.api_info.api_property_type); + } + return return_type; + } + + private static checkParentNameUnderSdkList( + apiInfoItem: ApiListItem, + sourceParentName: string, + isSdkCommon?: boolean + ): boolean { + const parentApis = apiInfoItem.api_info.parent_api; + const possibleNames: string[] = []; + const primaryParentName = parentApis[0]?.api_name || ''; + + if (primaryParentName) { + possibleNames.push(primaryParentName); + if (!!isSdkCommon && parentApis.length > 1) { + const secondaryParentName = parentApis[1]?.api_name || ''; + possibleNames.push(`${secondaryParentName}.${primaryParentName}`); + } + } + return possibleNames.includes(sourceParentName); + } + + private getPropertyTypeForPropertyAssignment( propertyAssignment: ts.PropertyAssignment, - contextualType: ts.Type + contextualType: ts.Type, + isSdkCommon?: boolean ): Map> | undefined { const propertyName = propertyAssignment.name.getText(); if (contextualType.isUnion()) { for (const type of contextualType.types) { - const deprecatedApiCheckMap = TypeScriptLinter.getPropertyInfoByContextualType(type, propertyName); + const deprecatedApiCheckMap = this.getPropertyInfoByContextualType( + type, + propertyName, + propertyAssignment, + isSdkCommon + ); if (deprecatedApiCheckMap) { return deprecatedApiCheckMap; } } } - return TypeScriptLinter.getPropertyInfoByContextualType(contextualType, propertyName); + return this.getPropertyInfoByContextualType(contextualType, propertyName, propertyAssignment, isSdkCommon); } - private static getPropertyInfoByContextualType( + private getPropertyInfoByContextualType( type: ts.Type, - propertyName: string + propertyName: string, + node: ts.Node, + isSdkCommon?: boolean ): Map> | undefined { const propertySymbol = type.getProperty(propertyName); if (!propertySymbol) { @@ -13370,6 +13908,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { propertyDecl.type.getText(), path.basename(propertyDecl.getSourceFile().fileName + '') ); + if (isSdkCommon) { + this.hanldeSdkCommonTypeName(node, type.getSymbol(), type.getSymbol()?.name + '', propertyDecl); + } } return deprecatedApiCheckMap; } @@ -13570,4 +14111,82 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } return false; } + + private static getParameterDeclarationsBySignature(signature: ts.Signature): ts.NodeArray { + const validParameters = signature.parameters. + map((paramSymbol) => { + const declarations = paramSymbol.getDeclarations(); + const paramDeclaration = declarations?.[0]; + return paramDeclaration && ts.isParameter(paramDeclaration) ? paramDeclaration : undefined; + }). + filter((param): param is ts.ParameterDeclaration => { + return param !== undefined; + }); + return ts.factory.createNodeArray(validParameters); + } + + private static isImportedFromOhos(importName: string, filePath: string): boolean { + const classPaths = TypeScriptLinter.sdkCommonIndexClassSet.get(importName); + return ( + !!classPaths && + classPaths.some((p) => { + return path.basename(p) === filePath; + }) + ); + } + + private static mergeSdkCommonApiListInfo(): Set { + return new Set([ + ...TypeScriptLinter.sdkCommonApiInfo, + ...TypeScriptLinter.sdkCommonSymbotIterSet, + ...TypeScriptLinter.sdkCommonAllDeprecatedTypeNameSet + ]); + } + + private static getFaultIdSdkCommonApiInfoWithConstructorDecl(extendClassName: string): string { + const mergedSet = TypeScriptLinter.mergeSdkCommonApiListInfo(); + let problem = ''; + for (const item of mergedSet) { + const isCompare = + item.api_info.parent_api[0].api_name === extendClassName && + SDK_COMMON_CONSTRUCTORLIKE.includes(item.api_info.api_type); + if (isCompare) { + problem = item.api_info.problem; + break; + } + } + return problem; + } + + private static getFaultIdSdkCommonApiInfoWithClassMember( + extendClassName: string, + targetName: string, + typeKey: string + ): string { + const mergedSet = TypeScriptLinter.mergeSdkCommonApiListInfo(); + const memberLike = typeKey === SDK_COMMON_TYPEKEY[0] ? SDK_COMMON_FUNCTIONLIKE : SDK_COMMON_PROPERTYLIKE; + let problem = ''; + for (const item of mergedSet) { + const isFunLikeCompare = + item.api_info.parent_api[0].api_name === extendClassName && + memberLike.includes(item.api_info.api_type) && + item.api_info.api_name === targetName; + if (isFunLikeCompare) { + problem = item.api_info.problem; + break; + } + } + return problem; + } + + private static checkIsSameAsParenName(targetName: string): boolean { + let res = false; + const mergedSet = TypeScriptLinter.mergeSdkCommonApiListInfo(); + for (const item of mergedSet) { + if (item.api_info.parent_api[0].api_name === targetName) { + res = true; + } + } + return res; + } } diff --git a/ets2panda/linter/src/lib/data/SdkCommonList.json b/ets2panda/linter/src/lib/data/SdkCommonList.json new file mode 100644 index 0000000000..d13d239b9a --- /dev/null +++ b/ets2panda/linter/src/lib/data/SdkCommonList.json @@ -0,0 +1,6450 @@ +{ + "api_list": [ + { + "file_path": "api/@ohos.util.ArrayList.d.ts", + "api_info": { + "line": 858, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "ArrayList", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.ArrayList", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.ArrayList.d.ts", + "api_info": { + "line": 858, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value: T, index?: number, arrlist?: ArrayList) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "ArrayList", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.ArrayList", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.ArrayList.d.ts", + "api_info": { + "line": 858, + "problem": "WhiteList", + "api_name": "replaceAllElements", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value: T, index?: number, arrlist?: ArrayList) => T", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "ArrayList", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.ArrayList", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.ArrayList.d.ts", + "api_info": { + "line": 858, + "problem": "BehaviorChange", + "api_name": "sort", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "comparator", + "type": "(firstValue: T, secondValue: T) => number", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "ArrayList", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.ArrayList", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@arkts.collections.d.ts", + "api_info": { + "line": 12151, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "BitVector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator", + "code_kind": 174 + }, + "import_path": [ + "@arkts.collections", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Deque.d.ts", + "api_info": { + "line": 375, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Deque", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Deque", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Deque.d.ts", + "api_info": { + "line": 375, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value: T, index?: number, deque?: Deque) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Deque", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Deque", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.HashMap.d.ts", + "api_info": { + "line": 551, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "HashMap", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator<[K, V]>", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.HashMap", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.HashMap.d.ts", + "api_info": { + "line": 551, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value?: V, key?: K, map?: HashMap) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "HashMap", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.HashMap", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.HashSet.d.ts", + "api_info": { + "line": 551, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "HashSet", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.HashSet", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.HashSet.d.ts", + "api_info": { + "line": 551, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value?: T, key?: T, set?: HashSet) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "HashSet", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.HashSet", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.LightWeightMap.d.ts", + "api_info": { + "line": 760, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LightWeightMap", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator<[K, V]>", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.LightWeightMap", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.LightWeightMap.d.ts", + "api_info": { + "line": 760, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value?: V, key?: K, map?: LightWeightMap) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LightWeightMap", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.LightWeightMap", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.LightWeightSet.d.ts", + "api_info": { + "line": 512, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LightWeightSet", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.LightWeightSet", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.LightWeightSet.d.ts", + "api_info": { + "line": 512, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value?: T, key?: T, set?: LightWeightSet) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LightWeightSet", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.LightWeightSet", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.LinkedList.d.ts", + "api_info": { + "line": 512, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LinkedList", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.LinkedList", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.LinkedList.d.ts", + "api_info": { + "line": 512, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value: T, index?: number, LinkedList?: LinkedList) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LinkedList", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.LinkedList", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.LinkedList.d.ts", + "api_info": { + "line": 512, + "problem": "BehaviorChange", + "api_name": "removeFirstFound", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "element", + "type": "T", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LinkedList", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.LinkedList", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.LinkedList.d.ts", + "api_info": { + "line": 512, + "problem": "BehaviorChange", + "api_name": "removeLastFound", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "element", + "type": "T", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LinkedList", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.LinkedList", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.List.d.ts", + "api_info": { + "line": 848, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "List", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.List", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.List.d.ts", + "api_info": { + "line": 848, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value: T, index?: number, List?: List) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "List", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.List", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.List.d.ts", + "api_info": { + "line": 848, + "problem": "WhiteList", + "api_name": "replaceAllElements", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value: T, index?: number, list?: List) => T", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "List", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.List", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.PlainArray.d.ts", + "api_info": { + "line": 848, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "PlainArray", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator<[number, T]>", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.PlainArray", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.PlainArray.d.ts", + "api_info": { + "line": 848, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value: T, index?: number, PlainArray?: PlainArray) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "PlainArray", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.PlainArray", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Queue.d.ts", + "api_info": { + "line": 266, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Queue", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Queue", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Queue.d.ts", + "api_info": { + "line": 266, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value: T, index?: number, Queue?: Queue) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Queue", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Queue", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Queue.d.ts", + "api_info": { + "line": 266, + "problem": "WhiteList", + "api_name": "add", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "element", + "type": "T", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Queue", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Queue", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Stack.d.ts", + "api_info": { + "line": 266, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Stack", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Stack", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Stack.d.ts", + "api_info": { + "line": 266, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value: T, index?: number, stack?: Stack) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Stack", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Stack", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.TreeMap.d.ts", + "api_info": { + "line": 760, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "TreeMap", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator<[K, V]>", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.TreeMap", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.TreeMap.d.ts", + "api_info": { + "line": 760, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value?: V, key?: K, map?: TreeMap) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "TreeMap", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.TreeMap", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.TreeMap.d.ts", + "api_info": { + "line": 760, + "problem": "BehaviorChange", + "api_name": "constructor", + "api_type": "ConstructorDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "comparator", + "type": "(firstValue: K, secondValue: K) => boolean", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "TreeMap", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 176 + }, + "import_path": [ + "@ohos.util.TreeMap", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.TreeSet.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "TreeSet", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.TreeSet", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.TreeSet.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value?: T, key?: T, set?: TreeSet) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "TreeSet", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.TreeSet", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.TreeSet.d.ts", + "api_info": { + "line": 89, + "problem": "BehaviorChange", + "api_name": "constructor", + "api_type": "ConstructorDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "comparator", + "type": "(firstValue: T, secondValue: T) => boolean", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "TreeSet", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 176 + }, + "import_path": [ + "@ohos.util.TreeSet", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "IterableIterator<[string, string]>", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "getAll", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "name", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "string[]", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "append", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "name", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "value", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "delete", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "name", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "entries", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "IterableIterator<[string, string]>", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value: string, key: string, searchParams: URLSearchParams) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "get", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "name", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "string | null", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "get", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "name", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "string[]", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "has", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "name", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "set", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "name", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "value", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "keys", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "IterableIterator", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "values", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "IterableIterator", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "toString", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "sort", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "constructor", + "api_type": "ConstructorDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "init", + "type": "string[][] | Record | string | URLSearchParams", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 176 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value: string, key: string, searchParams: URLParams) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "URLSearchParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LRUCache", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "IterableIterator<[K, V]>", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "BehaviorChange", + "api_name": "put", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "key", + "type": "K", + "is_optional": false, + "has_default": false + }, + { + "name": "value", + "type": "V", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LRUCache", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "V", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "BehaviorChange", + "api_name": "constructor", + "api_type": "ConstructorDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "capacity", + "type": "number", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LRUCache", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "BehaviorChange", + "api_name": "updateCapacity", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "newCapacity", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LRUCache", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "BehaviorChange", + "api_name": "getCapacity", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LRUCache", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "BehaviorChange", + "api_name": "getCreateCount", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LRUCache", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "BehaviorChange", + "api_name": "getMissCount", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LRUCache", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "BehaviorChange", + "api_name": "getRemovalCount", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LRUCache", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "BehaviorChange", + "api_name": "getMatchCount", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LRUCache", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "BehaviorChange", + "api_name": "getPutCount", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LRUCache", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "getPutCount", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LRUCache", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "length", + "api_type": "PropertyDeclaration", + "api_optional": false, + "parent_api": [ + { + "api_name": "LRUCache", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "number", + "code_kind": 171 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.json.d.ts", + "api_info": { + "line": 59, + "problem": "WhiteList", + "api_name": "parse", + "api_type": "FunctionDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "text", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "reviver", + "type": "Transformer", + "is_optional": true, + "has_default": false + }, + { + "name": "options", + "type": "ParseOptions", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "json", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Object | null", + "code_kind": 263 + }, + "import_path": [ + "@ohos.util.json" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.json.d.ts", + "api_info": { + "line": 42, + "problem": "WhiteList", + "api_name": "Transformer", + "api_type": "TypeAliasDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "this", + "type": "Object", + "is_optional": false, + "has_default": false + }, + { + "name": "key", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "value", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "json", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Object | undefined | null", + "code_kind": 268 + }, + "import_path": [ + "@ohos.util.json" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.json.d.ts", + "api_info": { + "line": 59, + "problem": "WhiteList", + "api_name": "remove", + "api_type": "FunctionDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "obj", + "type": "object", + "is_optional": false, + "has_default": false + }, + { + "name": "property", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "json", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 263 + }, + "import_path": [ + "@ohos.util.json" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 3585, + "problem": "WhiteList", + "api_name": "isArgumentsObject", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "types", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 3585, + "problem": "WhiteList", + "api_name": "isGeneratorFunction", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "types", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 3585, + "problem": "WhiteList", + "api_name": "isGeneratorFunction", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "types", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 3585, + "problem": "WhiteList", + "api_name": "isGeneratorObject", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "types", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 3585, + "problem": "WhiteList", + "api_name": "isModuleNamespaceObject", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "types", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 3585, + "problem": "WhiteList", + "api_name": "isProxy", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "types", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 3585, + "problem": "WhiteList", + "api_name": "isSymbolObject", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "Object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "types", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 4701, + "problem": "WhiteList", + "api_name": "addAfter", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "targetClass", + "type": "Object", + "is_optional": false, + "has_default": false + }, + { + "name": "methodName", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "isStatic", + "type": "boolean", + "is_optional": false, + "has_default": false + }, + { + "name": "after", + "type": "Function", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Aspect", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 4667, + "problem": "WhiteList", + "api_name": "addBefore", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "targetClass", + "type": "Object", + "is_optional": false, + "has_default": false + }, + { + "name": "methodName", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "isStatic", + "type": "boolean", + "is_optional": false, + "has_default": false + }, + { + "name": "before", + "type": "Function", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Aspect", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 4773, + "problem": "WhiteList", + "api_name": "replace", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "targetClass", + "type": "Object", + "is_optional": false, + "has_default": false + }, + { + "name": "methodName", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "isStatic", + "type": "boolean", + "is_optional": false, + "has_default": false + }, + { + "name": "instead", + "type": "Function", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Aspect", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 992, + "problem": "BehaviorChange", + "api_name": "href", + "api_type": "PropertyDeclaration", + "api_optional": false, + "parent_api": [ + { + "api_name": "URL", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 171 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 992, + "problem": "BehaviorChange", + "api_name": "href", + "api_type": "PropertyDeclaration", + "api_optional": false, + "parent_api": [ + { + "api_name": "URL", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 171 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 992, + "problem": "BehaviorChange", + "api_name": "origin", + "api_type": "PropertyDeclaration", + "api_optional": false, + "parent_api": [ + { + "api_name": "URL", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 171 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 992, + "problem": "BehaviorChange", + "api_name": "pathname", + "api_type": "PropertyDeclaration", + "api_optional": false, + "parent_api": [ + { + "api_name": "URL", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 171 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 1143, + "problem": "BehaviorChange", + "api_name": "search", + "api_type": "PropertyDeclaration", + "api_optional": false, + "parent_api": [ + { + "api_name": "URL", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 171 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 1143, + "problem": "WhiteList", + "api_name": "searchParams", + "api_type": "PropertyDeclaration", + "api_optional": false, + "parent_api": [ + { + "api_name": "URL", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "URLSearchParams", + "code_kind": 171 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.url.d.ts", + "api_info": { + "line": 283, + "problem": "BehaviorChange", + "api_name": "constructor", + "api_type": "ConstructorDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "init", + "type": "string[][] | Record | string | URLParams", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "URLParams", + "api_type": "ClassDeclaration" + }, + { + "api_name": "url", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 176 + }, + "import_path": [ + "@ohos.url", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 1139, + "problem": "WhiteList", + "api_name": "stringify", + "api_type": "MethodSignature", + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "any", + "is_optional": false, + "has_default": false + }, + { + "name": "replacer", + "type": "(this: any, key: string, value: any) => any", + "is_optional": true, + "has_default": false + }, + { + "name": "space", + "type": "string | number", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "JSON", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 1139, + "problem": "WhiteList", + "api_name": "stringify", + "api_type": "MethodSignature", + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "any", + "is_optional": false, + "has_default": false + }, + { + "name": "replacer", + "type": "(number | string)[] | null", + "is_optional": true, + "has_default": false + }, + { + "name": "space", + "type": "string | number", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "JSON", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.buffer.d.ts", + "api_info": { + "line": 3388, + "problem": "BehaviorChange", + "api_name": "slice", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "start", + "type": "number", + "is_optional": true, + "has_default": false + }, + { + "name": "end", + "type": "number", + "is_optional": true, + "has_default": false + }, + { + "name": "type", + "type": "string", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Blob", + "api_type": "ClassDeclaration" + }, + { + "api_name": "buffer", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Blob", + "code_kind": 174 + }, + "import_path": [ + "@ohos.buffer", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.buffer.d.ts", + "api_info": { + "line": 3388, + "problem": "BehaviorChange", + "api_name": "readInt8", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "offset", + "type": "number", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Buffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "buffer", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.buffer", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.buffer.d.ts", + "api_info": { + "line": 3388, + "problem": "BehaviorChange", + "api_name": "readInt16BE", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "offset", + "type": "number", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Buffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "buffer", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.buffer", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.buffer.d.ts", + "api_info": { + "line": 3388, + "problem": "BehaviorChange", + "api_name": "readInt16LE", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "offset", + "type": "number", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Buffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "buffer", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.buffer", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.buffer.d.ts", + "api_info": { + "line": 3388, + "problem": "BehaviorChange", + "api_name": "readInt32BE", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "offset", + "type": "number", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Buffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "buffer", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.buffer", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.buffer.d.ts", + "api_info": { + "line": 3388, + "problem": "BehaviorChange", + "api_name": "readInt32LE", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "offset", + "type": "number", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Buffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "buffer", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.buffer", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.buffer.d.ts", + "api_info": { + "line": 3388, + "problem": "BehaviorChange", + "api_name": "readIntBE", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "offset", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "byteLength", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Buffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "buffer", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.buffer", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.buffer.d.ts", + "api_info": { + "line": 3388, + "problem": "BehaviorChange", + "api_name": "readIntLE", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "offset", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "byteLength", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Buffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "buffer", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.buffer", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "getErrorString", + "api_type": "FunctionDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "errno", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "printf", + "api_type": "FunctionDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "format", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "...args", + "type": "Object[]", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "promiseWrapper", + "api_type": "FunctionDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "original", + "type": "(err: Object, value: Object) => void", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Object", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "constructor", + "api_type": "ConstructorDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Base64", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 176 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "constructor", + "api_type": "ConstructorDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Base64", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 176 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "decode", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "src", + "type": "Uint8Array | string", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Base64", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Promise", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "decodeSync", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "src", + "type": "Uint8Array | string", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Base64", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Uint8Array", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "encode", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "src", + "type": "Uint8Array", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Base64", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Promise", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "encodeSync", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "src", + "type": "Uint8Array", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Base64", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Uint8Array", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "encodeToString", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "src", + "type": "Uint8Array", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Base64", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Promise", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "encodeToStringSync", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "src", + "type": "Uint8Array", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Base64", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "BehaviorChange", + "api_name": "encodeToStringSync", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "src", + "type": "Uint8Array", + "is_optional": false, + "has_default": false + }, + { + "name": "options", + "type": "Type", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Base64Helper", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "stream", + "api_type": "PropertySignature", + "api_optional": true, + "parent_api": [ + { + "api_name": "DecodeWithStreamOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 170 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "IterableIterator<[K, V]>", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "IterableIterator<[K, V]>", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "afterRemoval", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "isEvict", + "type": "boolean", + "is_optional": false, + "has_default": false + }, + { + "name": "key", + "type": "K", + "is_optional": false, + "has_default": false + }, + { + "name": "value", + "type": "V", + "is_optional": false, + "has_default": false + }, + { + "name": "newValue", + "type": "V", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "clear", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "constructor", + "api_type": "ConstructorDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "capacity", + "type": "number", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 176 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "contains", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "key", + "type": "K", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "createDefault", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "key", + "type": "K", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "V", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "entries", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "IterableIterator<[K, V]>", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "get", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "key", + "type": "K", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "V | undefined", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "getCapacity", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "getCreateCount", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "getMatchCount", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "getMissCount", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "getPutCount", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "getPutCount", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "getRemovalCount", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "isEmpty", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "keys", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "K[]", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "put", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "key", + "type": "K", + "is_optional": false, + "has_default": false + }, + { + "name": "value", + "type": "V", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "V", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "remove", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "key", + "type": "K", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "V | undefined", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "toString", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "updateCapacity", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "newCapacity", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "values", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "V[]", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "length", + "api_type": "PropertyDeclaration", + "api_optional": false, + "parent_api": [ + { + "api_name": "LruBuffer", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "number", + "code_kind": 171 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "clamp", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "ScopeType", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Scope", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "ScopeType", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "constructor", + "api_type": "ConstructorDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "lowerObj", + "type": "ScopeType", + "is_optional": false, + "has_default": false + }, + { + "name": "upperObj", + "type": "ScopeType", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Scope", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 176 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "contains", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "range", + "type": "Scope", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Scope", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "contains", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "range", + "type": "ScopeType", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Scope", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "expand", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "lowerObj", + "type": "ScopeType", + "is_optional": false, + "has_default": false + }, + { + "name": "upperObj", + "type": "ScopeType", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Scope", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Scope", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "expand", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "ScopeType", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Scope", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Scope", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "expand", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "range", + "type": "Scope", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Scope", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Scope", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "getLower", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Scope", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "ScopeType", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "getUpper", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Scope", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "ScopeType", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "intersect", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "lowerObj", + "type": "ScopeType", + "is_optional": false, + "has_default": false + }, + { + "name": "upperObj", + "type": "ScopeType", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Scope", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Scope", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "intersect", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "range", + "type": "Scope", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Scope", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Scope", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "toString", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Scope", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "constructor", + "api_type": "ConstructorDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "encoding", + "type": "string", + "is_optional": true, + "has_default": false + }, + { + "name": "options", + "type": "{ fatal?: boolean; ignoreBOM?: boolean; }", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "TextDecoder", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 176 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "decode", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "input", + "type": "Uint8Array", + "is_optional": false, + "has_default": false + }, + { + "name": "options", + "type": "{ stream?: false; }", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "TextDecoder", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "decodeWithStream", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "input", + "type": "Uint8Array", + "is_optional": false, + "has_default": false + }, + { + "name": "options", + "type": "DecodeWithStreamOptions", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "TextDecoder", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "encode", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "input", + "type": "string", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "TextEncoder", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Uint8Array", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.d.ts", + "api_info": { + "line": 615, + "problem": "WhiteList", + "api_name": "encodeInto", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "input", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "dest", + "type": "Uint8Array", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "TextEncoder", + "api_type": "ClassDeclaration" + }, + { + "api_name": "util", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "{ read: number; written: number; }", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "[Symbol.iterator]", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "IterableIterator", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "add", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "element", + "type": "T", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "clear", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "clone", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "Vector", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "constructor", + "api_type": "ConstructorDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 176 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "convertToArray", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "Array", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "copyToArray", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "array", + "type": "Array", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "forEach", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value: T, index?: number, vector?: Vector) => void", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "get", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "index", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "T", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "getCapacity", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "getFirstElement", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "T", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "getIndexFrom", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "element", + "type": "T", + "is_optional": false, + "has_default": false + }, + { + "name": "index", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "getIndexOf", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "element", + "type": "T", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "getIndexOf", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "T", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "getLastIndexFrom", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "element", + "type": "T", + "is_optional": false, + "has_default": false + }, + { + "name": "index", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "getLastIndexOf", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "element", + "type": "T", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "number", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "has", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "element", + "type": "T", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "has", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "newCapacity", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "insert", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "element", + "type": "T", + "is_optional": false, + "has_default": false + }, + { + "name": "index", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "isEmpty", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "remove", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "element", + "type": "T", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "removeByIndex", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "index", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "T", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "removeByRange", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "fromIndex", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "toIndex", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "replaceAllElements", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "callbackFn", + "type": "(value: T, index?: number, vector?: Vector) => T", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "Object", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "set", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "index", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "element", + "type": "T", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "T", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "setLength", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "newSize", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "sort", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "comparator", + "type": "(firstValue: T, secondValue: T) => number", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "subVector", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "fromIndex", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "toIndex", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "Vector", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "toString", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "trimToCurrentLength", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [], + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "method_return_type": "void", + "code_kind": 174 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.util.Vector.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "length", + "api_type": "PropertyDeclaration", + "api_optional": false, + "parent_api": [ + { + "api_name": "Vector", + "api_type": "ClassDeclaration" + } + ], + "api_property_type": "number", + "code_kind": 171 + }, + "import_path": [ + "@ohos.util.Vector", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "convert", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "xml", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "options", + "type": "ConvertOptions", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "ConvertXML", + "api_type": "ClassDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Object", + "code_kind": 174 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "fastConvertToJSObject", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "xml", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "options", + "type": "ConvertOptions", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "ConvertXML", + "api_type": "ClassDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Object", + "code_kind": 174 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "convertToJSObject", + "api_type": "MethodDeclaration", + "api_optional": false, + "api_func_args": [ + { + "name": "xml", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "options", + "type": "ConvertOptions", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "ConvertXML", + "api_type": "ClassDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "Object", + "code_kind": 174 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "trim", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "boolean", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "ignoreDeclaration", + "api_type": "PropertySignature", + "api_optional": true, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "boolean", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "ignoreInstruction", + "api_type": "PropertySignature", + "api_optional": true, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "boolean", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "ignoreAttributes", + "api_type": "PropertySignature", + "api_optional": true, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "boolean", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "ignoreComment", + "api_type": "PropertySignature", + "api_optional": true, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "boolean", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "ignoreCDATA", + "api_type": "PropertySignature", + "api_optional": true, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "boolean", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "ignoreDoctype", + "api_type": "PropertySignature", + "api_optional": true, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "boolean", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "ignoreText", + "api_type": "PropertySignature", + "api_optional": true, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "boolean", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "declarationKey", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "instructionKey", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "attributesKey", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "textKey", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "cdataKey", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "doctypeKey", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "commentKey", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "parentKey", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "typeKey", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "nameKey", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.convertxml.d.ts", + "api_info": { + "line": 349, + "problem": "WhiteList", + "api_name": "elementsKey", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "ConvertOptions", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "xml", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "string", + "code_kind": 170 + }, + "import_path": [ + "@ohos.convertxml", + "@kit.ArkTS" + ], + "is_global": false + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/src/lib/utils/consts/SdkCommonDeprecateWhiteList.ts b/ets2panda/linter/src/lib/utils/consts/SdkCommonDeprecateWhiteList.ts new file mode 100644 index 0000000000..992e803740 --- /dev/null +++ b/ets2panda/linter/src/lib/utils/consts/SdkCommonDeprecateWhiteList.ts @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { FaultID } from '../../Problems'; + +export const SdkCommonApiProblemInfos = new Map([ + ['WhiteList', FaultID.SdkCommonApiWhiteList], + ['BehaviorChange', FaultID.SdkCommonApiBehaviorChange], + ['allDeprecated', FaultID.SdkCommonApiDeprecated] +]); +export const SDK_COMMON_INDEX_CLASS: Set = new Set(['Stack', 'Queue', 'LinkedList', 'PlainArray', 'Buffer']); +export enum SDK_COMMON_BUFFER_API { + apiName = 'Buffer', + full_api = 'buffer.Buffer', + indexof = 'indexOf' +} +export const SDK_COMMON_FUNCTIONLIKE = ['MethodSignature', 'MethodDeclaration', 'FunctionDeclaration']; +export const SDK_COMMON_PROPERTYLIKE = ['PropertyDeclaration', 'PropertySignature']; +export const SDK_COMMON_CONSTRUCTORLIKE = ['ConstructorDeclaration']; +export const SDK_COMMON_TYPEKEY = ['funlike', 'propertyLike']; + +export const SDK_COMMON_SYMBOL_ITERATOR: string = 'Symbol.iterator'; +export const SDK_COMMON_SYMBOL_ITERATOR_APINAME: string = '[Symbol.iterator]'; +export const SDK_COMMON_TRANSFORMER: string = 'Transformer'; +export const SDK_COMMON_CONSTRUCTOR: string = 'constructor'; +export const SDK_COMMON_VOID: string = 'void'; + +export const sdkCommonAllDeprecatedTypeName: Set = new Set([ + 'Base64', + 'LruBuffer', + 'Scope', + 'Vector', + 'ConvertXML', + 'ConvertOptions', + 'URLSearchParams' +]); +export const sdkCommonAllDeprecatedFullTypeName: Set = new Set([ + 'Base64', + 'LruBuffer', + 'Scope', + 'Vector', + 'ConvertXML', + 'ConvertOptions', + 'URLSearchParams', + 'util.Base64', + 'util.LruBuffer', + 'util.Scope', + 'Vector', + 'xml.ConvertXML', + 'xml.ConvertOptions', + 'url.URLSearchParams' +]); diff --git a/ets2panda/linter/test/deprecatedapi/swiper_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/swiper_api.ets.arkts2.json index be876956b6..6423f82bd7 100755 --- a/ets2panda/linter/test/deprecatedapi/swiper_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/swiper_api.ets.arkts2.json @@ -16,22 +16,22 @@ "result": [ { "line": 17, - "column": 37, + "column": 7, "endLine": 17, - "endColumn": 51, - "problem": "NoDeprecatedApi", + "endColumn": 11, + "problem": "InterfaceFieldNotImplemented", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "ArkTS 1.2 should implement all fields in the interface in the class (arkts-no-class-omit-interface-optional-prop)", "severity": "ERROR" }, { "line": 17, - "column": 7, + "column": 37, "endLine": 17, - "endColumn": 11, - "problem": "InterfaceFieldNotImplemented", + "endColumn": 51, + "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkTS 1.2 should implement all fields in the interface in the class (arkts-no-class-omit-interface-optional-prop)", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/sdkcommonapi/@ohos.convertxml.d.ts b/ets2panda/linter/test/sdkcommonapi/@ohos.convertxml.d.ts new file mode 100644 index 0000000000..e9aafa2364 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/@ohos.convertxml.d.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export declare namespace xml { + interface ConvertOptions { + trim: boolean; + ignoreDeclaration?: boolean; + ignoreInstruction?: boolean; + ignoreAttributes?: boolean; + ignoreComment?: boolean; + ignoreCDATA?: boolean; + ignoreDoctype?: boolean; + ignoreText?: boolean; + declarationKey: string; + instructionKey: string; + attributesKey: string; + textKey: string; + cdataKey: string; + doctypeKey: string; + commentKey: string; + parentKey: string; + typeKey: string; + nameKey: string; + elementsKey: string; + } + class ConvertXML { + convert(xml: string, options?: ConvertOptions): Object; + convertToJSObject(xml: string, options?: ConvertOptions): Object; + fastConvertToJSObject(xml: string, options?: ConvertOptions): Object; + } +} +export default xml; \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/@ohos.util.ArrayList.d.ts b/ets2panda/linter/test/sdkcommonapi/@ohos.util.ArrayList.d.ts new file mode 100644 index 0000000000..fd9e51d62d --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/@ohos.util.ArrayList.d.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export declare class ArrayList { + constructor(); + [Symbol.iterator](): IterableIterator; + sort(comparator?: (firstValue: T, secondValue: T) => number): void; + forEach(callbackFn: (value: T, index?: number, arrlist?: ArrayList) => void, thisArg?: Object): void; + replaceAllElements(callbackFn: (value: T, index?: number, arrlist?: ArrayList) => T, thisArg?: Object): void; +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/@ohos.util.Vector.d.ts b/ets2panda/linter/test/sdkcommonapi/@ohos.util.Vector.d.ts new file mode 100644 index 0000000000..8fae94d4d5 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/@ohos.util.Vector.d.ts @@ -0,0 +1,338 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export declare class Vector { + /** + * A constructor used to create a Vector object. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + constructor(); + /** + * Gets the element number of the Vector. This is a number one higher than the highest index in the vector. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + length: number; + /** + * Appends the specified element to the end of this vector. + * + * @param { T } element - Element to be appended to this vector + * @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + add(element: T): boolean; + /** + * Inserts the specified element at the specified position in this + * vector. Shifts the element currently at that position (if any) and + * any subsequent elements to the right (adds one to their index). + * + * @param { T } element - Element at which the specified element is to be inserted + * @param { number } index - Index to be inserted + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + insert(element: T, index: number): void; + /** + * Check if vector contains the specified element + * + * @param { T } element - Element to be contained + * @returns { boolean } the boolean type,if vector contains the specified element,return true,else return false + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + has(element: T): boolean; + /** + * Returns the element at the specified position in this Vector,or returns undefined if vector is empty + * + * @param { number } index - Index to be contained + * @returns { T } the number type ,returns the lowest index such that or -1 if there is no such index. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + get(index: number): T; + /** + * Returns the index of the first occurrence of the specified element + * in this vector, or -1 if this vector does not contain the element. + * + * @param { T } element - Element current index + * @returns { number } the number type + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + getIndexOf(element: T): number; + /** + * Returns the first component (the item at index 0) of this vector. + * or returns undefined if vector is empty + * + * @returns { T } the T type ,returns undefined if vector is empty + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + getFirstElement(): T; + /** + * Returns the Last component (the item at index length-1) of this vector. + * or returns undefined if vector is empty + * + * @returns { T } the T type ,returns undefined if vector is empty + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + getLastElement(): T; + /** + * Find the corresponding element according to the index, + * delete the element, and move the index of all elements to the right of the element forward by one. + * + * @param { number } index - The index in the vector + * @returns { T } the T type ,returns undefined if vector is empty,If the index is + * out of bounds (greater than or equal to length or less than 0), throw an exception + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + removeByIndex(index: number): T; + /** + * Removes the first occurrence of the specified element from this vector, + * if it is present. If the vector does not contain the element, it is + * unchanged. More formally, removes the element with the lowest index + * + * @param { T } element - Element to remove + * @returns { boolean } the boolean type ,If there is no such element, return false + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + remove(element: T): boolean; + /** + * Replaces the element at the specified position in this Vector with the specified element + * + * @param { number } index - Index to find + * @param { T } element - Element replaced element + * @returns { T } the T type + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + set(index: number, element: T): T; + /** + * Returns in the index of the last occurrence of the specified element in this vector , + * or -1 if the vector does not contain the element. + * + * @param { T } element - Element to find + * @returns { number } The number type + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + getLastIndexOf(element: T): number; + /** + * Returns the index of the last occurrence of the specified element in this vector ,searching backwards from index, + * or returns -1 if the element is not found,or -1 if there is no such index + * + * @param { T } element - Element to find + * @param { number } index - Index start index + * @returns { number } the number type + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + getLastIndexFrom(element: T, index: number): number; + /** + * Returns the index of the first occurrence of the specified element in this vector ,searching forwards from index, + * or returns -1 if the element is not found,or -1 if there is no such index + * + * @param { T } element - Element to find + * @param { number } index - Index start index + * @returns { number } the number type + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + getIndexFrom(element: T, index: number): number; + /** + * Removes from this vector all of the elements whose index is between fromIndex,inclusive,and toIndex ,exclusive. + * + * @param { number } fromIndex - The starting position of the index, containing the value at that index position + * @param { number } toIndex - The end of the index, excluding the value at that index + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + removeByRange(fromIndex: number, toIndex: number): void; + /** + * Replaces each element of this vector with the result of applying the operator to that element. + * + * @param { function } callbackFn - A function that accepts up to four arguments.The function to be called + * for each element in the vector,Returns the result of an operation + * @param { Object } thisArg - The value passed to the function generally uses the + * "this" value.If this parameter is empty, "undefined" will be passed to the "this" value + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + replaceAllElements(callbackFn: (value: T, index?: number, vector?: Vector) => T, thisArg?: Object): void; + /** + * Executes a provided function once for each value in the vector object. + * + * @param { function } callbackFn - callbackFn + * callbackFn (required) A function that accepts up to four arguments.The function to be + * called for each element in the vector + * @param { Object } thisArg - The value passed to the function generally uses the "this" value. + * If this parameter is empty, "undefined" will be passed to the "this" value + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + forEach(callbackFn: (value: T, index?: number, vector?: Vector) => void, thisArg?: Object): void; + /** + * Sorts this vector according to the order induced by the specified comparator,without comparator + * this parameter, it will default to ASCII sorting + * + * @param { function } comparator - comparator + * (Optional) A function that accepts up to two arguments.Specifies the sort order. + * Must be a function,return number type,If it returns firstValue minus secondValue, it returns an vector sorted + * in ascending order;If it returns secondValue minus firstValue, it returns an vector sorted in descending order; + * If this parameter is empty, it will default to ASCII sorting + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + sort(comparator?: (firstValue: T, secondValue: T) => number): void; + /** + * Returns a view of the portion of this vector between the specified fromIndex,inclusive,and toIndex,exclusive + * + * @param { number } fromIndex - The starting position of the index, containing the value at that index position + * @param { number } toIndex - The end of the index, excluding the value at that index + * @returns { Vector } + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + subVector(fromIndex: number, toIndex: number): Vector; + /** + * Removes all of the elements from this vector.The vector will + * be empty after this call returns.length becomes 0 + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + clear(): void; + /** + * Returns a shallow copy of this instance. (The elements themselves are not copied.) + * + * @returns { Vector } this vector instance + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + clone(): Vector; + /** + * Sets the length of this vector + * + * @param { number } newSize - newSize + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + setLength(newSize: number): void; + /** + * returns the capacity of this vector + * + * @returns { number } the number type + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + getCapacity(): number; + /** + * convert vector to array + * + * @returns { Array } the Array type + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + convertToArray(): Array; + /** + * Determine whether vector is empty and whether there is an element + * + * @returns { boolean } the boolean type + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + isEmpty(): boolean; + /** + * If the newCapacity provided by the user is greater than or equal to length, + * change the capacity of the vector to newCapacity, otherwise the capacity will not be changed + * + * @param { number } newCapacity - newCapacity + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + increaseCapacityTo(newCapacity: number): void; + /** + * Returns a string representation of this Vector, + * containing the String representation of each element + * + * @returns { string } + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + toString(): string; + /** + * Limit the capacity to the current length + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + trimToCurrentLength(): void; + /** + * Copies the components of this vector into the specified array, + * to overwrite elements of the same index + * + * @param { Array } array - Replaced array + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + copyToArray(array: Array): void; + /** + * returns an ES6 iterator.Each item of the iterator is a Javascript Object + * + * @returns { IterableIterator } + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + */ + [Symbol.iterator](): IterableIterator; +} +export default Vector; \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/@ohos.util.d.ts b/ets2panda/linter/test/sdkcommonapi/@ohos.util.d.ts new file mode 100644 index 0000000000..83195de524 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/@ohos.util.d.ts @@ -0,0 +1,1191 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare namespace util { + class Base64 { + /** + * Constructor for creating base64 encoding and decoding + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper.constructor + */ + constructor(); + /** + * Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * + * @param { Uint8Array } src - A Uint8Array value + * @returns { Uint8Array } Return the encoded new Uint8Array. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper.encodeSync + */ + encodeSync(src: Uint8Array): Uint8Array; + /** + * Encodes the specified byte array into a String using the Base64 encoding scheme. + * + * @param { Uint8Array } src - A Uint8Array value + * @returns { string } Return the encoded string. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper.encodeToStringSync + */ + encodeToStringSync(src: Uint8Array): string; + /** + * Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * + * @param { Uint8Array | string } src - A Uint8Array value or value A string value + * @returns { Uint8Array } Return the decoded Uint8Array. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper.decodeSync + */ + decodeSync(src: Uint8Array | string): Uint8Array; + /** + * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. + * + * @param { Uint8Array } src - A Uint8Array value + * @returns { Promise } Return the encodes asynchronous new Uint8Array. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper.encode + */ + encode(src: Uint8Array): Promise; + /** + * Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. + * + * @param { Uint8Array } src - A Uint8Array value + * @returns { Promise } Returns the encoded asynchronous string. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper.encodeToString + */ + encodeToString(src: Uint8Array): Promise; + /** + * Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. + * + * @param { Uint8Array | string } src - A Uint8Array value or value A string value + * @returns { Promise } Return the decoded asynchronous Uint8Array. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper.decode + */ + decode(src: Uint8Array | string): Promise; + } + class LruBuffer { + /** + * Default constructor used to create a new LruBuffer instance with the default capacity of 64. + * + * @param { number } capacity - Indicates the capacity to customize for the buffer. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.constructor + */ + constructor(capacity?: number); + /** + * Updates the buffer capacity to a specified capacity. + * + * @param { number } newCapacity - Indicates the new capacity to set. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.updateCapacity + */ + updateCapacity(newCapacity: number): void; + /** + * Returns a string representation of the object. + * + * @returns { string } Returns the string representation of the object and outputs the string representation of the object. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.toString + */ + toString(): string; + /** + * Obtains a list of all values in the current buffer. + * + * @type { number } + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.length + */ + length: number; + /** + * Obtains the capacity of the current buffer. + * + * @returns { number } Returns the capacity of the current buffer. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.getCapacity + */ + getCapacity(): number; + /** + * Clears key-value pairs from the current buffer. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.clear + */ + clear(): void; + /** + * Obtains the number of times createDefault(Object) returned a value. + * + * @returns { number } Returns the number of times createDefault(java.lang.Object) returned a value. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.getCreateCount + */ + getCreateCount(): number; + /** + * Obtains the number of times that the queried values are not matched. + * + * @returns { number } Returns the number of times that the queried values are not matched. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.getMissCount + */ + getMissCount(): number; + /** + * Obtains the number of times that values are evicted from the buffer. + * + * @returns { number } Returns the number of times that values are evicted from the buffer. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.getRemovalCount + */ + getRemovalCount(): number; + /** + * Obtains the number of times that the queried values are successfully matched. + * + * @returns { number } Returns the number of times that the queried values are successfully matched. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.getMatchCount + */ + getMatchCount(): number; + /** + * Obtains the number of times that values are added to the buffer. + * + * @returns { number } Returns the number of times that values are added to the buffer. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.getPutCount + */ + getPutCount(): number; + /** + * Checks whether the current buffer is empty. + * + * @returns { boolean } Returns true if the current buffer contains no value. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.isEmpty + */ + isEmpty(): boolean; + /** + * Obtains the value associated with a specified key. + * + * @param { K } key - Indicates the key to query. + * @returns { V | undefined } Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.get + */ + get(key: K): V | undefined; + /** + * Adds a key-value pair to the buffer. + * + * @param { K } key - Indicates the key to add. + * @param { V } value - Indicates the value associated with the key to add. + * @returns { V } Returns the value associated with the added key; returns the original value if the key to add already exists. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.put + */ + put(key: K, value: V): V; + /** + * Obtains a list of all values in the current buffer. + * + * @returns { V[] } Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.values + */ + values(): V[]; + /** + * Obtains a list of keys for the values in the current buffer. + * + * @returns { K[] } Returns a list of keys sorted from most recently accessed to least recently accessed. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.keys + */ + keys(): K[]; + /** + * Deletes a specified key and its associated value from the current buffer. + * + * @param { K } key - Indicates the key to delete. + * @returns { V | undefined } Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.remove + */ + remove(key: K): V | undefined; + /** + * Executes subsequent operations after a value is deleted. + * + * @param { boolean } isEvict - The parameter value is true if this method is called due to insufficient capacity, + * and the parameter value is false in other cases. + * @param { K } key - Indicates the deleted key. + * @param { V } value - Indicates the deleted value. + * @param { V } newValue - The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) + * method is called and the key to add already exists. The parameter value is null in other cases. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.afterRemoval + */ + afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void; + /** + * Checks whether the current buffer contains a specified key. + * + * @param { K } key - Indicates the key to check. + * @returns { boolean } Returns true if the buffer contains the specified key. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.contains + */ + contains(key: K): boolean; + /** + * Called after a cache miss to compute a value for the corresponding key. + * + * @param { K } key - Indicates the missed key. + * @returns { V } Returns the value associated with the key. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.createDefault + */ + createDefault(key: K): V; + /** + * Returns an array of key-value pairs of enumeratable properties of a given object. + * + * @returns { IterableIterator<[K, V]> } Returns an array of key-value pairs for the enumeratable properties of the given object itself. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.entries + */ + entries(): IterableIterator<[ + K, + V + ]>; + /** + * Specifies the default iterator for an object. + * @returns { IterableIterator<[K, V]> } Returns a two - dimensional array in the form of key - value pairs. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.[Symbol.iterator] + */ + [Symbol.iterator](): IterableIterator<[ + K, + V + ]>; + } + class LRUCache { + /** + * Default constructor used to create a new LruBuffer instance with the default capacity of 64. + * + * @param { number } [capacity] - Indicates the capacity to customize for the buffer. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Default constructor used to create a new LruBuffer instance with the default capacity of 64. + * + * @param { number } [capacity] - Indicates the capacity to customize for the buffer. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Default constructor used to create a new LruBuffer instance with the default capacity of 64. + * + * @param { number } [capacity] - Indicates the capacity to customize for the buffer. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + constructor(capacity?: number); + /** + * Updates the buffer capacity to a specified capacity. + * + * @param { number } newCapacity - Indicates the new capacity to set. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Updates the buffer capacity to a specified capacity. + * + * @param { number } newCapacity - Indicates the new capacity to set. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Updates the buffer capacity to a specified capacity. + * + * @param { number } newCapacity - Indicates the new capacity to set. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + updateCapacity(newCapacity: number): void; + /** + * Returns a string representation of the object. + * + * @returns { string } Returns the string representation of the object and outputs the string representation of the object. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns a string representation of the object. + * + * @returns { string } Returns the string representation of the object and outputs the string representation of the object. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns a string representation of the object. + * + * @returns { string } Returns the string representation of the object and outputs the string representation of the object. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + toString(): string; + /** + * Obtains a list of all values in the current buffer. + * + * @type { number } + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Obtains a list of all values in the current buffer. + * + * @type { number } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Obtains a list of all values in the current buffer. + * + * @type { number } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + length: number; + /** + * Obtains the capacity of the current buffer. + * + * @returns { number } Returns the capacity of the current buffer. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Obtains the capacity of the current buffer. + * + * @returns { number } Returns the capacity of the current buffer. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Obtains the capacity of the current buffer. + * + * @returns { number } Returns the capacity of the current buffer. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + getCapacity(): number; + /** + * Clears key-value pairs from the current buffer. + * + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Clears key-value pairs from the current buffer. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Clears key-value pairs from the current buffer. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + clear(): void; + /** + * Obtains the number of times createDefault(Object) returned a value. + * + * @returns { number } Returns the number of times createDefault(java.lang.Object) returned a value. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Obtains the number of times createDefault(Object) returned a value. + * + * @returns { number } Returns the number of times createDefault(java.lang.Object) returned a value. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Obtains the number of times createDefault(Object) returned a value. + * + * @returns { number } Returns the number of times createDefault(java.lang.Object) returned a value. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + getCreateCount(): number; + /** + * Obtains the number of times that the queried values are not matched. + * + * @returns { number } Returns the number of times that the queried values are not matched. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Obtains the number of times that the queried values are not matched. + * + * @returns { number } Returns the number of times that the queried values are not matched. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Obtains the number of times that the queried values are not matched. + * + * @returns { number } Returns the number of times that the queried values are not matched. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + getMissCount(): number; + /** + * Obtains the number of times that values are evicted from the buffer. + * + * @returns { number } Returns the number of times that values are evicted from the buffer. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Obtains the number of times that values are evicted from the buffer. + * + * @returns { number } Returns the number of times that values are evicted from the buffer. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Obtains the number of times that values are evicted from the buffer. + * + * @returns { number } Returns the number of times that values are evicted from the buffer. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + getRemovalCount(): number; + /** + * Obtains the number of times that the queried values are successfully matched. + * + * @returns { number } Returns the number of times that the queried values are successfully matched. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Obtains the number of times that the queried values are successfully matched. + * + * @returns { number } Returns the number of times that the queried values are successfully matched. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Obtains the number of times that the queried values are successfully matched. + * + * @returns { number } Returns the number of times that the queried values are successfully matched. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + getMatchCount(): number; + /** + * Obtains the number of times that values are added to the buffer. + * + * @returns { number } Returns the number of times that values are added to the buffer. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Obtains the number of times that values are added to the buffer. + * + * @returns { number } Returns the number of times that values are added to the buffer. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Obtains the number of times that values are added to the buffer. + * + * @returns { number } Returns the number of times that values are added to the buffer. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + getPutCount(): number; + /** + * Checks whether the current buffer is empty. + * + * @returns { boolean } Returns true if the current buffer contains no value. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Checks whether the current buffer is empty. + * + * @returns { boolean } Returns true if the current buffer contains no value. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Checks whether the current buffer is empty. + * + * @returns { boolean } Returns true if the current buffer contains no value. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + isEmpty(): boolean; + /** + * Obtains the value associated with a specified key. + * + * @param { K } key - Indicates the key to query. + * @returns { V | undefined } Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Obtains the value associated with a specified key. + * + * @param { K } key - Indicates the key to query. + * @returns { V | undefined } Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Obtains the value associated with a specified key. + * + * @param { K } key - Indicates the key to query. + * @returns { V | undefined } Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + get(key: K): V | undefined; + /** + * Adds a key-value pair to the buffer. + * + * @param { K } key - Indicates the key to add. + * @param { V } value - Indicates the value associated with the key to add. + * @returns { V } Returns the value associated with the added key; returns the original value if the key to add already exists. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Adds a key-value pair to the buffer. + * + * @param { K } key - Indicates the key to add. + * @param { V } value - Indicates the value associated with the key to add. + * @returns { V } Returns the value associated with the added key; returns the original value if the key to add already exists. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Adds a key-value pair to the buffer. + * + * @param { K } key - Indicates the key to add. + * @param { V } value - Indicates the value associated with the key to add. + * @returns { V } Returns the value associated with the added key; returns the original value if the key to add already exists. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + put(key: K, value: V): V; + /** + * Obtains a list of all values in the current buffer. + * + * @returns { V[] } Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Obtains a list of all values in the current buffer. + * + * @returns { V[] } Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Obtains a list of all values in the current buffer. + * + * @returns { V[] } Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + values(): V[]; + /** + * Obtains a list of keys for the values in the current buffer. + * since 9 + * + * @returns { K[] } Returns a list of keys sorted from most recently accessed to least recently accessed. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Obtains a list of keys for the values in the current buffer. + * since 9 + * + * @returns { K[] } Returns a list of keys sorted from most recently accessed to least recently accessed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Obtains a list of keys for the values in the current buffer. + * since 9 + * + * @returns { K[] } Returns a list of keys sorted from most recently accessed to least recently accessed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + keys(): K[]; + /** + * Deletes a specified key and its associated value from the current buffer. + * + * @param { K } key - Indicates the key to delete. + * @returns { V | undefined } Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Deletes a specified key and its associated value from the current buffer. + * + * @param { K } key - Indicates the key to delete. + * @returns { V | undefined } Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Deletes a specified key and its associated value from the current buffer. + * + * @param { K } key - Indicates the key to delete. + * @returns { V | undefined } Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + remove(key: K): V | undefined; + /** + * Executes subsequent operations after a value is deleted. + * + * @param { boolean } isEvict - The parameter value is true if this method is called due to insufficient capacity, + * and the parameter value is false in other cases. + * @param { K } key - Indicates the deleted key. + * @param { V } value - Indicates the deleted value. + * @param { V } newValue - The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) + * method is called and the key to add already exists. The parameter value is null in other cases. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Executes subsequent operations after a value is deleted. + * + * @param { boolean } isEvict - The parameter value is true if this method is called due to insufficient capacity, + * and the parameter value is false in other cases. + * @param { K } key - Indicates the deleted key. + * @param { V } value - Indicates the deleted value. + * @param { V } newValue - The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) + * method is called and the key to add already exists. The parameter value is null in other cases. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Executes subsequent operations after a value is deleted. + * + * @param { boolean } isEvict - The parameter value is true if this method is called due to insufficient capacity, + * and the parameter value is false in other cases. + * @param { K } key - Indicates the deleted key. + * @param { V } value - Indicates the deleted value. + * @param { V } newValue - The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) + * method is called and the key to add already exists. The parameter value is null in other cases. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void; + /** + * Checks whether the current buffer contains a specified key. + * + * @param { K } key - Indicates the key to check. + * @returns { boolean } Returns true if the buffer contains the specified key. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Checks whether the current buffer contains a specified key. + * + * @param { K } key - Indicates the key to check. + * @returns { boolean } Returns true if the buffer contains the specified key. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Checks whether the current buffer contains a specified key. + * + * @param { K } key - Indicates the key to check. + * @returns { boolean } Returns true if the buffer contains the specified key. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + contains(key: K): boolean; + /** + * Executes subsequent operations if miss to compute a value for the specific key. + * + * @param { K } key - Indicates the missed key. + * @returns { V } Returns the value associated with the key. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Executes subsequent operations if miss to compute a value for the specific key. + * + * @param { K } key - Indicates the missed key. + * @returns { V } Returns the value associated with the key. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Executes subsequent operations if miss to compute a value for the specific key. + * + * @param { K } key - Indicates the missed key. + * @returns { V } Returns the value associated with the key. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + createDefault(key: K): V; + /** + * Returns an array of key-value pairs of enumeratable properties of a given object. + * + * @returns { IterableIterator<[K, V]> } Returns an array of key-value pairs for the enumeratable properties of the given object itself. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns an array of key-value pairs of enumeratable properties of a given object. + * + * @returns { IterableIterator<[K, V]> } Returns an array of key-value pairs for the enumeratable properties of the given object itself. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns an array of key-value pairs of enumeratable properties of a given object. + * + * @returns { IterableIterator<[K, V]> } Returns an array of key-value pairs for the enumeratable properties of the given object itself. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + entries(): IterableIterator<[ + K, + V + ]>; + /** + * Specifies the default iterator for an object. + * + * @returns { IterableIterator<[K, V]> } Returns a two - dimensional array in the form of key - value pairs. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Specifies the default iterator for an object. + * + * @returns { IterableIterator<[K, V]> } Returns a two - dimensional array in the form of key - value pairs. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Specifies the default iterator for an object. + * + * @returns { IterableIterator<[K, V]> } Returns a two - dimensional array in the form of key - value pairs. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + [Symbol.iterator](): IterableIterator<[ + K, + V + ]>; + } + class Scope { + /** + * A constructor used to create a Scope instance with the lower and upper bounds specified. + * + * @param { ScopeType } lowerObj - A ScopeType value + * @param { ScopeType } upperObj - A ScopeType value + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.constructor + */ + constructor(lowerObj: ScopeType, upperObj: ScopeType); + /** + * Obtains a string representation of the current range. + * + * @returns { string } Returns a string representation of the current range object. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.toString + */ + toString(): string; + /** + * Returns the intersection of a given range and the current range. + * + * @param { Scope } range - A Scope range object + * @returns { Scope } Returns the intersection of a given range and the current range. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.intersect + */ + intersect(range: Scope): Scope; + /** + * Returns the intersection of the current range and the range specified by the given lower and upper bounds. + * + * @param { ScopeType } lowerObj - A ScopeType value + * @param { ScopeType } upperObj - A ScopeType value + * @returns { Scope } Returns the intersection of the current range and the range specified by the given lower and upper bounds. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.intersect + */ + intersect(lowerObj: ScopeType, upperObj: ScopeType): Scope; + /** + * Obtains the upper bound of the current range. + * + * @returns { ScopeType } Returns the upper bound of the current range. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.getUpper + */ + getUpper(): ScopeType; + /** + * Obtains the lower bound of the current range. + * + * @returns { ScopeType } Returns the lower bound of the current range. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.getLower + */ + getLower(): ScopeType; + /** + * Creates the smallest range that includes the current range and the given lower and upper bounds. + * + * @param { ScopeType } lowerObj - A ScopeType value + * @param { ScopeType } upperObj - A ScopeType value + * @returns { Scope } Returns the smallest range that includes the current range and the given lower and upper bounds. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.expand + */ + expand(lowerObj: ScopeType, upperObj: ScopeType): Scope; + /** + * Creates the smallest range that includes the current range and a given range. + * + * @param { Scope } range - A Scope range object + * @returns { Scope } Returns the smallest range that includes the current range and a given range. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.expand + */ + expand(range: Scope): Scope; + /** + * Creates the smallest range that includes the current range and a given value. + * + * @param { ScopeType } value - A ScopeType value + * @returns { Scope } Returns the smallest range that includes the current range and a given value. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.expand + */ + expand(value: ScopeType): Scope; + /** + * Checks whether a given value is within the current range. + * + * @param { ScopeType } value - A ScopeType value + * @returns { boolean } If the value is within the current range return true,otherwise return false. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.contains + */ + contains(value: ScopeType): boolean; + /** + * Checks whether a given range is within the current range. + * + * @param { Scope } range - A Scope range + * @returns { boolean } If the current range is within the given range return true,otherwise return false. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.contains + */ + contains(range: Scope): boolean; + /** + * Clamps a given value to the current range. + * + * @param { ScopeType } value - A ScopeType value + * @returns { ScopeType } Returns a ScopeType object that a given value is clamped to the current range.. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.clamp + */ + clamp(value: ScopeType): ScopeType; + } + interface ScopeComparable { + /** + * The comparison function is used by the scope. + * + * @param { ScopeComparable } other - Other + * @returns { boolean } Returns whether the current object is greater than or equal to the input object. + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * The comparison function is used by the scope. + * + * @param { ScopeComparable } other - Other + * @returns { boolean } Returns whether the current object is greater than or equal to the input object. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * The comparison function is used by the scope. + * + * @param { ScopeComparable } other - Other + * @returns { boolean } Returns whether the current object is greater than or equal to the input object. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 12 + */ + compareTo(other: ScopeComparable): boolean; + } + class types { + isArgumentsObject(value: Object): boolean; + isGeneratorFunction(value: Object): boolean; + isGeneratorObject(value: Object): boolean; + isModuleNamespaceObject(value: Object): boolean; + isProxy(value: Object): boolean; + isSymbolObject(value: Object): boolean; + } + class Aspect { + static addBefore(targetClass: Object, methodName: string, isStatic: boolean, before: Function): void; + static addAfter(targetClass: Object, methodName: string, isStatic: boolean, after: Function): void; + static replace(targetClass: Object, methodName: string, isStatic: boolean, instead: Function): void; + } + class Base64Helper { + encodeToStringSync(src: Uint8Array, options?: Type): string; + } + function getErrorString(errno: number): string; + function printf(format: string, ...args: Object[]): string; + function promiseWrapper(original: (err: Object, value: Object) => void): Object; + interface DecodeWithStreamOptions { + /** + * Does the call follow additional data blocks. The default value is false. + * @type { ?boolean } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + stream?: boolean; + } + class TextDecoder { + constructor(encoding?: string, options?: { + fatal?: boolean; + ignoreBOM?: boolean; + }); + decode(input: Uint8Array, options?: { + stream?: false; + }): string; + decodeWithStream(input: Uint8Array, options?: DecodeWithStreamOptions): string; + } + class TextEncoder { + encode(input?: string): Uint8Array; + encodeInto(input: string, dest: Uint8Array): { + read: number; + written: number; + }; + } +} +export default util; diff --git a/ets2panda/linter/test/sdkcommonapi/api/@arkts.collections.d.ts b/ets2panda/linter/test/sdkcommonapi/api/@arkts.collections.d.ts new file mode 100644 index 0000000000..e48680b122 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/api/@arkts.collections.d.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare namespace collections { + class Array implements ConcatArray { + constructor(); + constructor(first: T, ...left: T[]); + } + class Float32Array { + constructor(); + } + class Uint8Array { + constructor(); + } + class Uint8ClampedArray { + constructor(); + } + class Uint16Array { + constructor(); + } + class Uint32Array { + constructor(); + } +} + +export default collections; diff --git a/ets2panda/linter/test/sdkcommonapi/api/@ohos.buffer.d.ts b/ets2panda/linter/test/sdkcommonapi/api/@ohos.buffer.d.ts new file mode 100644 index 0000000000..f42a451235 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/api/@ohos.buffer.d.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare namespace buffer { + class Blob { + slice(start?: number, end?: number, type?: string): Blob; + } + class Buffer { + readInt8(offset?: number): number; + readInt16BE(offset?: number): number; + readInt16LE(offset?: number): number; + readInt32BE(offset?: number): number; + readInt32LE(offset?: number): number; + readIntBE(offset: number, byteLength: number): number; + readIntLE(offset: number, byteLength: number): number; + indexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; + } + function from(string: String, encoding?: BufferEncoding): Buffer; +} +export default buffer; \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/api/@ohos.url.d.ts b/ets2panda/linter/test/sdkcommonapi/api/@ohos.url.d.ts new file mode 100644 index 0000000000..ad14ed1386 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/api/@ohos.url.d.ts @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare namespace url { + class URLSearchParams { + constructor(init?: string[][] | Record | string | URLSearchParams); + [Symbol.iterator](): IterableIterator<[ + string, + string + ]>; + append(name: string, value: string): void; + delete(name: string): void; + getAll(name: string): string[]; + has(name: string): boolean; + keys(): IterableIterator; + entries(): IterableIterator<[ + string, + string + ]>; + forEach(callbackFn: (value: string, key: string, searchParams: URLSearchParams) => void, thisArg?: Object): void; + get(name: string): string | null; + set(name: string, value: string): void; + sort(): void; + toString(): string; + values(): IterableIterator; + } + class URL { + href: string; + readonly origin: string; + pathname: string; + search: string; + readonly searchParams: URLSearchParams; + } + class URLParams { + constructor(init?: string[][] | Record | string | URLParams); + [Symbol.iterator](): IterableIterator<[ + string, + string + ]>; + } +} +export default url; \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.LinkedList.d.ts b/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.LinkedList.d.ts new file mode 100644 index 0000000000..1ba1de3c7b --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.LinkedList.d.ts @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export declare class LinkedList { + constructor(); + length: number; + add(element: T): boolean; + [Symbol.iterator](): IterableIterator; + removeFirstFound(element: T): boolean; + removeLastFound(element: T): boolean; +} +export default LinkedList; \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.PlainArray.d.ts b/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.PlainArray.d.ts new file mode 100644 index 0000000000..8eef47deb4 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.PlainArray.d.ts @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export declare class PlainArray { + constructor(); + length: number; + add(key: number, value: T): void; + [Symbol.iterator](): IterableIterator<[ + number, + T + ]>; + getValueAt(index: number): T; + setValueAt(index: number, value: T): void; + forEach(callbackFn: (value: T, index?: number, PlainArray?: PlainArray) => void, thisArg?: Object): void; +} +export default PlainArray; \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.Queue.d.ts b/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.Queue.d.ts new file mode 100644 index 0000000000..688a9e1b93 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.Queue.d.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +declare class Queue { + constructor(); + length: number; + add(element: T): boolean; + [Symbol.iterator](): IterableIterator; +} + +export default Queue; \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.Stack.d.ts b/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.Stack.d.ts new file mode 100644 index 0000000000..65bdc86d2c --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.Stack.d.ts @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export declare class Stack { + [Symbol.iterator](): IterableIterator; +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.TreeMap.d.ts b/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.TreeMap.d.ts new file mode 100644 index 0000000000..c0ebb5b14a --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.TreeMap.d.ts @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +declare class TreeMap{ + constructor(comparator?: (firstValue: K, secondValue: K) => boolean); +} +export default TreeMap; \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.json.d.ts b/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.json.d.ts new file mode 100644 index 0000000000..3819fda8b6 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/api/@ohos.util.json.d.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare namespace json{ + type Transformer = (this: Object, key: string, value: Object) => Object | undefined | null; + function parse(text: string, reviver?: Transformer, options?: ParseOptions): Object | null; + function remove(obj: object, property: string): void; +} +export default json; \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets b/ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets new file mode 100644 index 0000000000..a60faf8956 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import collections from './api/@arkts.collections' + +const a: collections.Array = new collections.Array(); +const b: collections.Float32Array = new collections.Float32Array(); +const c: collections.Uint8Array = new collections.Uint8Array(); +const d: collections.Uint8ClampedArray = new collections.Uint8ClampedArray(); +const e: collections.Uint16Array = new collections.Uint16Array(); +const f: collections.Uint32Array = new collections.Uint32Array(); +const a1: collections.Array = new collections.Array("111"); +const a2: collections.Array = new collections.Array(2); +const a3: collections.Array = new collections.Array(); +let arr1 = new collections.Array(2) \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets.args.json b/ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets.args.json new file mode 100755 index 0000000000..4dfa4f2017 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets.arkts2.json b/ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets.arkts2.json new file mode 100755 index 0000000000..073ae7505a --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets.arkts2.json @@ -0,0 +1,248 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 15, + "column": 8, + "endLine": 15, + "endColumn": 19, + "problem": "LimitedStdLibNoImportConcurrency", + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 10, + "endLine": 17, + "endColumn": 27, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 42, + "endLine": 17, + "endColumn": 59, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 10, + "endLine": 18, + "endColumn": 34, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 41, + "endLine": 18, + "endColumn": 65, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 10, + "endLine": 19, + "endColumn": 32, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 39, + "endLine": 19, + "endColumn": 61, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 10, + "endLine": 20, + "endColumn": 39, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 46, + "endLine": 20, + "endColumn": 75, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 10, + "endLine": 21, + "endColumn": 33, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 40, + "endLine": 21, + "endColumn": 63, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 10, + "endLine": 22, + "endColumn": 33, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 40, + "endLine": 22, + "endColumn": 63, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 11, + "endLine": 23, + "endColumn": 28, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 43, + "endLine": 23, + "endColumn": 60, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 11, + "endLine": 24, + "endColumn": 22, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 39, + "endLine": 24, + "endColumn": 63, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 43, + "endLine": 24, + "endColumn": 54, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 11, + "endLine": 25, + "endColumn": 28, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 39, + "endLine": 25, + "endColumn": 62, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 43, + "endLine": 25, + "endColumn": 60, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 12, + "endLine": 26, + "endColumn": 36, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 16, + "endLine": 26, + "endColumn": 27, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets.json b/ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets.json new file mode 100755 index 0000000000..7633c79b6a --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/collections_no_array_sdk.ets.json @@ -0,0 +1,17 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets b/ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets new file mode 100755 index 0000000000..0528557176 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import buffer from './api/@ohos.buffer' + +let blob: buffer.Blob = new buffer.Blob(['a', 'b', 'c', 'd', 'e']); +const newBlob = blob.slice(0, 2, 'MIME'); //error +const res1 = newBlob.size // 5" + +//indexOf +let buf = buffer.from([-1, 5]); +let index = buf.indexOf(""); // error +let buf1 = new buffer.Buffer().indexOf(""); // error +let index2 = buffer.from("abc").indexOf(""); // error +let buf2 = buffer.from("123"); +let buf3 = buf2; +buf3.indexOf(""); // error +let buf4 = new buffer.Buffer(); +let buf5 = buf4; +buf5.indexOf(""); // error +buf5.indexOf(); // error +buf5.indexOf(1); +buf5.indexOf('adasf'); +new buffer.Buffer().indexOf("555"); + +//sum:7 \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets.args.json b/ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets.args.json new file mode 100755 index 0000000000..4dfa4f2017 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets.arkts2.json b/ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets.arkts2.json new file mode 100755 index 0000000000..bf860d819f --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets.arkts2.json @@ -0,0 +1,98 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 18, + "column": 22, + "endLine": 18, + "endColumn": 27, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"slice\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 7, + "endLine": 19, + "endColumn": 26, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 17, + "endLine": 23, + "endColumn": 24, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"indexOf\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 32, + "endLine": 24, + "endColumn": 39, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"indexOf\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 33, + "endLine": 25, + "endColumn": 40, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"indexOf\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 6, + "endLine": 28, + "endColumn": 13, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"indexOf\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 6, + "endLine": 31, + "endColumn": 13, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"indexOf\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 6, + "endLine": 32, + "endColumn": 13, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"indexOf\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets.json b/ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets.json new file mode 100755 index 0000000000..d4ee73858c --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_buffer.ets.json @@ -0,0 +1,28 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 19, + "column": 7, + "endLine": 19, + "endColumn": 26, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_index.ets b/ets2panda/linter/test/sdkcommonapi/sdk_index.ets new file mode 100755 index 0000000000..2f7fb4f18a --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_index.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {Stack} from './api/@ohos.util.Stack'; +import Queue from './api/@ohos.util.Queue'; +import {LinkedList} from './api/@ohos.util.LinkedList'; +import {PlainArray} from './api/@ohos.util.PlainArray'; + +let stack = new Stack(); +stack.push(1); +const a: number = stack[0]; //error + + +let queue = new Queue(); +queue.add(1); //error +const b: number = queue[0]; //error + + +let linkedList = new LinkedList(); +linkedList.add(1); +const c: number = linkedList[0]; //error + + +let plainArray = new PlainArray(); +stack.push(1); +const d: number = plainArray[0]; //error +const d: number = plainArray[]; \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_index.ets.args.json b/ets2panda/linter/test/sdkcommonapi/sdk_index.ets.args.json new file mode 100755 index 0000000000..4dfa4f2017 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_index.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_index.ets.arkts2.json b/ets2panda/linter/test/sdkcommonapi/sdk_index.ets.arkts2.json new file mode 100755 index 0000000000..1dbd86e5b7 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_index.ets.arkts2.json @@ -0,0 +1,68 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 23, + "column": 19, + "endLine": 23, + "endColumn": 27, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"Stack\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 7, + "endLine": 27, + "endColumn": 10, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"add\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 19, + "endLine": 28, + "endColumn": 27, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"Queue\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 19, + "endLine": 33, + "endColumn": 32, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"LinkedList\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 19, + "endLine": 38, + "endColumn": 32, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"PlainArray\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_index.ets.json b/ets2panda/linter/test/sdkcommonapi/sdk_index.ets.json new file mode 100755 index 0000000000..fd71430f1e --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_index.ets.json @@ -0,0 +1,17 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_json.ets b/ets2panda/linter/test/sdkcommonapi/sdk_json.ets new file mode 100755 index 0000000000..d3bf617e61 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_json.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import json from './api/@ohos.util.json' + +let obj = json.parse(''); //error +function aa(this: Object, key: string, value: Object): Object | undefined | null { + return null; +} +let obj1 = json.parse('', aa); //error +json.remove(obj, ''); //error +const uppercaseTransformer: json.Transformer = (key, value) => { //error + if (typeof value === 'string') { + return value.toUpperCase(); + } + return value; +}; +//sum:4 \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_json.ets.args.json b/ets2panda/linter/test/sdkcommonapi/sdk_json.ets.args.json new file mode 100755 index 0000000000..4dfa4f2017 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_json.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_json.ets.arkts2.json b/ets2panda/linter/test/sdkcommonapi/sdk_json.ets.arkts2.json new file mode 100755 index 0000000000..a63da21b61 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_json.ets.arkts2.json @@ -0,0 +1,78 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 15, + "column": 18, + "endLine": 15, + "endColumn": 41, + "problem": "NoImportJsonFile", + "suggest": "", + "rule": "JSON files cannot be imported (arkts-no-import-json-file)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 16, + "endLine": 17, + "endColumn": 21, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"parse\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 13, + "endLine": 18, + "endColumn": 17, + "problem": "InvalidIdentifier", + "suggest": "", + "rule": "This keyword cannot be used as identifiers (arkts-invalid-identifier)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 17, + "endLine": 21, + "endColumn": 22, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"parse\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 6, + "endLine": 22, + "endColumn": 12, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"remove\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 29, + "endLine": 23, + "endColumn": 45, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Transformer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_json.ets.json b/ets2panda/linter/test/sdkcommonapi/sdk_json.ets.json new file mode 100755 index 0000000000..7633c79b6a --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_json.ets.json @@ -0,0 +1,17 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_list.ets b/ets2panda/linter/test/sdkcommonapi/sdk_list.ets new file mode 100755 index 0000000000..d7f1ecb4d3 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_list.ets @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ArrayList } from './@ohos.util.ArrayList'; +import LinkedList from './api/@ohos.util.LinkedList'; +import {PlainArray} from './api/@ohos.util.PlainArray'; +import TreeMap from './api/@ohos.util.TreeMap'; + +let linkedList: LinkedList = new LinkedList(); +linkedList.add(4); +linkedList.add(5); +linkedList.add(4); +let result = linkedList.removeFirstFound(6);//error +let result1 = linkedList.removeLastFound(6); //error + +let plainArray: PlainArray = new PlainArray(); +let result3 = plainArray.getKeyAt(-1); +let result32 = plainArray.getValueAt(-1); +let result4 = plainArray.setValueAt(-2, 0); + +let treeMap: TreeMap = + new TreeMap((firstValue: string, secondValue: string): boolean => { //error + return firstValue > secondValue + }); + +let arrayList: ArrayList = new ArrayList(); +arrayList.add("刘"); +arrayList.add("张三"); +arrayList.add(1); +arrayList.add(2); +arrayList.sort((a, b) => a - b); //error + +function fn() {console.log('Hello');} +let arrayList2: ArrayList = new ArrayList(); +arrayList2.add(2); +arrayList2.forEach((value: number, index?: number) => { //error + console.log('value:' + value, 'index:' + index); +}, fn); + +let arrayList3: ArrayList = new ArrayList(); +arrayList.add(2); +arrayList.add(4); +arrayList.replaceAllElements((value: number): number => { //error + return value; +},fn); + + +arrayList.replaceAllElements((value: number): number => { //error need fix on whitelist + return value; +}); +arrayList2.forEach((value: number, index?: number) => { //error need fix on whitelist + console.log('value:' + value, 'index:' + index); +}); +//sum:6 \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_list.ets.args.json b/ets2panda/linter/test/sdkcommonapi/sdk_list.ets.args.json new file mode 100755 index 0000000000..4dfa4f2017 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_list.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_list.ets.arkts2.json b/ets2panda/linter/test/sdkcommonapi/sdk_list.ets.arkts2.json new file mode 100755 index 0000000000..b0da530530 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_list.ets.arkts2.json @@ -0,0 +1,158 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 21, + "column": 38, + "endLine": 21, + "endColumn": 54, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 25, + "endLine": 25, + "endColumn": 41, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"removeFirstFound\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 26, + "endLine": 26, + "endColumn": 41, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"removeLastFound\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 5, + "endLine": 29, + "endColumn": 38, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 15, + "endLine": 31, + "endColumn": 43, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 7, + "endLine": 34, + "endColumn": 14, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"constructor\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 11, + "endLine": 43, + "endColumn": 15, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"sort\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 12, + "endLine": 48, + "endColumn": 19, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"forEach\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 29, + "endLine": 52, + "endColumn": 44, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 11, + "endLine": 55, + "endColumn": 29, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"replaceAllElements\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 60, + "column": 11, + "endLine": 60, + "endColumn": 29, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"replaceAllElements\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 63, + "column": 12, + "endLine": 63, + "endColumn": 19, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"forEach\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 30, + "endLine": 55, + "endColumn": 66, + "problem": "StrictDiagnostic", + "suggest": "Argument of type '(value: number) => number' is not assignable to parameter of type '(value: String | Number, index?: number | undefined, arrlist?: ArrayList | undefined) => String | Number'.\n Types of parameters 'value' and 'value' are incompatible.\n Type 'String | Number' is not assignable to type 'number'.\n Type 'String' is not assignable to type 'number'.", + "rule": "Argument of type '(value: number) => number' is not assignable to parameter of type '(value: String | Number, index?: number | undefined, arrlist?: ArrayList | undefined) => String | Number'.\n Types of parameters 'value' and 'value' are incompatible.\n Type 'String | Number' is not assignable to type 'number'.\n Type 'String' is not assignable to type 'number'.", + "severity": "ERROR" + }, + { + "line": 60, + "column": 30, + "endLine": 60, + "endColumn": 88, + "problem": "StrictDiagnostic", + "suggest": "Argument of type '(value: number) => number' is not assignable to parameter of type '(value: String | Number, index?: number | undefined, arrlist?: ArrayList | undefined) => String | Number'.\n Types of parameters 'value' and 'value' are incompatible.\n Type 'String | Number' is not assignable to type 'number'.\n Type 'String' is not assignable to type 'number'.", + "rule": "Argument of type '(value: number) => number' is not assignable to parameter of type '(value: String | Number, index?: number | undefined, arrlist?: ArrayList | undefined) => String | Number'.\n Types of parameters 'value' and 'value' are incompatible.\n Type 'String | Number' is not assignable to type 'number'.\n Type 'String' is not assignable to type 'number'.", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_list.ets.json b/ets2panda/linter/test/sdkcommonapi/sdk_list.ets.json new file mode 100755 index 0000000000..1beab63279 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_list.ets.json @@ -0,0 +1,48 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 29, + "column": 5, + "endLine": 29, + "endColumn": 38, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 30, + "endLine": 55, + "endColumn": 66, + "problem": "StrictDiagnostic", + "suggest": "Argument of type '(value: number) => number' is not assignable to parameter of type '(value: String | Number, index?: number | undefined, arrlist?: ArrayList | undefined) => String | Number'.\n Types of parameters 'value' and 'value' are incompatible.\n Type 'String | Number' is not assignable to type 'number'.\n Type 'String' is not assignable to type 'number'.", + "rule": "Argument of type '(value: number) => number' is not assignable to parameter of type '(value: String | Number, index?: number | undefined, arrlist?: ArrayList | undefined) => String | Number'.\n Types of parameters 'value' and 'value' are incompatible.\n Type 'String | Number' is not assignable to type 'number'.\n Type 'String' is not assignable to type 'number'.", + "severity": "ERROR" + }, + { + "line": 60, + "column": 30, + "endLine": 60, + "endColumn": 88, + "problem": "StrictDiagnostic", + "suggest": "Argument of type '(value: number) => number' is not assignable to parameter of type '(value: String | Number, index?: number | undefined, arrlist?: ArrayList | undefined) => String | Number'.\n Types of parameters 'value' and 'value' are incompatible.\n Type 'String | Number' is not assignable to type 'number'.\n Type 'String' is not assignable to type 'number'.", + "rule": "Argument of type '(value: number) => number' is not assignable to parameter of type '(value: String | Number, index?: number | undefined, arrlist?: ArrayList | undefined) => String | Number'.\n Types of parameters 'value' and 'value' are incompatible.\n Type 'String | Number' is not assignable to type 'number'.\n Type 'String' is not assignable to type 'number'.", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_url.ets b/ets2panda/linter/test/sdkcommonapi/sdk_url.ets new file mode 100755 index 0000000000..2a2f5e1d0d --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_url.ets @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import url from './api/@ohos.url'; + +let paramsObj = new url.URLParams('aa=%E4%B8%AD%E5%9B%BD%BD'); //error +console.log(paramsObj.get('aa')) // 中国%BD console.log(paramsObj.toString()) // aa=%E4%B8%AD%E5%9B%BD%25BD" +const paramsObject1 = new url.URLSearchParams('fod=bay&edg=bap');//error +paramsObject1.append('fod', '3');//error + +let objectParams = new url.URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]);//error +let objectParams1 = new url.URLSearchParams({"fod" : '1' , "bard" : '2'});//error +let objectParams2 = new url.URLSearchParams('?fod=1&bard=2');//error +let urlObject1 = new url.URL('https://developer.mozilla.org/?fod=1&bard=2'); +let params1 = new url.URLSearchParams(urlObject1.search); //error*2 + +const paramsObject2 = new url.URLSearchParams('fod=bay&edg=bap');//error +paramsObject2.delete('fod');//error + +let searchParamsObject1 = new url.URLSearchParams("keyName1=valueName1&keyName2=valueName2");//error +let iter: Iterable = searchParamsObject1.entries();//error +let pairs = Array.from(iter); +for (let pair of pairs) { // Show keyName/valueName pairs + console.log(pair[0]+ ', '+ pair[1]); +} + +const myURLObject = new url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +myURLObject.searchParams.forEach((value, name, searchParams) => {//error*2 + console.log(name, value, myURLObject.searchParams === searchParams);//error +}); + +let paramsObject3 = new url.URLSearchParams('name=Jonathan&age=18');//error +let name = paramsObject3.get("name"); //error +let age = paramsObject3.get("age"); //error +let getObj = paramsObject3.get("abc"); //error + +let urlObject2 = new url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let params2 = new url.URLSearchParams(urlObject2.search.slice(1));//error*2 +params2.append('fod', '3');//error +console.log(params2.getAll('fod').toString())//error +let paramsObject4 = new url.URLSearchParams(urlObject2.search.slice(1));//error*2 +paramsObject4.has('bard') === true;//error + +let searchParamsObject2 = new url.URLSearchParams("key1=value1&key2=value2"); //error +let keys = Array.from(searchParamsObject2.keys());//error +for (let key of keys) { + console.log(key); +} + +let urlObject3 = new url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let paramsObject = new url.URLSearchParams(urlObject3.search.slice(1));//error*2 +paramsObject.set('baz', '3');//error + +let searchParamsObject = new url.URLSearchParams("c=3&a=9&b=4&d=2");//error +searchParamsObject.sort(); //error +console.log(searchParamsObject.toString());//error +let urlObject = new url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let params = new url.URLSearchParams(urlObject.search.slice(1));//error*2 +params.append('fod', '3');//error +console.log(params.toString()); //error + +let searchParams = new url.URLSearchParams("key1=value1&key2=value2");//error +let values = Array.from(searchParams.values());//error +for (let value of values) { console.log(value); } + +//sum:40 \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_url.ets.args.json b/ets2panda/linter/test/sdkcommonapi/sdk_url.ets.args.json new file mode 100755 index 0000000000..4dfa4f2017 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_url.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_url.ets.arkts2.json b/ets2panda/linter/test/sdkcommonapi/sdk_url.ets.arkts2.json new file mode 100755 index 0000000000..a8458bc115 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_url.ets.arkts2.json @@ -0,0 +1,438 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 17, + "column": 21, + "endLine": 17, + "endColumn": 34, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"constructor\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 31, + "endLine": 19, + "endColumn": 46, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 15, + "endLine": 20, + "endColumn": 21, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 28, + "endLine": 22, + "endColumn": 43, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 29, + "endLine": 23, + "endColumn": 44, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 29, + "endLine": 24, + "endColumn": 44, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 23, + "endLine": 26, + "endColumn": 38, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 50, + "endLine": 26, + "endColumn": 56, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"search\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 31, + "endLine": 28, + "endColumn": 46, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 15, + "endLine": 29, + "endColumn": 21, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 35, + "endLine": 31, + "endColumn": 50, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 52, + "endLine": 32, + "endColumn": 59, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 15, + "endLine": 35, + "endColumn": 22, + "problem": "RuntimeArrayCheck", + "suggest": "", + "rule": "Array bound not checked. (arkts-runtime-array-check)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 30, + "endLine": 35, + "endColumn": 37, + "problem": "RuntimeArrayCheck", + "suggest": "", + "rule": "Array bound not checked. (arkts-runtime-array-check)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 26, + "endLine": 39, + "endColumn": 33, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 13, + "endLine": 39, + "endColumn": 25, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"searchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 40, + "endLine": 40, + "endColumn": 52, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"searchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 29, + "endLine": 43, + "endColumn": 44, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 44, + "column": 26, + "endLine": 44, + "endColumn": 29, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 25, + "endLine": 45, + "endColumn": 28, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 28, + "endLine": 46, + "endColumn": 31, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 49, + "column": 23, + "endLine": 49, + "endColumn": 38, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 49, + "column": 50, + "endLine": 49, + "endColumn": 56, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"search\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 9, + "endLine": 50, + "endColumn": 15, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 51, + "column": 21, + "endLine": 51, + "endColumn": 27, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 29, + "endLine": 52, + "endColumn": 44, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 56, + "endLine": 52, + "endColumn": 62, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"search\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 53, + "column": 15, + "endLine": 53, + "endColumn": 18, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 35, + "endLine": 55, + "endColumn": 50, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 43, + "endLine": 56, + "endColumn": 47, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 62, + "column": 28, + "endLine": 62, + "endColumn": 43, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 62, + "column": 55, + "endLine": 62, + "endColumn": 61, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"search\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 63, + "column": 14, + "endLine": 63, + "endColumn": 17, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 65, + "column": 34, + "endLine": 65, + "endColumn": 49, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 20, + "endLine": 66, + "endColumn": 24, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 32, + "endLine": 67, + "endColumn": 40, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 22, + "endLine": 69, + "endColumn": 37, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 48, + "endLine": 69, + "endColumn": 54, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"search\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 8, + "endLine": 70, + "endColumn": 14, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 71, + "column": 20, + "endLine": 71, + "endColumn": 28, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 28, + "endLine": 73, + "endColumn": 43, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 74, + "column": 38, + "endLine": 74, + "endColumn": 44, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_url.ets.json b/ets2panda/linter/test/sdkcommonapi/sdk_url.ets.json new file mode 100755 index 0000000000..7633c79b6a --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_url.ets.json @@ -0,0 +1,17 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_util.ets b/ets2panda/linter/test/sdkcommonapi/sdk_util.ets new file mode 100755 index 0000000000..8e8394bb92 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_util.ets @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import util from './@ohos.util'; + +//util.Base64 +let base64 = new util.Base64(); //error +let array = new Uint8Array([99,122,69,122]); +base64.decode(array).then((val) => { //error + console.info(val.toString()); // 115,49,51 +}) +let buff = 'czEz'; +let result0 = base64.decodeSync(buff); //error +console.info("result0 = " + result0); // result = 115,49,51" + +base64.encode(array).then((val) => { //error + console.info(val.toString()); // 99,122,69,122 +}) + +let result1 = base64.encodeSync(array); //error +console.info("result1 = " + result1); // result = 99,122,69,122" + +base64.encodeToString(array).then((val) => { //error + console.info(val); // czEz +}) + +let result2 = base64.encodeToStringSync(array); //error +console.info("result2 = "+ result2); // result = czEz +//util.LruBuffer +class ChildLruBuffer extends util.LruBuffer { //error + length: number=0; //error + constructor(capacity?: number) { + super(capacity); //error + } + afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void { //error + if (isEvict === true) { + console.info('key: ' + key); // 输出结果:key: 11 + console.info('value: ' + value); // 输出结果:value: 1 + console.info('newValue: ' + newValue); // 输出结果:newValue: null + } + } + [Symbol.iterator](): IterableIterator<[ //error + K, + V + ]>{ + return <>; + } +} +class ChildLruBuffer1 extends util.LruBuffer { //error +} +let lru: ChildLruBuffer = new ChildLruBuffer(2); +lru.put(11, 1); //error +lru.put(22, 2); //error +lru.afterRemoval(false,22, 2,1); + +let lru1: ChildLruBuffer1 = new ChildLruBuffer1(2); +lru1.afterRemoval(false,22, 2,1); //error + +let pro : util.LruBuffer = new util.LruBuffer(); //error*2 +pro[Symbol.iterator](); //error +pro.afterRemoval(true,1,2,1); //error +pro.length; //error +pro.clear(); //error +let result4 = pro.contains(20); //error +console.info('result4 = ' + result4); // result = false +pro.createDefault(50); //error +pro.put(2,10); //error +pro.entries(); //error +pro.get(2); //error +pro.remove(20); //error +console.info("result = " + pro.toString()); //error +pro.updateCapacity(100); //error + +let pro3: util.LruBuffer = new util.LruBuffer(); //error*2 +pro3.put(2,10); //error +pro3.put(2,"anhu"); //error +pro3.put("afaf","grfb"); //error +let result3 = pro3.values(); //error +console.info("result3 = " + result3); // result = anhu,grfb" + +let pro4: util.LruBuffer= new util.LruBuffer(); //error*2 +pro4.put(2,10); //error +pro4.put(1,8); //error +console.info("result = " + pro4.length); //error + +//util.Scope +class ScopeDemo extends util.Scope {} //error +class Temperature implements util.ScopeComparable { + private readonly _temp: number; + constructor(value: number) { + this._temp = value; + } + compareTo(value: Temperature) { + return this._temp >= value.getTemp(); + } + getTemp() { + return this._temp; + } + toString(): string { + return this._temp.toString(); + } +} +let tempLower = new Temperature(30); +let tempUpper = new Temperature(40); +let tempMiDF = new Temperature(35); +let range = new util.Scope(tempLower, tempUpper); //error +console.info("result = " + range.clamp(tempMiDF)); //error +console.info("range = " + range); // range = [30, 40]" +let tempLess = new Temperature(20); +let tempMore = new Temperature(45); +let rangeSec = new util.Scope(tempLess, tempMore); //error +range.contains(rangeSec); //error + +let tempMiDS = new Temperature(39); +range.expand(tempMiDF, tempMiDS); //error +range.expand(range); //error +console.info("result = " + result); +range.expand(tempMiDF); //error +console.info("result = " + result); +range.getLower(); //error +range.getUpper(); //error +range.intersect(tempMiDF, tempMiDS); //error +range.intersect(range); //error +range.toString(); //error + +//sum:54 \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_util.ets.args.json b/ets2panda/linter/test/sdkcommonapi/sdk_util.ets.args.json new file mode 100755 index 0000000000..4dfa4f2017 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_util.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_util.ets.arkts2.json b/ets2panda/linter/test/sdkcommonapi/sdk_util.ets.arkts2.json new file mode 100755 index 0000000000..99f42c563f --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_util.ets.arkts2.json @@ -0,0 +1,668 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 18, + "column": 23, + "endLine": 18, + "endColumn": 29, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Base64\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 8, + "endLine": 20, + "endColumn": 14, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Base64\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 22, + "endLine": 24, + "endColumn": 32, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Base64\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 8, + "endLine": 27, + "endColumn": 14, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Base64\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 22, + "endLine": 31, + "endColumn": 32, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Base64\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 8, + "endLine": 34, + "endColumn": 22, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Base64\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 22, + "endLine": 38, + "endColumn": 40, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Base64\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 44, + "column": 5, + "endLine": 44, + "endColumn": 20, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 3, + "endLine": 52, + "endColumn": 4, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 53, + "column": 3, + "endLine": 58, + "endColumn": 4, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 3, + "endLine": 42, + "endColumn": 20, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 41, + "endLine": 41, + "endColumn": 50, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 53, + "column": 4, + "endLine": 53, + "endColumn": 19, + "problem": "BuiltinSymbolIterator", + "suggest": "", + "rule": "Using \"Symbol.iterator\" is not allowed in this API (arkts-builtin-symbol-iterator)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 12, + "endLine": 57, + "endColumn": 14, + "problem": "TypeAssertion", + "suggest": "", + "rule": "Only \"as T\" syntax is supported for type casts (arkts-as-casts)", + "severity": "ERROR" + }, + { + "line": 60, + "column": 1, + "endLine": 61, + "endColumn": 2, + "problem": "MissingSuperCall", + "suggest": "", + "rule": "The subclass constructor must call the parent class's parametered constructor (arkts-subclass-must-call-super-constructor-with-args)", + "severity": "ERROR" + }, + { + "line": 60, + "column": 42, + "endLine": 60, + "endColumn": 51, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 62, + "column": 43, + "endLine": 62, + "endColumn": 64, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 63, + "column": 5, + "endLine": 63, + "endColumn": 8, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 64, + "column": 5, + "endLine": 64, + "endColumn": 8, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 45, + "endLine": 67, + "endColumn": 67, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 68, + "column": 6, + "endLine": 68, + "endColumn": 18, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 11, + "endLine": 70, + "endColumn": 40, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 43, + "endLine": 70, + "endColumn": 63, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 52, + "endLine": 70, + "endColumn": 61, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 71, + "column": 5, + "endLine": 71, + "endColumn": 20, + "problem": "BuiltinSymbolIterator", + "suggest": "", + "rule": "Using \"Symbol.iterator\" is not allowed in this API (arkts-builtin-symbol-iterator)", + "severity": "ERROR" + }, + { + "line": 71, + "column": 5, + "endLine": 71, + "endColumn": 20, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"Symbol.iterator\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 72, + "column": 5, + "endLine": 72, + "endColumn": 17, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 5, + "endLine": 73, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 74, + "column": 5, + "endLine": 74, + "endColumn": 10, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 19, + "endLine": 75, + "endColumn": 27, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 77, + "column": 5, + "endLine": 77, + "endColumn": 18, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 78, + "column": 5, + "endLine": 78, + "endColumn": 8, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 79, + "column": 5, + "endLine": 79, + "endColumn": 12, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 80, + "column": 5, + "endLine": 80, + "endColumn": 8, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 81, + "column": 5, + "endLine": 81, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 82, + "column": 32, + "endLine": 82, + "endColumn": 40, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 83, + "column": 5, + "endLine": 83, + "endColumn": 19, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 85, + "column": 11, + "endLine": 85, + "endColumn": 58, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 85, + "column": 61, + "endLine": 85, + "endColumn": 81, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 85, + "column": 70, + "endLine": 85, + "endColumn": 79, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 86, + "column": 6, + "endLine": 86, + "endColumn": 9, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 87, + "column": 6, + "endLine": 87, + "endColumn": 9, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 88, + "column": 6, + "endLine": 88, + "endColumn": 9, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 89, + "column": 20, + "endLine": 89, + "endColumn": 26, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 92, + "column": 11, + "endLine": 92, + "endColumn": 40, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 92, + "column": 42, + "endLine": 92, + "endColumn": 62, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 92, + "column": 51, + "endLine": 92, + "endColumn": 60, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 6, + "endLine": 93, + "endColumn": 9, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 94, + "column": 6, + "endLine": 94, + "endColumn": 9, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 95, + "column": 33, + "endLine": 95, + "endColumn": 39, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.LruBuffer\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 98, + "column": 1, + "endLine": 98, + "endColumn": 39, + "problem": "MissingSuperCall", + "suggest": "", + "rule": "The subclass constructor must call the parent class's parametered constructor (arkts-subclass-must-call-super-constructor-with-args)", + "severity": "ERROR" + }, + { + "line": 98, + "column": 31, + "endLine": 98, + "endColumn": 36, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Scope\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 104, + "column": 13, + "endLine": 104, + "endColumn": 31, + "problem": "MethodInheritRule", + "suggest": "", + "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", + "severity": "ERROR" + }, + { + "line": 117, + "column": 22, + "endLine": 117, + "endColumn": 27, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Scope\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 118, + "column": 34, + "endLine": 118, + "endColumn": 39, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Scope\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 122, + "column": 25, + "endLine": 122, + "endColumn": 30, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Scope\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 123, + "column": 7, + "endLine": 123, + "endColumn": 15, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Scope\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 126, + "column": 7, + "endLine": 126, + "endColumn": 13, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Scope\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 127, + "column": 7, + "endLine": 127, + "endColumn": 13, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Scope\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 129, + "column": 7, + "endLine": 129, + "endColumn": 13, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Scope\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 131, + "column": 7, + "endLine": 131, + "endColumn": 15, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Scope\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 132, + "column": 7, + "endLine": 132, + "endColumn": 15, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Scope\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 133, + "column": 7, + "endLine": 133, + "endColumn": 16, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Scope\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 134, + "column": 7, + "endLine": 134, + "endColumn": 16, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Scope\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 135, + "column": 7, + "endLine": 135, + "endColumn": 15, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"util.Scope\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_util.ets.json b/ets2panda/linter/test/sdkcommonapi/sdk_util.ets.json new file mode 100755 index 0000000000..3b5a4f9ce5 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_util.ets.json @@ -0,0 +1,28 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 57, + "column": 12, + "endLine": 57, + "endColumn": 14, + "problem": "TypeAssertion", + "suggest": "", + "rule": "Only \"as T\" syntax is supported for type casts (arkts-as-casts)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_util2.ets b/ets2panda/linter/test/sdkcommonapi/sdk_util2.ets new file mode 100755 index 0000000000..5a08ed392d --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_util2.ets @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import util from './@ohos.util'; + +function test(obj: Object) { + let type = new util.types(); + type.isArgumentsObject(obj); //error + type.isGeneratorFunction(obj); //error + type.isGeneratorObject(obj); //error + type.isModuleNamespaceObject(obj); //error + type.isProxy(obj); //error + type.isSymbolObject(obj); //error +} + +class A { +} + +util.Aspect.addAfter(A, 'foo', true, (str: string) => { //error +}); +util.Aspect.addBefore(A, 'foo', true, (str: string) => { //error +}); +util.Aspect.replace(A, 'foo', true, (str: string) => { //error +}); + +let base64Helper = new util.Base64Helper(); +let array = new Uint8Array([115, 49, 51]); +let result = base64Helper.encodeToStringSync(array); //error +let cache = new util.LRUCache(); //error +let result1 = cache.put(2, 10); //error +console.log('result = ' + result1); // 输出结果:result = 10 +let pro2: util.LRUCache = new util.LRUCache(); //error +let result5 = pro2.getCapacity(); //error +console.info("result5 = " + result5); +pro2.put(1, 8); //error +let result6 = pro2.getCreateCount(); //error +console.info("result6 = " + result6); +pro2.getMatchCount(); //error +pro2.get(2); +console.info("result = " + pro2.getMissCount()); //error +console.info("result = " + pro2.getPutCount()); //error +pro2.updateCapacity(2); //error +pro2.put(50, 22); //error +pro2.length; //error +pro2.getCapacity(); //error +console.info("result = " + pro2.getRemovalCount()); //error +console.info("result = " + pro2.isEmpty()); +console.info("result = " + pro2.keys()); // 输出结果:result = 2" +console.info("result = " + pro2.put(2, 10)); //error +console.info("result = " + pro2.remove(20)); +let a: number = 5; +new util.LRUCache().length; //error*2 + +let errnum = -1; +console.info("" + util.getErrorString(errnum)); //error + +let res = util.printf("\"%s\"", "hello world!"); //error +console.info(res); // 输出结果:hello world! + +async function fn() { return 'hello world'; } +const addCall = util.promiseWrapper(util.callbackWrapper(fn)); //error + +let decodeWithStreamOptions: util.DecodeWithStreamOptions = { stream: false } //error +let textDecoder1 = new util.TextDecoder("utf-8",{ignoreBOM: true}); //error + +let uint8 = new Uint8Array(6); +uint8[0] = 0xEF; +uint8[1] = 0xBB; +uint8[2] = 0xBF; +uint8[3] = 0x61; +uint8[4] = 0x62; +uint8[5] = 0x63; +console.info("input num:"); +textDecoder1.decode(uint8, {stream: false}); //error + +let textDecoderOptions: util.TextDecoderOptions = { + fatal: false, + ignoreBOM : true +} + +let textEncoder3: util.TextEncoder = new util.TextEncoder(); +let resu = textEncoder3.encode(''); //error + +let textEncoder: util.TextEncoder = new util.TextEncoder(); +let buffer = new ArrayBuffer(4); +let uint = new Uint8Array(buffer); +let result10 = textEncoder.encodeInto('', uint); //error + +//sum:35 \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_util2.ets.args.json b/ets2panda/linter/test/sdkcommonapi/sdk_util2.ets.args.json new file mode 100755 index 0000000000..4dfa4f2017 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_util2.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_util2.ets.arkts2.json b/ets2panda/linter/test/sdkcommonapi/sdk_util2.ets.arkts2.json new file mode 100755 index 0000000000..c37e3cee93 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_util2.ets.arkts2.json @@ -0,0 +1,448 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 19, + "column": 8, + "endLine": 19, + "endColumn": 25, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"isArgumentsObject\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 8, + "endLine": 20, + "endColumn": 27, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"isGeneratorFunction\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 8, + "endLine": 21, + "endColumn": 25, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"isGeneratorObject\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 8, + "endLine": 22, + "endColumn": 31, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"isModuleNamespaceObject\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 8, + "endLine": 23, + "endColumn": 15, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"isProxy\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 8, + "endLine": 24, + "endColumn": 22, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"isSymbolObject\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 13, + "endLine": 30, + "endColumn": 21, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"addAfter\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 13, + "endLine": 32, + "endColumn": 22, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"addBefore\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 13, + "endLine": 34, + "endColumn": 20, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"replace\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 27, + "endLine": 39, + "endColumn": 45, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"encodeToStringSync\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 17, + "endLine": 40, + "endColumn": 30, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"constructor\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 21, + "endLine": 41, + "endColumn": 24, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"put\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 47, + "endLine": 43, + "endColumn": 60, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"constructor\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 43, + "endLine": 43, + "endColumn": 62, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 44, + "column": 20, + "endLine": 44, + "endColumn": 31, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"getCapacity\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 6, + "endLine": 46, + "endColumn": 9, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"put\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 20, + "endLine": 47, + "endColumn": 34, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"getCreateCount\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 49, + "column": 6, + "endLine": 49, + "endColumn": 19, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"getMatchCount\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 51, + "column": 33, + "endLine": 51, + "endColumn": 45, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"getMissCount\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 33, + "endLine": 52, + "endColumn": 44, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"getPutCount\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 53, + "column": 6, + "endLine": 53, + "endColumn": 20, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"updateCapacity\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 54, + "column": 6, + "endLine": 54, + "endColumn": 9, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"put\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 6, + "endLine": 55, + "endColumn": 12, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"length\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 6, + "endLine": 56, + "endColumn": 17, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"getCapacity\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 33, + "endLine": 57, + "endColumn": 48, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"getRemovalCount\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 60, + "column": 33, + "endLine": 60, + "endColumn": 36, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"put\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 63, + "column": 21, + "endLine": 63, + "endColumn": 27, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"length\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 63, + "column": 5, + "endLine": 63, + "endColumn": 18, + "problem": "SdkCommonApiBehaviorChange", + "suggest": "", + "rule": "The \"constructor\" in SDK has been changed.(sdk-method-changed)", + "severity": "ERROR" + }, + { + "line": 63, + "column": 1, + "endLine": 63, + "endColumn": 20, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 24, + "endLine": 66, + "endColumn": 38, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"getErrorString\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 68, + "column": 16, + "endLine": 68, + "endColumn": 22, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"printf\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 72, + "column": 22, + "endLine": 72, + "endColumn": 36, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"promiseWrapper\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 74, + "column": 63, + "endLine": 74, + "endColumn": 69, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stream\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 24, + "endLine": 75, + "endColumn": 40, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"constructor\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 78, + "column": 1, + "endLine": 78, + "endColumn": 9, + "problem": "RuntimeArrayCheck", + "suggest": "", + "rule": "Array bound not checked. (arkts-runtime-array-check)", + "severity": "ERROR" + }, + { + "line": 79, + "column": 1, + "endLine": 79, + "endColumn": 9, + "problem": "RuntimeArrayCheck", + "suggest": "", + "rule": "Array bound not checked. (arkts-runtime-array-check)", + "severity": "ERROR" + }, + { + "line": 80, + "column": 1, + "endLine": 80, + "endColumn": 9, + "problem": "RuntimeArrayCheck", + "suggest": "", + "rule": "Array bound not checked. (arkts-runtime-array-check)", + "severity": "ERROR" + }, + { + "line": 81, + "column": 1, + "endLine": 81, + "endColumn": 9, + "problem": "RuntimeArrayCheck", + "suggest": "", + "rule": "Array bound not checked. (arkts-runtime-array-check)", + "severity": "ERROR" + }, + { + "line": 82, + "column": 1, + "endLine": 82, + "endColumn": 9, + "problem": "RuntimeArrayCheck", + "suggest": "", + "rule": "Array bound not checked. (arkts-runtime-array-check)", + "severity": "ERROR" + }, + { + "line": 83, + "column": 1, + "endLine": 83, + "endColumn": 9, + "problem": "RuntimeArrayCheck", + "suggest": "", + "rule": "Array bound not checked. (arkts-runtime-array-check)", + "severity": "ERROR" + }, + { + "line": 85, + "column": 14, + "endLine": 85, + "endColumn": 20, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"decode\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 25, + "endLine": 93, + "endColumn": 31, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"encode\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 98, + "column": 28, + "endLine": 98, + "endColumn": 38, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"encodeInto\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_util2.ets.json b/ets2panda/linter/test/sdkcommonapi/sdk_util2.ets.json new file mode 100755 index 0000000000..7633c79b6a --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_util2.ets.json @@ -0,0 +1,17 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_vector.ets b/ets2panda/linter/test/sdkcommonapi/sdk_vector.ets new file mode 100755 index 0000000000..94be7b643e --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_vector.ets @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Vector from './@ohos.util.Vector'; + +let vector : Vector = new Vector(); //error +vector.add(2); //error +vector.add(4); //error +vector.add(5); //error +vector.add(4); //error +// 使用方法一: +let nums: Array = vector.convertToArray() //error +for (let item of nums) { + console.log("testLog value:" + item); +} +vector.clear(); //error +vector.add(2); //error +vector.clone(); //error +vector.add(2); //error +vector.convertToArray(); //error +vector.add(2); //error +let arr: Array = [] +vector.copyToArray(arr); //error + + +vector.add(2); //error +vector.forEach((value: number, index?: number) => { //error + console.log('value = ' + value, 'index = ' + index); +}); +vector.add(2); //error +vector.get(0); //error +vector.add(2); //error +vector.getCapacity(); //error +vector.getFirstElement(); //error +vector.getIndexFrom(2, 0); //error +vector.getIndexOf(2); //error +vector.getLastElement(); //error +vector.getLastIndexFrom(2, 0); //error +vector.getLastIndexOf(2); //error +vector.has(2); //error +vector.increaseCapacityTo(2); //error +vector.insert(2, 0); //error +vector.isEmpty(); //error +vector.remove(2); //error +vector.removeByIndex(0); //error +vector.removeByRange(0, 1); //error +vector.replaceAllElements((value: number) => { //error + return value; +}); +vector.set(0, 0); //error +vector.setLength(0); //error +vector.sort((firstValue: number, secondValue: number) => { //error + return firstValue - secondValue; +}); +vector.subVector(0, 1); //error +vector.toString(); //error +vector.trimToCurrentLength(); //error +let result = vector.length; //error +//sum:40 \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_vector.ets.args.json b/ets2panda/linter/test/sdkcommonapi/sdk_vector.ets.args.json new file mode 100755 index 0000000000..4dfa4f2017 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_vector.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_vector.ets.arkts2.json b/ets2panda/linter/test/sdkcommonapi/sdk_vector.ets.arkts2.json new file mode 100755 index 0000000000..936da3b8c2 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_vector.ets.arkts2.json @@ -0,0 +1,428 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 18, + "column": 14, + "endLine": 18, + "endColumn": 28, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 31, + "endLine": 18, + "endColumn": 43, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 8, + "endLine": 19, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 8, + "endLine": 20, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 8, + "endLine": 21, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 8, + "endLine": 22, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 35, + "endLine": 24, + "endColumn": 49, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 8, + "endLine": 28, + "endColumn": 13, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 8, + "endLine": 29, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 8, + "endLine": 30, + "endColumn": 13, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 8, + "endLine": 31, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 8, + "endLine": 32, + "endColumn": 22, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 8, + "endLine": 33, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 8, + "endLine": 35, + "endColumn": 19, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 8, + "endLine": 38, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 8, + "endLine": 39, + "endColumn": 15, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 8, + "endLine": 42, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 8, + "endLine": 43, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 44, + "column": 8, + "endLine": 44, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 8, + "endLine": 45, + "endColumn": 19, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 8, + "endLine": 46, + "endColumn": 23, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 8, + "endLine": 47, + "endColumn": 20, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 8, + "endLine": 48, + "endColumn": 18, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 49, + "column": 8, + "endLine": 49, + "endColumn": 22, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 8, + "endLine": 50, + "endColumn": 24, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 51, + "column": 8, + "endLine": 51, + "endColumn": 22, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 8, + "endLine": 52, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 53, + "column": 8, + "endLine": 53, + "endColumn": 26, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 54, + "column": 8, + "endLine": 54, + "endColumn": 14, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 8, + "endLine": 55, + "endColumn": 15, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 8, + "endLine": 56, + "endColumn": 14, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 8, + "endLine": 57, + "endColumn": 21, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 58, + "column": 8, + "endLine": 58, + "endColumn": 21, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 59, + "column": 8, + "endLine": 59, + "endColumn": 26, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 62, + "column": 8, + "endLine": 62, + "endColumn": 11, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 63, + "column": 8, + "endLine": 63, + "endColumn": 17, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 64, + "column": 8, + "endLine": 64, + "endColumn": 12, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 8, + "endLine": 67, + "endColumn": 17, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 68, + "column": 8, + "endLine": 68, + "endColumn": 16, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 8, + "endLine": 69, + "endColumn": 27, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 21, + "endLine": 70, + "endColumn": 27, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"Vector\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_vector.ets.json b/ets2panda/linter/test/sdkcommonapi/sdk_vector.ets.json new file mode 100755 index 0000000000..7633c79b6a --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_vector.ets.json @@ -0,0 +1,17 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets b/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets new file mode 100755 index 0000000000..69329cb6c9 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import convertxml from './@ohos.convertxml'; +let xml1 = ''; +let conv = new convertxml.ConvertXML(); //error +let options: convertxml.ConvertOptions = { //error + trim: false, //error + declarationKey: '', //error + instructionKey: '', //error + attributesKey: '', //error + textKey: '', //error + cdataKey: '', //error + doctypeKey: '', //error + commentKey: '', //error + parentKey: '', //error + typeKey: '', //error + nameKey: '', //error + elementsKey: '' //error +} +let result = JSON.stringify(conv.fastConvertToJSObject(xml1, options)); //error +let options2: convertxml.ConvertOptions = { //error + trim: false, //error + ignoreDeclaration: false, //error + ignoreInstruction: false, //error + ignoreAttributes: false, //error + ignoreComment: false, //error + ignoreCDATA: false, //error + ignoreDoctype: false, //error + ignoreText: false, //error + declarationKey: '', //error + instructionKey: '', //error + attributesKey: '', //error + textKey: '', //error + cdataKey: '', //error + doctypeKey: '', //error + commentKey: '', //error + parentKey: '', //error + typeKey: '', //error + nameKey: '', //error + elementsKey: '' //error +} +let opt:convertxml.ConvertXML; //error + +class Demo extends convertxml.ConvertXML implements convertxml.ConvertOptions{ //error*2 + parentKey: string; //error + typeKey: string; //error + nameKey: string; //error + elementsKey: string; //error + convert(xml: string, options?: convertxml.ConvertOptions | undefined): Object { //error*2 + } +} +//sum :44 \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.args.json b/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.args.json new file mode 100755 index 0000000000..4dfa4f2017 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.arkts2.json b/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.arkts2.json new file mode 100755 index 0000000000..f3ac4e12f2 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.arkts2.json @@ -0,0 +1,508 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 17, + "column": 27, + "endLine": 17, + "endColumn": 37, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertXML\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 14, + "endLine": 18, + "endColumn": 39, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 3, + "endLine": 19, + "endColumn": 14, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 3, + "endLine": 20, + "endColumn": 21, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 3, + "endLine": 21, + "endColumn": 21, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 3, + "endLine": 22, + "endColumn": 20, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 3, + "endLine": 23, + "endColumn": 14, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 3, + "endLine": 24, + "endColumn": 15, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 3, + "endLine": 25, + "endColumn": 17, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 3, + "endLine": 26, + "endColumn": 17, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 3, + "endLine": 27, + "endColumn": 16, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 3, + "endLine": 28, + "endColumn": 14, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 3, + "endLine": 29, + "endColumn": 14, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 3, + "endLine": 30, + "endColumn": 18, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 34, + "endLine": 32, + "endColumn": 55, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"xml.ConvertXML\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 15, + "endLine": 33, + "endColumn": 40, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 3, + "endLine": 34, + "endColumn": 14, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 3, + "endLine": 35, + "endColumn": 27, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 3, + "endLine": 36, + "endColumn": 27, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 3, + "endLine": 37, + "endColumn": 26, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 3, + "endLine": 38, + "endColumn": 23, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 3, + "endLine": 39, + "endColumn": 21, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 3, + "endLine": 40, + "endColumn": 23, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 3, + "endLine": 41, + "endColumn": 20, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 3, + "endLine": 42, + "endColumn": 21, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 3, + "endLine": 43, + "endColumn": 21, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 44, + "column": 3, + "endLine": 44, + "endColumn": 20, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 3, + "endLine": 45, + "endColumn": 14, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 3, + "endLine": 46, + "endColumn": 15, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 3, + "endLine": 47, + "endColumn": 17, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 3, + "endLine": 48, + "endColumn": 17, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 49, + "column": 3, + "endLine": 49, + "endColumn": 16, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 3, + "endLine": 50, + "endColumn": 14, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 51, + "column": 3, + "endLine": 51, + "endColumn": 14, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 3, + "endLine": 52, + "endColumn": 18, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 54, + "column": 5, + "endLine": 54, + "endColumn": 8, + "problem": "VariableMissingInitializer", + "suggest": "", + "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", + "severity": "ERROR" + }, + { + "line": 54, + "column": 9, + "endLine": 54, + "endColumn": 30, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertXML\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 61, + "column": 3, + "endLine": 62, + "endColumn": 4, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertXML\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 32, + "endLine": 56, + "endColumn": 42, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertXML\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 3, + "endLine": 57, + "endColumn": 21, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 58, + "column": 3, + "endLine": 58, + "endColumn": 19, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 59, + "column": 3, + "endLine": 59, + "endColumn": 19, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 60, + "column": 3, + "endLine": 60, + "endColumn": 23, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 66, + "endLine": 56, + "endColumn": 80, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 61, + "column": 34, + "endLine": 61, + "endColumn": 59, + "problem": "SdkCommonApiDeprecated", + "suggest": "", + "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 3, + "endLine": 57, + "endColumn": 12, + "problem": "StrictDiagnostic", + "suggest": "Property 'parentKey' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'parentKey' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 58, + "column": 3, + "endLine": 58, + "endColumn": 10, + "problem": "StrictDiagnostic", + "suggest": "Property 'typeKey' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'typeKey' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 59, + "column": 3, + "endLine": 59, + "endColumn": 10, + "problem": "StrictDiagnostic", + "suggest": "Property 'nameKey' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'nameKey' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 60, + "column": 3, + "endLine": 60, + "endColumn": 14, + "problem": "StrictDiagnostic", + "suggest": "Property 'elementsKey' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'elementsKey' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.json b/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.json new file mode 100755 index 0000000000..690a4fa56d --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.json @@ -0,0 +1,58 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 57, + "column": 3, + "endLine": 57, + "endColumn": 12, + "problem": "StrictDiagnostic", + "suggest": "Property 'parentKey' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'parentKey' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 58, + "column": 3, + "endLine": 58, + "endColumn": 10, + "problem": "StrictDiagnostic", + "suggest": "Property 'typeKey' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'typeKey' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 59, + "column": 3, + "endLine": 59, + "endColumn": 10, + "problem": "StrictDiagnostic", + "suggest": "Property 'nameKey' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'nameKey' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 60, + "column": 3, + "endLine": 60, + "endColumn": 14, + "problem": "StrictDiagnostic", + "suggest": "Property 'elementsKey' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'elementsKey' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets b/ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets new file mode 100755 index 0000000000..4cde50ea36 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { ArrayList } from './@ohos.util.ArrayList' + +let arrayList = new ArrayList(); +arrayList[Symbol.iterator](); //error \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets.args.json b/ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets.args.json new file mode 100755 index 0000000000..4dfa4f2017 --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets.arkts2.json b/ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets.arkts2.json new file mode 100755 index 0000000000..5c7594199f --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets.arkts2.json @@ -0,0 +1,38 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 18, + "column": 11, + "endLine": 18, + "endColumn": 26, + "problem": "BuiltinSymbolIterator", + "suggest": "", + "rule": "Using \"Symbol.iterator\" is not allowed in this API (arkts-builtin-symbol-iterator)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 11, + "endLine": 18, + "endColumn": 26, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"Symbol.iterator\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets.json b/ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets.json new file mode 100755 index 0000000000..7633c79b6a --- /dev/null +++ b/ets2panda/linter/test/sdkcommonapi/symbol_iterator.ets.json @@ -0,0 +1,17 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [] +} \ No newline at end of file -- Gitee From d132a3dc941db6d4034c1805f64e7a07fca664c0 Mon Sep 17 00:00:00 2001 From: ZhongNing Date: Fri, 1 Aug 2025 15:12:31 +0800 Subject: [PATCH 2/2] Add for BuiltIn Issue:https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICQDZ4 Test scenarios: update Require Signed-off-by: ZhongNing --- ets2panda/linter/rule-config.json | 4 +- ets2panda/linter/src/lib/CookBookMsg.ts | 2 + ets2panda/linter/src/lib/FaultAttrs.ts | 2 + ets2panda/linter/src/lib/FaultDesc.ts | 2 + ets2panda/linter/src/lib/Problems.ts | 2 + ets2panda/linter/src/lib/TypeScriptLinter.ts | 377 ++++- .../linter/src/lib/data/BuiltinList.json | 1437 ++++++++++++++++- .../src/lib/utils/consts/BuiltinWhiteList.ts | 16 +- .../lib/utils/consts/DeprecateWhiteList.ts | 1 + .../consts/SdkCommonDeprecateWhiteList.ts | 1 + .../linter/test/builtin/builtin_array.ets | 78 + .../test/builtin/builtin_array.ets.args.json | 19 + .../builtin/builtin_array.ets.arkts2.json | 388 +++++ .../test/builtin/builtin_array.ets.json | 78 + .../builtin_callsignature.ets.arkts2.json | 20 + .../linter/test/builtin/builtin_error.ets | 53 + .../test/builtin/builtin_error.ets.args.json | 19 + .../builtin/builtin_error.ets.arkts2.json | 208 +++ .../test/builtin/builtin_error.ets.json | 17 + ...upport_property_descriptor.ets.arkts2.json | 80 + .../linter/test/builtin/builtin_object.ets | 114 ++ .../test/builtin/builtin_object.ets.args.json | 19 + .../builtin/builtin_object.ets.arkts2.json | 518 ++++++ .../test/builtin/builtin_object.ets.json | 68 + .../builtin_symbol_iterator.ets.arkts2.json | 10 + .../linter/test/builtin/builtin_thisArgs.ets | 2 +- .../builtin/builtin_thisArgs.ets.arkts2.json | 10 + .../action_sheet.ets.arkts2.json | 20 + .../deprecated_api_font.ets.arkts2.json | 10 + .../lazy_for_each.ets.arkts2.json | 20 + .../interop_convert_import.ets.arkts2.json | 10 + .../interop_convert_import.ets.autofix.json | 10 + .../interop_convert_import.ets.migrate.json | 10 + .../interop_import_js_index.ets.arkts2.json | 20 + .../interop_import_js_index.ets.autofix.json | 20 + .../interop_import_js_rules.ets.arkts2.json | 10 + .../interop_import_js_rules.ets.autofix.json | 10 + .../interop/object_built_in.ets.arkts2.json | 40 + .../interop/reflect_built_in.ets.arkts2.json | 182 ++- ...arkts-array-type-immutable.ets.arkts2.json | 40 + ...imitive-type-normalization.ets.arkts2.json | 80 + .../main/arktsutils_module.ets.migrate.json | 80 + .../array_index_expr_type.ets.arkts2.json | 20 + .../array_index_expr_type.ets.autofix.json | 20 + .../array_index_expr_type.ets.migrate.json | 20 + .../test/main/class_as_object.ets.arkts2.json | 218 ++- .../main/collections_module.ets.migrate.json | 40 + .../func_inferred_type_args.ets.arkts2.json | 102 +- .../func_inferred_type_args_2.ets.arkts2.json | 90 ++ ...func_inferred_type_args_2.ets.autofix.json | 90 ++ ...func_inferred_type_args_2.ets.migrate.json | 90 ++ .../main/limited_stdlib_api.ets.arkts2.json | 130 ++ .../main/method_inheritance.ets.arkts2.json | 10 + .../test/main/no_sparse_array.ets.arkts2.json | 50 + .../main/no_sparse_array2.ets.arkts2.json | 50 + .../no_ts_like_smart_type.ets.arkts2.json | 40 + .../main/no_tuples_arrays.ets.arkts2.json | 40 + .../main/numeric_semantics.ets.arkts2.json | 30 + .../main/numeric_semantics.ets.autofix.json | 30 + .../main/numeric_semantics.ets.migrate.json | 30 + .../property_access_by_index.ets.arkts2.json | 30 + .../property_access_by_index.ets.autofix.json | 30 + .../property_access_by_index.ets.migrate.json | 30 + .../main/repeat_virtualscroll.ets.arkts2.json | 40 + .../repeat_virtualscroll.ets.autofix.json | 40 + .../repeat_virtualscroll.ets.migrate.json | 43 +- .../main/runtime_array_bound.ets.arkts2.json | 460 ++++++ .../main/runtime_array_bound.ets.migrate.json | 460 ++++++ .../main/structural_identity.ets.arkts2.json | 26 +- ...ntity_extended_inheritance.ets.arkts2.json | 42 +- .../test/main/swicth_expr.ets.arkts2.json | 10 + ...taskpool_deprecated_usages.ets.arkts2.json | 10 + .../test/main/ts_overload.ets.arkts2.json | 10 + .../linter/test/rules/rule207.ets.arkts2.json | 90 ++ .../linter/test/rules/rule37.ets.arkts2.json | 60 + .../linter/test/rules/rule37.ets.autofix.json | 162 +- .../linter/test/sdkcommonapi/sdk_url.ets | 6 +- .../test/sdkcommonapi/sdk_url.ets.arkts2.json | 30 + .../test/sdkcommonapi/sdk_xml.ets.arkts2.json | 20 + ...cl_with_duplicate_name_sdk.ets.arkts2.json | 26 +- 80 files changed, 6663 insertions(+), 169 deletions(-) create mode 100755 ets2panda/linter/test/builtin/builtin_array.ets create mode 100755 ets2panda/linter/test/builtin/builtin_array.ets.args.json create mode 100755 ets2panda/linter/test/builtin/builtin_array.ets.arkts2.json create mode 100755 ets2panda/linter/test/builtin/builtin_array.ets.json create mode 100755 ets2panda/linter/test/builtin/builtin_error.ets create mode 100755 ets2panda/linter/test/builtin/builtin_error.ets.args.json create mode 100755 ets2panda/linter/test/builtin/builtin_error.ets.arkts2.json create mode 100755 ets2panda/linter/test/builtin/builtin_error.ets.json create mode 100755 ets2panda/linter/test/builtin/builtin_object.ets create mode 100755 ets2panda/linter/test/builtin/builtin_object.ets.args.json create mode 100755 ets2panda/linter/test/builtin/builtin_object.ets.arkts2.json create mode 100755 ets2panda/linter/test/builtin/builtin_object.ets.json diff --git a/ets2panda/linter/rule-config.json b/ets2panda/linter/rule-config.json index e89808b662..ed4579f4e5 100644 --- a/ets2panda/linter/rule-config.json +++ b/ets2panda/linter/rule-config.json @@ -142,7 +142,9 @@ "arkts-builtin-thisArgs", "arkts-builtin-symbol-iterator", "arkts-builtin-no-property-descriptor", - "arkts-builtin-cotr" + "arkts-builtin-cotr", + "arkts-builtin-all", + "arkts-builtin-new-ctor" ], "OHMURL": [ "arkts-require-fullpath-name" diff --git a/ets2panda/linter/src/lib/CookBookMsg.ts b/ets2panda/linter/src/lib/CookBookMsg.ts index 5daab2724c..8d5c84c915 100644 --- a/ets2panda/linter/src/lib/CookBookMsg.ts +++ b/ets2panda/linter/src/lib/CookBookMsg.ts @@ -410,6 +410,8 @@ cookBookTag[399] = 'ArkUI deprecated api check (arkui-no-deprecated-api)'; cookBookTag[400] = 'ArkUI sdk common deprecated api check (arkui-sdk-common-deprecated-api)'; cookBookTag[401] = 'ArkUI sdk common whitelist api check (arkui-sdk-common-whitelist-api)'; cookBookTag[402] = 'ArkUI sdk common behavior change api check (arkui-sdk-common-behaviorchange-api)'; +cookBookTag[403] = 'Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)'; +cookBookTag[404] = 'API is not support ctor signature and func (arkts-builtin-new-cotr)'; for (let i = 0; i <= cookBookTag.length; i++) { cookBookMsg[i] = ''; diff --git a/ets2panda/linter/src/lib/FaultAttrs.ts b/ets2panda/linter/src/lib/FaultAttrs.ts index 2518ad5306..9d9fcd7c99 100644 --- a/ets2panda/linter/src/lib/FaultAttrs.ts +++ b/ets2panda/linter/src/lib/FaultAttrs.ts @@ -289,3 +289,5 @@ faultsAttrs[FaultID.NoDeprecatedApi] = new FaultAttributes(399); faultsAttrs[FaultID.SdkCommonApiDeprecated] = new FaultAttributes(400); faultsAttrs[FaultID.SdkCommonApiWhiteList] = new FaultAttributes(401); faultsAttrs[FaultID.SdkCommonApiBehaviorChange] = new FaultAttributes(402); +faultsAttrs[FaultID.BuiltinAll] = new FaultAttributes(403); +faultsAttrs[FaultID.BuiltinNewCtor] = new FaultAttributes(404); diff --git a/ets2panda/linter/src/lib/FaultDesc.ts b/ets2panda/linter/src/lib/FaultDesc.ts index edff8a207c..9a63a58500 100644 --- a/ets2panda/linter/src/lib/FaultDesc.ts +++ b/ets2panda/linter/src/lib/FaultDesc.ts @@ -278,3 +278,5 @@ faultDesc[FaultID.NoESObjectSupport] = 'ESObject type cannot be used'; faultDesc[FaultID.SdkCommonApiDeprecated] = 'ArkUI sdk common deprecated api check'; faultDesc[FaultID.SdkCommonApiWhiteList] = 'ArkUI sdk common whiteList api check'; faultDesc[FaultID.SdkCommonApiBehaviorChange] = 'ArkUI sdk common behavior change api check'; +faultDesc[FaultID.BuiltinAll] = 'Not support in builtin'; +faultDesc[FaultID.BuiltinNewCtor] = 'Api is not support ctor-signature in builtin'; diff --git a/ets2panda/linter/src/lib/Problems.ts b/ets2panda/linter/src/lib/Problems.ts index 364df2a5c4..5d56e6e928 100644 --- a/ets2panda/linter/src/lib/Problems.ts +++ b/ets2panda/linter/src/lib/Problems.ts @@ -278,6 +278,8 @@ export enum FaultID { SdkCommonApiDeprecated, SdkCommonApiWhiteList, SdkCommonApiBehaviorChange, + BuiltinAll, + BuiltinNewCtor, // this should always be last enum LAST_ID } diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index f1da2a31d5..6adcad7a6f 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -58,7 +58,15 @@ import { } from './utils/consts/SendableAPI'; import { DEFAULT_COMPATIBLE_SDK_VERSION, DEFAULT_COMPATIBLE_SDK_VERSION_STAGE } from './utils/consts/VersionInfo'; import { TYPED_ARRAYS } from './utils/consts/TypedArrays'; -import { BUILTIN_CONSTRUCTORS, COLLECTION_METHODS, COLLECTION_TYPES } from './utils/consts/BuiltinWhiteList'; +import { + BUILTIN_CONSTRUCTORS, + COLLECTION_METHODS, + COLLECTION_TYPES, + BUILTIN_TYPE, + BuiltinProblemInfos, + BUILTIN_CONSTRUCTOR_API_NAME, + BUILTIN_CONSTRUCTOR_API_TYPE +} from './utils/consts/BuiltinWhiteList'; import { forEachNodeInSubtree } from './utils/functions/ForEachNodeInSubtree'; import { hasPredecessor } from './utils/functions/HasPredecessor'; import { isStdLibrarySymbol, isStdLibraryType } from './utils/functions/IsStdLibrary'; @@ -145,9 +153,15 @@ import { SDK_COMMON_FUNCTIONLIKE, SDK_COMMON_PROPERTYLIKE, SDK_COMMON_CONSTRUCTORLIKE, - SDK_COMMON_TYPEKEY + SDK_COMMON_TYPEKEY, + SDK_COMMON_TYPE } from './utils/consts/SdkCommonDeprecateWhiteList'; -import { DeprecateProblem, DEPRECATE_CHECK_KEY, DEPRECATE_UNNAMED } from './utils/consts/DeprecateWhiteList'; +import { + DeprecateProblem, + DEPRECATE_CHECK_KEY, + DEPRECATE_UNNAMED, + DEPRECATE_TYPE +} from './utils/consts/DeprecateWhiteList'; import { BuiltinProblem, SYMBOL_ITERATOR, @@ -213,6 +227,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { static pathMap: Map>; static indexedTypeSet: Set; static globalApiInfo: Map>; + static builtApiInfo: Set; + static builtinNewCtorSet: Set; static deprecatedApiInfo: Set; static sdkCommonApiInfo: Set; static sdkCommonSymbotIterSet: Set; @@ -230,6 +246,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { TypeScriptLinter.nameSpaceFunctionCache = new Map>(); TypeScriptLinter.pathMap = new Map>(); TypeScriptLinter.globalApiInfo = new Map>(); + TypeScriptLinter.builtApiInfo = new Set(); + TypeScriptLinter.builtinNewCtorSet = new Set(); TypeScriptLinter.deprecatedApiInfo = new Set(); TypeScriptLinter.sdkCommonApiInfo = new Set(); TypeScriptLinter.funcMap = new Map>>(); @@ -264,6 +282,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { case BuiltinProblem.LimitedThisArg: TypeScriptLinter.initSdkBuiltinThisArgsWhitelist(item); break; + case BuiltinProblem.BuiltinNewCtor: + TypeScriptLinter.builtinNewCtorSet.add(item); + break; default: } } @@ -357,6 +378,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const list: ApiList = new ApiList(builtinWhiteList); if (list?.api_list?.length > 0) { for (const item of list.api_list) { + this.builtApiInfo.add(item); TypeScriptLinter.addGlobalApiInfosCollocetionData(item); } } @@ -10537,7 +10559,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { ) { continue; } - this.handleExtendCustomClassForSdkCommonApiDeprecated(extendedClassName, superCall); + this.handleExtendCustomClassForSdkCommonApiDeprecated(extendedClassName, superCall, SDK_COMMON_TYPE); + this.handleExtendCustomClassForSdkCommonApiDeprecated(extendedClassName, superCall, BUILTIN_TYPE); return; } @@ -10591,18 +10614,24 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private handleExtendCustomClassForSdkCommonApiDeprecated( extendedClassName: string, - superCall: ts.CallExpression + superCall: ts.CallExpression, + apiType: string ): void { - const problemStr = TypeScriptLinter.getFaultIdSdkCommonApiInfoWithConstructorDecl(extendedClassName); + const problemStr = TypeScriptLinter.getFaultIdSdkCommonApiInfoWithConstructorDecl(extendedClassName, apiType); if (problemStr) { const faultID = sdkCommonAllDeprecatedTypeName.has(extendedClassName) ? FaultID.SdkCommonApiDeprecated : - TypeScriptLinter.getFinalSdkFaultIdByProblem(problemStr); + TypeScriptLinter.getFinalSdkFaultIdByProblem(problemStr, apiType); + if (!faultID) { + return; + } this.incrementCounters( superCall, faultID, undefined, - TypeScriptLinter.getErrorMsgForSdkCommonApi(extendedClassName, faultID) + apiType === SDK_COMMON_TYPE ? + TypeScriptLinter.getErrorMsgForSdkCommonApi(extendedClassName, faultID) : + undefined ); } } @@ -13218,24 +13247,27 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (sym) { this.hanldeSdkCommonTypeName(node, sym, sym.name, decl); } - if (decl && (ts.isInterfaceDeclaration(decl) || ts.isClassDeclaration(decl))) { + if (decl && (ts.isInterfaceDeclaration(decl) || ts.isClassDeclaration(decl) || ts.isTypeAliasDeclaration(decl))) { let parentName = decl.name ? decl.name.text : 'unnamed'; if (ts.isQualifiedName(node.typeName)) { parentName = node.typeName.getText(); + } else if (ts.isTypeAliasDeclaration(decl)) { + parentName = ''; } const deprecatedApiCheckMap = TypeScriptLinter.updateDeprecatedApiCheckMap( parentName, undefined, - undefined, + ts.isTypeAliasDeclaration(decl) ? decl.type.getText() : undefined, path.basename(decl.getSourceFile().fileName + '') ); this.processApiNodeDeprecatedApi(typeName.getText(), typeName, deprecatedApiCheckMap); + this.processApiNodeDeprecatedApi(typeName.getText(), typeName, deprecatedApiCheckMap, undefined, BUILTIN_TYPE); } } private checkNewExpressionForDeprecatedApi(node: ts.NewExpression): void { const expression = node.expression; - this.checkNewExpressionForSdkCommonApi(node); + this.checkNewExpressionForSdkApi(node); if (ts.isIdentifier(expression)) { const decl = this.tsUtils.getDeclarationNode(expression); if (decl && ts.isClassDeclaration(decl)) { @@ -13250,7 +13282,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } - private checkNewExpressionForSdkCommonApi(newExpr: ts.NewExpression): void { + private checkNewExpressionForSdkApi(newExpr: ts.NewExpression): void { const type = this.tsTypeChecker.getTypeAtLocation(newExpr.expression); const resolvedSignature = this.tsTypeChecker.getResolvedSignature(newExpr); if (!resolvedSignature) { @@ -13272,11 +13304,47 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { newExpr.expression, deprecatedApiCheckMap, undefined, - true + SDK_COMMON_TYPE ); + if (BUILTIN_DISABLE_CALLSIGNATURE.includes(newExpr.expression.getText())) { + this.handleNewExpressionForBuiltNewCtor(newExpr.expression, deprecatedApiCheckMap); + } else { + this.processApiNodeDeprecatedApi( + BUILTIN_CONSTRUCTOR_API_NAME, + newExpr.expression, + deprecatedApiCheckMap, + undefined, + BUILTIN_TYPE + ); + } } } + private handleNewExpressionForBuiltNewCtor( + errorNode: ts.Node, + deprecatedApiCheckMap?: Map> + ): void { + if (TypeScriptLinter.builtinNewCtorSet.size === 0 || !deprecatedApiCheckMap) { + return; + } + [...TypeScriptLinter.builtinNewCtorSet].some((item) => { + if (item.api_info.parent_api?.length <= 0) { + return false; + } + const isBuiltinNewConstruct = + BUILTIN_CONSTRUCTOR_API_TYPE.includes(item.api_info.api_type) && + item.api_info.parent_api[0].api_name === deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.PARENT_NAME) + '' && + path.basename(item.file_path) === deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.FILE_NAME) + ''; + if (isBuiltinNewConstruct) { + const problemStr = item.api_info.problem; + if (problemStr.length > 0) { + this.incrementCounters(errorNode, FaultID.BuiltinNewCtor); + } + return true; + } + return false; + }); + } private checkHeritageClauseForDeprecatedApi(node: ts.HeritageClause): void { node.types.forEach((type) => { let expr = type.expression; @@ -13287,11 +13355,16 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { expr = type.expression.name; } const decl = this.tsUtils.getDeclarationNode(expr); - this.checkHeritageClauseForSdkCommonApiDeprecated(node, decl); + this.checkHeritageClauseForSdkCommonApiDeprecated(node, decl, SDK_COMMON_TYPE); + this.checkHeritageClauseForSdkCommonApiDeprecated(node, decl, BUILTIN_TYPE); }); } - private checkHeritageClauseForSdkCommonApiDeprecated(node: ts.HeritageClause, decl: ts.Node | undefined): void { + private checkHeritageClauseForSdkCommonApiDeprecated( + node: ts.HeritageClause, + decl: ts.Node | undefined, + apiType: string + ): void { if ( decl && (ts.isClassDeclaration(decl) || ts.isInterfaceDeclaration(decl)) && @@ -13299,35 +13372,45 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { decl.name ) { const extendClassName = decl.name.text; - if (TypeScriptLinter.checkIsSameAsParenName(extendClassName)) { + const newSet = TypeScriptLinter.refactorSetWhitSameAsParenName(extendClassName, apiType); + if (newSet && newSet.size > 0) { const sourceFunlikeArrs = node.parent.members.filter(ts.isFunctionLike); const sourceProDeclArrs = node.parent.members.filter(ts.isPropertyDeclaration); - this.checkSdkCommonApiInfoWithClassMember(sourceFunlikeArrs, extendClassName, SDK_COMMON_TYPEKEY[0]); - this.checkSdkCommonApiInfoWithClassMember(sourceProDeclArrs, extendClassName, SDK_COMMON_TYPEKEY[1]); + this.checkSdkCommonApiInfoWithClassMember(sourceFunlikeArrs, decl, SDK_COMMON_TYPEKEY[0], apiType, newSet); + this.checkSdkCommonApiInfoWithClassMember(sourceProDeclArrs, decl, SDK_COMMON_TYPEKEY[1], apiType, newSet); } } } private checkSdkCommonApiInfoWithClassMember( sourceMembers: ts.ClassElement[] | ts.PropertyDeclaration[], - extendClassName: string, - typeKey: string + decl: ts.ClassDeclaration | ts.InterfaceDeclaration, + typeKey: string, + apiType: string, + mergedSet: Set ): void { sourceMembers.some((func) => { - const funcName = func.name?.getText(); - if (!funcName) { + if (!func.name || !decl.name) { return; } - const problemStr = TypeScriptLinter.getFaultIdSdkCommonApiInfoWithClassMember(extendClassName, funcName, typeKey); + const funcName = func.name.getText(); + const extendClassName = decl.name.text; + const problemStr = TypeScriptLinter.getFaultIdSdkCommonApiInfoWithClassMember(decl, funcName, typeKey, mergedSet); if (problemStr) { - const faultID = sdkCommonAllDeprecatedTypeName.has(extendClassName) ? - FaultID.SdkCommonApiDeprecated : - TypeScriptLinter.getFinalSdkFaultIdByProblem(problemStr); + let faultID = TypeScriptLinter.getFinalSdkFaultIdByProblem(problemStr, apiType); + if (apiType === SDK_COMMON_TYPE) { + faultID = sdkCommonAllDeprecatedTypeName.has(extendClassName) ? FaultID.SdkCommonApiDeprecated : faultID; + } + if (!faultID) { + return; + } this.incrementCounters( func, faultID, undefined, - TypeScriptLinter.getErrorMsgForSdkCommonApi(extendClassName, faultID) + apiType === SDK_COMMON_TYPE ? + TypeScriptLinter.getErrorMsgForSdkCommonApi(extendClassName, faultID) : + undefined ); } }); @@ -13433,7 +13516,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (isNeedGetResolvedSignature) { this.checkCallExpressionForSdkCommonApiWithSignature(node, name, parName); } else { - this.reportDeprecatedApi(node, name, deprecatedApiCheckMap, true); + this.reportDeprecatedApi(node, name, deprecatedApiCheckMap, SDK_COMMON_TYPE); + this.reportDeprecatedApi(node, name, deprecatedApiCheckMap, BUILTIN_TYPE); } } @@ -13448,44 +13532,76 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } const functionSymbol = this.getFunctionSymbol(signature.declaration); const functionDeclaration = functionSymbol?.valueDeclaration; + let returnType = this.tsTypeChecker.typeToString(signature.getReturnType()); + let isSpecialTypeForBuiltIn = false; if (!functionDeclaration) { - return; + const signatureDecl = signature.getDeclaration(); + if (signatureDecl && ts.isFunctionLike(signatureDecl) && signatureDecl.type) { + returnType = signatureDecl.type.getText(); + if (!parName && BUILTIN_DISABLE_CALLSIGNATURE.includes(name.text)) { + const type = this.tsTypeChecker.getTypeAtLocation(name); + parName = this.tsTypeChecker.typeToString(type); + isSpecialTypeForBuiltIn = !!parName; + } + } } - const returnType = this.tsTypeChecker.typeToString(signature.getReturnType()); + const fileName = signature.getDeclaration().getSourceFile().fileName; const deprecatedApiCheckMap = TypeScriptLinter.updateDeprecatedApiCheckMap( parName === undefined ? '' : parName + '', TypeScriptLinter.getParameterDeclarationsBySignature(signature), returnType, - path.basename(functionDeclaration.getSourceFile().fileName) + fileName ); - this.reportDeprecatedApi(node, name, deprecatedApiCheckMap, true); + this.reportDeprecatedApi(node, name, deprecatedApiCheckMap, SDK_COMMON_TYPE); + if (isSpecialTypeForBuiltIn) { + this.processApiNodeDeprecatedApi( + BUILTIN_CONSTRUCTOR_API_NAME, + name, + deprecatedApiCheckMap, + undefined, + BUILTIN_TYPE + ); + } else { + this.reportDeprecatedApi(node, name, deprecatedApiCheckMap, BUILTIN_TYPE); + } } private reportDeprecatedApi( node: ts.CallExpression, name: ts.Identifier, deprecatedApiCheckMap?: Map>, - isSdkCommon?: boolean + apiType?: string ): void { - const problemStr = this.getFaultIdWithMatchedDeprecatedApi(name.text, deprecatedApiCheckMap, isSdkCommon); + const problemStr = this.getFaultIdWithMatchedDeprecatedApi(name.text, deprecatedApiCheckMap, apiType); if (problemStr.length > 0) { const autofix = this.autofixer?.fixDeprecatedApiForCallExpression(node); if (autofix) { this.interfacesNeedToImport.add('getUIContext'); } - const faultID = isSdkCommon ? TypeScriptLinter.getFinalSdkFaultIdByProblem(problemStr) : FaultID.NoDeprecatedApi; + const isSdkCommon = apiType === SDK_COMMON_TYPE; + const faultID = TypeScriptLinter.getFinalSdkFaultIdByProblem(problemStr, apiType); + if (!faultID) { + return; + } this.incrementCounters( name, faultID, - isSdkCommon ? undefined : autofix, + isSdkCommon || apiType === BUILTIN_TYPE ? undefined : autofix, isSdkCommon ? TypeScriptLinter.getErrorMsgForSdkCommonApi(name.text, faultID) : undefined ); } } - private static getFinalSdkFaultIdByProblem(problem: string): number { - const sdkFaultId = SdkCommonApiProblemInfos.get(problem); - return sdkFaultId ? sdkFaultId : FaultID.SdkCommonApiWhiteList; + private static getFinalSdkFaultIdByProblem(problem: string, apiType: string | undefined): number | undefined { + let sdkFaultId: number | undefined = FaultID.NoDeprecatedApi; + if (apiType === SDK_COMMON_TYPE) { + sdkFaultId = SdkCommonApiProblemInfos.get(problem); + return sdkFaultId ? sdkFaultId : FaultID.SdkCommonApiWhiteList; + } else if (apiType === BUILTIN_TYPE) { + sdkFaultId = BuiltinProblemInfos.get(problem); + return sdkFaultId ? sdkFaultId : undefined; + } + return sdkFaultId; } private checkSpecialApiForDeprecatedApi( @@ -13584,7 +13700,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { expression, this.getPropertyTypeForPropertyAssignment(node, contextualType, true), undefined, - true + SDK_COMMON_TYPE ); } } @@ -13618,7 +13734,14 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { path.basename(decl.getSourceFile().fileName) ); this.processApiNodeDeprecatedApi(expression.text, expression, deprecatedApiCheckMap); - this.processApiNodeDeprecatedApi(expression.text, expression, deprecatedApiCheckMap, undefined, true); + this.processApiNodeDeprecatedApi( + expression.text, + expression, + deprecatedApiCheckMap, + undefined, + SDK_COMMON_TYPE + ); + this.processApiNodeDeprecatedApi(expression.text, expression, deprecatedApiCheckMap, undefined, BUILTIN_TYPE); } }); } @@ -13773,11 +13896,15 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { errorNode: ts.Node, deprecatedApiCheckMap?: Map>, autofix?: Autofix[], - isSdkCommon?: boolean + apiType?: string ): void { - const problemStr = this.getFaultIdWithMatchedDeprecatedApi(apiName, deprecatedApiCheckMap, isSdkCommon); + const problemStr = this.getFaultIdWithMatchedDeprecatedApi(apiName, deprecatedApiCheckMap, apiType); if (problemStr.length > 0) { - const faultID = isSdkCommon ? TypeScriptLinter.getFinalSdkFaultIdByProblem(problemStr) : FaultID.NoDeprecatedApi; + const isSdkCommon = apiType === SDK_COMMON_TYPE; + const faultID = TypeScriptLinter.getFinalSdkFaultIdByProblem(problemStr, apiType); + if (!faultID) { + return; + } this.incrementCounters( errorNode, faultID, @@ -13790,51 +13917,82 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private getFaultIdWithMatchedDeprecatedApi( apiName: string, deprecatedApiCheckMap?: Map>, - isSdkCommon?: boolean + apiType?: string ): string { void this; - let setApiListItem = TypeScriptLinter.deprecatedApiInfo; - if (isSdkCommon) { - setApiListItem = TypeScriptLinter.sdkCommonApiInfo; + if (!apiType) { + apiType = DEPRECATE_TYPE; } + const setApiListItem = apiType && TypeScriptLinter.getApiListItemSetFromAllWhiteList(apiType); if (!setApiListItem || !deprecatedApiCheckMap) { return ''; } const apiNamesArr = [...setApiListItem]; + const isSdkCommon = apiType === SDK_COMMON_TYPE; let problem = ''; apiNamesArr.some((apiInfoItem) => { - if (apiInfoItem.api_info.parent_api?.length <= 0) { - return false; - } - let isSameApi = apiInfoItem.api_info.api_name === apiName; - isSameApi &&= TypeScriptLinter.checkParentNameUnderSdkList( - apiInfoItem, - deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.PARENT_NAME) + '', - isSdkCommon - ); - const return_type = this.getReturnTypeByApiInfoItem(apiInfoItem, isSdkCommon); - const actual_return_type = this.normalizeTypeString(deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.RETURN_TYPE)); - isSameApi &&= return_type === actual_return_type; - const api_func_args = apiInfoItem.api_info.api_func_args; - const params = deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.PARAM_SET); - if (api_func_args && params) { - const isParametersEqual = TypeScriptLinter.areParametersEqualForDeprecated( - api_func_args, - params as ts.NodeArray + if (!apiInfoItem.api_info.api_name && !apiName || BUILTIN_CONSTRUCTOR_API_NAME === apiName) { + problem = TypeScriptLinter.getFaultIdWithMatchedBuiltinConstructApi( + apiInfoItem, + deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.PARENT_NAME) + '' ); - isSameApi &&= isParametersEqual; + if (problem) { + return true; + } } + const isSameApi = this.checkIsSameApiWithSdkList(apiInfoItem, apiName, deprecatedApiCheckMap, apiType); const fileName = deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.FILE_NAME) + ''; const isSameFile = fileName.endsWith(path.basename(apiInfoItem.file_path)); const res = isSameApi && isSameFile; if (res) { - problem = isSdkCommon ? apiInfoItem.api_info.problem : DeprecateProblem.NoDeprecatedApi; + problem = + isSdkCommon || apiType === BUILTIN_TYPE ? apiInfoItem.api_info.problem : DeprecateProblem.NoDeprecatedApi; } return res; }); return problem; } + private checkIsSameApiWithSdkList( + apiInfoItem: ApiListItem, + apiName: string, + deprecatedApiCheckMap: Map>, + apiType?: string + ): boolean { + let isSameApi = apiInfoItem.api_info.api_name === apiName; + isSameApi &&= TypeScriptLinter.checkParentNameUnderSdkList( + apiInfoItem, + deprecatedApiCheckMap.get(DEPRECATE_CHECK_KEY.PARENT_NAME) + '', + apiType === SDK_COMMON_TYPE || apiType === BUILTIN_TYPE + ); + const return_type = this.getReturnTypeByApiInfoItem( + apiInfoItem, + apiType === SDK_COMMON_TYPE || apiType === BUILTIN_TYPE + ); + const actual_return_type = this.normalizeTypeString(deprecatedApiCheckMap.get(DEPRECATE_CHECK_KEY.RETURN_TYPE)); + isSameApi &&= return_type === actual_return_type; + const api_func_args = apiInfoItem.api_info.api_func_args; + const params = deprecatedApiCheckMap.get(DEPRECATE_CHECK_KEY.PARAM_SET); + if (api_func_args && params) { + const isParametersEqual = TypeScriptLinter.areParametersEqualForDeprecated( + api_func_args, + params as ts.NodeArray + ); + isSameApi &&= isParametersEqual; + } + return isSameApi; + } + + private static getFaultIdWithMatchedBuiltinConstructApi(apiInfoItem: ApiListItem, parentName: string): string { + if (apiInfoItem.api_info.parent_api?.length <= 0) { + return ''; + } + const isBuiltinConstruct = + BUILTIN_CONSTRUCTOR_API_TYPE.includes(apiInfoItem.api_info.api_type) && + apiInfoItem.api_info.parent_api[0].api_name === parentName; + return isBuiltinConstruct ? apiInfoItem.api_info.problem : ''; + } + private getReturnTypeByApiInfoItem( apiInfoItem: ApiListItem, isSdkCommon: boolean | undefined @@ -13864,7 +14022,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { possibleNames.push(`${secondaryParentName}.${primaryParentName}`); } } - return possibleNames.includes(sourceParentName); + return possibleNames.includes(sourceParentName) || parentApis.length === 0 && !sourceParentName; } private getPropertyTypeForPropertyAssignment( @@ -14143,13 +14301,27 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { ]); } - private static getFaultIdSdkCommonApiInfoWithConstructorDecl(extendClassName: string): string { - const mergedSet = TypeScriptLinter.mergeSdkCommonApiListInfo(); + private static getFaultIdSdkCommonApiInfoWithConstructorDecl(extendClassName: string, apiType: string): string { + const mergedSet = TypeScriptLinter.getApiListItemSetFromAllWhiteList( + apiType, + apiType === SDK_COMMON_TYPE ? true : undefined + ); + if (!mergedSet) { + return ''; + } + let api_types = ['']; + if (apiType === SDK_COMMON_TYPE) { + api_types = SDK_COMMON_CONSTRUCTORLIKE; + } else if (apiType === BUILTIN_TYPE) { + api_types = BUILTIN_CONSTRUCTOR_API_TYPE; + } let problem = ''; for (const item of mergedSet) { + if (item.api_info.parent_api?.length <= 0) { + continue; + } const isCompare = - item.api_info.parent_api[0].api_name === extendClassName && - SDK_COMMON_CONSTRUCTORLIKE.includes(item.api_info.api_type); + item.api_info.parent_api[0].api_name === extendClassName && api_types.includes(item.api_info.api_type); if (isCompare) { problem = item.api_info.problem; break; @@ -14159,18 +14331,28 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } private static getFaultIdSdkCommonApiInfoWithClassMember( - extendClassName: string, + decl: ts.ClassDeclaration | ts.InterfaceDeclaration, targetName: string, - typeKey: string + typeKey: string, + mergedSet: Set ): string { - const mergedSet = TypeScriptLinter.mergeSdkCommonApiListInfo(); + const extendClassName = decl.name?.text; + const fileName = path.basename(decl.getSourceFile().fileName); + if (!extendClassName || !fileName) { + return ''; + } const memberLike = typeKey === SDK_COMMON_TYPEKEY[0] ? SDK_COMMON_FUNCTIONLIKE : SDK_COMMON_PROPERTYLIKE; let problem = ''; + const apiFilePath = this.getApiFilePathsFromSdkList(mergedSet); for (const item of mergedSet) { + if (item.api_info.parent_api?.length <= 0) { + continue; + } const isFunLikeCompare = item.api_info.parent_api[0].api_name === extendClassName && memberLike.includes(item.api_info.api_type) && - item.api_info.api_name === targetName; + item.api_info.api_name === targetName && + apiFilePath.includes(fileName); if (isFunLikeCompare) { problem = item.api_info.problem; break; @@ -14179,14 +14361,45 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return problem; } - private static checkIsSameAsParenName(targetName: string): boolean { - let res = false; - const mergedSet = TypeScriptLinter.mergeSdkCommonApiListInfo(); + private static getApiFilePathsFromSdkList(mergedSet: Set): string[] { + const apiFilePath: string[] = []; + mergedSet.forEach((mem) => { + apiFilePath.push(path.basename(mem.file_path)); + }); + return apiFilePath; + } + + private static refactorSetWhitSameAsParenName(targetName: string, apiType: string): Set | undefined { + const mergedSet = TypeScriptLinter.getApiListItemSetFromAllWhiteList( + apiType, + apiType === SDK_COMMON_TYPE ? true : undefined + ); + if (!mergedSet) { + return undefined; + } + const newMergedSet = new Set(); for (const item of mergedSet) { + if (item.api_info.parent_api?.length <= 0) { + continue; + } if (item.api_info.parent_api[0].api_name === targetName) { - res = true; + newMergedSet.add(item); } } - return res; + return newMergedSet; + } + + private static getApiListItemSetFromAllWhiteList( + type: string, + isMergeSdkCommonApi?: boolean + ): Set | undefined { + if (type === DEPRECATE_TYPE) { + return TypeScriptLinter.deprecatedApiInfo; + } else if (type === SDK_COMMON_TYPE) { + return isMergeSdkCommonApi ? TypeScriptLinter.mergeSdkCommonApiListInfo() : TypeScriptLinter.sdkCommonApiInfo; + } else if (type === BUILTIN_TYPE) { + return TypeScriptLinter.builtApiInfo; + } + return undefined; } } diff --git a/ets2panda/linter/src/lib/data/BuiltinList.json b/ets2panda/linter/src/lib/data/BuiltinList.json index 659a25bbd5..f144f32472 100644 --- a/ets2panda/linter/src/lib/data/BuiltinList.json +++ b/ets2panda/linter/src/lib/data/BuiltinList.json @@ -10,7 +10,7 @@ "api_func_args": [], "parent_api": [], "code_kind": 268, - "api_property_type": "string | number | symbol" + "method_return_type": "string | number | symbol" }, "import_path": [], "is_global": true @@ -224,7 +224,7 @@ "file_path": "lib.es5.d.ts", "api_info": { "line": 392, - "problem": "BuiltinAll", + "problem": "NoPropertyDescriptor", "api_name": "length", "api_type": "PropertySignature", "api_optional": false, @@ -244,7 +244,7 @@ "file_path": "lib.es5.d.ts", "api_info": { "line": 393, - "problem": "BuiltinAll", + "problem": "NoPropertyDescriptor", "api_name": "callee", "api_type": "PropertySignature", "api_optional": false, @@ -277,6 +277,23 @@ "import_path": [], "is_global": true }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 522, + "problem": "BuiltinNewCtor", + "api_type": "CallSignature", + "parent_api": [ + { + "api_name": "StringConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 179 + }, + "import_path": [], + "is_global": true + }, { "file_path": "lib.es5.d.ts", "api_info": { @@ -294,6 +311,23 @@ "import_path": [], "is_global": true }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 539, + "problem": "BuiltinNewCtor", + "api_type": "CallSignature", + "parent_api": [ + { + "api_name": "BooleanConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 179 + }, + "import_path": [], + "is_global": true + }, { "file_path": "lib.es5.d.ts", "api_info": { @@ -311,11 +345,28 @@ "import_path": [], "is_global": true }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 576, + "problem": "BuiltinNewCtor", + "api_type": "CallSignature", + "parent_api": [ + { + "api_name": "NumberConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 179 + }, + "import_path": [], + "is_global": true + }, { "file_path": "lib.es5.d.ts", "api_info": { "line": 608, - "problem": "BuiltinAll", + "problem": "NoPropertyDescriptor", "api_name": "raw", "api_type": "PropertySignature", "api_optional": false, @@ -348,6 +399,23 @@ "import_path": [], "is_global": true }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 916, + "problem": "BuiltinNewCtor", + "api_type": "CallSignature", + "parent_api": [ + { + "api_name": "DateConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 179 + }, + "import_path": [], + "is_global": true + }, { "file_path": "lib.es5.d.ts", "api_info": { @@ -399,6 +467,23 @@ "import_path": [], "is_global": true }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 1060, + "problem": "BuiltinNewCtor", + "api_type": "CallSignature", + "parent_api": [ + { + "api_name": "ErrorConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 179 + }, + "import_path": [], + "is_global": true + }, { "file_path": "lib.es5.d.ts", "api_info": { @@ -1070,6 +1155,23 @@ "import_path": [], "is_global": true }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 1490, + "problem": "BuiltinNewCtor", + "api_type": "CallSignature", + "parent_api": [ + { + "api_name": "ArrayConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 179 + }, + "import_path": [], + "is_global": true + }, { "file_path": "lib.es5.d.ts", "api_info": { @@ -1303,7 +1405,7 @@ "file_path": "lib.es5.d.ts", "api_info": { "line": 1681, - "problem": "BuiltinAll", + "problem": "NoPropertyDescriptor", "api_name": "ArrayBuffer", "api_type": "PropertySignature", "api_optional": false, @@ -5762,6 +5864,23 @@ "import_path": [], "is_global": true }, + { + "file_path": "lib.es2021.promise.d.ts", + "api_info": { + "line": 1, + "problem": "BuiltinNewCtor", + "api_type": "CallSignature", + "parent_api": [ + { + "api_name": "AggregateErrorConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 179 + }, + "import_path": [], + "is_global": true + }, { "file_path": "lib.es2015.core.d.ts", "api_info": { @@ -5795,6 +5914,1314 @@ }, "import_path": [], "is_global": true + }, + { + "file_path": "lib.es2021.promise.d.ts", + "api_info": { + "line": 110, + "problem": "NoPropertyDescriptor", + "api_name": "errors", + "api_type": "PropertySignature", + "api_optional": true, + "parent_api": [ + { + "api_name": "AggregateError", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 170, + "api_property_type": "any[]" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2019.array.d.ts", + "api_info": { + "line": 1506, + "problem": "BuiltinAll", + "api_name": "flat", + "api_type": "MethodSignature", + "api_func_args": [ + { + "name": "this", + "type": "A", + "is_optional": false, + "has_default": false + }, + { + "name": "depth", + "type": "D", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Array", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "FlatArray[]", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2017.intl.d.ts", + "api_info": { + "line": 114, + "problem": "NoPropertyDescriptor", + "api_name": "day", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "DateTimeFormatPartTypesRegistry", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "Intl", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "any", + "code_kind": 170 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2017.intl.d.ts", + "api_info": { + "line": 114, + "problem": "NoPropertyDescriptor", + "api_name": "dayPeriod", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "DateTimeFormatPartTypesRegistry", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "Intl", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "any", + "code_kind": 170 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2017.intl.d.ts", + "api_info": { + "line": 114, + "problem": "NoPropertyDescriptor", + "api_name": "era", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "DateTimeFormatPartTypesRegistry", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "Intl", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "any", + "code_kind": 170 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2017.intl.d.ts", + "api_info": { + "line": 114, + "problem": "NoPropertyDescriptor", + "api_name": "hour", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "DateTimeFormatPartTypesRegistry", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "Intl", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "any", + "code_kind": 170 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2017.intl.d.ts", + "api_info": { + "line": 114, + "problem": "NoPropertyDescriptor", + "api_name": "literal", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "DateTimeFormatPartTypesRegistry", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "Intl", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "any", + "code_kind": 170 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2017.intl.d.ts", + "api_info": { + "line": 114, + "problem": "NoPropertyDescriptor", + "api_name": "minute", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "DateTimeFormatPartTypesRegistry", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "Intl", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "any", + "code_kind": 170 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2017.intl.d.ts", + "api_info": { + "line": 114, + "problem": "NoPropertyDescriptor", + "api_name": "month", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "DateTimeFormatPartTypesRegistry", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "Intl", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "any", + "code_kind": 170 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2017.intl.d.ts", + "api_info": { + "line": 114, + "problem": "NoPropertyDescriptor", + "api_name": "second", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "DateTimeFormatPartTypesRegistry", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "Intl", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "any", + "code_kind": 170 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2017.intl.d.ts", + "api_info": { + "line": 114, + "problem": "NoPropertyDescriptor", + "api_name": "timeZoneName", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "DateTimeFormatPartTypesRegistry", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "Intl", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "any", + "code_kind": 170 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2017.intl.d.ts", + "api_info": { + "line": 114, + "problem": "NoPropertyDescriptor", + "api_name": "weekday", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "DateTimeFormatPartTypesRegistry", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "Intl", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "any", + "code_kind": 170 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2017.intl.d.ts", + "api_info": { + "line": 114, + "problem": "NoPropertyDescriptor", + "api_name": "year", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "DateTimeFormatPartTypesRegistry", + "api_type": "InterfaceDeclaration" + }, + { + "api_name": "Intl", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "any", + "code_kind": 170 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2020.intl.d.ts", + "api_info": { + "line": 114, + "problem": "NoPropertyDescriptor", + "api_name": "prototype", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "DisplayNames", + "api_type": "VariableDeclaration" + }, + { + "api_name": "Intl", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "DisplayNames", + "code_kind": 170 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2021.intl.d.ts", + "api_info": { + "line": 114, + "problem": "NoPropertyDescriptor", + "api_name": "prototype", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "ListFormat", + "api_type": "VariableDeclaration" + }, + { + "api_name": "Intl", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "ListFormat", + "code_kind": 170 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 114, + "problem": "NoPropertyDescriptor", + "api_name": "prototype", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "NumberFormat", + "api_type": "VariableDeclaration" + }, + { + "api_name": "Intl", + "api_type": "ModuleDeclaration" + } + ], + "api_property_type": "NumberFormat", + "code_kind": 170 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2019.array.d.ts", + "api_info": { + "line": 1506, + "problem": "BuiltinAll", + "api_name": "flat", + "api_type": "MethodSignature", + "api_func_args": [ + { + "name": "this", + "type": "A", + "is_optional": false, + "has_default": false + }, + { + "name": "depth", + "type": "D", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "ReadonlyArray", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "FlatArray[]", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2019.array.d.ts", + "api_info": { + "line": 1506, + "problem": "BuiltinAll", + "api_name": "flatMap", + "api_type": "MethodSignature", + "api_func_args": [ + { + "name": "callback", + "type": "(this: This, value: T, index: number, array: T[]) => U | ReadonlyArray", + "is_optional": false, + "has_default": false + }, + { + "name": "thisArg", + "type": "This", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "ReadonlyArray", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "FlatArray[]", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2018.regexp.d.ts", + "api_info": { + "line": 110, + "problem": "NoPropertyDescriptor", + "api_name": "groups", + "api_type": "PropertySignature", + "api_optional": true, + "parent_api": [ + { + "api_name": "RegExpExecArray", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 170, + "api_property_type": "{[key: string]: string}" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2018.regexp.d.ts", + "api_info": { + "line": 110, + "problem": "NoPropertyDescriptor", + "api_name": "groups", + "api_type": "PropertySignature", + "api_optional": true, + "parent_api": [ + { + "api_name": "RegExpMatchArray", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 170, + "api_property_type": "{[key: string]: string}" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2019.array.d.ts", + "api_info": { + "line": 110, + "problem": "NoPropertyDescriptor", + "api_name": "FlatArray", + "api_type": "TypeAliasDeclaration", + "api_optional": true, + "parent_api": [], + "code_kind": 170, + "method_return_type": "{\"done\": Arr, \"recur\": Arr extends ReadonlyArray ? FlatArray : Arr}[Depth extends -1 ? \"done\" : \"recur\"]" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.core.d.ts", + "api_info": { + "line": 1506, + "problem": "BuiltinAll", + "api_name": "isFinite", + "api_type": "MethodSignature", + "api_func_args": [ + { + "name": "number", + "type": "unknown", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "NumberConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.core.d.ts", + "api_info": { + "line": 1506, + "problem": "BuiltinAll", + "api_name": "isInteger", + "api_type": "MethodSignature", + "api_func_args": [ + { + "name": "number", + "type": "unknown", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "NumberConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.core.d.ts", + "api_info": { + "line": 1506, + "problem": "BuiltinAll", + "api_name": "isNaN", + "api_type": "MethodSignature", + "api_func_args": [ + { + "name": "number", + "type": "unknown", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "NumberConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.core.d.ts", + "api_info": { + "line": 1506, + "problem": "BuiltinAll", + "api_name": "isSafeInteger", + "api_type": "MethodSignature", + "api_func_args": [ + { + "name": "number", + "type": "unknown", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "NumberConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.reflect.d.ts", + "api_info": { + "line": 1506, + "problem": "BuiltinAll", + "api_name": "get", + "api_type": "MethodDeclaration", + "api_func_args": [ + { + "name": "target", + "type": "T", + "is_optional": false, + "has_default": false + }, + { + "name": "propertyKey", + "type": "P", + "is_optional": false, + "has_default": false + }, + { + "name": "receiver", + "type": "unknown", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Reflect", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "P extends keyof T ? T[P] : any", + "code_kind": 174 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.reflect.d.ts", + "api_info": { + "line": 1506, + "problem": "BuiltinAll", + "api_name": "has", + "api_type": "MethodDeclaration", + "api_func_args": [ + { + "name": "target", + "type": "object", + "is_optional": false, + "has_default": false + }, + { + "name": "propertyKey", + "type": "PropertyKey", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Reflect", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.reflect.d.ts", + "api_info": { + "line": 1506, + "problem": "BuiltinAll", + "api_name": "ownKeys", + "api_type": "MethodDeclaration", + "api_func_args": [ + { + "name": "target", + "type": "object", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Reflect", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "(string | symbol)[]", + "code_kind": 174 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.reflect.d.ts", + "api_info": { + "line": 1506, + "problem": "BuiltinAll", + "api_name": "set", + "api_type": "MethodDeclaration", + "api_func_args": [ + { + "name": "target", + "type": "T", + "is_optional": false, + "has_default": false + }, + { + "name": "propertyKey", + "type": "P", + "is_optional": false, + "has_default": false + }, + { + "name": "value", + "type": "P extends keyof T ? T[P] : any", + "is_optional": false, + "has_default": false + }, + { + "name": "receiver", + "type": "any", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Reflect", + "api_type": "ModuleDeclaration" + } + ], + "method_return_type": "boolean", + "code_kind": 174 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.core.d.ts", + "api_info": { + "line": 1506, + "problem": "BuiltinAll", + "api_name": "raw", + "api_type": "MethodSignature", + "api_func_args": [ + { + "name": "template", + "type": "{ raw: readonly string[] | ArrayLike}", + "is_optional": false, + "has_default": false + }, + { + "name": "substitutions", + "type": "any[]", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "StringConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.iterable.d.ts", + "api_info": { + "line": 1, + "problem": "BuiltinAll", + "api_name": "from", + "api_type": "MethodSignature", + "api_optional": false, + "api_func_args": [ + { + "name": "iterable", + "type": "Iterable | ArrayLike", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "ArrayConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "T[]", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 1, + "problem": "BuiltinAll", + "api_name": "isArray", + "api_type": "MethodSignature", + "api_optional": false, + "api_func_args": [ + { + "name": "arg", + "type": "any", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "ArrayConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "arg is any[]", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.iterable.d.ts", + "api_info": { + "line": 1506, + "problem": "BuiltinAll", + "api_name": "IteratorResult", + "api_type": "TypeAliasDeclaration", + "api_func_args": [], + "parent_api": [], + "method_return_type": "IteratorYieldResult | IteratorReturnResult", + "code_kind": 268 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.iterable.d.ts", + "api_info": { + "line": 1681, + "problem": "BuiltinAll", + "api_name": "done", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "IteratorReturnResult", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 170, + "api_property_type": "true" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.iterable.d.ts", + "api_info": { + "line": 1681, + "problem": "BuiltinAll", + "api_name": "value", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "IteratorReturnResult", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 170, + "api_property_type": "TReturn" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.iterable.d.ts", + "api_info": { + "line": 1681, + "problem": "BuiltinAll", + "api_name": "done", + "api_type": "PropertySignature", + "api_optional": true, + "parent_api": [ + { + "api_name": "IteratorYieldResult", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 170, + "api_property_type": "false" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.iterable.d.ts", + "api_info": { + "line": 1681, + "problem": "BuiltinAll", + "api_name": "value", + "api_type": "PropertySignature", + "api_optional": false, + "parent_api": [ + { + "api_name": "IteratorYieldResult", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 170, + "api_property_type": "TYield" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 1244, + "problem": "BuiltinAll", + "api_name": "isView", + "api_type": "MethodSignature", + "api_optional": false, + "api_func_args": [ + { + "name": "arg", + "type": "any", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "ArrayBufferConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "arg is ArrayBufferView", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 1244, + "problem": "BuiltinAll", + "api_name": "toJSON", + "api_type": "MethodSignature", + "api_optional": false, + "api_func_args": [ + { + "name": "key", + "type": "any", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "Date", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2022.error.d.ts", + "api_info": { + "line": 110, + "problem": "NoPropertyDescriptor", + "api_name": "cause", + "api_type": "PropertySignature", + "api_optional": true, + "parent_api": [ + { + "api_name": "ErrorOptions", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 170, + "api_property_type": "unknown" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2022.error.d.ts", + "api_info": { + "line": 110, + "problem": "NoPropertyDescriptor", + "api_name": "cause", + "api_type": "PropertySignature", + "api_optional": true, + "parent_api": [ + { + "api_name": "Error", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 170, + "api_property_type": "unknown" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 1139, + "problem": "BuiltinAll", + "api_name": "stringify", + "api_type": "MethodSignature", + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "any", + "is_optional": false, + "has_default": false + }, + { + "name": "replacer", + "type": "(this: any, key: string, value: any) => any", + "is_optional": true, + "has_default": false + }, + { + "name": "space", + "type": "string | number", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "JSON", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 1139, + "problem": "BuiltinAll", + "api_name": "stringify", + "api_type": "MethodSignature", + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "any", + "is_optional": false, + "has_default": false + }, + { + "name": "replacer", + "type": "(number | string)[] | null", + "is_optional": true, + "has_default": false + }, + { + "name": "space", + "type": "string | number", + "is_optional": true, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "JSON", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2017.object.d.ts", + "api_info": { + "line": 1139, + "problem": "BuiltinAll", + "api_name": "entries", + "api_type": "MethodSignature", + "api_optional": false, + "api_func_args": [ + { + "name": "o", + "type": "{}", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "ObjectConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "[string, any][]", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2017.object.d.ts", + "api_info": { + "line": 1139, + "problem": "BuiltinAll", + "api_name": "values", + "api_type": "MethodSignature", + "api_optional": false, + "api_func_args": [ + { + "name": "o", + "type": "{}", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "ObjectConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "any[]", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2019.object.d.ts", + "api_info": { + "line": 1139, + "problem": "BuiltinAll", + "api_name": "fromEntries", + "api_type": "MethodSignature", + "api_optional": false, + "api_func_args": [ + { + "name": "entries", + "type": "Iterable", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "ObjectConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "{ [k: string]: T }", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es5.d.ts", + "api_info": { + "line": 1139, + "problem": "BuiltinAll", + "api_name": "replace", + "api_type": "MethodSignature", + "api_optional": false, + "api_func_args": [ + { + "name": "searchValue", + "type": "string | RegExp", + "is_optional": false, + "has_default": false + }, + { + "name": "replacer", + "type": "(substring: string, ...args: any[]) => string", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "String", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2021.string.d.ts", + "api_info": { + "line": 1139, + "problem": "BuiltinAll", + "api_name": "replaceAll", + "api_type": "MethodSignature", + "api_optional": false, + "api_func_args": [ + { + "name": "searchValue", + "type": "string | RegExp", + "is_optional": false, + "has_default": false + }, + { + "name": "replacer", + "type": "(substring: string, ...args: any[]) => string", + "is_optional": false, + "has_default": false + } + ], + "parent_api": [ + { + "api_name": "String", + "api_type": "InterfaceDeclaration" + } + ], + "method_return_type": "string", + "code_kind": 173 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.collection.d.ts", + "api_info": { + "line": 522, + "problem": "BuiltinNoCtorFunc", + "api_type": "CallSignature", + "parent_api": [ + { + "api_name": "WeakMapConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 179 + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "lib.es2015.collection.d.ts", + "api_info": { + "line": 522, + "problem": "BuiltinNewCtor", + "api_type": "CallSignature", + "parent_api": [ + { + "api_name": "WeakMapConstructor", + "api_type": "InterfaceDeclaration" + } + ], + "code_kind": 179 + }, + "import_path": [], + "is_global": true } ] } \ No newline at end of file diff --git a/ets2panda/linter/src/lib/utils/consts/BuiltinWhiteList.ts b/ets2panda/linter/src/lib/utils/consts/BuiltinWhiteList.ts index 297b5fba00..7efc48c878 100644 --- a/ets2panda/linter/src/lib/utils/consts/BuiltinWhiteList.ts +++ b/ets2panda/linter/src/lib/utils/consts/BuiltinWhiteList.ts @@ -13,12 +13,16 @@ * limitations under the License. */ +import { FaultID } from '../../Problems'; + export enum BuiltinProblem { LimitedThisArg = 'ThisArg', SymbolIterator = 'SymbolIterator', BuiltinNoCtorFunc = 'BuiltinNoCtorFunc', BuiltinNoPropertyDescriptor = 'NoPropertyDescriptor', - MissingAttributes = 'MissingAttributes' + MissingAttributes = 'MissingAttributes', + BuiltinAll = 'BuiltinAll', + BuiltinNewCtor = 'BuiltinNewCtor' } export const SYMBOL_ITERATOR: string = 'Symbol.iterator'; @@ -51,3 +55,13 @@ export const BUILTIN_CONSTRUCTORS = ['Boolean', 'Number', 'Object', 'String']; export const COLLECTION_TYPES = new Set(['Map', 'Set', 'WeakMap', 'WeakSet']); export const COLLECTION_METHODS = new Set(['add', 'delete', 'get', 'has', 'set']); + +export const BUILTIN_TYPE = 'BuiltinApi'; +export const BuiltinProblemInfos = new Map([ + [BuiltinProblem.BuiltinNoCtorFunc, FaultID.BuiltinNoCtorFunc], + [BuiltinProblem.BuiltinAll, FaultID.BuiltinAll], + [BuiltinProblem.BuiltinNoPropertyDescriptor, FaultID.NoPropertyDescriptor], + [BuiltinProblem.SymbolIterator, FaultID.BuiltinSymbolIterator] +]); +export const BUILTIN_CONSTRUCTOR_API_NAME: string = 'builtin_constructor'; +export const BUILTIN_CONSTRUCTOR_API_TYPE = ['CallSignature']; diff --git a/ets2panda/linter/src/lib/utils/consts/DeprecateWhiteList.ts b/ets2panda/linter/src/lib/utils/consts/DeprecateWhiteList.ts index 0cdf0e2aba..e89e671d0d 100644 --- a/ets2panda/linter/src/lib/utils/consts/DeprecateWhiteList.ts +++ b/ets2panda/linter/src/lib/utils/consts/DeprecateWhiteList.ts @@ -13,6 +13,7 @@ * limitations under the License. */ +export const DEPRECATE_TYPE = 'DeprecatedApi'; export enum DeprecateProblem { NoDeprecatedApi = 'NoDeprecatedApi' } diff --git a/ets2panda/linter/src/lib/utils/consts/SdkCommonDeprecateWhiteList.ts b/ets2panda/linter/src/lib/utils/consts/SdkCommonDeprecateWhiteList.ts index 992e803740..7a6c52b469 100644 --- a/ets2panda/linter/src/lib/utils/consts/SdkCommonDeprecateWhiteList.ts +++ b/ets2panda/linter/src/lib/utils/consts/SdkCommonDeprecateWhiteList.ts @@ -15,6 +15,7 @@ import { FaultID } from '../../Problems'; +export const SDK_COMMON_TYPE = 'SdkCommonApi'; export const SdkCommonApiProblemInfos = new Map([ ['WhiteList', FaultID.SdkCommonApiWhiteList], ['BehaviorChange', FaultID.SdkCommonApiBehaviorChange], diff --git a/ets2panda/linter/test/builtin/builtin_array.ets b/ets2panda/linter/test/builtin/builtin_array.ets new file mode 100755 index 0000000000..dbf1092470 --- /dev/null +++ b/ets2panda/linter/test/builtin/builtin_array.ets @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { collections } from '@kit.ArkTS'; + +let arr1 = new Array(); //BuiltinNewCtor +let arr2 = new Array(); //BuiltinNewCtor +arr1.concat(1, arr2); //BuiltinAll +Array.length; +let arr11: ReadonlyArray = new Array(); //BuiltinNewCtor +let arr22: ReadonlyArray = new Array(); //BuiltinNewCtor +arr11.concat(1, arr22); //BuiltinAll + +const isArr = Array.isArray([1]); //BuiltinAll +let arr = new Array(); //BuiltinNewCtor + +const date = new Date("August 19,1975 23:00:00 UTC");//lib.es2015.core.d.ts +const jsonDate = date.toJSON(); //BuiltinAll +new Date().toJSON(); //BuiltinAll+BuiltinNewCtor +function getDate(){ + return date; +} +getDate().toJSON(); //BuiltinAll +console.log(new Demo().localDate?.toJSON()) //BuiltinAll +const demo = new Demo(); +demo.get()?.toJSON(); //BuiltinAll +Date.toString(); +//Reflect +let a1 = new Array(1,2,3) //BuiltinNewCtor +Reflect.ownKeys(a1) //BuiltinAll + +//ArrayBufferConstructor +ArrayBuffer.isView(1); //BuiltinAll +ArrayBuffer.isView(100n); //BuiltinAll +interface ArrayBufferConstructor{} +class Demo implements ArrayBufferConstructor,Date{ + localDate:Date|undefined = undefined; + set(localDate:Date|undefined){ + localDate = new Date(); //BuiltinNewCtor + return localDate + } + get():Date|undefined{ + return this.set(this.localDate); + } + isView(arg: string): arg is ArrayBufferView { + this.localDate?.toJSON(); //BuiltinAll + } + toJSON(key?: number): string { //BuiltinAll + return ''; + } +} + +let array = new collections.Array(1, 2, 3); +let array1 = new collections.Array(4, 5, 6); +let array2 = new collections.Array(7, 8, 9); +let concatArray = array.concat(array1, array2); +let arr3: collections.Array = new collections.Array('a', 'b', 'c', 'd'); +let result: boolean = collections.Array.isArray(arr3); +console.info(result + ''); + +const uint8 = new Uint8Array([1, 2, 3]); +ArrayBuffer.isView(uint8) //BuiltinAll +const buffer = new ArrayBuffer(16); +const dataView = new DataView(buffer); +ArrayBuffer.isView(dataView) //BuiltinAll + +//sum:24 \ No newline at end of file diff --git a/ets2panda/linter/test/builtin/builtin_array.ets.args.json b/ets2panda/linter/test/builtin/builtin_array.ets.args.json new file mode 100755 index 0000000000..4dfa4f2017 --- /dev/null +++ b/ets2panda/linter/test/builtin/builtin_array.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/builtin/builtin_array.ets.arkts2.json b/ets2panda/linter/test/builtin/builtin_array.ets.arkts2.json new file mode 100755 index 0000000000..d94294bab4 --- /dev/null +++ b/ets2panda/linter/test/builtin/builtin_array.ets.arkts2.json @@ -0,0 +1,388 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 15, + "column": 10, + "endLine": 15, + "endColumn": 21, + "problem": "LimitedStdLibNoImportConcurrency", + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 16, + "endLine": 17, + "endColumn": 21, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 16, + "endLine": 18, + "endColumn": 21, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 6, + "endLine": 19, + "endColumn": 12, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 40, + "endLine": 21, + "endColumn": 45, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 40, + "endLine": 22, + "endColumn": 45, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 7, + "endLine": 23, + "endColumn": 13, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 21, + "endLine": 25, + "endColumn": 28, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 15, + "endLine": 26, + "endColumn": 20, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 23, + "endLine": 29, + "endColumn": 29, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 12, + "endLine": 30, + "endColumn": 18, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 5, + "endLine": 30, + "endColumn": 9, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 11, + "endLine": 34, + "endColumn": 17, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 35, + "endLine": 35, + "endColumn": 41, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 13, + "endLine": 37, + "endColumn": 19, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 14, + "endLine": 40, + "endColumn": 19, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 1, + "endLine": 41, + "endColumn": 20, + "problem": "InteropCallReflect", + "suggest": "", + "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 9, + "endLine": 41, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 44, + "column": 13, + "endLine": 44, + "endColumn": 19, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 13, + "endLine": 45, + "endColumn": 19, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 46, + "endLine": 47, + "endColumn": 50, + "problem": "ExtendsExpression", + "suggest": "", + "rule": "Extends or implements expression are not supported(arkts-no-extends-expression)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 7, + "endLine": 47, + "endColumn": 11, + "problem": "InterfaceFieldNotImplemented", + "suggest": "", + "rule": "ArkTS 1.2 should implement all fields in the interface in the class (arkts-no-class-omit-interface-optional-prop)", + "severity": "ERROR" + }, + { + "line": 59, + "column": 3, + "endLine": 61, + "endColumn": 4, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 21, + "endLine": 50, + "endColumn": 25, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 24, + "endLine": 56, + "endColumn": 46, + "problem": "IsOperator", + "suggest": "", + "rule": "Type guarding is supported with \"instanceof\" and \"as\" (arkts-no-is)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 21, + "endLine": 57, + "endColumn": 27, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 59, + "column": 10, + "endLine": 59, + "endColumn": 22, + "problem": "MethodInheritRule", + "suggest": "", + "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", + "severity": "ERROR" + }, + { + "line": 64, + "column": 5, + "endLine": 64, + "endColumn": 43, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 64, + "column": 17, + "endLine": 64, + "endColumn": 34, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 65, + "column": 5, + "endLine": 65, + "endColumn": 44, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 65, + "column": 18, + "endLine": 65, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 5, + "endLine": 66, + "endColumn": 44, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 18, + "endLine": 66, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 5, + "endLine": 67, + "endColumn": 47, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 68, + "column": 43, + "endLine": 68, + "endColumn": 60, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 13, + "endLine": 73, + "endColumn": 19, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 76, + "column": 13, + "endLine": 76, + "endColumn": 19, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/builtin/builtin_array.ets.json b/ets2panda/linter/test/builtin/builtin_array.ets.json new file mode 100755 index 0000000000..f96a03d6a0 --- /dev/null +++ b/ets2panda/linter/test/builtin/builtin_array.ets.json @@ -0,0 +1,78 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 41, + "column": 1, + "endLine": 41, + "endColumn": 20, + "problem": "InteropCallReflect", + "suggest": "", + "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 24, + "endLine": 56, + "endColumn": 46, + "problem": "IsOperator", + "suggest": "", + "rule": "Type guarding is supported with \"instanceof\" and \"as\" (arkts-no-is)", + "severity": "ERROR" + }, + { + "line": 64, + "column": 5, + "endLine": 64, + "endColumn": 43, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 65, + "column": 5, + "endLine": 65, + "endColumn": 44, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 5, + "endLine": 66, + "endColumn": 44, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 5, + "endLine": 67, + "endColumn": 47, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/builtin/builtin_callsignature.ets.arkts2.json b/ets2panda/linter/test/builtin/builtin_callsignature.ets.arkts2.json index 8263890683..38faeba291 100644 --- a/ets2panda/linter/test/builtin/builtin_callsignature.ets.arkts2.json +++ b/ets2panda/linter/test/builtin/builtin_callsignature.ets.arkts2.json @@ -34,6 +34,16 @@ "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", "severity": "ERROR" }, + { + "line": 20, + "column": 10, + "endLine": 20, + "endColumn": 15, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 23, "column": 29, @@ -54,6 +64,16 @@ "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", "severity": "ERROR" }, + { + "line": 27, + "column": 10, + "endLine": 27, + "endColumn": 16, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 30, "column": 33, diff --git a/ets2panda/linter/test/builtin/builtin_error.ets b/ets2panda/linter/test/builtin/builtin_error.ets new file mode 100755 index 0000000000..36716c22fd --- /dev/null +++ b/ets2panda/linter/test/builtin/builtin_error.ets @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +let err1: AggregateError = new AggregateError([1]); //NoPropertyDescriptor +let err2: AggregateError = new AggregateError([1]); //NoPropertyDescriptor +let errors: Object[] = err2.errors; // NoPropertyDescriptor +try { + throw new Error(); //lib.es2022.error.d.ts +} catch (e) { + new Error("Connecting to database failed.", {cause: e}); +} +function get(err: AggregateError):Error { //NoPropertyDescriptor + const a = AggregateError.name; + const errr = Error() //BuiltinNoCtorFunc + return new Error; //lib.es2022.error.d.ts +} +const err3 = new AggregateError([1, "two", new Error("fail")]); //NoPropertyDescriptor +console.log(err3.errors.toString()); // NoPropertyDescriptor +console.log(err3.message); // NoPropertyDescriptor? + +const err4 = new AggregateError( //NoPropertyDescriptor + [new TypeError("invalid type"), new RangeError("out of bounds")], + "Multiple errors occurred" +); +console.log(err4.errors.length.toString()); // NoPropertyDescriptor + BuiltinAll + +function fetchData() { + try { + throw new Error("Network timeout"); //BuiltinNoCtorFunc lib.es2022.error.d.ts + } catch (e) { + return new Error("Fetch failed", { cause: e }); + } +} + +const result = fetchData(); +if (result.cause) {//NoPropertyDescriptor + console.log("Root cause:", result.cause.message); // NoPropertyDescriptor +} +console.log(err4.errors.toString()); // NoPropertyDescriptor + +//sum:18-1 \ No newline at end of file diff --git a/ets2panda/linter/test/builtin/builtin_error.ets.args.json b/ets2panda/linter/test/builtin/builtin_error.ets.args.json new file mode 100755 index 0000000000..4dfa4f2017 --- /dev/null +++ b/ets2panda/linter/test/builtin/builtin_error.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/builtin/builtin_error.ets.arkts2.json b/ets2panda/linter/test/builtin/builtin_error.ets.arkts2.json new file mode 100755 index 0000000000..a6ae05544d --- /dev/null +++ b/ets2panda/linter/test/builtin/builtin_error.ets.arkts2.json @@ -0,0 +1,208 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 16, + "column": 5, + "endLine": 16, + "endColumn": 9, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 5, + "endLine": 17, + "endColumn": 9, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 5, + "endLine": 18, + "endColumn": 35, + "problem": "ArrayTypeImmutable", + "suggest": "", + "rule": "Array type is immutable in ArkTS1.2 (arkts-array-type-immutable)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 24, + "endLine": 18, + "endColumn": 28, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 29, + "endLine": 18, + "endColumn": 35, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 14, + "endLine": 24, + "endColumn": 17, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 16, + "endLine": 26, + "endColumn": 21, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 7, + "endLine": 29, + "endColumn": 11, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 13, + "endLine": 30, + "endColumn": 17, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 18, + "endLine": 30, + "endColumn": 24, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 13, + "endLine": 31, + "endColumn": 17, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 7, + "endLine": 33, + "endColumn": 11, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 25, + "endLine": 37, + "endColumn": 31, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 13, + "endLine": 37, + "endColumn": 17, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 18, + "endLine": 37, + "endColumn": 24, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 12, + "endLine": 48, + "endColumn": 17, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 49, + "column": 37, + "endLine": 49, + "endColumn": 42, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 51, + "column": 13, + "endLine": 51, + "endColumn": 17, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 51, + "column": 18, + "endLine": 51, + "endColumn": 24, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/builtin/builtin_error.ets.json b/ets2panda/linter/test/builtin/builtin_error.ets.json new file mode 100755 index 0000000000..7633c79b6a --- /dev/null +++ b/ets2panda/linter/test/builtin/builtin_error.ets.json @@ -0,0 +1,17 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/builtin/builtin_not_support_property_descriptor.ets.arkts2.json b/ets2panda/linter/test/builtin/builtin_not_support_property_descriptor.ets.arkts2.json index aa44c0c86e..eff14bb847 100644 --- a/ets2panda/linter/test/builtin/builtin_not_support_property_descriptor.ets.arkts2.json +++ b/ets2panda/linter/test/builtin/builtin_not_support_property_descriptor.ets.arkts2.json @@ -54,6 +54,16 @@ "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", "severity": "ERROR" }, + { + "line": 17, + "column": 4, + "endLine": 17, + "endColumn": 16, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, { "line": 18, "column": 2, @@ -64,6 +74,16 @@ "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", "severity": "ERROR" }, + { + "line": 18, + "column": 4, + "endLine": 18, + "endColumn": 14, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, { "line": 19, "column": 2, @@ -74,6 +94,16 @@ "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", "severity": "ERROR" }, + { + "line": 19, + "column": 4, + "endLine": 19, + "endColumn": 9, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, { "line": 20, "column": 2, @@ -84,6 +114,16 @@ "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", "severity": "ERROR" }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 12, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, { "line": 21, "column": 2, @@ -164,6 +204,16 @@ "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", "severity": "ERROR" }, + { + "line": 38, + "column": 7, + "endLine": 38, + "endColumn": 19, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, { "line": 39, "column": 5, @@ -174,6 +224,16 @@ "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", "severity": "ERROR" }, + { + "line": 39, + "column": 7, + "endLine": 39, + "endColumn": 17, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, { "line": 40, "column": 5, @@ -184,6 +244,16 @@ "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", "severity": "ERROR" }, + { + "line": 40, + "column": 7, + "endLine": 40, + "endColumn": 12, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, { "line": 41, "column": 5, @@ -194,6 +264,16 @@ "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", "severity": "ERROR" }, + { + "line": 41, + "column": 7, + "endLine": 41, + "endColumn": 15, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, { "line": 42, "column": 5, diff --git a/ets2panda/linter/test/builtin/builtin_object.ets b/ets2panda/linter/test/builtin/builtin_object.ets new file mode 100755 index 0000000000..b05a9753d9 --- /dev/null +++ b/ets2panda/linter/test/builtin/builtin_object.ets @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +//NumberConstructor +const num1 = new Number('123');//BuiltinNewCtor 1 +Number('123');//BuiltinNoCtorFunc 1 +console.log(Number(undefined).toString());//BuiltinNoCtorFunc 1 +Number.isFinite(1) //BuiltinAll 1 +Number.isInteger(true) //BuiltinAll 1 +Number.isNaN(true) //BuiltinAll 1 +Number.isSafeInteger(true) //BuiltinAll 1 +isFinite(11); +//ObjectConstructor +interface Person { + name: string; + age: number; +} +const obj: Person = { + name: '', + age: 42 +}; +const a: [string, number][] = Object.entries(obj);//BuiltinAll 1 +Object.values(obj);//BuiltinAll 1 + +const entries: Map = new Map([ + ['1', '2'] +]); +const obj1 = Object.fromEntries(entries);//BuiltinAll 1 +typeof new Object();//BuiltinAll 1 + +//String +new String(undefined);//BuiltinNewCtor 1 +String('');//BuiltinNoCtorFunc 1 +const str: string = 'abc'; +str.replace('a', 'b'); +str.replaceAll('a', 'b'); +class Demo implements String{ + replaceAll1(searchValue: string | RegExp, replacer: string): string { + + } + replaceAll(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string{//BuiltinAll 1 + + } +} +//replace(searchValue: string | RegExp, replaceValue: string): string; +const text = "Hello World, World!"; +const result1 = text.replace("World", "TypeScript"); +const result2 = text.replace(/World/g, "TypeScript"); + +//replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; +function toUpperCaseReplacer(match: string): string { + return match.toUpperCase(); +} +text.replace('',toUpperCaseReplacer)//BuiltinAll 1 +const result4 = text.replace("world", (match) => match.toUpperCase());//BuiltinAll 1 +const result5 = text.replace("/(\w+) (\w+)/", (first, last:number) => `${last}, ${first}`);//BuiltinAll 1 +//replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; +//lib.es2015.symbol.wellknown.d.ts +const result6 = text.replace(/-/g, (match, offset:string) => `-${offset}-`);//BuiltinAll!! +const camelCase = text.replace(/_(\w)/g, (_, char:string) => char.toUpperCase());//BuiltinAll!! +console.log(camelCase); +const prices = { apple: 5, banana: 3 }; +function pricesChange(count:string, fruit:string){ + const price = prices[fruit as keyof typeof prices] || 0; + return `${count} ${fruit} ($${price * parseInt(count)})`; +} +const result7 = text.replaceAll(/(\d+)\s+(\w+)/g, pricesChange);//BuiltinAll 1 + +//WeakMapConstructor +interface Person1 { + age: number; +} +const key1: Person1 = {age: 12}; +const key2: Person1 = {age: 123}; +const weakMap = new WeakMap([ //BuiltinNoCtorFunc 1 + [key1, 'value1'], + [key2, 'value2'] +]); +//JSON +const a = JSON.stringify({x: 5, y: 6});//BuiltinAll 1 +class Test implements JSON{ + stringify(value: string, replacer?: (number | string)[] | null, space?: string | number): string{//BuiltinAll 1 + return ''; + } + str: String = ''; + get() { + return this.str; + } +} +const d = new Test(); +d.get().replaceAll('a', pricesChange);//BuiltinAll 1 + +const boolObj1 = new Boolean(true); //BuiltinNewCtor +console.log(boolObj1.valueOf()); +console.log(new Test().valueOf()); //BuiltinAll +console.log(typeof boolObj1); +const tt = new Test(); +typeof tt.valueOf; //BuiltinAll?? +const boolObj2 = new Boolean(""); //BuiltinNewCtor +const boolObj3 = new Boolean(null); //BuiltinNewCtor +const boolObj4 = new Boolean(0); //BuiltinNewCtor + +//sum:27 diff --git a/ets2panda/linter/test/builtin/builtin_object.ets.args.json b/ets2panda/linter/test/builtin/builtin_object.ets.args.json new file mode 100755 index 0000000000..4dfa4f2017 --- /dev/null +++ b/ets2panda/linter/test/builtin/builtin_object.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} diff --git a/ets2panda/linter/test/builtin/builtin_object.ets.arkts2.json b/ets2panda/linter/test/builtin/builtin_object.ets.arkts2.json new file mode 100755 index 0000000000..3621e310c9 --- /dev/null +++ b/ets2panda/linter/test/builtin/builtin_object.ets.arkts2.json @@ -0,0 +1,518 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 16, + "column": 14, + "endLine": 16, + "endColumn": 31, + "problem": "CreatingPrimitiveTypes", + "suggest": "", + "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 18, + "endLine": 16, + "endColumn": 24, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 7, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 13, + "endLine": 18, + "endColumn": 19, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 8, + "endLine": 19, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 8, + "endLine": 20, + "endColumn": 17, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 8, + "endLine": 21, + "endColumn": 13, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 8, + "endLine": 22, + "endColumn": 21, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 7, + "endLine": 33, + "endColumn": 50, + "problem": "ArrayTypeImmutable", + "suggest": "", + "rule": "Array type is immutable in ArkTS1.2 (arkts-array-type-immutable)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 38, + "endLine": 33, + "endColumn": 45, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 8, + "endLine": 34, + "endColumn": 14, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 38, + "endLine": 38, + "endColumn": 3, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 21, + "endLine": 39, + "endColumn": 32, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 21, + "endLine": 39, + "endColumn": 32, + "problem": "LimitedStdLibApi", + "suggest": "", + "rule": "Usage of standard library is restricted (arkts-limited-stdlib)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 12, + "endLine": 40, + "endColumn": 18, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 1, + "endLine": 43, + "endColumn": 22, + "problem": "CreatingPrimitiveTypes", + "suggest": "", + "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 5, + "endLine": 43, + "endColumn": 11, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 44, + "column": 1, + "endLine": 44, + "endColumn": 7, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 7, + "endLine": 48, + "endColumn": 11, + "problem": "InterfaceFieldNotImplemented", + "suggest": "", + "rule": "ArkTS 1.2 should implement all fields in the interface in the class (arkts-no-class-omit-interface-optional-prop)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 3, + "endLine": 54, + "endColumn": 4, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 83, + "endLine": 52, + "endColumn": 86, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 59, + "column": 30, + "endLine": 59, + "endColumn": 38, + "problem": "RegularExpressionLiteral", + "suggest": "", + "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", + "severity": "ERROR" + }, + { + "line": 65, + "column": 6, + "endLine": 65, + "endColumn": 13, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 22, + "endLine": 66, + "endColumn": 29, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 22, + "endLine": 67, + "endColumn": 29, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 30, + "endLine": 70, + "endColumn": 34, + "problem": "RegularExpressionLiteral", + "suggest": "", + "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", + "severity": "ERROR" + }, + { + "line": 71, + "column": 32, + "endLine": 71, + "endColumn": 40, + "problem": "RegularExpressionLiteral", + "suggest": "", + "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 16, + "endLine": 73, + "endColumn": 17, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 17, + "endLine": 75, + "endColumn": 53, + "problem": "PropertyAccessByIndex", + "suggest": "", + "rule": "Indexed access is not supported for fields (arkts-no-props-by-index)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 39, + "endLine": 75, + "endColumn": 45, + "problem": "TypeQuery", + "suggest": "", + "rule": "\"typeof\" operator is allowed only in expression contexts (arkts-no-type-query)", + "severity": "ERROR" + }, + { + "line": 78, + "column": 22, + "endLine": 78, + "endColumn": 32, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 78, + "column": 33, + "endLine": 78, + "endColumn": 49, + "problem": "RegularExpressionLiteral", + "suggest": "", + "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", + "severity": "ERROR" + }, + { + "line": 86, + "column": 21, + "endLine": 86, + "endColumn": 28, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 91, + "column": 16, + "endLine": 91, + "endColumn": 25, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 91, + "column": 16, + "endLine": 91, + "endColumn": 25, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 92, + "column": 7, + "endLine": 92, + "endColumn": 11, + "problem": "InterfaceFieldNotImplemented", + "suggest": "", + "rule": "ArkTS 1.2 should implement all fields in the interface in the class (arkts-no-class-omit-interface-optional-prop)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 3, + "endLine": 95, + "endColumn": 4, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"JSON\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 3, + "endLine": 95, + "endColumn": 4, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 13, + "endLine": 93, + "endColumn": 26, + "problem": "MethodInheritRule", + "suggest": "", + "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 28, + "endLine": 93, + "endColumn": 65, + "problem": "MethodInheritRule", + "suggest": "", + "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", + "severity": "ERROR" + }, + { + "line": 102, + "column": 9, + "endLine": 102, + "endColumn": 19, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 104, + "column": 18, + "endLine": 104, + "endColumn": 35, + "problem": "CreatingPrimitiveTypes", + "suggest": "", + "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", + "severity": "ERROR" + }, + { + "line": 104, + "column": 22, + "endLine": 104, + "endColumn": 29, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 106, + "column": 24, + "endLine": 106, + "endColumn": 31, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 110, + "column": 18, + "endLine": 110, + "endColumn": 33, + "problem": "CreatingPrimitiveTypes", + "suggest": "", + "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", + "severity": "ERROR" + }, + { + "line": 110, + "column": 22, + "endLine": 110, + "endColumn": 29, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 111, + "column": 18, + "endLine": 111, + "endColumn": 35, + "problem": "CreatingPrimitiveTypes", + "suggest": "", + "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", + "severity": "ERROR" + }, + { + "line": 111, + "column": 22, + "endLine": 111, + "endColumn": 29, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 112, + "column": 18, + "endLine": 112, + "endColumn": 32, + "problem": "CreatingPrimitiveTypes", + "suggest": "", + "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", + "severity": "ERROR" + }, + { + "line": 112, + "column": 22, + "endLine": 112, + "endColumn": 29, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/builtin/builtin_object.ets.json b/ets2panda/linter/test/builtin/builtin_object.ets.json new file mode 100755 index 0000000000..3ca8258156 --- /dev/null +++ b/ets2panda/linter/test/builtin/builtin_object.ets.json @@ -0,0 +1,68 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 39, + "column": 14, + "endLine": 39, + "endColumn": 41, + "problem": "LimitedStdLibApi", + "suggest": "", + "rule": "Usage of standard library is restricted (arkts-limited-stdlib)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 83, + "endLine": 52, + "endColumn": 86, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 16, + "endLine": 73, + "endColumn": 17, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 17, + "endLine": 75, + "endColumn": 53, + "problem": "PropertyAccessByIndex", + "suggest": "", + "rule": "Indexed access is not supported for fields (arkts-no-props-by-index)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 39, + "endLine": 75, + "endColumn": 45, + "problem": "TypeQuery", + "suggest": "", + "rule": "\"typeof\" operator is allowed only in expression contexts (arkts-no-type-query)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/builtin/builtin_symbol_iterator.ets.arkts2.json b/ets2panda/linter/test/builtin/builtin_symbol_iterator.ets.arkts2.json index 2a6b56517a..54848fe0ea 100755 --- a/ets2panda/linter/test/builtin/builtin_symbol_iterator.ets.arkts2.json +++ b/ets2panda/linter/test/builtin/builtin_symbol_iterator.ets.arkts2.json @@ -24,6 +24,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 17, + "column": 31, + "endLine": 17, + "endColumn": 34, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 17, "column": 40, diff --git a/ets2panda/linter/test/builtin/builtin_thisArgs.ets b/ets2panda/linter/test/builtin/builtin_thisArgs.ets index b296e847c1..912735bad5 100755 --- a/ets2panda/linter/test/builtin/builtin_thisArgs.ets +++ b/ets2panda/linter/test/builtin/builtin_thisArgs.ets @@ -23,7 +23,7 @@ Class MyClass { } } -let arr: Array = new Array(1, 2, 3); +let arr: Array = new Array(1, 2, 3); //BuiltinNewCtor let a = new MyClass(2); let b = new MyClass(3); arr.filter(a.compare, a); diff --git a/ets2panda/linter/test/builtin/builtin_thisArgs.ets.arkts2.json b/ets2panda/linter/test/builtin/builtin_thisArgs.ets.arkts2.json index eb2072ee24..28a94963ff 100755 --- a/ets2panda/linter/test/builtin/builtin_thisArgs.ets.arkts2.json +++ b/ets2panda/linter/test/builtin/builtin_thisArgs.ets.arkts2.json @@ -24,6 +24,16 @@ "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", "severity": "ERROR" }, + { + "line": 26, + "column": 30, + "endLine": 26, + "endColumn": 35, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 27, "column": 5, diff --git a/ets2panda/linter/test/deprecatedapi/action_sheet.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/action_sheet.ets.arkts2.json index 35e1e2cbd1..882e689fb3 100644 --- a/ets2panda/linter/test/deprecatedapi/action_sheet.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/action_sheet.ets.arkts2.json @@ -24,6 +24,26 @@ "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", "severity": "ERROR" }, + { + "line": 41, + "column": 45, + "endLine": 41, + "endColumn": 54, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 45, + "endLine": 41, + "endColumn": 54, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 18, "column": 2, diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.arkts2.json index 00497d0261..1dfb982b0c 100644 --- a/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.arkts2.json @@ -24,6 +24,16 @@ "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", "severity": "ERROR" }, + { + "line": 21, + "column": 33, + "endLine": 21, + "endColumn": 38, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 24, "column": 10, diff --git a/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets.arkts2.json index 7d0cfc0cb7..d40f9b53f6 100644 --- a/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets.arkts2.json @@ -24,6 +24,16 @@ "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", "severity": "ERROR" }, + { + "line": 78, + "column": 27, + "endLine": 78, + "endColumn": 33, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 82, "column": 27, @@ -34,6 +44,16 @@ "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", "severity": "ERROR" }, + { + "line": 92, + "column": 39, + "endLine": 92, + "endColumn": 45, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 16, "column": 34, diff --git a/ets2panda/linter/test/interop/interop_convert_import.ets.arkts2.json b/ets2panda/linter/test/interop/interop_convert_import.ets.arkts2.json index 741e95d38a..35e1e2d620 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.arkts2.json +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.arkts2.json @@ -124,6 +124,16 @@ "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", "severity": "ERROR" }, + { + "line": 25, + "column": 48, + "endLine": 25, + "endColumn": 53, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 25, "column": 44, diff --git a/ets2panda/linter/test/interop/interop_convert_import.ets.autofix.json b/ets2panda/linter/test/interop/interop_convert_import.ets.autofix.json index 48479f4d9e..a4f8a52be9 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.autofix.json @@ -212,6 +212,16 @@ "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", "severity": "ERROR" }, + { + "line": 25, + "column": 48, + "endLine": 25, + "endColumn": 53, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 25, "column": 44, diff --git a/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.json b/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.json index 056c6e9c99..204d56755f 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.json @@ -44,6 +44,16 @@ "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", "severity": "ERROR" }, + { + "line": 25, + "column": 48, + "endLine": 25, + "endColumn": 53, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 25, "column": 44, diff --git a/ets2panda/linter/test/interop/interop_import_js_index.ets.arkts2.json b/ets2panda/linter/test/interop/interop_import_js_index.ets.arkts2.json index 95e55d3f56..f6d4f19da7 100644 --- a/ets2panda/linter/test/interop/interop_import_js_index.ets.arkts2.json +++ b/ets2panda/linter/test/interop/interop_import_js_index.ets.arkts2.json @@ -94,6 +94,16 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, + { + "line": 22, + "column": 16, + "endLine": 22, + "endColumn": 22, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 22, "column": 11, @@ -104,6 +114,16 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, + { + "line": 23, + "column": 26, + "endLine": 23, + "endColumn": 32, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 23, "column": 21, diff --git a/ets2panda/linter/test/interop/interop_import_js_index.ets.autofix.json b/ets2panda/linter/test/interop/interop_import_js_index.ets.autofix.json index 9653a8ed9c..6e88cbc042 100644 --- a/ets2panda/linter/test/interop/interop_import_js_index.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_import_js_index.ets.autofix.json @@ -138,6 +138,16 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, + { + "line": 22, + "column": 16, + "endLine": 22, + "endColumn": 22, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 22, "column": 11, @@ -159,6 +169,16 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, + { + "line": 23, + "column": 26, + "endLine": 23, + "endColumn": 32, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 23, "column": 21, diff --git a/ets2panda/linter/test/interop/interop_import_js_rules.ets.arkts2.json b/ets2panda/linter/test/interop/interop_import_js_rules.ets.arkts2.json index d309c364fa..472a71a82d 100644 --- a/ets2panda/linter/test/interop/interop_import_js_rules.ets.arkts2.json +++ b/ets2panda/linter/test/interop/interop_import_js_rules.ets.arkts2.json @@ -294,6 +294,16 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, + { + "line": 51, + "column": 15, + "endLine": 51, + "endColumn": 21, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 51, "column": 11, diff --git a/ets2panda/linter/test/interop/interop_import_js_rules.ets.autofix.json b/ets2panda/linter/test/interop/interop_import_js_rules.ets.autofix.json index 2590e69b49..614ee8504a 100644 --- a/ets2panda/linter/test/interop/interop_import_js_rules.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_import_js_rules.ets.autofix.json @@ -371,6 +371,16 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, + { + "line": 51, + "column": 15, + "endLine": 51, + "endColumn": 21, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 51, "column": 11, diff --git a/ets2panda/linter/test/interop/object_built_in.ets.arkts2.json b/ets2panda/linter/test/interop/object_built_in.ets.arkts2.json index 41a2db7981..a9b38d59e3 100644 --- a/ets2panda/linter/test/interop/object_built_in.ets.arkts2.json +++ b/ets2panda/linter/test/interop/object_built_in.ets.arkts2.json @@ -34,6 +34,26 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 21, + "column": 12, + "endLine": 21, + "endColumn": 19, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 12, + "endLine": 23, + "endColumn": 18, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 24, "column": 9, @@ -63,6 +83,26 @@ "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" + }, + { + "line": 30, + "column": 22, + "endLine": 30, + "endColumn": 27, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 34, + "endLine": 31, + "endColumn": 40, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" } ] } diff --git a/ets2panda/linter/test/interop/reflect_built_in.ets.arkts2.json b/ets2panda/linter/test/interop/reflect_built_in.ets.arkts2.json index c76a12de83..2f9d957666 100644 --- a/ets2panda/linter/test/interop/reflect_built_in.ets.arkts2.json +++ b/ets2panda/linter/test/interop/reflect_built_in.ets.arkts2.json @@ -24,6 +24,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 18, + "column": 10, + "endLine": 18, + "endColumn": 13, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 19, "column": 2, @@ -34,6 +44,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 19, + "column": 10, + "endLine": 19, + "endColumn": 13, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 20, "column": 2, @@ -44,6 +64,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 20, + "column": 10, + "endLine": 20, + "endColumn": 17, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 24, "column": 5, @@ -54,6 +84,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 24, + "column": 20, + "endLine": 24, + "endColumn": 23, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 27, "column": 1, @@ -114,6 +154,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 36, + "column": 13, + "endLine": 36, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 37, "column": 5, @@ -124,6 +174,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 37, + "column": 13, + "endLine": 37, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 38, "column": 5, @@ -134,6 +194,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 38, + "column": 13, + "endLine": 38, + "endColumn": 20, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 41, "column": 1, @@ -154,6 +224,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 42, + "column": 9, + "endLine": 42, + "endColumn": 12, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 43, "column": 1, @@ -164,6 +244,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 43, + "column": 9, + "endLine": 43, + "endColumn": 12, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 44, "column": 1, @@ -174,6 +264,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 44, + "column": 9, + "endLine": 44, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 46, "column": 1, @@ -194,6 +294,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 47, + "column": 9, + "endLine": 47, + "endColumn": 12, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 48, "column": 1, @@ -204,6 +314,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 48, + "column": 9, + "endLine": 48, + "endColumn": 12, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 49, "column": 1, @@ -214,6 +334,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 49, + "column": 9, + "endLine": 49, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 51, "column": 1, @@ -234,6 +364,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 52, + "column": 9, + "endLine": 52, + "endColumn": 12, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 53, "column": 1, @@ -244,6 +384,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 53, + "column": 9, + "endLine": 53, + "endColumn": 12, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 54, "column": 1, @@ -254,6 +404,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 54, + "column": 9, + "endLine": 54, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 56, "column": 1, @@ -274,6 +434,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 57, + "column": 9, + "endLine": 57, + "endColumn": 12, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 58, "column": 1, @@ -293,6 +463,16 @@ "suggest": "", "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" + }, + { + "line": 59, + "column": 9, + "endLine": 59, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/arkts-array-type-immutable.ets.arkts2.json b/ets2panda/linter/test/main/arkts-array-type-immutable.ets.arkts2.json index fa2a742d07..611f64c4d7 100644 --- a/ets2panda/linter/test/main/arkts-array-type-immutable.ets.arkts2.json +++ b/ets2panda/linter/test/main/arkts-array-type-immutable.ets.arkts2.json @@ -64,6 +64,16 @@ "rule": "Array type is immutable in ArkTS1.2 (arkts-array-type-immutable)", "severity": "ERROR" }, + { + "line": 32, + "column": 35, + "endLine": 32, + "endColumn": 40, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 36, "column": 3, @@ -334,6 +344,16 @@ "rule": "Array type is immutable in ArkTS1.2 (arkts-array-type-immutable)", "severity": "ERROR" }, + { + "line": 149, + "column": 40, + "endLine": 149, + "endColumn": 45, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 149, "column": 36, @@ -344,6 +364,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 150, + "column": 21, + "endLine": 150, + "endColumn": 26, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 150, "column": 17, @@ -374,6 +404,16 @@ "rule": "Usage of standard library is restricted (arkts-limited-stdlib)", "severity": "ERROR" }, + { + "line": 155, + "column": 17, + "endLine": 155, + "endColumn": 22, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 156, "column": 1, diff --git a/ets2panda/linter/test/main/arkts-primitive-type-normalization.ets.arkts2.json b/ets2panda/linter/test/main/arkts-primitive-type-normalization.ets.arkts2.json index 6265f75a79..f9ab07f285 100644 --- a/ets2panda/linter/test/main/arkts-primitive-type-normalization.ets.arkts2.json +++ b/ets2panda/linter/test/main/arkts-primitive-type-normalization.ets.arkts2.json @@ -24,6 +24,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 16, + "column": 12, + "endLine": 16, + "endColumn": 18, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 17, "column": 1, @@ -34,6 +44,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 17, + "column": 5, + "endLine": 17, + "endColumn": 11, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 17, "column": 18, @@ -44,6 +64,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 17, + "column": 22, + "endLine": 17, + "endColumn": 28, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 18, "column": 5, @@ -54,6 +84,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 18, + "column": 9, + "endLine": 18, + "endColumn": 16, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 19, "column": 9, @@ -64,6 +104,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 19, + "column": 13, + "endLine": 19, + "endColumn": 19, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 20, "column": 1, @@ -74,6 +124,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 20, + "column": 5, + "endLine": 20, + "endColumn": 12, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 21, "column": 1, @@ -84,6 +144,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 21, + "column": 5, + "endLine": 21, + "endColumn": 11, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 22, "column": 1, @@ -93,6 +163,16 @@ "suggest": "", "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" + }, + { + "line": 22, + "column": 5, + "endLine": 22, + "endColumn": 11, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/arktsutils_module.ets.migrate.json b/ets2panda/linter/test/main/arktsutils_module.ets.migrate.json index a3e735670a..07b95938ed 100644 --- a/ets2panda/linter/test/main/arktsutils_module.ets.migrate.json +++ b/ets2panda/linter/test/main/arktsutils_module.ets.migrate.json @@ -14,6 +14,86 @@ "limitations under the License." ], "result": [ + { + "line": 27, + "column": 31, + "endLine": 27, + "endColumn": 40, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 31, + "endLine": 27, + "endColumn": 40, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 23, + "endLine": 29, + "endColumn": 32, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 23, + "endLine": 29, + "endColumn": 32, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 23, + "endLine": 31, + "endColumn": 32, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 23, + "endLine": 31, + "endColumn": 32, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 31, + "endLine": 33, + "endColumn": 40, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 31, + "endLine": 33, + "endColumn": 40, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 35, "column": 22, diff --git a/ets2panda/linter/test/main/array_index_expr_type.ets.arkts2.json b/ets2panda/linter/test/main/array_index_expr_type.ets.arkts2.json index 723d6e343d..f7b2f17f4c 100644 --- a/ets2panda/linter/test/main/array_index_expr_type.ets.arkts2.json +++ b/ets2panda/linter/test/main/array_index_expr_type.ets.arkts2.json @@ -374,6 +374,26 @@ "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", "severity": "ERROR" }, + { + "line": 54, + "column": 36, + "endLine": 54, + "endColumn": 42, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 58, + "column": 33, + "endLine": 58, + "endColumn": 39, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 64, "column": 3, diff --git a/ets2panda/linter/test/main/array_index_expr_type.ets.autofix.json b/ets2panda/linter/test/main/array_index_expr_type.ets.autofix.json index f4dd521cf0..6c25ada216 100644 --- a/ets2panda/linter/test/main/array_index_expr_type.ets.autofix.json +++ b/ets2panda/linter/test/main/array_index_expr_type.ets.autofix.json @@ -506,6 +506,26 @@ "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", "severity": "ERROR" }, + { + "line": 54, + "column": 36, + "endLine": 54, + "endColumn": 42, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 58, + "column": 33, + "endLine": 58, + "endColumn": 39, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 64, "column": 3, diff --git a/ets2panda/linter/test/main/array_index_expr_type.ets.migrate.json b/ets2panda/linter/test/main/array_index_expr_type.ets.migrate.json index 3ee4a7e174..ed9ca565e1 100644 --- a/ets2panda/linter/test/main/array_index_expr_type.ets.migrate.json +++ b/ets2panda/linter/test/main/array_index_expr_type.ets.migrate.json @@ -134,6 +134,26 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 59, + "column": 36, + "endLine": 59, + "endColumn": 42, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 63, + "column": 33, + "endLine": 63, + "endColumn": 39, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 69, "column": 3, diff --git a/ets2panda/linter/test/main/class_as_object.ets.arkts2.json b/ets2panda/linter/test/main/class_as_object.ets.arkts2.json index ae6c793e86..3ffabb344d 100644 --- a/ets2panda/linter/test/main/class_as_object.ets.arkts2.json +++ b/ets2panda/linter/test/main/class_as_object.ets.arkts2.json @@ -174,6 +174,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 87, + "column": 46, + "endLine": 87, + "endColumn": 52, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 87, "column": 39, @@ -215,14 +225,14 @@ "severity": "ERROR" }, { - "line": 98, - "column": 5, - "endLine": 98, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" + "line": 98, + "column": 5, + "endLine": 98, + "endColumn": 6, + "problem": "VariableMissingInitializer", + "suggest": "", + "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", + "severity": "ERROR" }, { "line": 98, @@ -254,6 +264,16 @@ "rule": "Enum cannot get member name by member value (arkts-enum-no-props-by-index)", "severity": "ERROR" }, + { + "line": 116, + "column": 45, + "endLine": 116, + "endColumn": 51, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 116, "column": 42, @@ -674,6 +694,96 @@ "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", "severity": "ERROR" }, + { + "line": 171, + "column": 7, + "endLine": 171, + "endColumn": 14, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 171, + "column": 17, + "endLine": 171, + "endColumn": 31, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 172, + "column": 15, + "endLine": 172, + "endColumn": 20, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 173, + "column": 12, + "endLine": 173, + "endColumn": 18, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 174, + "column": 14, + "endLine": 174, + "endColumn": 21, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 175, + "column": 14, + "endLine": 175, + "endColumn": 18, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 176, + "column": 13, + "endLine": 176, + "endColumn": 18, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 177, + "column": 17, + "endLine": 177, + "endColumn": 26, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 179, + "column": 13, + "endLine": 179, + "endColumn": 19, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 180, "column": 7, @@ -684,6 +794,26 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 181, + "column": 18, + "endLine": 181, + "endColumn": 28, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 182, + "column": 16, + "endLine": 182, + "endColumn": 30, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 183, "column": 15, @@ -694,6 +824,26 @@ "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", "severity": "ERROR" }, + { + "line": 183, + "column": 15, + "endLine": 183, + "endColumn": 21, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 184, + "column": 13, + "endLine": 184, + "endColumn": 19, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 185, "column": 13, @@ -704,6 +854,36 @@ "rule": "\"Symbol()\" API is not supported (arkts-no-symbol)", "severity": "ERROR" }, + { + "line": 186, + "column": 19, + "endLine": 186, + "endColumn": 30, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 187, + "column": 17, + "endLine": 187, + "endColumn": 26, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 188, + "column": 16, + "endLine": 188, + "endColumn": 24, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 190, "column": 19, @@ -714,6 +894,16 @@ "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", "severity": "ERROR" }, + { + "line": 192, + "column": 15, + "endLine": 192, + "endColumn": 21, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 193, "column": 9, @@ -733,6 +923,16 @@ "suggest": "", "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", "severity": "ERROR" + }, + { + "line": 202, + "column": 30, + "endLine": 202, + "endColumn": 36, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/collections_module.ets.migrate.json b/ets2panda/linter/test/main/collections_module.ets.migrate.json index 5a14ab57e1..0a7db0112a 100644 --- a/ets2panda/linter/test/main/collections_module.ets.migrate.json +++ b/ets2panda/linter/test/main/collections_module.ets.migrate.json @@ -14,6 +14,36 @@ "limitations under the License." ], "result": [ + { + "line": 26, + "column": 43, + "endLine": 26, + "endColumn": 48, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 28, + "endLine": 28, + "endColumn": 33, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 28, + "endLine": 30, + "endColumn": 33, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 32, "column": 7, @@ -24,6 +54,16 @@ "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", "severity": "ERROR" }, + { + "line": 34, + "column": 43, + "endLine": 34, + "endColumn": 48, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 36, "column": 7, diff --git a/ets2panda/linter/test/main/func_inferred_type_args.ets.arkts2.json b/ets2panda/linter/test/main/func_inferred_type_args.ets.arkts2.json index 7b672d3e61..6e24728473 100755 --- a/ets2panda/linter/test/main/func_inferred_type_args.ets.arkts2.json +++ b/ets2panda/linter/test/main/func_inferred_type_args.ets.arkts2.json @@ -75,14 +75,14 @@ "severity": "ERROR" }, { - "line": 56, - "column": 5, - "endLine": 56, - "endColumn": 6, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" + "line": 56, + "column": 5, + "endLine": 56, + "endColumn": 6, + "problem": "VariableMissingInitializer", + "suggest": "", + "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", + "severity": "ERROR" }, { "line": 56, @@ -225,14 +225,14 @@ "severity": "ERROR" }, { - "line": 72, - "column": 7, - "endLine": 72, - "endColumn": 8, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" + "line": 72, + "column": 7, + "endLine": 72, + "endColumn": 8, + "problem": "VariableMissingInitializer", + "suggest": "", + "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", + "severity": "ERROR" }, { "line": 72, @@ -264,6 +264,56 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 81, + "column": 3, + "endLine": 81, + "endColumn": 10, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 82, + "column": 3, + "endLine": 82, + "endColumn": 10, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 83, + "column": 3, + "endLine": 83, + "endColumn": 10, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 84, + "column": 3, + "endLine": 84, + "endColumn": 10, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, + { + "line": 87, + "column": 1, + "endLine": 87, + "endColumn": 8, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 89, "column": 5, @@ -274,6 +324,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 89, + "column": 16, + "endLine": 89, + "endColumn": 21, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 89, "column": 12, @@ -374,6 +434,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 93, + "column": 20, + "endLine": 93, + "endColumn": 27, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 93, "column": 16, diff --git a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.arkts2.json b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.arkts2.json index 582bf2a455..5051f8aebf 100644 --- a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.arkts2.json +++ b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.arkts2.json @@ -24,6 +24,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 17, + "column": 28, + "endLine": 17, + "endColumn": 33, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 17, "column": 24, @@ -34,6 +44,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 18, + "column": 40, + "endLine": 18, + "endColumn": 45, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 18, "column": 36, @@ -44,6 +64,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 19, + "column": 21, + "endLine": 19, + "endColumn": 26, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 19, "column": 17, @@ -394,6 +424,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 81, + "column": 29, + "endLine": 81, + "endColumn": 34, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 81, "column": 25, @@ -404,6 +444,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 83, + "column": 9, + "endLine": 83, + "endColumn": 14, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 83, "column": 5, @@ -424,6 +474,16 @@ "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", "severity": "ERROR" }, + { + "line": 97, + "column": 40, + "endLine": 97, + "endColumn": 45, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 97, "column": 36, @@ -434,6 +494,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 98, + "column": 55, + "endLine": 98, + "endColumn": 60, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 98, "column": 51, @@ -444,6 +514,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 99, + "column": 56, + "endLine": 99, + "endColumn": 61, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 99, "column": 52, @@ -454,6 +534,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 100, + "column": 26, + "endLine": 100, + "endColumn": 31, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 100, "column": 22, diff --git a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.autofix.json b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.autofix.json index 4b652fc080..2569068cb4 100644 --- a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.autofix.json +++ b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.autofix.json @@ -24,6 +24,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 17, + "column": 28, + "endLine": 17, + "endColumn": 33, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 17, "column": 24, @@ -34,6 +44,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 18, + "column": 40, + "endLine": 18, + "endColumn": 45, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 18, "column": 36, @@ -55,6 +75,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 19, + "column": 21, + "endLine": 19, + "endColumn": 26, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 19, "column": 17, @@ -570,6 +600,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 81, + "column": 29, + "endLine": 81, + "endColumn": 34, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 81, "column": 25, @@ -591,6 +631,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 83, + "column": 9, + "endLine": 83, + "endColumn": 14, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 83, "column": 5, @@ -622,6 +672,16 @@ "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", "severity": "ERROR" }, + { + "line": 97, + "column": 40, + "endLine": 97, + "endColumn": 45, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 97, "column": 36, @@ -643,6 +703,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 98, + "column": 55, + "endLine": 98, + "endColumn": 60, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 98, "column": 51, @@ -664,6 +734,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 99, + "column": 56, + "endLine": 99, + "endColumn": 61, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 99, "column": 52, @@ -674,6 +754,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 100, + "column": 26, + "endLine": 100, + "endColumn": 31, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 100, "column": 22, diff --git a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.json b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.json index 452d9d6225..2d447a139b 100644 --- a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.json +++ b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.json @@ -24,6 +24,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 24, + "column": 28, + "endLine": 24, + "endColumn": 33, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 24, "column": 24, @@ -34,6 +44,26 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 25, + "column": 40, + "endLine": 25, + "endColumn": 45, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 21, + "endLine": 26, + "endColumn": 26, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 28, "column": 7, @@ -234,6 +264,26 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 88, + "column": 29, + "endLine": 88, + "endColumn": 34, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 90, + "column": 9, + "endLine": 90, + "endColumn": 14, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 93, "column": 77, @@ -244,6 +294,36 @@ "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", "severity": "ERROR" }, + { + "line": 104, + "column": 40, + "endLine": 104, + "endColumn": 45, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 105, + "column": 55, + "endLine": 105, + "endColumn": 60, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 106, + "column": 56, + "endLine": 106, + "endColumn": 61, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 106, "column": 52, @@ -254,6 +334,16 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 107, + "column": 26, + "endLine": 107, + "endColumn": 31, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 118, "column": 22, diff --git a/ets2panda/linter/test/main/limited_stdlib_api.ets.arkts2.json b/ets2panda/linter/test/main/limited_stdlib_api.ets.arkts2.json index fa489440e0..9b0853754f 100644 --- a/ets2panda/linter/test/main/limited_stdlib_api.ets.arkts2.json +++ b/ets2panda/linter/test/main/limited_stdlib_api.ets.arkts2.json @@ -134,6 +134,16 @@ "rule": "Usage of standard library is restricted (arkts-limited-stdlib)", "severity": "ERROR" }, + { + "line": 62, + "column": 8, + "endLine": 62, + "endColumn": 19, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 62, "column": 8, @@ -294,6 +304,26 @@ "rule": "Using \"Object.getOwnPropertyNames\" is not allowed in this API (arkts-builtin-object-getOwnPropertyNames))", "severity": "ERROR" }, + { + "line": 81, + "column": 20, + "endLine": 81, + "endColumn": 26, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 82, + "column": 20, + "endLine": 82, + "endColumn": 27, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 85, "column": 1, @@ -404,6 +434,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 89, + "column": 9, + "endLine": 89, + "endColumn": 12, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 90, "column": 1, @@ -514,6 +554,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 95, + "column": 21, + "endLine": 95, + "endColumn": 24, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 96, "column": 1, @@ -524,6 +574,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 96, + "column": 21, + "endLine": 96, + "endColumn": 24, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 97, "column": 1, @@ -534,6 +594,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 97, + "column": 21, + "endLine": 97, + "endColumn": 24, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 98, "column": 1, @@ -544,6 +614,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 98, + "column": 21, + "endLine": 98, + "endColumn": 24, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 99, "column": 1, @@ -554,6 +634,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 99, + "column": 21, + "endLine": 99, + "endColumn": 28, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 100, "column": 1, @@ -564,6 +654,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 100, + "column": 9, + "endLine": 100, + "endColumn": 12, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 101, "column": 1, @@ -574,6 +674,16 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, + { + "line": 101, + "column": 9, + "endLine": 101, + "endColumn": 12, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 104, "column": 32, @@ -854,6 +964,26 @@ "rule": "Usage of standard library is restricted (arkts-limited-stdlib)", "severity": "ERROR" }, + { + "line": 120, + "column": 13, + "endLine": 120, + "endColumn": 19, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 123, + "column": 7, + "endLine": 123, + "endColumn": 14, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 127, "column": 12, diff --git a/ets2panda/linter/test/main/method_inheritance.ets.arkts2.json b/ets2panda/linter/test/main/method_inheritance.ets.arkts2.json index 7a9d5b7dab..81d92a1dce 100644 --- a/ets2panda/linter/test/main/method_inheritance.ets.arkts2.json +++ b/ets2panda/linter/test/main/method_inheritance.ets.arkts2.json @@ -94,6 +94,16 @@ "rule": "Overridden method parameters and return types must respect type inheritance principles (arkts-method-inherit-rule)", "severity": "ERROR" }, + { + "line": 95, + "column": 16, + "endLine": 95, + "endColumn": 22, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 124, "column": 7, diff --git a/ets2panda/linter/test/main/no_sparse_array.ets.arkts2.json b/ets2panda/linter/test/main/no_sparse_array.ets.arkts2.json index ca26b319a6..fdb403dd53 100644 --- a/ets2panda/linter/test/main/no_sparse_array.ets.arkts2.json +++ b/ets2panda/linter/test/main/no_sparse_array.ets.arkts2.json @@ -24,6 +24,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 46, + "column": 16, + "endLine": 46, + "endColumn": 22, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 47, "column": 13, @@ -34,6 +44,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 47, + "column": 17, + "endLine": 47, + "endColumn": 24, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 48, "column": 12, @@ -43,6 +63,36 @@ "suggest": "", "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" + }, + { + "line": 48, + "column": 16, + "endLine": 48, + "endColumn": 22, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 49, + "column": 16, + "endLine": 49, + "endColumn": 22, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 86, + "column": 16, + "endLine": 86, + "endColumn": 23, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/no_sparse_array2.ets.arkts2.json b/ets2panda/linter/test/main/no_sparse_array2.ets.arkts2.json index acd50132f8..3419183080 100644 --- a/ets2panda/linter/test/main/no_sparse_array2.ets.arkts2.json +++ b/ets2panda/linter/test/main/no_sparse_array2.ets.arkts2.json @@ -264,6 +264,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 47, + "column": 16, + "endLine": 47, + "endColumn": 22, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 47, "column": 23, @@ -284,6 +294,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 48, + "column": 17, + "endLine": 48, + "endColumn": 24, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 48, "column": 25, @@ -304,6 +324,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 49, + "column": 16, + "endLine": 49, + "endColumn": 22, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 49, "column": 23, @@ -314,6 +344,16 @@ "rule": "Sparse array is not supported in ArkTS1.2 (arkts-no-sparse-array)", "severity": "ERROR" }, + { + "line": 50, + "column": 16, + "endLine": 50, + "endColumn": 22, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 50, "column": 23, @@ -354,6 +394,16 @@ "rule": "Sparse array is not supported in ArkTS1.2 (arkts-no-sparse-array)", "severity": "ERROR" }, + { + "line": 57, + "column": 16, + "endLine": 57, + "endColumn": 23, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 58, "column": 10, diff --git a/ets2panda/linter/test/main/no_ts_like_smart_type.ets.arkts2.json b/ets2panda/linter/test/main/no_ts_like_smart_type.ets.arkts2.json index 3ab8448c63..f5dde68408 100755 --- a/ets2panda/linter/test/main/no_ts_like_smart_type.ets.arkts2.json +++ b/ets2panda/linter/test/main/no_ts_like_smart_type.ets.arkts2.json @@ -114,6 +114,36 @@ "rule": "Smart type differences (arkts-no-ts-like-smart-type)", "severity": "ERROR" }, + { + "line": 93, + "column": 66, + "endLine": 93, + "endColumn": 75, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 66, + "endLine": 93, + "endColumn": 75, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 101, + "column": 54, + "endLine": 101, + "endColumn": 58, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 105, "column": 8, @@ -124,6 +154,16 @@ "rule": "Smart type differences (arkts-no-ts-like-smart-type)", "severity": "ERROR" }, + { + "line": 109, + "column": 50, + "endLine": 109, + "endColumn": 54, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 114, "column": 9, diff --git a/ets2panda/linter/test/main/no_tuples_arrays.ets.arkts2.json b/ets2panda/linter/test/main/no_tuples_arrays.ets.arkts2.json index e485672d32..a05ea850fb 100644 --- a/ets2panda/linter/test/main/no_tuples_arrays.ets.arkts2.json +++ b/ets2panda/linter/test/main/no_tuples_arrays.ets.arkts2.json @@ -234,6 +234,26 @@ "rule": "Array and tuple are different type(arkts-no-tuples-arrays)", "severity": "ERROR" }, + { + "line": 102, + "column": 27, + "endLine": 102, + "endColumn": 36, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 102, + "column": 27, + "endLine": 102, + "endColumn": 36, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 103, "column": 16, @@ -394,6 +414,16 @@ "rule": "Array and tuple are different type(arkts-no-tuples-arrays)", "severity": "ERROR" }, + { + "line": 126, + "column": 33, + "endLine": 126, + "endColumn": 40, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 127, "column": 1, @@ -404,6 +434,16 @@ "rule": "Array and tuple are different type(arkts-no-tuples-arrays)", "severity": "ERROR" }, + { + "line": 128, + "column": 12, + "endLine": 128, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 128, "column": 1, diff --git a/ets2panda/linter/test/main/numeric_semantics.ets.arkts2.json b/ets2panda/linter/test/main/numeric_semantics.ets.arkts2.json index fc7c0bef22..5e499343a6 100644 --- a/ets2panda/linter/test/main/numeric_semantics.ets.arkts2.json +++ b/ets2panda/linter/test/main/numeric_semantics.ets.arkts2.json @@ -84,6 +84,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 153, + "column": 13, + "endLine": 153, + "endColumn": 19, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 161, "column": 61, @@ -144,6 +154,26 @@ "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", "severity": "ERROR" }, + { + "line": 206, + "column": 33, + "endLine": 206, + "endColumn": 37, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 207, + "column": 33, + "endLine": 207, + "endColumn": 37, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 207, "column": 42, diff --git a/ets2panda/linter/test/main/numeric_semantics.ets.autofix.json b/ets2panda/linter/test/main/numeric_semantics.ets.autofix.json index 132354c1a5..b14ff912af 100644 --- a/ets2panda/linter/test/main/numeric_semantics.ets.autofix.json +++ b/ets2panda/linter/test/main/numeric_semantics.ets.autofix.json @@ -84,6 +84,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 153, + "column": 13, + "endLine": 153, + "endColumn": 19, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 161, "column": 61, @@ -144,6 +154,26 @@ "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", "severity": "ERROR" }, + { + "line": 206, + "column": 33, + "endLine": 206, + "endColumn": 37, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 207, + "column": 33, + "endLine": 207, + "endColumn": 37, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 207, "column": 42, diff --git a/ets2panda/linter/test/main/numeric_semantics.ets.migrate.json b/ets2panda/linter/test/main/numeric_semantics.ets.migrate.json index 8248685e05..6f104f145e 100644 --- a/ets2panda/linter/test/main/numeric_semantics.ets.migrate.json +++ b/ets2panda/linter/test/main/numeric_semantics.ets.migrate.json @@ -84,6 +84,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 163, + "column": 13, + "endLine": 163, + "endColumn": 19, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 171, "column": 61, @@ -144,6 +154,26 @@ "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", "severity": "ERROR" }, + { + "line": 216, + "column": 33, + "endLine": 216, + "endColumn": 37, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 217, + "column": 33, + "endLine": 217, + "endColumn": 37, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 217, "column": 42, diff --git a/ets2panda/linter/test/main/property_access_by_index.ets.arkts2.json b/ets2panda/linter/test/main/property_access_by_index.ets.arkts2.json index 01ea1d9c16..b89577a4dd 100644 --- a/ets2panda/linter/test/main/property_access_by_index.ets.arkts2.json +++ b/ets2panda/linter/test/main/property_access_by_index.ets.arkts2.json @@ -94,6 +94,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 57, + "column": 18, + "endLine": 57, + "endColumn": 23, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 57, "column": 14, @@ -324,6 +334,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 115, + "column": 15, + "endLine": 115, + "endColumn": 20, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 117, "column": 20, @@ -364,6 +384,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 139, + "column": 16, + "endLine": 139, + "endColumn": 22, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 159, "column": 3, diff --git a/ets2panda/linter/test/main/property_access_by_index.ets.autofix.json b/ets2panda/linter/test/main/property_access_by_index.ets.autofix.json index 79d7fb7b1f..005454c5a6 100644 --- a/ets2panda/linter/test/main/property_access_by_index.ets.autofix.json +++ b/ets2panda/linter/test/main/property_access_by_index.ets.autofix.json @@ -94,6 +94,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 57, + "column": 18, + "endLine": 57, + "endColumn": 23, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 57, "column": 14, @@ -324,6 +334,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 115, + "column": 15, + "endLine": 115, + "endColumn": 20, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 117, "column": 20, @@ -364,6 +384,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 139, + "column": 16, + "endLine": 139, + "endColumn": 22, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 159, "column": 3, diff --git a/ets2panda/linter/test/main/property_access_by_index.ets.migrate.json b/ets2panda/linter/test/main/property_access_by_index.ets.migrate.json index 373804e464..7facb07828 100644 --- a/ets2panda/linter/test/main/property_access_by_index.ets.migrate.json +++ b/ets2panda/linter/test/main/property_access_by_index.ets.migrate.json @@ -94,6 +94,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 57, + "column": 18, + "endLine": 57, + "endColumn": 23, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 57, "column": 14, @@ -324,6 +334,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 115, + "column": 15, + "endLine": 115, + "endColumn": 20, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 117, "column": 20, @@ -364,6 +384,16 @@ "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" }, + { + "line": 139, + "column": 16, + "endLine": 139, + "endColumn": 22, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 159, "column": 3, diff --git a/ets2panda/linter/test/main/repeat_virtualscroll.ets.arkts2.json b/ets2panda/linter/test/main/repeat_virtualscroll.ets.arkts2.json index e9f013b081..623bfcba65 100644 --- a/ets2panda/linter/test/main/repeat_virtualscroll.ets.arkts2.json +++ b/ets2panda/linter/test/main/repeat_virtualscroll.ets.arkts2.json @@ -14,6 +14,26 @@ "limitations under the License." ], "result": [ + { + "line": 36, + "column": 62, + "endLine": 36, + "endColumn": 71, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 62, + "endLine": 36, + "endColumn": 71, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 40, "column": 9, @@ -24,6 +44,26 @@ "rule": "\"Repeat\" natively supports virtual scrolling capability in ArkTS1.2, so the default virtual scrolling should be disabled (arkui-repeat-disable-default-virtualscroll)", "severity": "ERROR" }, + { + "line": 46, + "column": 62, + "endLine": 46, + "endColumn": 71, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 62, + "endLine": 46, + "endColumn": 71, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 48, "column": 9, diff --git a/ets2panda/linter/test/main/repeat_virtualscroll.ets.autofix.json b/ets2panda/linter/test/main/repeat_virtualscroll.ets.autofix.json index 50e60f2e52..c706126c22 100644 --- a/ets2panda/linter/test/main/repeat_virtualscroll.ets.autofix.json +++ b/ets2panda/linter/test/main/repeat_virtualscroll.ets.autofix.json @@ -14,6 +14,26 @@ "limitations under the License." ], "result": [ + { + "line": 36, + "column": 62, + "endLine": 36, + "endColumn": 71, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 62, + "endLine": 36, + "endColumn": 71, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 40, "column": 9, @@ -35,6 +55,26 @@ "rule": "\"Repeat\" natively supports virtual scrolling capability in ArkTS1.2, so the default virtual scrolling should be disabled (arkui-repeat-disable-default-virtualscroll)", "severity": "ERROR" }, + { + "line": 46, + "column": 62, + "endLine": 46, + "endColumn": 71, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 62, + "endLine": 46, + "endColumn": 71, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 48, "column": 9, diff --git a/ets2panda/linter/test/main/repeat_virtualscroll.ets.migrate.json b/ets2panda/linter/test/main/repeat_virtualscroll.ets.migrate.json index ca88f857e9..343dbe39dc 100644 --- a/ets2panda/linter/test/main/repeat_virtualscroll.ets.migrate.json +++ b/ets2panda/linter/test/main/repeat_virtualscroll.ets.migrate.json @@ -13,5 +13,46 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [] + "result": [ + { + "line": 48, + "column": 62, + "endLine": 48, + "endColumn": 71, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 62, + "endLine": 48, + "endColumn": 71, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 58, + "column": 62, + "endLine": 58, + "endColumn": 71, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 58, + "column": 62, + "endLine": 58, + "endColumn": 71, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + } + ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/runtime_array_bound.ets.arkts2.json b/ets2panda/linter/test/main/runtime_array_bound.ets.arkts2.json index 2c19de62ff..1f28e9db42 100644 --- a/ets2panda/linter/test/main/runtime_array_bound.ets.arkts2.json +++ b/ets2panda/linter/test/main/runtime_array_bound.ets.arkts2.json @@ -14,6 +14,16 @@ "limitations under the License." ], "result": [ + { + "line": 19, + "column": 25, + "endLine": 19, + "endColumn": 31, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 29, "column": 5, @@ -24,6 +34,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 33, + "column": 26, + "endLine": 33, + "endColumn": 32, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 34, "column": 5, @@ -34,6 +54,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 39, + "column": 26, + "endLine": 39, + "endColumn": 32, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 45, "column": 5, @@ -44,6 +74,26 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 50, + "column": 10, + "endLine": 50, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 10, + "endLine": 55, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 59, "column": 1, @@ -54,6 +104,36 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 63, + "column": 10, + "endLine": 63, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 10, + "endLine": 70, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 81, + "column": 11, + "endLine": 81, + "endColumn": 17, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 87, "column": 1, @@ -64,6 +144,26 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 90, + "column": 24, + "endLine": 90, + "endColumn": 30, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 24, + "endLine": 93, + "endColumn": 30, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 95, "column": 1, @@ -84,6 +184,26 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 100, + "column": 25, + "endLine": 100, + "endColumn": 31, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 103, + "column": 25, + "endLine": 103, + "endColumn": 31, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 105, "column": 1, @@ -104,6 +224,26 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 110, + "column": 28, + "endLine": 110, + "endColumn": 34, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 115, + "column": 28, + "endLine": 115, + "endColumn": 34, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 117, "column": 1, @@ -144,6 +284,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 124, + "column": 9, + "endLine": 124, + "endColumn": 15, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 125, "column": 1, @@ -214,6 +364,16 @@ "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", "severity": "ERROR" }, + { + "line": 135, + "column": 8, + "endLine": 135, + "endColumn": 14, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 136, "column": 1, @@ -224,6 +384,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 138, + "column": 8, + "endLine": 138, + "endColumn": 14, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 139, "column": 1, @@ -384,6 +554,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 169, + "column": 28, + "endLine": 169, + "endColumn": 33, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 169, "column": 24, @@ -394,6 +574,56 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 169, + "column": 36, + "endLine": 169, + "endColumn": 42, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 170, + "column": 23, + "endLine": 170, + "endColumn": 29, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 175, + "column": 11, + "endLine": 175, + "endColumn": 17, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 179, + "column": 19, + "endLine": 179, + "endColumn": 25, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 184, + "column": 19, + "endLine": 184, + "endColumn": 25, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 185, "column": 23, @@ -404,6 +634,16 @@ "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", "severity": "ERROR" }, + { + "line": 188, + "column": 19, + "endLine": 188, + "endColumn": 25, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 189, "column": 19, @@ -434,6 +674,76 @@ "rule": "Smart type differences (arkts-no-ts-like-smart-type)", "severity": "ERROR" }, + { + "line": 194, + "column": 18, + "endLine": 194, + "endColumn": 24, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 200, + "column": 32, + "endLine": 200, + "endColumn": 38, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 200, + "column": 45, + "endLine": 200, + "endColumn": 51, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 208, + "column": 10, + "endLine": 208, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 214, + "column": 8, + "endLine": 214, + "endColumn": 14, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 219, + "column": 16, + "endLine": 219, + "endColumn": 21, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 220, + "column": 16, + "endLine": 220, + "endColumn": 21, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 227, "column": 1, @@ -444,6 +754,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 229, + "column": 34, + "endLine": 229, + "endColumn": 40, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 233, "column": 1, @@ -454,6 +774,46 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 235, + "column": 10, + "endLine": 235, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 239, + "column": 25, + "endLine": 239, + "endColumn": 31, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 244, + "column": 16, + "endLine": 244, + "endColumn": 22, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 248, + "column": 34, + "endLine": 248, + "endColumn": 40, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 250, "column": 5, @@ -464,6 +824,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 254, + "column": 28, + "endLine": 254, + "endColumn": 33, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 254, "column": 24, @@ -474,6 +844,46 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, + { + "line": 254, + "column": 36, + "endLine": 254, + "endColumn": 42, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 255, + "column": 23, + "endLine": 255, + "endColumn": 29, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 259, + "column": 23, + "endLine": 259, + "endColumn": 29, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 264, + "column": 23, + "endLine": 264, + "endColumn": 29, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 266, "column": 3, @@ -484,6 +894,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 270, + "column": 28, + "endLine": 270, + "endColumn": 33, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 270, "column": 24, @@ -514,6 +934,16 @@ "rule": "Array type is immutable in ArkTS1.2 (arkts-array-type-immutable)", "severity": "ERROR" }, + { + "line": 288, + "column": 26, + "endLine": 288, + "endColumn": 32, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 292, "column": 34, @@ -534,6 +964,26 @@ "rule": "Array type is immutable in ArkTS1.2 (arkts-array-type-immutable)", "severity": "ERROR" }, + { + "line": 295, + "column": 26, + "endLine": 295, + "endColumn": 32, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 299, + "column": 44, + "endLine": 299, + "endColumn": 49, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 301, "column": 23, @@ -544,6 +994,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 313, + "column": 36, + "endLine": 313, + "endColumn": 41, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 316, "column": 9, diff --git a/ets2panda/linter/test/main/runtime_array_bound.ets.migrate.json b/ets2panda/linter/test/main/runtime_array_bound.ets.migrate.json index e9b3765b05..c9a61308ad 100644 --- a/ets2panda/linter/test/main/runtime_array_bound.ets.migrate.json +++ b/ets2panda/linter/test/main/runtime_array_bound.ets.migrate.json @@ -14,6 +14,16 @@ "limitations under the License." ], "result": [ + { + "line": 19, + "column": 25, + "endLine": 19, + "endColumn": 31, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 29, "column": 5, @@ -24,6 +34,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 33, + "column": 26, + "endLine": 33, + "endColumn": 32, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 34, "column": 5, @@ -34,6 +54,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 39, + "column": 26, + "endLine": 39, + "endColumn": 32, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 45, "column": 5, @@ -44,6 +74,26 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 50, + "column": 10, + "endLine": 50, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 10, + "endLine": 55, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 59, "column": 1, @@ -54,6 +104,36 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 63, + "column": 10, + "endLine": 63, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 10, + "endLine": 70, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 81, + "column": 11, + "endLine": 81, + "endColumn": 17, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 87, "column": 1, @@ -64,6 +144,26 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 90, + "column": 24, + "endLine": 90, + "endColumn": 30, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 24, + "endLine": 93, + "endColumn": 30, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 95, "column": 1, @@ -84,6 +184,26 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 100, + "column": 25, + "endLine": 100, + "endColumn": 31, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 103, + "column": 25, + "endLine": 103, + "endColumn": 31, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 105, "column": 1, @@ -104,6 +224,26 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 110, + "column": 28, + "endLine": 110, + "endColumn": 34, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 115, + "column": 28, + "endLine": 115, + "endColumn": 34, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 117, "column": 1, @@ -144,6 +284,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 124, + "column": 9, + "endLine": 124, + "endColumn": 15, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 125, "column": 1, @@ -194,6 +344,16 @@ "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", "severity": "ERROR" }, + { + "line": 135, + "column": 8, + "endLine": 135, + "endColumn": 14, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 136, "column": 1, @@ -204,6 +364,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 138, + "column": 8, + "endLine": 138, + "endColumn": 14, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 144, "column": 1, @@ -264,6 +434,76 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 169, + "column": 28, + "endLine": 169, + "endColumn": 33, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 169, + "column": 44, + "endLine": 169, + "endColumn": 50, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 170, + "column": 23, + "endLine": 170, + "endColumn": 29, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 175, + "column": 11, + "endLine": 175, + "endColumn": 17, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 179, + "column": 19, + "endLine": 179, + "endColumn": 25, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 184, + "column": 19, + "endLine": 184, + "endColumn": 25, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 188, + "column": 19, + "endLine": 188, + "endColumn": 25, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 194, "column": 14, @@ -274,6 +514,76 @@ "rule": "Smart type differences (arkts-no-ts-like-smart-type)", "severity": "ERROR" }, + { + "line": 194, + "column": 18, + "endLine": 194, + "endColumn": 24, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 200, + "column": 32, + "endLine": 200, + "endColumn": 38, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 200, + "column": 45, + "endLine": 200, + "endColumn": 51, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 208, + "column": 10, + "endLine": 208, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 214, + "column": 8, + "endLine": 214, + "endColumn": 14, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 219, + "column": 16, + "endLine": 219, + "endColumn": 21, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 220, + "column": 16, + "endLine": 220, + "endColumn": 21, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 227, "column": 1, @@ -284,6 +594,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 229, + "column": 34, + "endLine": 229, + "endColumn": 40, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 233, "column": 1, @@ -294,6 +614,46 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 235, + "column": 10, + "endLine": 235, + "endColumn": 16, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 239, + "column": 25, + "endLine": 239, + "endColumn": 31, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 244, + "column": 16, + "endLine": 244, + "endColumn": 22, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 248, + "column": 34, + "endLine": 248, + "endColumn": 40, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 250, "column": 5, @@ -304,6 +664,56 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 254, + "column": 28, + "endLine": 254, + "endColumn": 33, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, + { + "line": 254, + "column": 44, + "endLine": 254, + "endColumn": 50, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 255, + "column": 23, + "endLine": 255, + "endColumn": 29, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 259, + "column": 23, + "endLine": 259, + "endColumn": 29, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 264, + "column": 23, + "endLine": 264, + "endColumn": 29, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 266, "column": 3, @@ -314,6 +724,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 270, + "column": 28, + "endLine": 270, + "endColumn": 33, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 276, "column": 7, @@ -334,6 +754,16 @@ "rule": "Array type is immutable in ArkTS1.2 (arkts-array-type-immutable)", "severity": "ERROR" }, + { + "line": 288, + "column": 26, + "endLine": 288, + "endColumn": 32, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 294, "column": 5, @@ -344,6 +774,26 @@ "rule": "Array type is immutable in ArkTS1.2 (arkts-array-type-immutable)", "severity": "ERROR" }, + { + "line": 295, + "column": 26, + "endLine": 295, + "endColumn": 32, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, + { + "line": 299, + "column": 44, + "endLine": 299, + "endColumn": 49, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 301, "column": 23, @@ -354,6 +804,16 @@ "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" }, + { + "line": 313, + "column": 36, + "endLine": 313, + "endColumn": 41, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 316, "column": 9, diff --git a/ets2panda/linter/test/main/structural_identity.ets.arkts2.json b/ets2panda/linter/test/main/structural_identity.ets.arkts2.json index 5bbd4876a8..f8d1d8adbc 100644 --- a/ets2panda/linter/test/main/structural_identity.ets.arkts2.json +++ b/ets2panda/linter/test/main/structural_identity.ets.arkts2.json @@ -675,14 +675,14 @@ "severity": "ERROR" }, { - "line": 507, - "column": 5, - "endLine": 507, - "endColumn": 7, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" + "line": 507, + "column": 5, + "endLine": 507, + "endColumn": 7, + "problem": "VariableMissingInitializer", + "suggest": "", + "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", + "severity": "ERROR" }, { "line": 511, @@ -1074,6 +1074,16 @@ "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 622, + "column": 45, + "endLine": 622, + "endColumn": 49, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 626, "column": 5, diff --git a/ets2panda/linter/test/main/structural_identity_extended_inheritance.ets.arkts2.json b/ets2panda/linter/test/main/structural_identity_extended_inheritance.ets.arkts2.json index 4d493d1fed..ff670b9dc9 100644 --- a/ets2panda/linter/test/main/structural_identity_extended_inheritance.ets.arkts2.json +++ b/ets2panda/linter/test/main/structural_identity_extended_inheritance.ets.arkts2.json @@ -14,6 +14,16 @@ "limitations under the License." ], "result": [ + { + "line": 49, + "column": 15, + "endLine": 49, + "endColumn": 20, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 56, "column": 1, @@ -25,24 +35,24 @@ "severity": "ERROR" }, { - "line": 58, - "column": 5, - "endLine": 58, - "endColumn": 16, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" + "line": 58, + "column": 5, + "endLine": 58, + "endColumn": 16, + "problem": "VariableMissingInitializer", + "suggest": "", + "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", + "severity": "ERROR" }, { - "line": 60, - "column": 5, - "endLine": 60, - "endColumn": 16, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" + "line": 60, + "column": 5, + "endLine": 60, + "endColumn": 16, + "problem": "VariableMissingInitializer", + "suggest": "", + "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", + "severity": "ERROR" }, { "line": 73, diff --git a/ets2panda/linter/test/main/swicth_expr.ets.arkts2.json b/ets2panda/linter/test/main/swicth_expr.ets.arkts2.json index 469e417b34..1b562f7ef1 100755 --- a/ets2panda/linter/test/main/swicth_expr.ets.arkts2.json +++ b/ets2panda/linter/test/main/swicth_expr.ets.arkts2.json @@ -93,6 +93,16 @@ "suggest": "", "rule": "Primitive types are normalized with their boxed type (arkts-primitive-type-normalization)", "severity": "ERROR" + }, + { + "line": 215, + "column": 17, + "endLine": 215, + "endColumn": 23, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/taskpool_deprecated_usages.ets.arkts2.json b/ets2panda/linter/test/main/taskpool_deprecated_usages.ets.arkts2.json index 4b786c5828..1bd64d0b96 100644 --- a/ets2panda/linter/test/main/taskpool_deprecated_usages.ets.arkts2.json +++ b/ets2panda/linter/test/main/taskpool_deprecated_usages.ets.arkts2.json @@ -84,6 +84,16 @@ "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", "severity": "ERROR" }, + { + "line": 22, + "column": 17, + "endLine": 22, + "endColumn": 22, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 24, "column": 5, diff --git a/ets2panda/linter/test/main/ts_overload.ets.arkts2.json b/ets2panda/linter/test/main/ts_overload.ets.arkts2.json index ca097aeaa4..bd4f982acf 100644 --- a/ets2panda/linter/test/main/ts_overload.ets.arkts2.json +++ b/ets2panda/linter/test/main/ts_overload.ets.arkts2.json @@ -44,6 +44,16 @@ "rule": "Class TS overloading is not supported(arkts-no-ts-overload)", "severity": "ERROR" }, + { + "line": 20, + "column": 16, + "endLine": 20, + "endColumn": 20, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 30, "column": 3, diff --git a/ets2panda/linter/test/rules/rule207.ets.arkts2.json b/ets2panda/linter/test/rules/rule207.ets.arkts2.json index d286d0d82d..61ec5d90d7 100644 --- a/ets2panda/linter/test/rules/rule207.ets.arkts2.json +++ b/ets2panda/linter/test/rules/rule207.ets.arkts2.json @@ -54,6 +54,26 @@ "rule": "Special arguments object inside functions are not supported (arkts-no-arguments-obj)", "severity": "ERROR" }, + { + "line": 25, + "column": 25, + "endLine": 25, + "endColumn": 34, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 35, + "endLine": 25, + "endColumn": 41, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, { "line": 25, "column": 25, @@ -84,6 +104,26 @@ "rule": "Special arguments object inside functions are not supported (arkts-no-arguments-obj)", "severity": "ERROR" }, + { + "line": 31, + "column": 41, + "endLine": 31, + "endColumn": 50, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 51, + "endLine": 31, + "endColumn": 57, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, { "line": 31, "column": 41, @@ -224,6 +264,26 @@ "rule": "Special arguments object inside functions are not supported (arkts-no-arguments-obj)", "severity": "ERROR" }, + { + "line": 57, + "column": 9, + "endLine": 57, + "endColumn": 18, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 19, + "endLine": 57, + "endColumn": 25, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, { "line": 57, "column": 9, @@ -254,6 +314,16 @@ "rule": "This keyword cannot be used as identifiers (arkts-invalid-identifier)", "severity": "ERROR" }, + { + "line": 68, + "column": 10, + "endLine": 68, + "endColumn": 19, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, { "line": 68, "column": 22, @@ -274,6 +344,16 @@ "rule": "Special arguments object inside functions are not supported (arkts-no-arguments-obj)", "severity": "ERROR" }, + { + "line": 73, + "column": 22, + "endLine": 73, + "endColumn": 31, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" + }, { "line": 79, "column": 15, @@ -283,6 +363,16 @@ "suggest": "", "rule": "Indexed access is not supported for fields (arkts-no-props-by-index)", "severity": "ERROR" + }, + { + "line": 79, + "column": 17, + "endLine": 79, + "endColumn": 26, + "problem": "NoPropertyDescriptor", + "suggest": "", + "rule": "Not support propertydescriptor (arkts-builtin-no-property-descriptor)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/rules/rule37.ets.arkts2.json b/ets2panda/linter/test/rules/rule37.ets.arkts2.json index e07b57d6df..a09ecda014 100644 --- a/ets2panda/linter/test/rules/rule37.ets.arkts2.json +++ b/ets2panda/linter/test/rules/rule37.ets.arkts2.json @@ -134,6 +134,16 @@ "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", "severity": "ERROR" }, + { + "line": 65, + "column": 24, + "endLine": 65, + "endColumn": 30, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 67, "column": 24, @@ -144,6 +154,16 @@ "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", "severity": "ERROR" }, + { + "line": 67, + "column": 24, + "endLine": 67, + "endColumn": 30, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 69, "column": 20, @@ -154,6 +174,16 @@ "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", "severity": "ERROR" }, + { + "line": 69, + "column": 20, + "endLine": 69, + "endColumn": 26, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 71, "column": 20, @@ -164,6 +194,16 @@ "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", "severity": "ERROR" }, + { + "line": 71, + "column": 20, + "endLine": 71, + "endColumn": 26, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 73, "column": 24, @@ -174,6 +214,16 @@ "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", "severity": "ERROR" }, + { + "line": 73, + "column": 24, + "endLine": 73, + "endColumn": 30, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 75, "column": 21, @@ -183,6 +233,16 @@ "suggest": "", "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", "severity": "ERROR" + }, + { + "line": 75, + "column": 21, + "endLine": 75, + "endColumn": 27, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/rules/rule37.ets.autofix.json b/ets2panda/linter/test/rules/rule37.ets.autofix.json index 3cad91ca09..1baf0c53c3 100644 --- a/ets2panda/linter/test/rules/rule37.ets.autofix.json +++ b/ets2panda/linter/test/rules/rule37.ets.autofix.json @@ -24,7 +24,11 @@ { "start": 631, "end": 637, - "replacementText": "new RegExp(\"bc*d\")" + "replacementText": "new RegExp(\"bc*d\")", + "line": 16, + "column": 22, + "endLine": 16, + "endColumn": 28 } ], "suggest": "", @@ -41,7 +45,11 @@ { "start": 699, "end": 764, - "replacementText": "new RegExp(\"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*(\\\\.[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)*$\")" + "replacementText": "new RegExp(\"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*(\\\\.[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)*$\")", + "line": 20, + "column": 17, + "endLine": 20, + "endColumn": 82 } ], "suggest": "", @@ -58,7 +66,11 @@ { "start": 892, "end": 900, - "replacementText": "new RegExp(\"bc*d\", \"ig\")" + "replacementText": "new RegExp(\"bc*d\", \"ig\")", + "line": 23, + "column": 23, + "endLine": 23, + "endColumn": 31 } ], "suggest": "", @@ -75,7 +87,11 @@ { "start": 985, "end": 992, - "replacementText": "new RegExp(\"bc*d\", \"i\")" + "replacementText": "new RegExp(\"bc*d\", \"i\")", + "line": 27, + "column": 34, + "endLine": 27, + "endColumn": 41 } ], "suggest": "", @@ -92,7 +108,11 @@ { "start": 1088, "end": 1093, - "replacementText": "new RegExp(\"a\\\\\\\\\")" + "replacementText": "new RegExp(\"a\\\\\\\\\")", + "line": 31, + "column": 23, + "endLine": 31, + "endColumn": 28 } ], "suggest": "", @@ -109,7 +129,11 @@ { "start": 1195, "end": 1201, - "replacementText": "new RegExp(\"bc*d\")" + "replacementText": "new RegExp(\"bc*d\")", + "line": 36, + "column": 44, + "endLine": 36, + "endColumn": 50 } ], "suggest": "", @@ -126,7 +150,11 @@ { "start": 1239, "end": 1304, - "replacementText": "new RegExp(\"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*(\\\\.[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)*$\")" + "replacementText": "new RegExp(\"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*(\\\\.[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)*$\")", + "line": 38, + "column": 36, + "endLine": 38, + "endColumn": 101 } ], "suggest": "", @@ -143,7 +171,11 @@ { "start": 1410, "end": 1416, - "replacementText": "new RegExp(\"bc*d\")" + "replacementText": "new RegExp(\"bc*d\")", + "line": 43, + "column": 22, + "endLine": 43, + "endColumn": 28 } ], "suggest": "", @@ -160,7 +192,11 @@ { "start": 1557, "end": 1563, - "replacementText": "new RegExp(\"bc*d\")" + "replacementText": "new RegExp(\"bc*d\")", + "line": 51, + "column": 22, + "endLine": 51, + "endColumn": 28 } ], "suggest": "", @@ -177,7 +213,11 @@ { "start": 1694, "end": 1759, - "replacementText": "new RegExp(\"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*(\\\\.[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)*$\")" + "replacementText": "new RegExp(\"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*(\\\\.[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)*$\")", + "line": 59, + "column": 17, + "endLine": 59, + "endColumn": 82 } ], "suggest": "", @@ -194,7 +234,11 @@ { "start": 1799, "end": 1864, - "replacementText": "new RegExp(\"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*(\\\\.[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)*$\")" + "replacementText": "new RegExp(\"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*(\\\\.[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)*$\")", + "line": 63, + "column": 28, + "endLine": 63, + "endColumn": 93 } ], "suggest": "", @@ -211,13 +255,27 @@ { "start": 1890, "end": 1904, - "replacementText": "new RegExp(\"ab*c\")" + "replacementText": "new RegExp(\"ab*c\")", + "line": 65, + "column": 24, + "endLine": 65, + "endColumn": 38 } ], "suggest": "", "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", "severity": "ERROR" }, + { + "line": 65, + "column": 24, + "endLine": 65, + "endColumn": 30, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 67, "column": 24, @@ -228,13 +286,27 @@ { "start": 1929, "end": 1947, - "replacementText": "new RegExp(\"ab*c\", \"i\")" + "replacementText": "new RegExp(\"ab*c\", \"i\")", + "line": 67, + "column": 24, + "endLine": 67, + "endColumn": 42 } ], "suggest": "", "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", "severity": "ERROR" }, + { + "line": 67, + "column": 24, + "endLine": 67, + "endColumn": 30, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 69, "column": 20, @@ -245,13 +317,27 @@ { "start": 1968, "end": 1992, - "replacementText": "new RegExp('dawfgr' + '12345')" + "replacementText": "new RegExp('dawfgr' + '12345')", + "line": 69, + "column": 20, + "endLine": 69, + "endColumn": 44 } ], "suggest": "", "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", "severity": "ERROR" }, + { + "line": 69, + "column": 20, + "endLine": 69, + "endColumn": 26, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 71, "column": 20, @@ -262,13 +348,27 @@ { "start": 2013, "end": 2169, - "replacementText": "new RegExp('.∗?(?:(?:元宵|三八|妇女|母亲|父亲|七夕|重阳|情人|儿童|六一' + '|愚人|复活|青年|护士|建军|教师|建党|万圣|感恩|秘书|七一|五四|八一|腊八|光棍|植树|中元)节|除夕|大年三十|大年30|七夕' + '|平安夜|六一|七一|五四|八一|三八|腊八|双十一|双十二).∗')" + "replacementText": "new RegExp('.∗?(?:(?:元宵|三八|妇女|母亲|父亲|七夕|重阳|情人|儿童|六一' + '|愚人|复活|青年|护士|建军|教师|建党|万圣|感恩|秘书|七一|五四|八一|腊八|光棍|植树|中元)节|除夕|大年三十|大年30|七夕' + '|平安夜|六一|七一|五四|八一|三八|腊八|双十一|双十二).∗')", + "line": 71, + "column": 20, + "endLine": 71, + "endColumn": 176 } ], "suggest": "", "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", "severity": "ERROR" }, + { + "line": 71, + "column": 20, + "endLine": 71, + "endColumn": 26, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 73, "column": 24, @@ -279,13 +379,27 @@ { "start": 2195, "end": 2227, - "replacementText": "new RegExp('dawfgr'.concat('12345'))" + "replacementText": "new RegExp('dawfgr'.concat('12345'))", + "line": 73, + "column": 24, + "endLine": 73, + "endColumn": 56 } ], "suggest": "", "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", "severity": "ERROR" }, + { + "line": 73, + "column": 24, + "endLine": 73, + "endColumn": 30, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" + }, { "line": 75, "column": 21, @@ -296,12 +410,26 @@ { "start": 2250, "end": 2282, - "replacementText": "new RegExp('dawfgr' + '12345' + '789')" + "replacementText": "new RegExp('dawfgr' + '12345' + '789')", + "line": 75, + "column": 21, + "endLine": 75, + "endColumn": 53 } ], "suggest": "", "rule": "RegExp literals are not supported (arkts-no-regexp-literals)", "severity": "ERROR" + }, + { + "line": 75, + "column": 21, + "endLine": 75, + "endColumn": 27, + "problem": "BuiltinNoCtorFunc", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-cotr)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_url.ets b/ets2panda/linter/test/sdkcommonapi/sdk_url.ets index 2a2f5e1d0d..e9a14fb806 100755 --- a/ets2panda/linter/test/sdkcommonapi/sdk_url.ets +++ b/ets2panda/linter/test/sdkcommonapi/sdk_url.ets @@ -30,7 +30,7 @@ paramsObject2.delete('fod');//error let searchParamsObject1 = new url.URLSearchParams("keyName1=valueName1&keyName2=valueName2");//error let iter: Iterable = searchParamsObject1.entries();//error -let pairs = Array.from(iter); +let pairs = Array.from(iter); //BuiltinAll for (let pair of pairs) { // Show keyName/valueName pairs console.log(pair[0]+ ', '+ pair[1]); } @@ -53,7 +53,7 @@ let paramsObject4 = new url.URLSearchParams(urlObject2.search.slice(1));//error* paramsObject4.has('bard') === true;//error let searchParamsObject2 = new url.URLSearchParams("key1=value1&key2=value2"); //error -let keys = Array.from(searchParamsObject2.keys());//error +let keys = Array.from(searchParamsObject2.keys());//error+BuiltinAll for (let key of keys) { console.log(key); } @@ -71,7 +71,7 @@ params.append('fod', '3');//error console.log(params.toString()); //error let searchParams = new url.URLSearchParams("key1=value1&key2=value2");//error -let values = Array.from(searchParams.values());//error +let values = Array.from(searchParams.values());//error+BuiltinAll for (let value of values) { console.log(value); } //sum:40 \ No newline at end of file diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_url.ets.arkts2.json b/ets2panda/linter/test/sdkcommonapi/sdk_url.ets.arkts2.json index a8458bc115..14e65454b0 100755 --- a/ets2panda/linter/test/sdkcommonapi/sdk_url.ets.arkts2.json +++ b/ets2panda/linter/test/sdkcommonapi/sdk_url.ets.arkts2.json @@ -134,6 +134,16 @@ "rule": "The \"url.URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", "severity": "ERROR" }, + { + "line": 33, + "column": 19, + "endLine": 33, + "endColumn": 23, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 35, "column": 15, @@ -304,6 +314,16 @@ "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", "severity": "ERROR" }, + { + "line": 56, + "column": 18, + "endLine": 56, + "endColumn": 22, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 56, "column": 43, @@ -424,6 +444,16 @@ "rule": "The \"URLSearchParams\" in SDK is no longer supported.(sdk-method-not-supported)", "severity": "ERROR" }, + { + "line": 74, + "column": 20, + "endLine": 74, + "endColumn": 24, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 74, "column": 38, diff --git a/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.arkts2.json b/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.arkts2.json index f3ac4e12f2..d4548ca16f 100755 --- a/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.arkts2.json +++ b/ets2panda/linter/test/sdkcommonapi/sdk_xml.ets.arkts2.json @@ -154,6 +154,26 @@ "rule": "The \"ConvertOptions\" in SDK is no longer supported.(sdk-method-not-supported)", "severity": "ERROR" }, + { + "line": 32, + "column": 19, + "endLine": 32, + "endColumn": 28, + "problem": "SdkCommonApiWhiteList", + "suggest": "", + "rule": "The \"stringify\" in SDK is no longer supported.(sdk-method-not-supported)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 19, + "endLine": 32, + "endColumn": 28, + "problem": "BuiltinAll", + "suggest": "", + "rule": "Using BuiltinAll as a type is not allowed in this API (arkts-builtin-all)", + "severity": "ERROR" + }, { "line": 32, "column": 34, diff --git a/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.arkts2.json b/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.arkts2.json index 709ee01e70..c2da3b6523 100644 --- a/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.arkts2.json +++ b/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.arkts2.json @@ -64,6 +64,16 @@ "rule": "API path have changed - please update your imports accordingly (sdk-no-decl-with-duplicate-name)", "severity": "ERROR" }, + { + "line": 22, + "column": 44, + "endLine": 22, + "endColumn": 49, + "problem": "BuiltinNewCtor", + "suggest": "", + "rule": "API is not support ctor signature and func (arkts-builtin-new-cotr)", + "severity": "ERROR" + }, { "line": 22, "column": 40, @@ -155,14 +165,14 @@ "severity": "ERROR" }, { - "line": 52, - "column": 5, - "endLine": 52, - "endColumn": 19, - "problem": "VariableMissingInitializer", - "suggest": "", - "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", - "severity": "ERROR" + "line": 52, + "column": 5, + "endLine": 52, + "endColumn": 19, + "problem": "VariableMissingInitializer", + "suggest": "", + "rule": "After a variable is declared, a value must be assigned before using it (arkts-var-assignment-before-use)", + "severity": "ERROR" }, { "line": 53, -- Gitee