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


Java Annotations.size方法代码示例

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


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

示例1: AnnotationSetItem

import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
 * Constructs an instance.
 *
 * @param annotations {@code non-null;} set of annotations
 * @param dexFile {@code non-null;} dex output
 */
public AnnotationSetItem(Annotations annotations, DexFile dexFile) {
    super(ALIGNMENT, writeSize(annotations));

    this.annotations = annotations;
    this.items = new AnnotationItem[annotations.size()];

    int at = 0;
    for (Annotation a : annotations.getAnnotations()) {
        items[at] = new AnnotationItem(a, dexFile);
        at++;
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:19,代码来源:AnnotationSetItem.java

示例2: writeSize

import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
 * Gets the write size for the given set.
 *
 * @param annotations {@code non-null;} the set
 * @return {@code > 0;} the write size
 */
private static int writeSize(Annotations annotations) {
    // This includes an int size at the start of the list.

    try {
        return (annotations.size() * ENTRY_WRITE_SIZE) + 4;
    } catch (NullPointerException ex) {
        // Elucidate the exception.
        throw new NullPointerException("list == null");
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:17,代码来源:AnnotationSetItem.java

示例3: translate0

import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
 * Performs the main act of translation. This method is separated
 * from {@link #translate} just to keep things a bit simpler in
 * terms of exception handling.
 *
 * @param filePath {@code non-null;} the file path for the class,
 * excluding any base directory specification
 * @param bytes {@code non-null;} contents of the file
 * @param cfOptions options for class translation
 * @param dexOptions options for dex output
 * @return {@code non-null;} the translated class
 */
private static ClassDefItem translate0(String filePath, byte[] bytes,
        CfOptions cfOptions, DexOptions dexOptions) {
    DirectClassFile cf =
        new DirectClassFile(bytes, filePath, cfOptions.strictNameCheck);

    cf.setAttributeFactory(StdAttributeFactory.THE_ONE);
    cf.getMagic();

    OptimizerOptions.loadOptimizeLists(cfOptions.optimizeListFile,
            cfOptions.dontOptimizeListFile);

    // Build up a class to output.

    CstType thisClass = cf.getThisClass();
    int classAccessFlags = cf.getAccessFlags() & ~AccessFlags.ACC_SUPER;
    CstString sourceFile = (cfOptions.positionInfo == PositionList.NONE) ? null :
        cf.getSourceFile();
    ClassDefItem out =
        new ClassDefItem(thisClass, classAccessFlags,
                cf.getSuperclass(), cf.getInterfaces(), sourceFile);

    Annotations classAnnotations =
        AttributeTranslator.getClassAnnotations(cf, cfOptions);
    if (classAnnotations.size() != 0) {
        out.setClassAnnotations(classAnnotations);
    }

    processFields(cf, out);
    processMethods(cf, cfOptions, dexOptions, out);

    return out;
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:45,代码来源:CfTranslator.java

示例4: AnnotationSetItem

import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
 * Constructs an instance.
 *
 * @param annotations {@code non-null;} set of annotations
 */
public AnnotationSetItem(Annotations annotations) {
    super(ALIGNMENT, writeSize(annotations));

    this.annotations = annotations;
    this.items = new AnnotationItem[annotations.size()];

    int at = 0;
    for (Annotation a : annotations.getAnnotations()) {
        items[at] = new AnnotationItem(a);
        at++;
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:18,代码来源:AnnotationSetItem.java

示例5: translate0

import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
 * Performs the main act of translation. This method is separated
 * from {@link #translate} just to keep things a bit simpler in
 * terms of exception handling.
 *
 * @param cf {@code non-null;} the class file
 * @param bytes {@code non-null;} contents of the file
 * @param cfOptions options for class translation
 * @param dexOptions options for dex output
 * @param dexFile {@code non-null;} dex output
 * @return {@code non-null;} the translated class
 */
private static ClassDefItem translate0(DirectClassFile cf, byte[] bytes,
        CfOptions cfOptions, DexOptions dexOptions, DexFile dexFile) {

    OptimizerOptions.loadOptimizeLists(cfOptions.optimizeListFile,
            cfOptions.dontOptimizeListFile);

    // Build up a class to output.

    CstType thisClass = cf.getThisClass();
    int classAccessFlags = cf.getAccessFlags() & ~AccessFlags.ACC_SUPER;
    CstString sourceFile = (cfOptions.positionInfo == PositionList.NONE) ? null :
        cf.getSourceFile();
    ClassDefItem out =
        new ClassDefItem(thisClass, classAccessFlags,
                cf.getSuperclass(), cf.getInterfaces(), sourceFile);

    Annotations classAnnotations =
        AttributeTranslator.getClassAnnotations(cf, cfOptions);
    if (classAnnotations.size() != 0) {
        out.setClassAnnotations(classAnnotations, dexFile);
    }

    FieldIdsSection fieldIdsSection = dexFile.getFieldIds();
    MethodIdsSection methodIdsSection = dexFile.getMethodIds();
    processFields(cf, out, dexFile);
    processMethods(cf, cfOptions, dexOptions, out, dexFile);

    // intern constant pool method, field and type references
    ConstantPool constantPool = cf.getConstantPool();
    int constantPoolSize = constantPool.size();

    for (int i = 0; i < constantPoolSize; i++) {
        Constant constant = constantPool.getOrNull(i);
        if (constant instanceof CstMethodRef) {
            methodIdsSection.intern((CstBaseMethodRef) constant);
        } else if (constant instanceof CstInterfaceMethodRef) {
            methodIdsSection.intern(((CstInterfaceMethodRef) constant).toMethodRef());
        } else if (constant instanceof CstFieldRef) {
            fieldIdsSection.intern((CstFieldRef) constant);
        } else if (constant instanceof CstEnumRef) {
            fieldIdsSection.intern(((CstEnumRef) constant).getFieldRef());
        }
    }

    return out;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:59,代码来源:CfTranslator.java

示例6: translate0

import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
 * Performs the main act of translation. This method is separated
 * from {@link #translate} just to keep things a bit simpler in
 * terms of exception handling.
 *
 * @param filePath {@code non-null;} the file path for the class,
 * excluding any base directory specification
 * @param bytes {@code non-null;} contents of the file
 * @param cfOptions options for class translation
 * @param dexOptions options for dex output
 * @param optimizerOptions options for the optimizer
 * @return {@code non-null;} the translated class
 */
private static ClassDefItem translate0(DirectClassFile cf, byte[] bytes,
        CfOptions cfOptions, DexOptions dexOptions, OptimizerOptions optimizerOptions, DexFile dexFile) {

    optimizerOptions.loadOptimizeLists(cfOptions.optimizeListFile,
            cfOptions.dontOptimizeListFile);

    // Build up a class to output.

    CstType thisClass = cf.getThisClass();
    int classAccessFlags = cf.getAccessFlags() & ~AccessFlags.ACC_SUPER;
    CstString sourceFile = (cfOptions.positionInfo == PositionList.NONE) ? null :
        cf.getSourceFile();
    ClassDefItem out =
        new ClassDefItem(thisClass, classAccessFlags,
                cf.getSuperclass(), cf.getInterfaces(), sourceFile);

    Annotations classAnnotations =
        AttributeTranslator.getClassAnnotations(cf, cfOptions);
    if (classAnnotations.size() != 0) {
        out.setClassAnnotations(classAnnotations);
    }

    FieldIdsSection fieldIdsSection = dexFile.getFieldIds();
    MethodIdsSection methodIdsSection = dexFile.getMethodIds();
    TypeIdsSection typeIdsSection = dexFile.getTypeIds();
    processFields(cf, out, fieldIdsSection);
    processMethods(cf, cfOptions, dexOptions, optimizerOptions, out, methodIdsSection);

    // intern constant pool method, field and type references
    ConstantPool constantPool = cf.getConstantPool();
    int constantPoolSize = constantPool.size();

    for (int i = 0; i < constantPoolSize; i++) {
        Constant constant = constantPool.getOrNull(i);
        if (constant instanceof CstMethodRef) {
            methodIdsSection.intern((CstBaseMethodRef) constant);
        } else if (constant instanceof CstInterfaceMethodRef) {
            methodIdsSection.intern(((CstInterfaceMethodRef) constant).toMethodRef());
        } else if (constant instanceof CstFieldRef) {
            fieldIdsSection.intern((CstFieldRef) constant);
        } else if (constant instanceof CstEnumRef) {
            fieldIdsSection.intern(((CstEnumRef) constant).getFieldRef());
        } else if (constant instanceof CstType) {
            typeIdsSection.intern((CstType) constant);
        }
    }

    return out;
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:63,代码来源:CfTranslator.java

示例7: translate0

import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
 * Performs the main act of translation. This method is separated
 * from {@link #translate} just to keep things a bit simpler in
 * terms of exception handling.
 *
 *
 * @param context
 * @param cf {@code non-null;} the class file
 * @param bytes {@code non-null;} contents of the file
 * @param cfOptions options for class translation
 * @param dexOptions options for dex output
 * @param dexFile {@code non-null;} dex output
 * @return {@code non-null;} the translated class
 */
private static ClassDefItem translate0(DxContext context, DirectClassFile cf, byte[] bytes,
                                       CfOptions cfOptions, DexOptions dexOptions, DexFile dexFile) {

    context.optimizerOptions.loadOptimizeLists(cfOptions.optimizeListFile,
            cfOptions.dontOptimizeListFile);

    // Build up a class to output.

    CstType thisClass = cf.getThisClass();
    int classAccessFlags = cf.getAccessFlags() & ~AccessFlags.ACC_SUPER;
    CstString sourceFile = (cfOptions.positionInfo == PositionList.NONE) ? null :
        cf.getSourceFile();
    ClassDefItem out =
        new ClassDefItem(thisClass, classAccessFlags,
                cf.getSuperclass(), cf.getInterfaces(), sourceFile);

    Annotations classAnnotations =
        AttributeTranslator.getClassAnnotations(cf, cfOptions);
    if (classAnnotations.size() != 0) {
        out.setClassAnnotations(classAnnotations, dexFile);
    }

    FieldIdsSection fieldIdsSection = dexFile.getFieldIds();
    MethodIdsSection methodIdsSection = dexFile.getMethodIds();
    processFields(cf, out, dexFile);
    processMethods(context, cf, cfOptions, dexOptions, out, dexFile);

    // intern constant pool method, field and type references
    ConstantPool constantPool = cf.getConstantPool();
    int constantPoolSize = constantPool.size();

    for (int i = 0; i < constantPoolSize; i++) {
        Constant constant = constantPool.getOrNull(i);
        if (constant instanceof CstMethodRef) {
            methodIdsSection.intern((CstBaseMethodRef) constant);
        } else if (constant instanceof CstInterfaceMethodRef) {
            methodIdsSection.intern(((CstInterfaceMethodRef) constant).toMethodRef());
        } else if (constant instanceof CstFieldRef) {
            fieldIdsSection.intern((CstFieldRef) constant);
        } else if (constant instanceof CstEnumRef) {
            fieldIdsSection.intern(((CstEnumRef) constant).getFieldRef());
        }
    }

    return out;
}
 
开发者ID:facebook,项目名称:buck,代码行数:61,代码来源:CfTranslator.java


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