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


Java DexBackedMethod.getName方法代码示例

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


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

示例1: compare

import org.jf.dexlib2.dexbacked.DexBackedMethod; //导入方法依赖的package包/类
private static boolean compare(DexBackedMethod dexBackedMethod, DexBackedMethod sDexBackedMethod) {
    if (dexBackedMethod == null || sDexBackedMethod == null || dexBackedMethod.getName() == null || sDexBackedMethod.getName() == null) {
        return false;
    }
    if (dexBackedMethod.getName().equals(sDexBackedMethod.getName())) {
        List<String> parameters = dexBackedMethod.getParameterTypes();
        List<String> sParameters = sDexBackedMethod.getParameterTypes();
        if (parameters.size() != sParameters.size()) {
            return false;
        }
        for (String param : parameters) {
            if (!sParameters.contains(param)) {
                return false;
            }
        }
        return true;
    }
    return false;
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:20,代码来源:SmaliDiffUtils.java

示例2: filterMethod

import org.jf.dexlib2.dexbacked.DexBackedMethod; //导入方法依赖的package包/类
@Override
public boolean filterMethod(MethodDiffInfo methodDiffInfo) throws PatchException {
    DexBackedMethod dexBackedMethod = methodDiffInfo.getBackedMethod();
    if (dexBackedMethod.getName().equals("<clinit>") || dexBackedMethod.getName().contains("ajc$preClinit")||dexBackedMethod.getName().equals("<init>")||dexBackedMethod.getName().contains("access$")) {
        return true;
    }

    if (methodDiffInfo.getType().equals(DiffType.REMOVE)) {
        return true;
    } else if (methodDiffInfo.getType().equals(DiffType.ADD)){
        throw new PatchException("can't add method:" + dexBackedMethod.getName() + " in class:" + dexBackedMethod.getDefiningClass());
    }

    if (dexBackedMethod.getParameters().size() > 8) {
        throw new PatchException("can't patch method:" + dexBackedMethod.getName() + "has Parameters above 8 in class:"+dexBackedMethod.getDefiningClass());
    }
    if (dexBackedMethod.getParameterTypes().contains("J") || dexBackedMethod.getParameterTypes().contains("D") || dexBackedMethod.getParameterTypes().contains("F")) {
       throw new PatchException("can't patch method:" + dexBackedMethod.getName() + "has ParameterType long,double or float in class:"+dexBackedMethod.getDefiningClass());
    }
    return false;
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:22,代码来源:AndFixFilterImpl.java

示例3: getMethod

import org.jf.dexlib2.dexbacked.DexBackedMethod; //导入方法依赖的package包/类
private static DexBackedMethod getMethod(
                            DexBackedClassDef classDef,
                            String methodName) {

     for (DexBackedMethod method : classDef.getVirtualMethods()) {

        String matchName = method.getName();
        if (matchName.equals(methodName)) {
            return method;
        }
    }

    return null;
}
 
开发者ID:android-dtf,项目名称:core_generate_aidl,代码行数:15,代码来源:App.java

示例4: buildPrepareClass

import org.jf.dexlib2.dexbacked.DexBackedMethod; //导入方法依赖的package包/类
private static Set<String> buildPrepareClass(File smaliDir, List<File> newFiles,
                                                 DexDiffInfo info) throws PatchException {
        Set<DexBackedClassDef> classes = Sets.newHashSet();
        classes = SmaliDiffUtils.scanClasses(smaliDir, newFiles);
        ArrayList<String> methods = new ArrayList<String>();
        {
            Set<DexBackedMethod> tempSet = info.getModifiedMethods();
            for (DexBackedMethod methodRef : tempSet) {
                String template = methodRef.getDefiningClass() + "->" + methodRef.getName();
                methods.add(template);
                System.out.println("template: " + template);
                if (superClasses.containsKey(methodRef.getDefiningClass())) {
                    ArrayList<String> derivedClasses = superClasses.get(methodRef.getDefiningClass());
                    for (int i = 0; i < derivedClasses.size(); i++) {
                        template = derivedClasses.get(i) + "->" + methodRef.getName();
                        System.out.println("template: " + template);
                        methods.add(template);
                    }
                }
            }
        }

        Set<String> prepareClasses = new HashSet<String>();
        try {
            final ClassFileNameHandler inFileNameHandler = new ClassFileNameHandler(smaliDir, ".smali");
            for (DexBackedClassDef classDef : classes) {
                currentClassType = null;
                String className = TypeGenUtil.newType(classDef.getType());
                // baksmali.disassembleClass(classDef, outFileNameHandler, options);
                File smaliFile = inFileNameHandler.getUniqueFilenameForClass(className);
                if (!smaliFile.exists()){
                    continue;
                }
                //增加class注解到prepare
                getClassAnnotaionPrepareClasses(classDef,prepareClasses,info);

                BufferedReader br = new BufferedReader(new FileReader(smaliFile));
                String data = br.readLine();// 一次读入一行,直到读入null为文件结束
                while (data != null) {
                    boolean find = false;
                    for (String m : methods) {
                        if (data.contains(m)) {
                            find = true;
                            break;
                        }
                    }
                    if (find) {
                        prepareClasses.add(className.substring(1, className.length() - 1).replace('/', '.'));
                        System.out.println("prepare class: " + className);
                        break;
                    }
                    data = br.readLine(); // 接着读下一行
                }
                br.close();

            }
        } catch (Exception e) {
            throw new PatchException(e);
        }
        for (DexBackedMethod method:info.getModifiedMethods()) {
            prepareClasses.add(method.getDefiningClass().substring(1, method.getDefiningClass().length() - 1).replace("/", "."));
        }
        //增加modify的anatation到prepare
//        getMethodAnnotaionPrepareClasses(info,prepareClasses);
        return prepareClasses;
    }
 
开发者ID:alibaba,项目名称:atlas,代码行数:67,代码来源:ApkPatch.java


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