From b8bc5bbc398f843b9ed01dbe0c6a22c674e2cf13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=91=E5=85=89=E9=95=BF=E9=A2=88=E9=B9=BF?= <64970244+eirv@users.noreply.github.com> Date: Mon, 24 Jul 2023 16:03:13 +0800 Subject: [PATCH 1/2] fix: attribute type inconsistent bug #12 --- .../java/com/wind/meditor/visitor/ModifyAttributeVisitor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/src/main/java/com/wind/meditor/visitor/ModifyAttributeVisitor.java b/lib/src/main/java/com/wind/meditor/visitor/ModifyAttributeVisitor.java index 51b0e7b..35bfa5b 100644 --- a/lib/src/main/java/com/wind/meditor/visitor/ModifyAttributeVisitor.java +++ b/lib/src/main/java/com/wind/meditor/visitor/ModifyAttributeVisitor.java @@ -50,6 +50,7 @@ public class ModifyAttributeVisitor extends NodeVisitor { || (resourceId >= 0 && resourceId == attributeItem.getResourceId())) { hasBeenAddedAttributeList.add(attributeItem); newObj = attributeItem.getValue(); + type = attributeItem.getType(); break; } } From 5228701050dd7258a5988107a19bf1affe8cad45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=91=E5=85=89=E9=95=BF=E9=A2=88=E9=B9=BF?= <64970244+eirv@users.noreply.github.com> Date: Mon, 24 Jul 2023 16:22:43 +0800 Subject: [PATCH 2/2] imporovement --- .../java/com/wind/meditor/visitor/ModifyAttributeVisitor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/main/java/com/wind/meditor/visitor/ModifyAttributeVisitor.java b/lib/src/main/java/com/wind/meditor/visitor/ModifyAttributeVisitor.java index 35bfa5b..d6d1da9 100644 --- a/lib/src/main/java/com/wind/meditor/visitor/ModifyAttributeVisitor.java +++ b/lib/src/main/java/com/wind/meditor/visitor/ModifyAttributeVisitor.java @@ -50,7 +50,9 @@ public class ModifyAttributeVisitor extends NodeVisitor { || (resourceId >= 0 && resourceId == attributeItem.getResourceId())) { hasBeenAddedAttributeList.add(attributeItem); newObj = attributeItem.getValue(); - type = attributeItem.getType(); + if (obj != null && newObj != null && obj.getClass() != newObj.getClass()) { + type = attributeItem.getType(); + } break; } }