mirror of
https://github.com/revanced/smali.git
synced 2025-05-21 16:37:04 +02:00
Remove the Instruction template parameter from InstructionFactory
This commit is contained in:
parent
ca5de1d803
commit
e9aa2c230f
@ -40,7 +40,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ImmutableInstructionFactory implements InstructionFactory<ImmutableInstruction, Reference> {
|
||||
public class ImmutableInstructionFactory implements InstructionFactory<Reference> {
|
||||
public static final ImmutableInstructionFactory INSTANCE = new ImmutableInstructionFactory();
|
||||
|
||||
private ImmutableInstructionFactory() {
|
||||
|
@ -109,7 +109,7 @@ public abstract class DexWriter<
|
||||
protected int numCodeItemItems = 0;
|
||||
protected int numClassDataItems = 0;
|
||||
|
||||
protected final InstructionFactory<? extends Insn, BaseReference> instructionFactory;
|
||||
protected final InstructionFactory<BaseReference> instructionFactory;
|
||||
|
||||
protected final StringSection<StringKey, StringRef> stringSection;
|
||||
protected final TypeSection<StringKey, TypeKey, TypeRef> typeSection;
|
||||
@ -124,7 +124,7 @@ public abstract class DexWriter<
|
||||
protected final AnnotationSetSection<AnnotationKey, AnnotationSetKey> annotationSetSection;
|
||||
|
||||
protected DexWriter(int api,
|
||||
InstructionFactory<? extends Insn, BaseReference> instructionFactory,
|
||||
InstructionFactory<BaseReference> instructionFactory,
|
||||
StringSection<StringKey, StringRef> stringSection,
|
||||
TypeSection<StringKey, TypeKey, TypeRef> typeSection,
|
||||
ProtoSection<StringKey, TypeKey, ProtoKey, TypeListKey> protoSection,
|
||||
@ -814,7 +814,8 @@ public abstract class DexWriter<
|
||||
tryBlocks = TryListBuilder.massageTryBlocks(tryBlocks);
|
||||
|
||||
InstructionWriteUtil<StringRef, BaseReference> instrWriteUtil =
|
||||
new InstructionWriteUtil<StringRef, BaseReference>(instructions, stringSection, instructionFactory);
|
||||
new InstructionWriteUtil<StringRef, BaseReference>(
|
||||
instructions, stringSection, instructionFactory);
|
||||
writer.writeUshort(instrWriteUtil.getOutParamCount());
|
||||
writer.writeUshort(tryBlocks.size());
|
||||
writer.writeInt(debugItemOffset);
|
||||
|
@ -41,36 +41,36 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public interface InstructionFactory<Insn extends Instruction, Ref extends Reference> {
|
||||
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<Ref extends Reference> {
|
||||
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<? extends SwitchElement> switchElements);
|
||||
Insn makePackedSwitchPayload(@Nullable List<? extends SwitchElement> switchElements);
|
||||
Insn makeArrayPayload(int elementWidth, @Nullable List<Number> arrayElements);
|
||||
Instruction makeInstruction51l(@Nonnull Opcode opcode, int registerA, long literal);
|
||||
Instruction makeSparseSwitchPayload(@Nullable List<? extends SwitchElement> switchElements);
|
||||
Instruction makePackedSwitchPayload(@Nullable List<? extends SwitchElement> switchElements);
|
||||
Instruction makeArrayPayload(int elementWidth, @Nullable List<Number> arrayElements);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class BuilderInstructionFactory implements InstructionFactory<BuilderInstruction, BuilderReference> {
|
||||
public class BuilderInstructionFactory implements InstructionFactory<BuilderReference> {
|
||||
public static final BuilderInstructionFactory INSTANCE = new BuilderInstructionFactory();
|
||||
|
||||
private BuilderInstructionFactory() {
|
||||
|
@ -56,7 +56,7 @@ import java.util.List;
|
||||
public class InstructionWriteUtil<StringRef extends StringReference,
|
||||
BaseReference extends Reference> {
|
||||
private final StringIndexProvider<StringRef> stringIndexProvider;
|
||||
private final InstructionFactory<? extends Instruction, BaseReference> instructionFactory;
|
||||
private final InstructionFactory<BaseReference> instructionFactory;
|
||||
private final Iterable<? extends Instruction> originalInstructions;
|
||||
|
||||
private List<Instruction> instructions;
|
||||
@ -72,7 +72,7 @@ public class InstructionWriteUtil<StringRef extends StringReference,
|
||||
|
||||
public InstructionWriteUtil(@Nonnull Iterable<? extends Instruction> instructions,
|
||||
@Nonnull StringIndexProvider<StringRef> stringIndexProvider,
|
||||
@Nonnull InstructionFactory<? extends Instruction, BaseReference> instructionFactory) {
|
||||
@Nonnull InstructionFactory<BaseReference> instructionFactory) {
|
||||
this.stringIndexProvider = stringIndexProvider;
|
||||
this.instructionFactory = instructionFactory;
|
||||
this.originalInstructions = instructions;
|
||||
|
@ -77,7 +77,7 @@ import java.util.*;
|
||||
private int apiLevel = 15;
|
||||
private Opcodes opcodes = new Opcodes(apiLevel);
|
||||
private DexBuilder dexBuilder;
|
||||
private InstructionFactory<BuilderInstruction, BuilderReference> instructionFactory =
|
||||
private InstructionFactory<BuilderReference> instructionFactory =
|
||||
BuilderInstructionFactory.INSTANCE;
|
||||
|
||||
public void setDexBuilder(DexBuilder dexBuilder) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user