Java Code Examples for com.sun.tools.classfile.Annotation#element_value_pair()

The following examples show how to use com.sun.tools.classfile.Annotation#element_value_pair() . 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: TestAnnotationInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void testElementValue(
        TestResult testResult,
        ClassFile classFile,
        Annotation.element_value element_value)
        throws ConstantPoolException {
    testTag(testResult, element_value.tag);
    Annotation ev = ((Annotation.Annotation_element_value) element_value).annotation_value;
    testResult.checkEquals(
            classFile.constant_pool.getUTF8Info(ev.type_index).value,
            String.format("L%s;", annotationName),
            "type_index");
    for (int i = 0; i < ev.num_element_value_pairs; ++i) {
        Annotation.element_value_pair pair = ev.element_value_pairs[i];
        Pair expectedPair = annotation.elementValues.get(i);
        expectedPair.elementValue.testElementValue(testResult, classFile, pair.value);
        testResult.checkEquals(
                classFile.constant_pool.getUTF8Info(pair.element_name_index).value,
                expectedPair.elementName,
                "element_name_index");
    }
}
 
Example 2
Source File: ClassReader.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void parseAnnotation(Annotation anno, Element p) {
    Element ea = new Element("Annotation");
    ea.setAttr("name", "" + x.getCpString(anno.type_index));
    for (Annotation.element_value_pair evp : anno.element_value_pairs) {
        Element evpe = new Element("Element");
        evpe.setAttr("tag", "" + evp.value.tag);
        evpe.setAttr("value", x.getCpString(evp.element_name_index));
        Element child = aev.visit(evp.value, evpe);
        if (child != null) {
            evpe.add(child);
        }
        ea.add(evpe);
    }
    ea.trimToSize();
    p.add(ea);
}
 
Example 3
Source File: ClassReader.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void parseAnnotation(Annotation anno, Element p) {
    Element ea = new Element("Annotation");
    ea.setAttr("name", "" + x.getCpString(anno.type_index));
    for (Annotation.element_value_pair evp : anno.element_value_pairs) {
        Element evpe = new Element("Element");
        evpe.setAttr("tag", "" + evp.value.tag);
        evpe.setAttr("value", x.getCpString(evp.element_name_index));
        Element child = aev.visit(evp.value, evpe);
        if (child != null) {
            evpe.add(child);
        }
        ea.add(evpe);
    }
    ea.trimToSize();
    p.add(ea);
}
 
Example 4
Source File: ClassReader.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void parseAnnotation(Annotation anno, Element p) {
    Element ea = new Element("Annotation");
    ea.setAttr("name", "" + x.getCpString(anno.type_index));
    for (Annotation.element_value_pair evp : anno.element_value_pairs) {
        Element evpe = new Element("Element");
        evpe.setAttr("tag", "" + evp.value.tag);
        evpe.setAttr("value", x.getCpString(evp.element_name_index));
        Element child = aev.visit(evp.value, evpe);
        if (child != null) {
            evpe.add(child);
        }
        ea.add(evpe);
    }
    ea.trimToSize();
    p.add(ea);
}
 
Example 5
Source File: ClassReader.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void parseAnnotation(Annotation anno, Element p) {
    Element ea = new Element("Annotation");
    ea.setAttr("name", "" + x.getCpString(anno.type_index));
    for (Annotation.element_value_pair evp : anno.element_value_pairs) {
        Element evpe = new Element("Element");
        evpe.setAttr("tag", "" + evp.value.tag);
        evpe.setAttr("value", x.getCpString(evp.element_name_index));
        Element child = aev.visit(evp.value, evpe);
        if (child != null) {
            evpe.add(child);
        }
        ea.add(evpe);
    }
    ea.trimToSize();
    p.add(ea);
}
 
Example 6
Source File: ClassReader.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitAnnotation(Annotation_element_value a, Element p) {
    Element el = new Element("Annotation");
    Annotation anno = a.annotation_value;
    for (Annotation.element_value_pair evp : anno.element_value_pairs) {
        Element child = visit(evp.value, el);
        if (child != null) {
            el.add(child);
        }
    }
    el.trimToSize();
    return el;
}
 
