diff --git a/dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstructionFactory.java b/dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstructionFactory.java index ad562019..38a4d1d6 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstructionFactory.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstructionFactory.java @@ -40,7 +40,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.List; -public class ImmutableInstructionFactory implements InstructionFactory { +public class ImmutableInstructionFactory implements InstructionFactory { public static final ImmutableInstructionFactory INSTANCE = new ImmutableInstructionFactory(); private ImmutableInstructionFactory() { diff --git a/dexlib2/src/main/java/org/jf/dexlib2/writer/DexWriter.java b/dexlib2/src/main/java/org/jf/dexlib2/writer/DexWriter.java index 34d9fbc5..c501dec6 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/writer/DexWriter.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/writer/DexWriter.java @@ -109,7 +109,7 @@ public abstract class DexWriter< protected int numCodeItemItems = 0; protected int numClassDataItems = 0; - protected final InstructionFactory instructionFactory; + protected final InstructionFactory instructionFactory; protected final StringSection stringSection; protected final TypeSection typeSection; @@ -124,7 +124,7 @@ public abstract class DexWriter< protected final AnnotationSetSection annotationSetSection; protected DexWriter(int api, - InstructionFactory instructionFactory, + InstructionFactory instructionFactory, StringSection stringSection, TypeSection typeSection, ProtoSection protoSection, @@ -814,7 +814,8 @@ public abstract class DexWriter< tryBlocks = TryListBuilder.massageTryBlocks(tryBlocks); InstructionWriteUtil instrWriteUtil = - new InstructionWriteUtil(instructions, stringSection, instructionFactory); + new InstructionWriteUtil( + instructions, stringSection, instructionFactory); writer.writeUshort(instrWriteUtil.getOutParamCount()); writer.writeUshort(tryBlocks.size()); writer.writeInt(debugItemOffset); diff --git a/dexlib2/src/main/java/org/jf/dexlib2/writer/InstructionFactory.java b/dexlib2/src/main/java/org/jf/dexlib2/writer/InstructionFactory.java index 63a41562..31db1b8c 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/writer/InstructionFactory.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/writer/InstructionFactory.java @@ -41,36 +41,36 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.List; -public interface InstructionFactory { - Insn makeInstruction10t(@Nonnull Opcode opcode, int codeOffset); - Insn makeInstruction10x(@Nonnull Opcode opcode); - Insn makeInstruction11n(@Nonnull Opcode opcode, int registerA, int literal); - Insn makeInstruction11x(@Nonnull Opcode opcode, int registerA); - Insn makeInstruction12x(@Nonnull Opcode opcode, int registerA, int registerB); - Insn makeInstruction20bc(@Nonnull Opcode opcode, int verificationError, @Nonnull Ref reference); - Insn makeInstruction20t(@Nonnull Opcode opcode, int codeOffset); - Insn makeInstruction21c(@Nonnull Opcode opcode, int registerA, @Nonnull Ref reference); - Insn makeInstruction21ih(@Nonnull Opcode opcode, int registerA, int literal); - Insn makeInstruction21lh(@Nonnull Opcode opcode, int registerA, long literal); - Insn makeInstruction21s(@Nonnull Opcode opcode, int registerA, int literal); - Insn makeInstruction21t(@Nonnull Opcode opcode, int registerA, int codeOffset); - Insn makeInstruction22b(@Nonnull Opcode opcode, int registerA, int registerB, int literal); - Insn makeInstruction22c(@Nonnull Opcode opcode, int registerA, int registerB, @Nonnull Ref reference); - Insn makeInstruction22s(@Nonnull Opcode opcode, int registerA, int registerB, int literal); - Insn makeInstruction22t(@Nonnull Opcode opcode, int registerA, int registerB, int codeOffset); - Insn makeInstruction22x(@Nonnull Opcode opcode, int registerA, int registerB); - Insn makeInstruction23x(@Nonnull Opcode opcode, int registerA, int registerB, int registerC); - Insn makeInstruction30t(@Nonnull Opcode opcode, int codeOffset); - Insn makeInstruction31c(@Nonnull Opcode opcode, int registerA, @Nonnull Ref reference); - Insn makeInstruction31i(@Nonnull Opcode opcode, int registerA, int literal); - Insn makeInstruction31t(@Nonnull Opcode opcode, int registerA, int codeOffset); - Insn makeInstruction32x(@Nonnull Opcode opcode, int registerA, int registerB); - Insn makeInstruction35c(@Nonnull Opcode opcode, int registerCount, int registerC, int registerD, int registerE, +public interface InstructionFactory { + Instruction makeInstruction10t(@Nonnull Opcode opcode, int codeOffset); + Instruction makeInstruction10x(@Nonnull Opcode opcode); + Instruction makeInstruction11n(@Nonnull Opcode opcode, int registerA, int literal); + Instruction makeInstruction11x(@Nonnull Opcode opcode, int registerA); + Instruction makeInstruction12x(@Nonnull Opcode opcode, int registerA, int registerB); + Instruction makeInstruction20bc(@Nonnull Opcode opcode, int verificationError, @Nonnull Ref reference); + Instruction makeInstruction20t(@Nonnull Opcode opcode, int codeOffset); + Instruction makeInstruction21c(@Nonnull Opcode opcode, int registerA, @Nonnull Ref reference); + Instruction makeInstruction21ih(@Nonnull Opcode opcode, int registerA, int literal); + Instruction makeInstruction21lh(@Nonnull Opcode opcode, int registerA, long literal); + Instruction makeInstruction21s(@Nonnull Opcode opcode, int registerA, int literal); + Instruction makeInstruction21t(@Nonnull Opcode opcode, int registerA, int codeOffset); + Instruction makeInstruction22b(@Nonnull Opcode opcode, int registerA, int registerB, int literal); + Instruction makeInstruction22c(@Nonnull Opcode opcode, int registerA, int registerB, @Nonnull Ref reference); + Instruction makeInstruction22s(@Nonnull Opcode opcode, int registerA, int registerB, int literal); + Instruction makeInstruction22t(@Nonnull Opcode opcode, int registerA, int registerB, int codeOffset); + Instruction makeInstruction22x(@Nonnull Opcode opcode, int registerA, int registerB); + Instruction makeInstruction23x(@Nonnull Opcode opcode, int registerA, int registerB, int registerC); + Instruction makeInstruction30t(@Nonnull Opcode opcode, int codeOffset); + Instruction makeInstruction31c(@Nonnull Opcode opcode, int registerA, @Nonnull Ref reference); + Instruction makeInstruction31i(@Nonnull Opcode opcode, int registerA, int literal); + Instruction makeInstruction31t(@Nonnull Opcode opcode, int registerA, int codeOffset); + Instruction makeInstruction32x(@Nonnull Opcode opcode, int registerA, int registerB); + Instruction makeInstruction35c(@Nonnull Opcode opcode, int registerCount, int registerC, int registerD, int registerE, int registerF, int registerG, @Nonnull Ref reference); - Insn makeInstruction3rc(@Nonnull Opcode opcode, int startRegister, int registerCount, + Instruction makeInstruction3rc(@Nonnull Opcode opcode, int startRegister, int registerCount, @Nonnull Ref reference); - Insn makeInstruction51l(@Nonnull Opcode opcode, int registerA, long literal); - Insn makeSparseSwitchPayload(@Nullable List switchElements); - Insn makePackedSwitchPayload(@Nullable List switchElements); - Insn makeArrayPayload(int elementWidth, @Nullable List arrayElements); + Instruction makeInstruction51l(@Nonnull Opcode opcode, int registerA, long literal); + Instruction makeSparseSwitchPayload(@Nullable List switchElements); + Instruction makePackedSwitchPayload(@Nullable List switchElements); + Instruction makeArrayPayload(int elementWidth, @Nullable List arrayElements); } diff --git a/dexlib2/src/main/java/org/jf/dexlib2/writer/builder/BuilderInstructionFactory.java b/dexlib2/src/main/java/org/jf/dexlib2/writer/builder/BuilderInstructionFactory.java index 349c7e23..280c318d 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/writer/builder/BuilderInstructionFactory.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/writer/builder/BuilderInstructionFactory.java @@ -40,7 +40,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.List; -public class BuilderInstructionFactory implements InstructionFactory { +public class BuilderInstructionFactory implements InstructionFactory { public static final BuilderInstructionFactory INSTANCE = new BuilderInstructionFactory(); private BuilderInstructionFactory() { diff --git a/dexlib2/src/main/java/org/jf/dexlib2/writer/util/InstructionWriteUtil.java b/dexlib2/src/main/java/org/jf/dexlib2/writer/util/InstructionWriteUtil.java index 3d34846f..25f50d2d 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/writer/util/InstructionWriteUtil.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/writer/util/InstructionWriteUtil.java @@ -56,7 +56,7 @@ import java.util.List; public class InstructionWriteUtil { private final StringIndexProvider stringIndexProvider; - private final InstructionFactory instructionFactory; + private final InstructionFactory instructionFactory; private final Iterable originalInstructions; private List instructions; @@ -72,7 +72,7 @@ public class InstructionWriteUtil instructions, @Nonnull StringIndexProvider stringIndexProvider, - @Nonnull InstructionFactory instructionFactory) { + @Nonnull InstructionFactory instructionFactory) { this.stringIndexProvider = stringIndexProvider; this.instructionFactory = instructionFactory; this.originalInstructions = instructions; diff --git a/smali/src/main/antlr3/smaliTreeWalker.g b/smali/src/main/antlr3/smaliTreeWalker.g index 285fe349..e57cab59 100644 --- a/smali/src/main/antlr3/smaliTreeWalker.g +++ b/smali/src/main/antlr3/smaliTreeWalker.g @@ -77,7 +77,7 @@ import java.util.*; private int apiLevel = 15; private Opcodes opcodes = new Opcodes(apiLevel); private DexBuilder dexBuilder; - private InstructionFactory instructionFactory = + private InstructionFactory instructionFactory = BuilderInstructionFactory.INSTANCE; public void setDexBuilder(DexBuilder dexBuilder) {