From 9c92290aecab013c18eb7e98db3388469e50a956 Mon Sep 17 00:00:00 2001 From: Caleb Fenton Date: Mon, 15 Feb 2016 09:38:58 -0800 Subject: [PATCH] Properly intern fields when unreflecting --- .../java/org/cf/simplify/strategy/UnreflectionStrategy.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/simplify/src/main/java/org/cf/simplify/strategy/UnreflectionStrategy.java b/simplify/src/main/java/org/cf/simplify/strategy/UnreflectionStrategy.java index ab8c1267a..172805235 100644 --- a/simplify/src/main/java/org/cf/simplify/strategy/UnreflectionStrategy.java +++ b/simplify/src/main/java/org/cf/simplify/strategy/UnreflectionStrategy.java @@ -35,6 +35,7 @@ import org.jf.dexlib2.iface.reference.MethodReference; import org.jf.dexlib2.immutable.reference.ImmutableMethodReference; import org.jf.dexlib2.util.ReferenceUtil; +import org.jf.dexlib2.writer.builder.BuilderField; import org.jf.dexlib2.writer.builder.BuilderMethod; import org.jf.dexlib2.writer.builder.BuilderTypeReference; import org.slf4j.Logger; @@ -165,8 +166,10 @@ private BuilderInstruction buildFieldGetReplacement(int address) { String type = parts[1]; boolean isStatic = false; - FieldReference fieldRef = manipulator.getDexBuilder().internField(className, fieldName, type, + BuilderField builderField = manipulator.getDexBuilder().internField(className, fieldName, type, field.getModifiers(), null, null); + FieldReference fieldRef = manipulator.getDexBuilder().internFieldReference(builderField); + isStatic = Modifier.isStatic(field.getModifiers()); Opcode newOp = getGetOpcode(type, isStatic);