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


Java CPInfo类代码示例

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


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

示例1: checkMethod

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入依赖的package包/类
static void checkMethod(String cname, String mname, ConstantPool cp,
        Code_attribute code) throws ConstantPool.InvalidIndex {
    for (Instruction i : code.getInstructions()) {
        String iname = i.getMnemonic();
        if ("invokespecial".equals(iname)
                || "invokestatic".equals(iname)) {
            int idx = i.getByte(2);
            System.out.println("Verifying " + cname + ":" + mname +
                    " instruction:" + iname + " index @" + idx);
            CPInfo cpinfo = cp.get(idx);
            if (cpinfo instanceof ConstantPool.CONSTANT_Methodref_info) {
                throw new RuntimeException("unexpected CP type expected "
                        + "InterfaceMethodRef, got MethodRef, " + cname
                        + ", " + mname);
            }
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:LambdaAsm.java

示例2: convertConstantValue

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入依赖的package包/类
Object convertConstantValue(CPInfo info, String descriptor) throws ConstantPoolException {
    if (info instanceof CONSTANT_Integer_info) {
        if ("Z".equals(descriptor))
            return ((CONSTANT_Integer_info) info).value == 1;
        else
            return ((CONSTANT_Integer_info) info).value;
    } else if (info instanceof CONSTANT_Long_info) {
        return ((CONSTANT_Long_info) info).value;
    } else if (info instanceof CONSTANT_Float_info) {
        return ((CONSTANT_Float_info) info).value;
    } else if (info instanceof CONSTANT_Double_info) {
        return ((CONSTANT_Double_info) info).value;
    } else if (info instanceof CONSTANT_String_info) {
        return ((CONSTANT_String_info) info).getString();
    }
    throw new IllegalStateException(info.getClass().getName());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:CreateSymbols.java

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

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

示例5: translate

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入依赖的package包/类
ConstantPool translate(ConstantPool cp, Map<Object,Object> translations) {
    ConstantPool cp2 = (ConstantPool) translations.get(cp);
    if (cp2 == null) {
        ConstantPool.CPInfo[] pool2 = new ConstantPool.CPInfo[cp.size()];
        boolean eq = true;
        for (int i = 0; i < cp.size(); ) {
            ConstantPool.CPInfo cpInfo;
            try {
                cpInfo = cp.get(i);
            } catch (ConstantPool.InvalidIndex e) {
                throw new IllegalStateException(e);
            }
            ConstantPool.CPInfo cpInfo2 = translate(cpInfo, translations);
            eq &= (cpInfo == cpInfo2);
            pool2[i] = cpInfo2;
            if (cpInfo.getTag() != cpInfo2.getTag())
                throw new IllegalStateException();
            i += cpInfo.size();
        }

        if (eq)
            cp2 = cp;
        else
            cp2 = new ConstantPool(pool2);

        translations.put(cp, cp2);
    }
    return cp2;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:ClassTranslator.java

示例6: visitClass

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入依赖的package包/类
public CPInfo visitClass(CONSTANT_Class_info info, Map<Object, Object> translations) {
    CONSTANT_Class_info info2 = (CONSTANT_Class_info) translations.get(info);
    if (info2 == null) {
        ConstantPool cp2 = translate(info.cp, translations);
        if (cp2 == info.cp)
            info2 = info;
        else
            info2 = new CONSTANT_Class_info(cp2, info.name_index);
        translations.put(info, info2);
    }
    return info;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:ClassTranslator.java

示例7: visitDouble

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入依赖的package包/类
public CPInfo visitDouble(CONSTANT_Double_info info, Map<Object, Object> translations) {
    CONSTANT_Double_info info2 = (CONSTANT_Double_info) translations.get(info);
    if (info2 == null) {
        info2 = info;
        translations.put(info, info2);
    }
    return info;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:ClassTranslator.java

示例8: visitFieldref

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入依赖的package包/类
public CPInfo visitFieldref(CONSTANT_Fieldref_info info, Map<Object, Object> translations) {
    CONSTANT_Fieldref_info info2 = (CONSTANT_Fieldref_info) translations.get(info);
    if (info2 == null) {
        ConstantPool cp2 = translate(info.cp, translations);
        if (cp2 == info.cp)
            info2 = info;
        else
            info2 = new CONSTANT_Fieldref_info(cp2, info.class_index, info.name_and_type_index);
        translations.put(info, info2);
    }
    return info;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:ClassTranslator.java

示例9: visitFloat

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入依赖的package包/类
public CPInfo visitFloat(CONSTANT_Float_info info, Map<Object, Object> translations) {
    CONSTANT_Float_info info2 = (CONSTANT_Float_info) translations.get(info);
    if (info2 == null) {
        info2 = info;
        translations.put(info, info2);
    }
    return info;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:ClassTranslator.java

示例10: visitInteger

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入依赖的package包/类
public CPInfo visitInteger(CONSTANT_Integer_info info, Map<Object, Object> translations) {
    CONSTANT_Integer_info info2 = (CONSTANT_Integer_info) translations.get(info);
    if (info2 == null) {
        info2 = info;
        translations.put(info, info2);
    }
    return info;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:ClassTranslator.java

示例11: visitInterfaceMethodref

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入依赖的package包/类
public CPInfo visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Map<Object, Object> translations) {
    CONSTANT_InterfaceMethodref_info info2 = (CONSTANT_InterfaceMethodref_info) translations.get(info);
    if (info2 == null) {
        ConstantPool cp2 = translate(info.cp, translations);
        if (cp2 == info.cp)
            info2 = info;
        else
            info2 = new CONSTANT_InterfaceMethodref_info(cp2, info.class_index, info.name_and_type_index);
        translations.put(info, info2);
    }
    return info;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:ClassTranslator.java

示例12: visitInvokeDynamic

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入依赖的package包/类
public CPInfo visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Map<Object, Object> translations) {
    CONSTANT_InvokeDynamic_info info2 = (CONSTANT_InvokeDynamic_info) translations.get(info);
    if (info2 == null) {
        ConstantPool cp2 = translate(info.cp, translations);
        if (cp2 == info.cp) {
            info2 = info;
        } else {
            info2 = new CONSTANT_InvokeDynamic_info(cp2, info.bootstrap_method_attr_index, info.name_and_type_index);
        }
        translations.put(info, info2);
    }
    return info;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:ClassTranslator.java

示例13: visitLong

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入依赖的package包/类
public CPInfo visitLong(CONSTANT_Long_info info, Map<Object, Object> translations) {
    CONSTANT_Long_info info2 = (CONSTANT_Long_info) translations.get(info);
    if (info2 == null) {
        info2 = info;
        translations.put(info, info2);
    }
    return info;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:ClassTranslator.java

示例14: visitNameAndType

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入依赖的package包/类
public CPInfo visitNameAndType(CONSTANT_NameAndType_info info, Map<Object, Object> translations) {
    CONSTANT_NameAndType_info info2 = (CONSTANT_NameAndType_info) translations.get(info);
    if (info2 == null) {
        ConstantPool cp2 = translate(info.cp, translations);
        if (cp2 == info.cp)
            info2 = info;
        else
            info2 = new CONSTANT_NameAndType_info(cp2, info.name_index, info.type_index);
        translations.put(info, info2);
    }
    return info;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:ClassTranslator.java

示例15: visitMethodref

import com.sun.tools.classfile.ConstantPool.CPInfo; //导入依赖的package包/类
public CPInfo visitMethodref(CONSTANT_Methodref_info info, Map<Object, Object> translations) {
    CONSTANT_Methodref_info info2 = (CONSTANT_Methodref_info) translations.get(info);
    if (info2 == null) {
        ConstantPool cp2 = translate(info.cp, translations);
        if (cp2 == info.cp)
            info2 = info;
        else
            info2 = new CONSTANT_Methodref_info(cp2, info.class_index, info.name_and_type_index);
        translations.put(info, info2);
    }
    return info;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:ClassTranslator.java


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