Search in sources :

Example 6 with ImmutableInstruction35c

use of org.jf.dexlib2.immutable.instruction.ImmutableInstruction35c in project smali by JesusFreke.

the class CallSiteTest method testPoolCallSite.

@Test
public void testPoolCallSite() throws IOException {
    ClassDef class1 = new ImmutableClassDef("Lcls1;", AccessFlags.PUBLIC.getValue(), "Ljava/lang/Object;", null, null, null, null, Lists.<Method>newArrayList(new ImmutableMethod("Lcls1", "method1", ImmutableList.of(), "V", AccessFlags.PUBLIC.getValue(), null, null, new ImmutableMethodImplementation(10, ImmutableList.of(new ImmutableInstruction35c(Opcode.INVOKE_CUSTOM, 0, 0, 0, 0, 0, 0, new ImmutableCallSiteReference("call_site_1", new ImmutableMethodHandleReference(MethodHandleType.INVOKE_STATIC, new ImmutableMethodReference("Lcls1", "loader", ImmutableList.of("Ljava/lang/invoke/Lookup;", "Ljava/lang/String;", "Ljava/lang/invoke/MethodType;"), "Ljava/lang/invoke/CallSite;")), "someMethod", new ImmutableMethodProtoReference(ImmutableList.of(), "V"), ImmutableList.of()))), null, null))));
    File tempFile = File.createTempFile("dex", ".dex");
    DexFileFactory.writeDexFile(tempFile.getPath(), new ImmutableDexFile(Opcodes.forArtVersion(111), ImmutableList.of(class1)));
    verifyDexFile(DexFileFactory.loadDexFile(tempFile, Opcodes.forArtVersion(111)));
}
Also used : ImmutableMethodProtoReference(org.jf.dexlib2.immutable.reference.ImmutableMethodProtoReference) ImmutableClassDef(org.jf.dexlib2.immutable.ImmutableClassDef) ClassDef(org.jf.dexlib2.iface.ClassDef) ImmutableMethod(org.jf.dexlib2.immutable.ImmutableMethod) ImmutableClassDef(org.jf.dexlib2.immutable.ImmutableClassDef) ImmutableMethodReference(org.jf.dexlib2.immutable.reference.ImmutableMethodReference) ImmutableInstruction35c(org.jf.dexlib2.immutable.instruction.ImmutableInstruction35c) ImmutableMethodHandleReference(org.jf.dexlib2.immutable.reference.ImmutableMethodHandleReference) ImmutableMethodImplementation(org.jf.dexlib2.immutable.ImmutableMethodImplementation) ImmutableDexFile(org.jf.dexlib2.immutable.ImmutableDexFile) File(java.io.File) DexFile(org.jf.dexlib2.iface.DexFile) ImmutableDexFile(org.jf.dexlib2.immutable.ImmutableDexFile) ImmutableCallSiteReference(org.jf.dexlib2.immutable.reference.ImmutableCallSiteReference) Test(org.junit.Test)

Aggregations

ImmutableMethodReference (org.jf.dexlib2.immutable.reference.ImmutableMethodReference)4 Opcode (org.jf.dexlib2.Opcode)3 MethodReference (org.jf.dexlib2.iface.reference.MethodReference)3 BaseMethodReference (org.jf.dexlib2.base.reference.BaseMethodReference)2 ImmutableMethodImplementation (org.jf.dexlib2.immutable.ImmutableMethodImplementation)2 ImmutableStringReference (org.jf.dexlib2.immutable.reference.ImmutableStringReference)2 ImmutableTypeReference (org.jf.dexlib2.immutable.reference.ImmutableTypeReference)2 ExceptionWithContext (org.jf.util.ExceptionWithContext)2 Test (org.junit.Test)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 ClassDef (org.jf.dexlib2.iface.ClassDef)1 DexFile (org.jf.dexlib2.iface.DexFile)1 Instruction (org.jf.dexlib2.iface.instruction.Instruction)1 ReferenceInstruction (org.jf.dexlib2.iface.instruction.ReferenceInstruction)1 FieldReference (org.jf.dexlib2.iface.reference.FieldReference)1 StringReference (org.jf.dexlib2.iface.reference.StringReference)1 TypeReference (org.jf.dexlib2.iface.reference.TypeReference)1 ImmutableClassDef (org.jf.dexlib2.immutable.ImmutableClassDef)1 ImmutableDexFile (org.jf.dexlib2.immutable.ImmutableDexFile)1