• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MethodList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



MethodList类属于com.android.dx.cf.iface包,在下文中一共展示了MethodList类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: convert

import com.android.dx.cf.iface.MethodList; //导入依赖的package包/类
/**
 * Converts a {@link ConcreteMethod} to a {@link RopMethod}.
 *
 * @param method {@code non-null;} method to convert
 * @param advice {@code non-null;} translation advice to use
 * @param methods {@code non-null;} list of methods defined by the class
 *     that defines {@code method}.
 * @return {@code non-null;} the converted instance
 */
public static RopMethod convert(ConcreteMethod method,
        TranslationAdvice advice, MethodList methods) {
    try {
        Ropper r = new Ropper(method, advice, methods);
        r.doit();
        return r.getRopMethod();
    } catch (SimException ex) {
        ex.addContext("...while working on method " +
                      method.getNat().toHuman());
        throw ex;
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:22,代码来源:Ropper.java


示例5: Ropper

import com.android.dx.cf.iface.MethodList; //导入依赖的package包/类
/**
 * Constructs an instance. This class is not publicly instantiable; use
 * {@link #convert}.
 *
 * @param method {@code non-null;} method to convert
 * @param advice {@code non-null;} translation advice to use
 * @param methods {@code non-null;} list of methods defined by the class
 *     that defines {@code method}.
 */
private Ropper(ConcreteMethod method, TranslationAdvice advice, MethodList methods) {
    if (method == null) {
        throw new NullPointerException("method == null");
    }

    if (advice == null) {
        throw new NullPointerException("advice == null");
    }

    this.method = method;
    this.blocks = BasicBlocker.identifyBlocks(method);
    this.maxLabel = blocks.getMaxLabel();
    this.maxLocals = method.getMaxLocals();
    this.machine = new RopperMachine(this, method, advice, methods);
    this.sim = new Simulator(machine, method);
    this.startFrames = new Frame[maxLabel];
    this.subroutines = new Subroutine[maxLabel];

    /*
     * The "* 2 + 10" below is to conservatively believe that every
     * block is an exception handler target and should also
     * take care of enough other possible extra overhead such that
     * the underlying array is unlikely to need resizing.
     */
    this.result = new ArrayList<BasicBlock>(blocks.size() * 2 + 10);
    this.resultSubroutines =
        new ArrayList<IntList>(blocks.size() * 2 + 10);

    this.catchInfos = new CatchInfo[maxLabel];
    this.synchNeedsExceptionHandler = false;

    /*
     * Set up the first stack frame with the right limits, but leave it
     * empty here (to be filled in outside of the constructor).
     */
    startFrames[0] = new Frame(maxLocals, method.getMaxStack());
    exceptionSetupLabelAllocator = new ExceptionSetupLabelAllocator();
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:48,代码来源:Ropper.java


示例6: RopperMachine

import com.android.dx.cf.iface.MethodList; //导入依赖的package包/类
/**
 * Constructs an instance.
 *
 * @param ropper {@code non-null;} ropper controlling this instance
 * @param method {@code non-null;} method being converted
 * @param advice {@code non-null;} translation advice to use
 * @param methods {@code non-null;} list of methods defined by the class
 *     that defines {@code method}.
 */
public RopperMachine(Ropper ropper, ConcreteMethod method,
        TranslationAdvice advice, MethodList methods) {
    super(method.getEffectiveDescriptor());

    if (methods == null) {
        throw new NullPointerException("methods == null");
    }

    if (ropper == null) {
        throw new NullPointerException("ropper == null");
    }

    if (advice == null) {
        throw new NullPointerException("advice == null");
    }

    this.ropper = ropper;
    this.method = method;
    this.methods = methods;
    this.advice = advice;
    this.maxLocals = method.getMaxLocals();
    this.insns = new ArrayList<Insn>(25);
    this.catches = null;
    this.catchesUsed = false;
    this.returns = false;
    this.primarySuccessorIndex = -1;
    this.extraBlockCount = 0;
    this.blockCanThrow = false;
    this.returnOp = null;
    this.returnPosition = null;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:41,代码来源:RopperMachine.java


示例7: 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


示例8: 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


示例9: getMethods

import com.android.dx.cf.iface.MethodList; //导入依赖的package包/类
/** {@inheritDoc} */
public MethodList getMethods() {
    parseToEndIfNecessary();
    return methods;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:6,代码来源:DirectClassFile.java


示例10: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AssertsEnabled类代码示例发布时间:2022-05-23
下一篇:
Java TIntIntIterator类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap