From f0dcdc5c2e0750a810ea47d2cce5e501f7b30df9 Mon Sep 17 00:00:00 2001 From: xRain Date: Tue, 18 Aug 2026 00:59:58 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=88=A0=E9=99=A4=E4=BB=85?= =?UTF-8?q?=E6=9C=89=E7=A9=BA=E6=9E=84=E9=80=A0=E5=99=A8=E7=9A=84=20public?= =?UTF-8?q?=20init()=20{}=E2=80=94=E2=80=94=E7=BC=96=E8=AF=91=E5=99=A8?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=8F=90=E4=BE=9B=E6=97=A0=E5=8F=82=E6=9E=84?= =?UTF-8?q?=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ReflectionCache.FieldMetadata / JsonOption 删除空 init - 测试模型 LeafChild / LeafAll 删除空 init(反射构造正常) - 保留有带参构造器的空 init(FieldInfo 等) --- src/common/ReflectionCache.cj | 2 -- src/json/JsonOption.cj | 2 -- src/tests/JsonSerializer_test.cj | 2 -- 3 files changed, 6 deletions(-) diff --git a/src/common/ReflectionCache.cj b/src/common/ReflectionCache.cj index 2b95ed4..c793b54 100644 --- a/src/common/ReflectionCache.cj +++ b/src/common/ReflectionCache.cj @@ -28,8 +28,6 @@ public class FieldMetadata { public var variable: ?InstanceVariableInfo = None /// 是否可变(反序列化只写 var) public var mutable: Bool = false - - public init() {} } /** diff --git a/src/json/JsonOption.cj b/src/json/JsonOption.cj index d5f7938..bedd058 100644 --- a/src/json/JsonOption.cj +++ b/src/json/JsonOption.cj @@ -20,8 +20,6 @@ public class JsonOption { /// 递归深度上限(默认 64) public var maxDepth: Int64 = 64 - public init() {} - /// 默认选项实例 public static let instance: JsonOption = JsonOption() } diff --git a/src/tests/JsonSerializer_test.cj b/src/tests/JsonSerializer_test.cj index 02154de..b86eb1b 100644 --- a/src/tests/JsonSerializer_test.cj +++ b/src/tests/JsonSerializer_test.cj @@ -67,7 +67,6 @@ open class MidParent <: GrandParent { class LeafChild <: MidParent { public var _lc: String = "" - public init() {} } // 三级继承(全标宏):爷 → 父 → 子 每层都标注 @SerializerParent @@ -83,7 +82,6 @@ open class MidAll <: GrandAll { class LeafAll <: MidAll { public var _la: String = "" - public init() {} } func makeUser(): User {