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

The following examples show how to use com.sun.tools.classfile.Annotation#element_value() . 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: ClassReader.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitArray(Array_element_value a, Element p) {
 Element el = new Element("Array");
    for (Annotation.element_value v : a.values) {
       Element child = visit(v, el);
       if (child != null) {
           el.add(child);
       }
    }
    el.trimToSize();
    return el;
}
 
Example 2
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 ConstantPoolException {
    testTag(testResult, element_value.tag);
    Annotation.Class_element_value ev = (Annotation.Class_element_value) element_value;
    String expectedClassName = className.replace(".class", "");
    expectedClassName = mappedClassName.getOrDefault(expectedClassName,
            String.format("Ljava/lang/%s;", expectedClassName));
    testResult.checkEquals(
            classFile.constant_pool.getUTF8Info(ev.class_info_index).value,
            expectedClassName, "class_info_index : " + expectedClassName);
}
 
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 ConstantPoolException {
    testTag(testResult, element_value.tag);
    Annotation.Primitive_element_value ev =
            (Annotation.Primitive_element_value) element_value;
    ConstantPool.CONSTANT_Utf8_info info =
            (ConstantPool.CONSTANT_Utf8_info) classFile.constant_pool.get(ev.const_value_index);
    testResult.checkEquals(info.value, value, "const_value_index");
}
 
Example 4
Source File: ClassReader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitArray(Array_element_value a, Element p) {
 Element el = new Element("Array");
    for (Annotation.element_value v : a.values) {
       Element child = visit(v, el);
       if (child != null) {
           el.add(child);
       }
    }
    el.trimToSize();
    return el;
}
 
Example 5
Source File: ClassReader.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitArray(Array_element_value a, Element p) {
 Element el = new Element("Array");
    for (Annotation.element_value v : a.values) {
       Element child = visit(v, el);
       if (child != null) {
           el.add(child);
       }
    }
    el.trimToSize();
    return el;
}
 
Example 6
Source File: ClassReader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element visitArray(Array_element_value a, Element p) {
    Element el = new Element("Array");
    for (Annotation.element_value v : a.values) {
       Element child = visit(v, el);
       if (child != null) {
           el.add(child);
       }
    }
    el.trimToSize();
    return el;
}
 
Example 7
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 ConstantPoolException {
    testTag(testResult, element_value.tag);
    Annotation.Primitive_element_value ev =
            (Annotation.Primitive_element_value) element_value;
    ConstantPool.CONSTANT_Integer_info info =
            (ConstantPool.CONSTANT_Integer_info) classFile.constant_pool.get(ev.const_value_index);
    testResult.checkEquals(info.value, value ? 1 : 0, "const_value_index : " + value);
}
 
Example 8
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 9
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 value, boolean resolveIndices) {
    value.accept(this, resolveIndices);
}
 
Example 10
Source File: AnnotationWriter.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void write(Annotation.element_value value) {
    write(value, false);
}
 
Example 11
Source File: AnnotationDefaultVerifier.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void testElementValue(int tag, TestResult testResult, ClassFile classFile,
                             Annotation.element_value element_value, String[] values)
        throws ConstantPool.UnexpectedEntry, ConstantPool.InvalidIndex {
    get(tag).testElementValue(testResult, classFile, element_value, values);
}
 
Example 12
Source File: ClassReader.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public Element visit(Annotation.element_value v, Element p) {
    return v.accept(this, p);
}
 
Example 13
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 value) {
    write(value, false);
}
 
Example 14
Source File: ClassReader.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public Element visit(Annotation.element_value v, Element p) {
    return v.accept(this, p);
}
 
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 value, boolean resolveIndices) {
    value.accept(this, resolveIndices);
}
 
Example 16
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 value, boolean resolveIndices) {
    ev_writer.write(value, resolveIndices);
}
 
Example 17
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 value) {
    write(value, false);
}
 
Example 18
Source File: ClassReader.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public Element visit(Annotation.element_value v, Element p) {
    return v.accept(this, p);
}
 
Example 19
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 value, boolean resolveIndices) {
    value.accept(this, resolveIndices);
}
 
Example 20
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 value) {
    write(value, false);
}