本文整理汇总了Java中org.jf.dexlib2.immutable.reference.ImmutableMethodReference类的典型用法代码示例。如果您正苦于以下问题:Java ImmutableMethodReference类的具体用法?Java ImmutableMethodReference怎么用?Java ImmutableMethodReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImmutableMethodReference类属于org.jf.dexlib2.immutable.reference包,在下文中一共展示了ImmutableMethodReference类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: modifyMethodAndFix
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference; //导入依赖的package包/类
private static MethodImplementation modifyMethodAndFix(@Nonnull MethodImplementation implementation, Method method) {
MutableMethodImplementation mutableImplementation = new MutableMethodImplementation(implementation);
System.out.println(mutableImplementation.getRegisterCount());
List<BuilderInstruction> instructions = mutableImplementation.getInstructions();
mutableImplementation.addInstruction(0,
new BuilderInstruction21c(Opcode.CONST_STRING, 0,
new ImmutableStringReference("AndFix:" + method.getDefiningClass().replace("/", "."))));
mutableImplementation.addInstruction(1,
new BuilderInstruction35c(Opcode.INVOKE_STATIC, 1,
0, 0, 0, 0, 0,
new ImmutableMethodReference("Landroid/util/Log;", "e",
Lists.newArrayList("Ljava/lang/String;", "Ljava/lang/String;"), "I")));
return mutableImplementation;
}
示例2: modifyMethodTpatch
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference; //导入依赖的package包/类
private static MethodImplementation modifyMethodTpatch(@Nonnull MethodImplementation implementation, Method method) {
MutableMethodImplementation mutableImplementation = new MutableMethodImplementation(implementation);
System.out.println(mutableImplementation.getRegisterCount());
List<BuilderInstruction> instructions = mutableImplementation.getInstructions();
boolean isModified = false;
for (int i = 0; i < instructions.size(); i++) {
isModified = false;
if (instructions.get(i).getOpcode() == Opcode.INVOKE_DIRECT) {
if (!isModified) {
mutableImplementation.addInstruction(i++,
new BuilderInstruction21c(Opcode.CONST_STRING, 0,
new ImmutableStringReference("tpatch:" + method.getDefiningClass().replace("/", "."))));
mutableImplementation.addInstruction(i++,
new BuilderInstruction35c(Opcode.INVOKE_STATIC, 1,
0, 0, 0, 0, 0,
new ImmutableMethodReference("Landroid/util/Log;", "e",
Lists.newArrayList("Ljava/lang/String;", "Ljava/lang/String;"), "I")));
isModified = true;
break;
}
}
// mutableImplementation.addInstruction(instructions.get(i));
}
return mutableImplementation;
}
示例3: method_literal
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference; //导入依赖的package包/类
public final MethodReference method_literal() throws RecognitionException {
MethodReference value = null;
ImmutableMethodReference fully_qualified_method209 =null;
try {
// D:\\decomplier_tools\\smali\\smali\\smali\\src\\main\\antlr3\\smaliTreeWalker.g:1268:3: ( ^( I_ENCODED_METHOD fully_qualified_method ) )
// D:\\decomplier_tools\\smali\\smali\\smali\\src\\main\\antlr3\\smaliTreeWalker.g:1268:5: ^( I_ENCODED_METHOD fully_qualified_method )
{
match(input,I_ENCODED_METHOD,FOLLOW_I_ENCODED_METHOD_in_method_literal3592);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_fully_qualified_method_in_method_literal3594);
fully_qualified_method209=fully_qualified_method();
state._fsp--;
match(input, Token.UP, null);
value = fully_qualified_method209;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
return value;
}
示例4: buildEnclosingMethodTag
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference; //导入依赖的package包/类
private Annotation buildEnclosingMethodTag(EnclosingMethodTag t, Set<String> skipList) {
if (!skipList.add("Ldalvik/annotation/EnclosingMethod;"))
return null;
if (t.getEnclosingMethod() == null)
return null;
String[] split1 = t.getEnclosingMethodSig().split("\\)");
String parametersS = split1[0].replaceAll("\\(", "");
String returnTypeS = split1[1];
List<String> typeList = new ArrayList<String>();
if (!parametersS.equals("")) {
for (String p : Util.splitParameters(parametersS)) {
if (!p.isEmpty())
typeList.add(p);
}
}
ImmutableMethodReference mRef = new ImmutableMethodReference
(SootToDexUtils.getDexClassName(t.getEnclosingClass()),
t.getEnclosingMethod(), typeList, returnTypeS);
ImmutableMethodEncodedValue methodRef = new ImmutableMethodEncodedValue
(dexFile.internMethodReference(mRef));
AnnotationElement methodElement = new ImmutableAnnotationElement("value", methodRef);
return new ImmutableAnnotation(AnnotationVisibility.SYSTEM,
"Ldalvik/annotation/EnclosingMethod;",
Collections.singleton(methodElement));
}
示例5:
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference; //导入依赖的package包/类
protected static BuilderMethodReference toMethodReference
(SootMethodRef m, DexBuilder belongingDexFile) {
List<String> parameters = new ArrayList<String>();
for (Type t : m.parameterTypes())
parameters.add(SootToDexUtils.getDexTypeDescriptor(t));
MethodReference methodRef = new ImmutableMethodReference
(SootToDexUtils.getDexClassName(m.declaringClass().getName()),
m.name(),
parameters,
SootToDexUtils.getDexTypeDescriptor(m.returnType()));
return belongingDexFile.internMethodReference(methodRef);
}
示例6: method_literal
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference; //导入依赖的package包/类
public final MethodReference method_literal() throws RecognitionException {
MethodReference value = null;
ImmutableMethodReference fully_qualified_method209 =null;
try {
// /usr/local/google/home/bgruv/android/aosp-master/external/smali/smali/src/main/antlr3/smaliTreeWalker.g:1268:3: ( ^( I_ENCODED_METHOD fully_qualified_method ) )
// /usr/local/google/home/bgruv/android/aosp-master/external/smali/smali/src/main/antlr3/smaliTreeWalker.g:1268:5: ^( I_ENCODED_METHOD fully_qualified_method )
{
match(input,I_ENCODED_METHOD,FOLLOW_I_ENCODED_METHOD_in_method_literal3592);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_fully_qualified_method_in_method_literal3594);
fully_qualified_method209=fully_qualified_method();
state._fsp--;
match(input, Token.UP, null);
value = fully_qualified_method209;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
return value;
}
示例7: insn_format35c_method
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference; //导入依赖的package包/类
public final void insn_format35c_method() throws RecognitionException {
CommonTree INSTRUCTION_FORMAT35c_METHOD161=null;
TreeRuleReturnScope register_list162 =null;
ImmutableMethodReference fully_qualified_method163 =null;
try {
// D:\\decomplier_tools\\smali\\smali\\smali\\src\\main\\antlr3\\smaliTreeWalker.g:1040:3: ( ^( I_STATEMENT_FORMAT35c_METHOD INSTRUCTION_FORMAT35c_METHOD register_list fully_qualified_method ) )
// D:\\decomplier_tools\\smali\\smali\\smali\\src\\main\\antlr3\\smaliTreeWalker.g:1041:5: ^( I_STATEMENT_FORMAT35c_METHOD INSTRUCTION_FORMAT35c_METHOD register_list fully_qualified_method )
{
match(input,I_STATEMENT_FORMAT35c_METHOD,FOLLOW_I_STATEMENT_FORMAT35c_METHOD_in_insn_format35c_method2834);
match(input, Token.DOWN, null);
INSTRUCTION_FORMAT35c_METHOD161=(CommonTree)match(input,INSTRUCTION_FORMAT35c_METHOD,FOLLOW_INSTRUCTION_FORMAT35c_METHOD_in_insn_format35c_method2836);
pushFollow(FOLLOW_register_list_in_insn_format35c_method2838);
register_list162=register_list();
state._fsp--;
pushFollow(FOLLOW_fully_qualified_method_in_insn_format35c_method2840);
fully_qualified_method163=fully_qualified_method();
state._fsp--;
match(input, Token.UP, null);
Opcode opcode = opcodes.getOpcodeByName((INSTRUCTION_FORMAT35c_METHOD161!=null?INSTRUCTION_FORMAT35c_METHOD161.getText():null));
//this depends on the fact that register_list returns a byte[5]
byte[] registers = (register_list162!=null?((smaliTreeWalker.register_list_return)register_list162).registers:null);
byte registerCount = (register_list162!=null?((smaliTreeWalker.register_list_return)register_list162).registerCount:0);
ImmutableMethodReference methodReference = fully_qualified_method163;
method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction35c(opcode, registerCount, registers[0], registers[1],
registers[2], registers[3], registers[4], dexBuilder.internMethodReference(methodReference)));
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
}
示例8: insn_format3rc_method
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference; //导入依赖的package包/类
public final void insn_format3rc_method() throws RecognitionException {
CommonTree INSTRUCTION_FORMAT3rc_METHOD167=null;
TreeRuleReturnScope register_range168 =null;
ImmutableMethodReference fully_qualified_method169 =null;
try {
// D:\\decomplier_tools\\smali\\smali\\smali\\src\\main\\antlr3\\smaliTreeWalker.g:1070:3: ( ^( I_STATEMENT_FORMAT3rc_METHOD INSTRUCTION_FORMAT3rc_METHOD register_range fully_qualified_method ) )
// D:\\decomplier_tools\\smali\\smali\\smali\\src\\main\\antlr3\\smaliTreeWalker.g:1071:5: ^( I_STATEMENT_FORMAT3rc_METHOD INSTRUCTION_FORMAT3rc_METHOD register_range fully_qualified_method )
{
match(input,I_STATEMENT_FORMAT3rc_METHOD,FOLLOW_I_STATEMENT_FORMAT3rc_METHOD_in_insn_format3rc_method2892);
match(input, Token.DOWN, null);
INSTRUCTION_FORMAT3rc_METHOD167=(CommonTree)match(input,INSTRUCTION_FORMAT3rc_METHOD,FOLLOW_INSTRUCTION_FORMAT3rc_METHOD_in_insn_format3rc_method2894);
pushFollow(FOLLOW_register_range_in_insn_format3rc_method2896);
register_range168=register_range();
state._fsp--;
pushFollow(FOLLOW_fully_qualified_method_in_insn_format3rc_method2898);
fully_qualified_method169=fully_qualified_method();
state._fsp--;
match(input, Token.UP, null);
Opcode opcode = opcodes.getOpcodeByName((INSTRUCTION_FORMAT3rc_METHOD167!=null?INSTRUCTION_FORMAT3rc_METHOD167.getText():null));
int startRegister = (register_range168!=null?((smaliTreeWalker.register_range_return)register_range168).startRegister:0);
int endRegister = (register_range168!=null?((smaliTreeWalker.register_range_return)register_range168).endRegister:0);
int registerCount = endRegister-startRegister+1;
ImmutableMethodReference methodReference = fully_qualified_method169;
method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction3rc(opcode, startRegister, registerCount,
dexBuilder.internMethodReference(methodReference)));
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
}
示例9: insn_format35c_method
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference; //导入依赖的package包/类
public final void insn_format35c_method() throws RecognitionException {
CommonTree INSTRUCTION_FORMAT35c_METHOD161=null;
TreeRuleReturnScope register_list162 =null;
ImmutableMethodReference fully_qualified_method163 =null;
try {
// /usr/local/google/home/bgruv/android/aosp-master/external/smali/smali/src/main/antlr3/smaliTreeWalker.g:1040:3: ( ^( I_STATEMENT_FORMAT35c_METHOD INSTRUCTION_FORMAT35c_METHOD register_list fully_qualified_method ) )
// /usr/local/google/home/bgruv/android/aosp-master/external/smali/smali/src/main/antlr3/smaliTreeWalker.g:1041:5: ^( I_STATEMENT_FORMAT35c_METHOD INSTRUCTION_FORMAT35c_METHOD register_list fully_qualified_method )
{
match(input,I_STATEMENT_FORMAT35c_METHOD,FOLLOW_I_STATEMENT_FORMAT35c_METHOD_in_insn_format35c_method2834);
match(input, Token.DOWN, null);
INSTRUCTION_FORMAT35c_METHOD161=(CommonTree)match(input,INSTRUCTION_FORMAT35c_METHOD,FOLLOW_INSTRUCTION_FORMAT35c_METHOD_in_insn_format35c_method2836);
pushFollow(FOLLOW_register_list_in_insn_format35c_method2838);
register_list162=register_list();
state._fsp--;
pushFollow(FOLLOW_fully_qualified_method_in_insn_format35c_method2840);
fully_qualified_method163=fully_qualified_method();
state._fsp--;
match(input, Token.UP, null);
Opcode opcode = opcodes.getOpcodeByName((INSTRUCTION_FORMAT35c_METHOD161!=null?INSTRUCTION_FORMAT35c_METHOD161.getText():null));
//this depends on the fact that register_list returns a byte[5]
byte[] registers = (register_list162!=null?((smaliTreeWalker.register_list_return)register_list162).registers:null);
byte registerCount = (register_list162!=null?((smaliTreeWalker.register_list_return)register_list162).registerCount:0);
ImmutableMethodReference methodReference = fully_qualified_method163;
method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction35c(opcode, registerCount, registers[0], registers[1],
registers[2], registers[3], registers[4], dexBuilder.internMethodReference(methodReference)));
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
}
示例10: insn_format3rc_method
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference; //导入依赖的package包/类
public final void insn_format3rc_method() throws RecognitionException {
CommonTree INSTRUCTION_FORMAT3rc_METHOD167=null;
TreeRuleReturnScope register_range168 =null;
ImmutableMethodReference fully_qualified_method169 =null;
try {
// /usr/local/google/home/bgruv/android/aosp-master/external/smali/smali/src/main/antlr3/smaliTreeWalker.g:1070:3: ( ^( I_STATEMENT_FORMAT3rc_METHOD INSTRUCTION_FORMAT3rc_METHOD register_range fully_qualified_method ) )
// /usr/local/google/home/bgruv/android/aosp-master/external/smali/smali/src/main/antlr3/smaliTreeWalker.g:1071:5: ^( I_STATEMENT_FORMAT3rc_METHOD INSTRUCTION_FORMAT3rc_METHOD register_range fully_qualified_method )
{
match(input,I_STATEMENT_FORMAT3rc_METHOD,FOLLOW_I_STATEMENT_FORMAT3rc_METHOD_in_insn_format3rc_method2892);
match(input, Token.DOWN, null);
INSTRUCTION_FORMAT3rc_METHOD167=(CommonTree)match(input,INSTRUCTION_FORMAT3rc_METHOD,FOLLOW_INSTRUCTION_FORMAT3rc_METHOD_in_insn_format3rc_method2894);
pushFollow(FOLLOW_register_range_in_insn_format3rc_method2896);
register_range168=register_range();
state._fsp--;
pushFollow(FOLLOW_fully_qualified_method_in_insn_format3rc_method2898);
fully_qualified_method169=fully_qualified_method();
state._fsp--;
match(input, Token.UP, null);
Opcode opcode = opcodes.getOpcodeByName((INSTRUCTION_FORMAT3rc_METHOD167!=null?INSTRUCTION_FORMAT3rc_METHOD167.getText():null));
int startRegister = (register_range168!=null?((smaliTreeWalker.register_range_return)register_range168).startRegister:0);
int endRegister = (register_range168!=null?((smaliTreeWalker.register_range_return)register_range168).endRegister:0);
int registerCount = endRegister-startRegister+1;
ImmutableMethodReference methodReference = fully_qualified_method169;
method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction3rc(opcode, startRegister, registerCount,
dexBuilder.internMethodReference(methodReference)));
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
}