当前位置: 首页>>代码示例>>Java>>正文


Java MethodReference.getDefiningClass方法代码示例

本文整理汇总了Java中org.jf.dexlib2.iface.reference.MethodReference.getDefiningClass方法的典型用法代码示例。如果您正苦于以下问题:Java MethodReference.getDefiningClass方法的具体用法?Java MethodReference.getDefiningClass怎么用?Java MethodReference.getDefiningClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jf.dexlib2.iface.reference.MethodReference的用法示例。


在下文中一共展示了MethodReference.getDefiningClass方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMethodDescriptor

import org.jf.dexlib2.iface.reference.MethodReference; //导入方法依赖的package包/类
public static String getMethodDescriptor(MethodReference methodReference, boolean useImplicitReference) {
    StringBuilder sb = new StringBuilder();
    if (!useImplicitReference) {
        String clazz = methodReference.getDefiningClass();//TypeGenUtil.newType(methodReference.getDefiningClass());
        sb.append(clazz);
        sb.append("->");
    }
    sb.append(methodReference.getName());
    sb.append('(');
    for (CharSequence paramType : methodReference.getParameterTypes()) {
        sb.append(paramType);
    }
    sb.append(')');
    sb.append(methodReference.getReturnType());
    return sb.toString();
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:17,代码来源:ReferenceUtil.java

示例2: addUsedMethods

import org.jf.dexlib2.iface.reference.MethodReference; //导入方法依赖的package包/类
public static void addUsedMethods(MethodReference methodReference) {
        String className = methodReference.getDefiningClass();
//        if (Build.addClasses.contains(className.substring(1, className.length() - 1).replace('/', '.'))){
//            return;
//        }
        String method = methodReference.getName();
        String params;
        if (APatchTool.mappingMap == null) {
            params = methodReference.getParameterTypes().toString().replace(',', '|').replaceAll(" ", "");
        } else {
            params = getParamsType(methodReference.getParameterTypes());
        }


        System.out.println("add used method:" + className + "->" + method + ":" + params
                + " " + methodReference.getReturnType());

        String record = className.substring(1, className.length() - 1).replace('/', '.') + ":" +
                method + ":" + params + ":" + methodReference.getReturnType();
        if (Build.usedMethods.contains(record)) {
            return;
        }
        if (p.matcher(className).find()) {
            return;
        }
        Build.usedMethods.add(record);
    }
 
开发者ID:alibaba,项目名称:atlas,代码行数:28,代码来源:DexDiffInfo.java

示例3: of

import org.jf.dexlib2.iface.reference.MethodReference; //导入方法依赖的package包/类
@Nonnull
public static ImmutableMethodReference of(@Nonnull MethodReference methodReference) {
    if (methodReference instanceof ImmutableMethodReference) {
        return (ImmutableMethodReference)methodReference;
    }
    return new ImmutableMethodReference(
            methodReference.getDefiningClass(),
            methodReference.getName(),
            methodReference.getParameterTypes(),
            methodReference.getReturnType());
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:12,代码来源:ImmutableMethodReference.java

示例4: MethodEntity

import org.jf.dexlib2.iface.reference.MethodReference; //导入方法依赖的package包/类
public MethodEntity(MethodReference ref) {
    className = ref.getDefiningClass();
    methodName = ref.getName();
    List<? extends CharSequence> types = ref.getParameterTypes();
    StringBuilder sBuilder = new StringBuilder(types.size()+3);
    sBuilder.append("(");
    for (CharSequence type: types){
        sBuilder.append(type);
    }
    sBuilder.append(")");
    sBuilder.append(ref.getReturnType());
    description = sBuilder.toString();
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:14,代码来源:MethodEntity.java

示例5: getSootMethodRef

import org.jf.dexlib2.iface.reference.MethodReference; //导入方法依赖的package包/类
/**
 * Return the SootMethodRef for the invoked method.
 *
 * @param invType The invocation type
 */
private SootMethodRef getSootMethodRef(InvocationType invType) {
	if (methodRef != null)
		return methodRef;
	
    MethodReference mItem = (MethodReference) ((ReferenceInstruction) instruction).getReference();
    String tItem = mItem.getDefiningClass();

    String className = tItem;
    Debug.printDbg("tItem: ", tItem ," class name: ", className);
      if (className.startsWith("[")) {
        className = "java.lang.Object";
      } else {
        className = dottedClassName (tItem);
      }

    SootClass sc = SootResolver.v().makeClassRef(className);
    if (invType == InvocationType.Interface && sc.isPhantom())
    	sc.setModifiers(sc.getModifiers() | Modifier.INTERFACE);
    String methodName = mItem.getName();

    Type returnType = DexType.toSoot(mItem.getReturnType());
    List<Type> parameterTypes = new ArrayList<Type>();
    List<? extends CharSequence> paramTypes = mItem.getParameterTypes();
    if (paramTypes != null)
        for (CharSequence type : paramTypes)
            parameterTypes.add(DexType.toSoot(type.toString()));

    Debug.printDbg("sc: ", sc);
    Debug.printDbg("methodName: ", methodName);
    Debug.printDbg("parameterTypes: ");
    for (Type t: parameterTypes)
      Debug.printDbg(" t: ", t);
    Debug.printDbg("returnType: ", returnType);
    Debug.printDbg("isStatic: ", invType == InvocationType.Static);
    methodRef = Scene.v().makeMethodRef(sc, methodName, parameterTypes, returnType,
    		invType == InvocationType.Static);
    
    return methodRef;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:45,代码来源:MethodInvocationInstruction.java

示例6: of

import org.jf.dexlib2.iface.reference.MethodReference; //导入方法依赖的package包/类
public static ImmutableMethodReference of( MethodReference methodReference) {
    if (methodReference instanceof ImmutableMethodReference) {
        return (ImmutableMethodReference)methodReference;
    }
    return new ImmutableMethodReference(
            methodReference.getDefiningClass(),
            methodReference.getName(),
            methodReference.getParameterTypes(),
            methodReference.getReturnType());
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:11,代码来源:ImmutableMethodReference.java

示例7: getDefiningClass

import org.jf.dexlib2.iface.reference.MethodReference; //导入方法依赖的package包/类
@Nonnull @Override public CharSequence getDefiningClass(@Nonnull MethodReference methodReference) {
    return methodReference.getDefiningClass();
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:4,代码来源:MethodPool.java

示例8: getAccessedMember

import org.jf.dexlib2.iface.reference.MethodReference; //导入方法依赖的package包/类
@Nullable
public AccessedMember getAccessedMember(@Nonnull MethodReference methodReference) {
    String methodDescriptor = ReferenceUtil.getMethodDescriptor(methodReference);

    AccessedMember accessedMember = resolvedAccessors.get(methodDescriptor);
    if (accessedMember != null) {
        return accessedMember;
    }

    String type = methodReference.getDefiningClass();
    ClassDef classDef = classDefMap.get(type);
    if (classDef == null) {
        return null;
    }

    Method matchedMethod = null;
    MethodImplementation matchedMethodImpl = null;
    for (Method method: classDef.getMethods()) {
        MethodImplementation methodImpl = method.getImplementation();
        if (methodImpl != null) {
            if (methodReferenceEquals(method, methodReference)) {
                matchedMethod = method;
                matchedMethodImpl = methodImpl;
                break;
            }
        }
    }

    if (matchedMethod == null) {
        return null;
    }

    //A synthetic accessor will be marked synthetic
    if (!AccessFlags.SYNTHETIC.isSet(matchedMethod.getAccessFlags())) {
        return null;
    }

    List<Instruction> instructions = ImmutableList.copyOf(matchedMethodImpl.getInstructions());

    int accessType = SyntheticAccessorFSM.test(instructions);

    if (accessType >= 0) {
        AccessedMember member =
                new AccessedMember(accessType, ((ReferenceInstruction)instructions.get(0)).getReference());
        resolvedAccessors.put(methodDescriptor, member);
        return member;
    }
    return null;
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:50,代码来源:SyntheticAccessorResolver.java

示例9: ReflectionEntity

import org.jf.dexlib2.iface.reference.MethodReference; //导入方法依赖的package包/类
public ReflectionEntity(MethodReference ref) {
    className = ref.getDefiningClass();
    methodName = ref.getName();
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:5,代码来源:ReflectionDecode.java

示例10: getDefiningClass

import org.jf.dexlib2.iface.reference.MethodReference; //导入方法依赖的package包/类
@Override public CharSequence getDefiningClass( MethodReference methodReference) {
    return methodReference.getDefiningClass();
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:4,代码来源:MethodPool.java

示例11: getAccessedMember

import org.jf.dexlib2.iface.reference.MethodReference; //导入方法依赖的package包/类
public AccessedMember getAccessedMember( MethodReference methodReference) {
    String methodDescriptor = ReferenceUtil.getMethodDescriptor(methodReference);

    AccessedMember accessedMember = resolvedAccessors.get(methodDescriptor);
    if (accessedMember != null) {
        return accessedMember;
    }

    String type = methodReference.getDefiningClass();
    ClassDef classDef = classDefMap.get(type);
    if (classDef == null) {
        return null;
    }

    Method matchedMethod = null;
    MethodImplementation matchedMethodImpl = null;
    for (Method method: classDef.getMethods()) {
        MethodImplementation methodImpl = method.getImplementation();
        if (methodImpl != null) {
            if (methodReferenceEquals(method, methodReference)) {
                matchedMethod = method;
                matchedMethodImpl = methodImpl;
                break;
            }
        }
    }

    if (matchedMethod == null) {
        return null;
    }

    //A synthetic accessor will be marked synthetic
    if (!AccessFlags.SYNTHETIC.isSet(matchedMethod.getAccessFlags())) {
        return null;
    }

    List<Instruction> instructions = ImmutableList.copyOf(matchedMethodImpl.getInstructions());


    int accessType = syntheticAccessorFSM.test(instructions);

    if (accessType >= 0) {
        AccessedMember member =
                new AccessedMember(accessType, ((ReferenceInstruction)instructions.get(0)).getReference());
        resolvedAccessors.put(methodDescriptor, member);
        return member;
    }
    return null;
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:50,代码来源:SyntheticAccessorResolver.java

示例12: getAccessedMember

import org.jf.dexlib2.iface.reference.MethodReference; //导入方法依赖的package包/类
@Nullable
public AccessedMember getAccessedMember(@Nonnull MethodReference methodReference) {
    String methodDescriptor = ReferenceUtil.getMethodDescriptor(methodReference);

    AccessedMember accessedMember = resolvedAccessors.get(methodDescriptor);
    if (accessedMember != null) {
        return accessedMember;
    }

    String type = methodReference.getDefiningClass();
    ClassDef classDef = classDefMap.get(type);
    if (classDef == null) {
        return null;
    }

    Method matchedMethod = null;
    MethodImplementation matchedMethodImpl = null;
    for (Method method: classDef.getMethods()) {
        MethodImplementation methodImpl = method.getImplementation();
        if (methodImpl != null) {
            if (methodReferenceEquals(method, methodReference)) {
                matchedMethod = method;
                matchedMethodImpl = methodImpl;
                break;
            }
        }
    }

    if (matchedMethod == null) {
        return null;
    }

    //A synthetic accessor will be marked synthetic
    if (!AccessFlags.SYNTHETIC.isSet(matchedMethod.getAccessFlags())) {
        return null;
    }

    List<Instruction> instructions = ImmutableList.copyOf(matchedMethodImpl.getInstructions());


    int accessType = syntheticAccessorFSM.test(instructions);

    if (accessType >= 0) {
        AccessedMember member =
                new AccessedMember(accessType, ((ReferenceInstruction)instructions.get(0)).getReference());
        resolvedAccessors.put(methodDescriptor, member);
        return member;
    }
    return null;
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:51,代码来源:SyntheticAccessorResolver.java


注:本文中的org.jf.dexlib2.iface.reference.MethodReference.getDefiningClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。