Java Code Examples for com.sun.tools.classfile.ConstantPool#CONSTANT_Long_info

The following examples show how to use com.sun.tools.classfile.ConstantPool#CONSTANT_Long_info . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StringSharingPlugin.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void scanConstantPool(Set<Integer> utf8Descriptors)
        throws Exception {
    for (int i = 1; i < cf.constant_pool.size(); i++) {
        try {
            ConstantPool.CPInfo info = cf.constant_pool.get(i);
            if (info instanceof ConstantPool.CONSTANT_NameAndType_info) {
                ConstantPool.CONSTANT_NameAndType_info nameAndType
                        = (ConstantPool.CONSTANT_NameAndType_info) info;
                utf8Descriptors.add(nameAndType.type_index);
            }
            if (info instanceof ConstantPool.CONSTANT_MethodType_info) {
                ConstantPool.CONSTANT_MethodType_info mt
                        = (ConstantPool.CONSTANT_MethodType_info) info;
                utf8Descriptors.add(mt.descriptor_index);
            }

            if (info instanceof ConstantPool.CONSTANT_Double_info
                    || info instanceof ConstantPool.CONSTANT_Long_info) {
                i++;
            }
        } catch (ConstantPool.InvalidIndex ex) {
            throw new IOException(ex);
        }
    }
}
 
Example 2
Source File: AnnotationDefaultVerifier.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void testElementValue(
        TestResult testCase,
        ClassFile classFile,
        Annotation.element_value element_value,
        String[] values) throws ConstantPool.InvalidIndex {
    Annotation.Primitive_element_value ev =
            (Annotation.Primitive_element_value) element_value;
    ConstantPool.CONSTANT_Long_info info =
            (ConstantPool.CONSTANT_Long_info)
                    classFile.constant_pool.get(ev.const_value_index);
    testCase.checkEquals(info.value, Long.parseLong(values[0]), "const_value_index");
}
 
Example 3
Source File: TestAnnotationInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void testElementValue(TestResult testResult,
                             ClassFile classFile,
                             Annotation.element_value element_value)
        throws ConstantPool.InvalidIndex {
    testTag(testResult, element_value.tag);
    Annotation.Primitive_element_value ev =
            (Annotation.Primitive_element_value) element_value;
    ConstantPool.CONSTANT_Long_info info =
            (ConstantPool.CONSTANT_Long_info) classFile.constant_pool.get(ev.const_value_index);
    testResult.checkEquals(info.value, value, "const_value_index");
}
 
Example 4
Source File: CPSelector.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Void visitLong(ConstantPool.CONSTANT_Long_info info, CPEntries p) {
    return null;
}