From 5084234f41f5ae3f20f265f30ba1d847a358067b Mon Sep 17 00:00:00 2001 From: REAndroid Date: Wed, 30 Oct 2024 18:50:00 +0100 Subject: [PATCH] [DEX] Fix annotation value conversion --- src/main/java/com/reandroid/dex/data/AnnotationElement.java | 3 ++- src/main/java/com/reandroid/dex/value/DexValueType.java | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/reandroid/dex/data/AnnotationElement.java b/src/main/java/com/reandroid/dex/data/AnnotationElement.java index 20a22e2b2..00d88c2f1 100644 --- a/src/main/java/com/reandroid/dex/data/AnnotationElement.java +++ b/src/main/java/com/reandroid/dex/data/AnnotationElement.java @@ -33,12 +33,13 @@ public AnnotationElement() { @Override public AnnotationElementKey getKey(){ - return checkKey(new AnnotationElementKey(getName(), getValue())); + return new AnnotationElementKey(getName(), getValue()); } @Override public void setKey(Key key) { AnnotationElementKey elementKey = (AnnotationElementKey) key; setName(elementKey.getName()); + setValue(elementKey.getValue()); } public Key getValue() { DexValueBlock valueBlock = getValueBlock(); diff --git a/src/main/java/com/reandroid/dex/value/DexValueType.java b/src/main/java/com/reandroid/dex/value/DexValueType.java index 067cc7bb6..98054489c 100644 --- a/src/main/java/com/reandroid/dex/value/DexValueType.java +++ b/src/main/java/com/reandroid/dex/value/DexValueType.java @@ -274,6 +274,9 @@ public static Key createNull(TypeKey typeKey) { if (TypeKey.TYPE_F.equals(typeKey)) { return PrimitiveKey.of(0.0f); } + if (TypeKey.TYPE_I.equals(typeKey)) { + return PrimitiveKey.of(0); + } if (TypeKey.TYPE_J.equals(typeKey)) { return PrimitiveKey.of(0L); }