From ba60b99c0e3808dfb286bfb1b394114f0e7feb42 Mon Sep 17 00:00:00 2001 From: xingzeng Date: Wed, 3 Sep 2025 16:58:16 +0800 Subject: [PATCH] Use toXXX instead of unboxed() Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/ICVOSZ Remove unboxed method for Built-In Type Classes Reason: The public unboxed() method is slated for removal now that we don't have primitives at the language level. Meaning: Transfer from relying on primitive types to not relying on primitive types, with promise that in new language compiling framework it stiil can process type cast correctly. Signed-off-by: xingzeng --- frameworks/ets/ets/@ohos.app.ability.Want.ets | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/frameworks/ets/ets/@ohos.app.ability.Want.ets b/frameworks/ets/ets/@ohos.app.ability.Want.ets index 0eb0cec5513..379e634eee9 100644 --- a/frameworks/ets/ets/@ohos.app.ability.Want.ets +++ b/frameworks/ets/ets/@ohos.app.ability.Want.ets @@ -55,28 +55,28 @@ class RecordWriter { private writeValueType(obj: Object): boolean { if (obj instanceof Boolean) { - this.buffer.append(JSON.stringify(obj.unboxed())); + this.buffer.append(JSON.stringify(obj.toBoolean())); return true; } else if (obj instanceof Byte) { - this.buffer.append(JSON.stringify(obj.unboxed())); + this.buffer.append(JSON.stringify(obj.toByte())); return true; } else if (obj instanceof Char) { - this.buffer.append(JSON.stringify(obj.unboxed())); + this.buffer.append(JSON.stringify(obj.toChar())); return true; } else if (obj instanceof Short) { - this.buffer.append(JSON.stringify(obj.unboxed())); + this.buffer.append(JSON.stringify(obj.toShort())); return true; } else if (obj instanceof Int) { - this.buffer.append(JSON.stringify(obj.unboxed())); + this.buffer.append(JSON.stringify(obj.toInt())); return true; } else if (obj instanceof Long) { - this.buffer.append(JSON.stringify(obj.unboxed())); + this.buffer.append(JSON.stringify(obj.toLong())); return true; } else if (obj instanceof Float) { - this.buffer.append(JSON.stringify(obj.unboxed())); + this.buffer.append(JSON.stringify(obj.toFloat())); return true; } else if (obj instanceof Double) { - this.buffer.append(JSON.stringify(obj.unboxed())); + this.buffer.append(JSON.stringify(obj.toDouble())); return true; } else if (obj instanceof BigInt) { this.buffer.append(JSON.stringify(obj)); @@ -186,7 +186,7 @@ export class RecordSerializeTool { } private static jsonValue2Object(value: JSONValue): string | number | boolean | null | - Array | Record { + Array | Record { if (value instanceof JSONString) { return value.value; } else if (value instanceof JSONNumber) { -- Gitee