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


Java CPInfo.size方法代码示例

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


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

示例1: checkReferences

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入方法依赖的package包/类
void checkReferences() throws IOException, ConstantPoolException {
    File testClasses = new File(System.getProperty("test.classes"));
    File file = new File(testClasses,
            CPoolRefClassContainingInlinedCts.class.getName() + ".class");
    ClassFile classFile = ClassFile.read(file);
    int i = 1;
    CPInfo cpInfo;
    while (i < classFile.constant_pool.size()) {
        cpInfo = classFile.constant_pool.get(i);
        if (cpInfo instanceof CONSTANT_Class_info) {
            checkClassName(((CONSTANT_Class_info)cpInfo).getName());
        }
        i += cpInfo.size();
    }
    if (numberOfReferencedClassesToBeChecked != 16) {
        throw new AssertionError("Class reference missing in the constant pool");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:CPoolRefClassContainingInlinedCts.java

示例2: checkReferences

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入方法依赖的package包/类
void checkReferences() throws IOException, ConstantPoolException {
    File testClasses = new File(System.getProperty("test.classes"));
    File file = new File(testClasses,
            CPoolRefClassContainingInlinedCts.class.getName() + ".class");
    ClassFile classFile = ClassFile.read(file);
    int i = 1;
    CPInfo cpInfo;
    while (i < classFile.constant_pool.size()) {
        cpInfo = classFile.constant_pool.get(i);
        if (cpInfo instanceof CONSTANT_Class_info) {
            checkClassName(((CONSTANT_Class_info)cpInfo).getName());
        }
        i += cpInfo.size();
    }
    if (numberOfReferencedClassesToBeChecked != 8) {
        throw new AssertionError("Class reference missing in the constant pool");
    }
}
 
开发者ID:infobip,项目名称:infobip-open-jdk-8,代码行数:19,代码来源:CPoolRefClassContainingInlinedCts.java

示例3: addToCP

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入方法依赖的package包/类
private static int addToCP(List<CPInfo> constantPool, CPInfo entry) {
    int result = constantPool.size();

    constantPool.add(entry);

    if (entry.size() > 1) {
        constantPool.add(null);
    }

    return result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:CreateSymbols.java

示例4: addModuleResolutionAttribute

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入方法依赖的package包/类
private void addModuleResolutionAttribute(Path classfile, int resolution_flags) throws Exception {
    ClassFile cf = ClassFile.read(classfile);
    Attributes attrs = cf.attributes;
    List<CPInfo> cpData = new ArrayList<>();
    cpData.add(null);
    for (CPInfo info : cf.constant_pool.entries()) {
        cpData.add(info);
        if (info.size() == 2)
            cpData.add(null);
    }
    cpData.add(new CONSTANT_Utf8_info(Attribute.ModuleResolution));
    ConstantPool newCP = new ConstantPool(cpData.toArray(new CPInfo[0]));
    ModuleResolution_attribute res = new ModuleResolution_attribute(newCP, resolution_flags);
    Map<String, Attribute> newAttributeMap = new HashMap<>(attrs.map);
    newAttributeMap.put(Attribute.ModuleResolution, res);
    Attributes newAttrs = new Attributes(newAttributeMap);
    ClassFile newCF = new ClassFile(cf.magic,
                                    cf.minor_version,
                                    cf.major_version,
                                    newCP,
                                    cf.access_flags,
                                    cf.this_class,
                                    cf.super_class,
                                    cf.interfaces,
                                    cf.fields,
                                    cf.methods,
                                    newAttrs);
    try (OutputStream out = Files.newOutputStream(classfile)) {
        new ClassWriter().write(newCF, out);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:IncubatingTest.java


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