Example 7
Source File: StringSharingPlugin.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void scanAnnotation(Annotation annotation,
        Set<Integer> utf8Descriptors) throws Exception {
    utf8Descriptors.add(annotation.type_index);
    for (Annotation.element_value_pair evp : annotation.element_value_pairs) {
        utf8Descriptors.add(evp.element_name_index);
        scanElementValue(evp.value, utf8Descriptors);
    }
}
 
Example 8
Source File: ClassReader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitAnnotation(Annotation_element_value a, Element p) {
    Element el = new Element("Annotation");
    Annotation anno = a.annotation_value;
    for (Annotation.element_value_pair evp : anno.element_value_pairs) {
        Element child = visit(evp.value, el);
        if (child != null) {
            el.add(child);
        }
    }
    el.trimToSize();
    return el;
}
 
Example 9
Source File: ClassReader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitAnnotation(Annotation_element_value a, Element p) {
    Element el = new Element("Annotation");
    Annotation anno = a.annotation_value;
    for (Annotation.element_value_pair evp : anno.element_value_pairs) {
        Element child = visit(evp.value, el);
        if (child != null) {
            el.add(child);
        }
    }
    el.trimToSize();
    return el;
}
 
Example 10
Source File: ClassReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitAnnotation(Annotation_element_value a, Element p) {
    Element el = new Element("Annotation");
    Annotation anno = a.annotation_value;
    for (Annotation.element_value_pair evp : anno.element_value_pairs) {
        Element child = visit(evp.value, el);
        if (child != null) {
            el.add(child);
        }
    }
    el.trimToSize();
    return el;
}
 
Example 11
Source File: ClassReader.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitAnnotation(Annotation_element_value a, Element p) {
    Element el = new Element("Annotation");
    Annotation anno = a.annotation_value;
    for (Annotation.element_value_pair evp : anno.element_value_pairs) {
        Element child = visit(evp.value, el);
        if (child != null) {
            el.add(child);
        }
    }
    el.trimToSize();
    return el;
}
 
Example 12
Source File: ClassReader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitAnnotation(Annotation_element_value a, Element p) {
    Element el = new Element("Annotation");
    Annotation anno = a.annotation_value;
    for (Annotation.element_value_pair evp : anno.element_value_pairs) {
        Element child = visit(evp.value, el);
        if (child != null) {
            el.add(child);
        }
    }
    el.trimToSize();
    return el;
}
 
Example 13
Source File: ClassReader.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitAnnotation(Annotation_element_value a, Element p) {
    Element el = new Element("Annotation");
    Annotation anno = a.annotation_value;
    for (Annotation.element_value_pair evp : anno.element_value_pairs) {
        Element child = visit(evp.value, el);
        if (child != null) {
            el.add(child);
        }
    }
    el.trimToSize();
    return el;
}
 
Example 14
Source File: AnnotationWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void write(Annotation.element_value_pair pair, boolean resolveIndices) {
    writeIndex(pair.element_name_index, resolveIndices);
    print("=");
    write(pair.value, resolveIndices);
}
 
Example 15
Source File: AnnotationWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void write(Annotation.element_value_pair pair) {
    write(pair, false);
}
 
Example 16
Source File: AnnotationWriter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void write(Annotation.element_value_pair pair, boolean resolveIndices) {
    writeIndex(pair.element_name_index, resolveIndices);
    print("=");
    write(pair.value, resolveIndices);
}
 
Example 17
Source File: AnnotationWriter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void write(Annotation.element_value_pair pair) {
    write(pair, false);
}
 
Example 18
Source File: AnnotationWriter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void write(Annotation.element_value_pair pair) {
    write(pair, false);
}
 
Example 19
Source File: AnnotationWriter.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void write(Annotation.element_value_pair pair) {
    write(pair, false);
}
 
Example 20
Source File: AnnotationWriter.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public void write(Annotation.element_value_pair pair, boolean resolveIndices) {
    writeIndex(pair.element_name_index, resolveIndices);
    print("=");
    write(pair.value, resolveIndices);
}