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


Java MethodList.size方法代码示例

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


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

示例1: addDependencies

import com.android.dx.cf.iface.MethodList; //导入方法依赖的package包/类
private void addDependencies(DirectClassFile classFile) {
    for (Constant constant : classFile.getConstantPool().getEntries()) {
        if (constant instanceof CstType) {
            checkDescriptor(((CstType) constant).getClassType().getDescriptor());
        } else if (constant instanceof CstFieldRef) {
            checkDescriptor(((CstFieldRef) constant).getType().getDescriptor());
        } else if (constant instanceof CstBaseMethodRef) {
            checkPrototype(((CstBaseMethodRef) constant).getPrototype());
        }
    }
    FieldList fields = classFile.getFields();
    int nbField = fields.size();
    for (int i = 0; i < nbField; i++) {
      checkDescriptor(fields.get(i).getDescriptor().getString());
    }
    MethodList methods = classFile.getMethods();
    int nbMethods = methods.size();
    for (int i = 0; i < nbMethods; i++) {
      checkPrototype(Prototype.intern(methods.get(i).getDescriptor().getString()));
    }
}
 
开发者ID:dodola,项目名称:RocooFix,代码行数:22,代码来源:ClassReferenceListBuilder.java

示例2: addDependencies

import com.android.dx.cf.iface.MethodList; //导入方法依赖的package包/类
private void addDependencies(DirectClassFile classFile) {
    for (Constant constant : classFile.getConstantPool().getEntries()) {
        if (constant instanceof CstType) {
            checkDescriptor(((CstType) constant).getClassType().getDescriptor());
        } else if (constant instanceof CstFieldRef) {
            checkDescriptor(((CstFieldRef) constant).getType().getDescriptor());
        } else if (constant instanceof CstBaseMethodRef) {
            checkPrototype(((CstBaseMethodRef) constant).getPrototype());
        }
    }

    FieldList fields = classFile.getFields();
    int nbField = fields.size();
    for (int i = 0; i < nbField; i++) {
      checkDescriptor(fields.get(i).getDescriptor().getString());
    }

    MethodList methods = classFile.getMethods();
    int nbMethods = methods.size();
    for (int i = 0; i < nbMethods; i++) {
      checkPrototype(Prototype.intern(methods.get(i).getDescriptor().getString()));
    }
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:24,代码来源:ClassReferenceListBuilder.java

示例3: translateAnnotationDefaults

import com.android.dx.cf.iface.MethodList; //导入方法依赖的package包/类
/**
 * Gets the {@code AnnotationDefault} attributes out of a
 * given class, if any, reforming them as an
 * {@code AnnotationDefault} annotation.
 *
 * @param cf {@code non-null;} the class in question
 * @return {@code null-ok;} an appropriately-constructed
 * {@code AnnotationDefault} annotation, if there were any
 * annotation defaults in the class, or {@code null} if not
 */
private static Annotation translateAnnotationDefaults(DirectClassFile cf) {
    CstType thisClass = cf.getThisClass();
    MethodList methods = cf.getMethods();
    int sz = methods.size();
    Annotation result =
        new Annotation(thisClass, AnnotationVisibility.EMBEDDED);
    boolean any = false;

    for (int i = 0; i < sz; i++) {
        Method one = methods.get(i);
        AttributeList attribs = one.getAttributes();
        AttAnnotationDefault oneDefault = (AttAnnotationDefault)
            attribs.findFirst(AttAnnotationDefault.ATTRIBUTE_NAME);

        if (oneDefault != null) {
            NameValuePair pair = new NameValuePair(
                    one.getNat().getName(),
                    oneDefault.getValue());
            result.add(pair);
            any = true;
        }
    }

    if (! any) {
        return null;
    }

    result.setImmutable();
    return AnnotationUtils.makeAnnotationDefault(result);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:41,代码来源:AttributeTranslator.java

示例4: keepAnnotated

import com.android.dx.cf.iface.MethodList; //导入方法依赖的package包/类
/**
 * Keep classes annotated with runtime annotations.
 */
private void keepAnnotated(Path path) throws FileNotFoundException {
    for (ClassPathElement element : path.getElements()) {
        forClazz:
            for (String name : element.list()) {
                if (name.endsWith(CLASS_EXTENSION)) {
                    DirectClassFile clazz = path.getClass(name);
                    if (hasRuntimeVisibleAnnotation(clazz)) {
                        filesToKeep.add(name);
                    } else {
                        MethodList methods = clazz.getMethods();
                        for (int i = 0; i<methods.size(); i++) {
                            if (hasRuntimeVisibleAnnotation(methods.get(i))) {
                                filesToKeep.add(name);
                                continue forClazz;
                            }
                        }
                        FieldList fields = clazz.getFields();
                        for (int i = 0; i<fields.size(); i++) {
                            if (hasRuntimeVisibleAnnotation(fields.get(i))) {
                                filesToKeep.add(name);
                                continue forClazz;
                            }
                        }
                    }
                }
            }
    }
}
 
开发者ID:dodola,项目名称:RocooFix,代码行数:32,代码来源:MainDexListBuilder.java

示例5: process

import com.android.dx.cf.iface.MethodList; //导入方法依赖的package包/类
/**
 * Process the given Java Class file and add the classes to the given root.
 * 
 * @param cf
 *            the class file to process
 * @param root
 *            the root element to append the classes to
 * @param referencedTypes
 *            will be filled with the types references in this class file
 * @return the class name for the DEXMLVM file
 */
private TypePlusSuperType process(DirectClassFile cf, Element root,
        Map<String, ReferenceKind> referencedTypes) {
    boolean skeletonOnly = hasSkeletonOnlyAnnotation(cf.getAttributes());
    Element classElement = processClass(cf, root, referencedTypes);
    processFields(cf.getFields(), classElement, referencedTypes, skeletonOnly);

    MethodList methods = cf.getMethods();
    int sz = methods.size();

    for (int i = 0; i < sz; i++) {
        Method one = methods.get(i);

        if (hasIgnoreAnnotation(one.getAttributes())) {
            // If this method has the @XMLVMIgnore annotation, we just
            // simply ignore it.
            continue;
        }

        if (skeletonOnly
                && (one.getAccessFlags() & (AccessFlags.ACC_PRIVATE | AccessFlags.ACC_SYNTHETIC)) != 0) {
            // We only want to generate skeletons. This method is private or
            // synthetic so simply ignore it.
            continue;
        }

        try {
            processMethod(one, cf, classElement, referencedTypes, skeletonOnly);
        } catch (RuntimeException ex) {
            String msg = "...while processing " + one.getName().toHuman() + " "
                    + one.getDescriptor().toHuman();
            throw ExceptionWithContext.withContext(ex, msg);
        }
    }

    String className = classElement.getAttributeValue("name");
    String superClassName = classElement.getAttributeValue("extends");
    return new TypePlusSuperType(className, superClassName);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:50,代码来源:DEXmlvmOutputProcess.java

示例6: getAllDependencies

import com.android.dx.cf.iface.MethodList; //导入方法依赖的package包/类
/**
 * Adds all dependencies of the given class to classDeps.
 */
private static void getAllDependencies(byte[] bytes, String relativePath,
        Dependencies.ClassDeps classDeps) {

    Log.debug(TAG, relativePath);
    DirectClassFile classFile = new DirectClassFile(bytes, relativePath, false);
    classFile.setAttributeFactory(StdAttributeFactory.THE_ONE);
    try {
        classFile.getMagic();
    } catch (ParseException ex) {
        Log.warn(TAG, "Put to red-list as it couldn't be parsed: " + relativePath);
        BAD_CLASSES.add(classDeps.getClassName());
        return;
    }

    String superClassName = "";
    // This can happen for java.lang.Object.
    if (classFile.getSuperclass() != null) {
        superClassName = Util.parseClassName(
                classFile.getSuperclass().getClassType().getClassName()).toString();
    }

    // Super Class
    if (!superClassName.isEmpty()) {
        Set<String> superClass = new HashSet<String>();
        superClass.add(superClassName.replace('/', '.'));
        classDeps.getMethodDeps("SUPER").addDependency(superClassName.replace('/', '.'), "");
    }

    // Interfaces
    TypeList interfaces = classFile.getInterfaces();
    if (interfaces.size() > 0) {
        Set<String> interfaceList = new HashSet<String>();
        for (int i = 0; i < interfaces.size(); ++i) {
            interfaceList.add(Util.parseClassName(interfaces.getType(i).getClassName())
                    .toString());
            classDeps.getMethodDeps("INTERFACES").addDependency(
                    Util.parseClassName(interfaces.getType(i).getClassName()).toString(), "");
        }
    }

    // Methods
    MethodList methods = classFile.getMethods();
    for (int i = 0; i < methods.size(); i++) {
        Method method = methods.get(i);
        // CstMethodRef methodRef = new
        // CstMethodRef(method.getDefiningClass(), method.getNat());
        // We shouldn't need to go through the signature. If the class is
        // not used in the code block, we can ignore it.
        // processSignature(methodRef, dependencies);
        processCode(getCode(method, classFile),
                classDeps.getMethodDeps(method.getName().toHuman()));
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:57,代码来源:JDKAnalyzer.java


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