Java Code Examples for jdk.internal.org.objectweb.asm.AnnotationVisitor#visitEnd()

The following examples show how to use jdk.internal.org.objectweb.asm.AnnotationVisitor#visitEnd() . 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: AnnotationNode.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Makes the given visitor visit a given annotation value.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 * @param name
 *            the value name.
 * @param value
 *            the actual value.
 */
static void accept(final AnnotationVisitor av, final String name,
        final Object value) {
    if (av != null) {
        if (value instanceof String[]) {
            String[] typeconst = (String[]) value;
            av.visitEnum(name, typeconst[0], typeconst[1]);
        } else if (value instanceof AnnotationNode) {
            AnnotationNode an = (AnnotationNode) value;
            an.accept(av.visitAnnotation(name, an.desc));
        } else if (value instanceof List) {
            AnnotationVisitor v = av.visitArray(name);
            if (v != null) {
                List<?> array = (List<?>) value;
                for (int j = 0; j < array.size(); ++j) {
                    accept(v, null, array.get(j));
                }
                v.visitEnd();
            }
        } else {
            av.visit(name, value);
        }
    }
}
 
Example 2
Source File: AnnotationNode.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Makes the given visitor visit a given annotation value.
 *
 * @param av an annotation visitor. Maybe <tt>null</tt>.
 * @param name the value name.
 * @param value the actual value.
 */
static void accept(
    final AnnotationVisitor av,
    final String name,
    final Object value)
{
    if (av != null) {
        if (value instanceof String[]) {
            String[] typeconst = (String[]) value;
            av.visitEnum(name, typeconst[0], typeconst[1]);
        } else if (value instanceof AnnotationNode) {
            AnnotationNode an = (AnnotationNode) value;
            an.accept(av.visitAnnotation(name, an.desc));
        } else if (value instanceof List) {
            AnnotationVisitor v = av.visitArray(name);
            List<?> array = (List<?>) value;
            for (int j = 0; j < array.size(); ++j) {
                accept(v, null, array.get(j));
            }
            v.visitEnd();
        } else {
            av.visit(name, value);
        }
    }
}
 
Example 3
Source File: AnnotationNode.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Makes the given visitor visit a given annotation value.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 * @param name
 *            the value name.
 * @param value
 *            the actual value.
 */
static void accept(final AnnotationVisitor av, final String name,
        final Object value) {
    if (av != null) {
        if (value instanceof String[]) {
            String[] typeconst = (String[]) value;
            av.visitEnum(name, typeconst[0], typeconst[1]);
        } else if (value instanceof AnnotationNode) {
            AnnotationNode an = (AnnotationNode) value;
            an.accept(av.visitAnnotation(name, an.desc));
        } else if (value instanceof List) {
            AnnotationVisitor v = av.visitArray(name);
            if (v != null) {
                List<?> array = (List<?>) value;
                for (int j = 0; j < array.size(); ++j) {
                    accept(v, null, array.get(j));
                }
                v.visitEnd();
            }
        } else {
            av.visit(name, value);
        }
    }
}
 
Example 4
Source File: AnnotationNode.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Makes the given visitor visit a given annotation value.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 * @param name
 *            the value name.
 * @param value
 *            the actual value.
 */
static void accept(final AnnotationVisitor av, final String name,
        final Object value) {
    if (av != null) {
        if (value instanceof String[]) {
            String[] typeconst = (String[]) value;
            av.visitEnum(name, typeconst[0], typeconst[1]);
        } else if (value instanceof AnnotationNode) {
            AnnotationNode an = (AnnotationNode) value;
            an.accept(av.visitAnnotation(name, an.desc));
        } else if (value instanceof List) {
            AnnotationVisitor v = av.visitArray(name);
            if (v != null) {
                List<?> array = (List<?>) value;
                for (int j = 0; j < array.size(); ++j) {
                    accept(v, null, array.get(j));
                }
                v.visitEnd();
            }
        } else {
            av.visit(name, value);
        }
    }
}
 
Example 5
Source File: AnnotationNode.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Makes the given visitor visit a given annotation value.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 * @param name
 *            the value name.
 * @param value
 *            the actual value.
 */
static void accept(final AnnotationVisitor av, final String name,
        final Object value) {
    if (av != null) {
        if (value instanceof String[]) {
            String[] typeconst = (String[]) value;
            av.visitEnum(name, typeconst[0], typeconst[1]);
        } else if (value instanceof AnnotationNode) {
            AnnotationNode an = (AnnotationNode) value;
            an.accept(av.visitAnnotation(name, an.desc));
        } else if (value instanceof List) {
            AnnotationVisitor v = av.visitArray(name);
            List<?> array = (List<?>) value;
            for (int j = 0; j < array.size(); ++j) {
                accept(v, null, array.get(j));
            }
            v.visitEnd();
        } else {
            av.visit(name, value);
        }
    }
}
 
Example 6
Source File: EventClassBuilder.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void buildClassInfo() {
    String internalSuperName = ASMToolkit.getInternalName(Event.class.getName());
    String internalClassName = type.getInternalName();
    classWriter.visit(52, Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER, internalClassName, null, internalSuperName, null);

    for (AnnotationElement a : annotationElements) {
        String descriptor = ASMToolkit.getDescriptor(a.getTypeName());
        AnnotationVisitor av = classWriter.visitAnnotation(descriptor, true);
        for (ValueDescriptor v : a.getValueDescriptors()) {
            Object value = a.getValue(v.getName());
            String name = v.getName();
            if (v.isArray()) {
                AnnotationVisitor arrayVisitor = av.visitArray(name);
                Object[] array = (Object[]) value;
                for (int i = 0; i < array.length; i++) {
                    arrayVisitor.visit(null, array[i]);
                }
                arrayVisitor.visitEnd();
            } else {
                av.visit(name, value);
            }
        }
        av.visitEnd();
    }
}
 
Example 7
Source File: AnnotationNode.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Makes the given visitor visit a given annotation value.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 * @param name
 *            the value name.
 * @param value
 *            the actual value.
 */
static void accept(final AnnotationVisitor av, final String name,
        final Object value) {
    if (av != null) {
        if (value instanceof String[]) {
            String[] typeconst = (String[]) value;
            av.visitEnum(name, typeconst[0], typeconst[1]);
        } else if (value instanceof AnnotationNode) {
            AnnotationNode an = (AnnotationNode) value;
            an.accept(av.visitAnnotation(name, an.desc));
        } else if (value instanceof List) {
            AnnotationVisitor v = av.visitArray(name);
            if (v != null) {
                List<?> array = (List<?>) value;
                for (int j = 0; j < array.size(); ++j) {
                    accept(v, null, array.get(j));
                }
                v.visitEnd();
            }
        } else {
            av.visit(name, value);
        }
    }
}
 
Example 8
Source File: EventClassBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void buildClassInfo() {
    String internalSuperName = ASMToolkit.getInternalName(Event.class.getName());
    String internalClassName = type.getInternalName();
    classWriter.visit(52, Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER, internalClassName, null, internalSuperName, null);

    for (AnnotationElement a : annotationElements) {
        String descriptor = ASMToolkit.getDescriptor(a.getTypeName());
        AnnotationVisitor av = classWriter.visitAnnotation(descriptor, true);
        for (ValueDescriptor v : a.getValueDescriptors()) {
            Object value = a.getValue(v.getName());
            String name = v.getName();
            if (v.isArray()) {
                AnnotationVisitor arrayVisitor = av.visitArray(name);
                Object[] array = (Object[]) value;
                for (int i = 0; i < array.length; i++) {
                    arrayVisitor.visit(null, array[i]);
                }
                arrayVisitor.visitEnd();
            } else {
                av.visit(name, value);
            }
        }
        av.visitEnd();
    }
}
 
Example 9
Source File: AnnotationNode.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Makes the given visitor visit a given annotation value.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 * @param name
 *            the value name.
 * @param value
 *            the actual value.
 */
static void accept(final AnnotationVisitor av, final String name,
        final Object value) {
    if (av != null) {
        if (value instanceof String[]) {
            String[] typeconst = (String[]) value;
            av.visitEnum(name, typeconst[0], typeconst[1]);
        } else if (value instanceof AnnotationNode) {
            AnnotationNode an = (AnnotationNode) value;
            an.accept(av.visitAnnotation(name, an.desc));
        } else if (value instanceof List) {
            AnnotationVisitor v = av.visitArray(name);
            if (v != null) {
                List<?> array = (List<?>) value;
                for (int j = 0; j < array.size(); ++j) {
                    accept(v, null, array.get(j));
                }
                v.visitEnd();
            }
        } else {
            av.visit(name, value);
        }
    }
}
 
Example 10
Source File: AnnotationNode.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Makes the given visitor visit a given annotation value.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 * @param name
 *            the value name.
 * @param value
 *            the actual value.
 */
static void accept(final AnnotationVisitor av, final String name,
        final Object value) {
    if (av != null) {
        if (value instanceof String[]) {
            String[] typeconst = (String[]) value;
            av.visitEnum(name, typeconst[0], typeconst[1]);
        } else if (value instanceof AnnotationNode) {
            AnnotationNode an = (AnnotationNode) value;
            an.accept(av.visitAnnotation(name, an.desc));
        } else if (value instanceof List) {
            AnnotationVisitor v = av.visitArray(name);
            if (v != null) {
                List<?> array = (List<?>) value;
                for (int j = 0; j < array.size(); ++j) {
                    accept(v, null, array.get(j));
                }
                v.visitEnd();
            }
        } else {
            av.visit(name, value);
        }
    }
}
 
Example 11
Source File: EventClassBuilder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void buildClassInfo() {
    String internalSuperName = ASMToolkit.getInternalName(Event.class.getName());
    String internalClassName = type.getInternalName();
    classWriter.visit(52, Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER, internalClassName, null, internalSuperName, null);

    for (AnnotationElement a : annotationElements) {
        String descriptor = ASMToolkit.getDescriptor(a.getTypeName());
        AnnotationVisitor av = classWriter.visitAnnotation(descriptor, true);
        for (ValueDescriptor v : a.getValueDescriptors()) {
            Object value = a.getValue(v.getName());
            String name = v.getName();
            if (v.isArray()) {
                AnnotationVisitor arrayVisitor = av.visitArray(name);
                Object[] array = (Object[]) value;
                for (int i = 0; i < array.length; i++) {
                    arrayVisitor.visit(null, array[i]);
                }
                arrayVisitor.visitEnd();
            } else {
                av.visit(name, value);
            }
        }
        av.visitEnd();
    }
}
 
Example 12
Source File: AnnotationNode.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Makes the given visitor visit a given annotation value.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 * @param name
 *            the value name.
 * @param value
 *            the actual value.
 */
static void accept(final AnnotationVisitor av, final String name,
        final Object value) {
    if (av != null) {
        if (value instanceof String[]) {
            String[] typeconst = (String[]) value;
            av.visitEnum(name, typeconst[0], typeconst[1]);
        } else if (value instanceof AnnotationNode) {
            AnnotationNode an = (AnnotationNode) value;
            an.accept(av.visitAnnotation(name, an.desc));
        } else if (value instanceof List) {
            AnnotationVisitor v = av.visitArray(name);
            if (v != null) {
                List<?> array = (List<?>) value;
                for (int j = 0; j < array.size(); ++j) {
                    accept(v, null, array.get(j));
                }
                v.visitEnd();
            }
        } else {
            av.visit(name, value);
        }
    }
}
 
Example 13
Source File: AnnotationNode.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Makes the given visitor visit this annotation.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 */
public void accept(final AnnotationVisitor av) {
    if (av != null) {
        if (values != null) {
            for (int i = 0; i < values.size(); i += 2) {
                String name = (String) values.get(i);
                Object value = values.get(i + 1);
                accept(av, name, value);
            }
        }
        av.visitEnd();
    }
}
 
Example 14
Source File: AnnotationNode.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Makes the given visitor visit this annotation.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 */
public void accept(final AnnotationVisitor av) {
    if (av != null) {
        if (values != null) {
            for (int i = 0; i < values.size(); i += 2) {
                String name = (String) values.get(i);
                Object value = values.get(i + 1);
                accept(av, name, value);
            }
        }
        av.visitEnd();
    }
}
 
Example 15
Source File: AnnotationNode.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Makes the given visitor visit this annotation.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 */
public void accept(final AnnotationVisitor av) {
    if (av != null) {
        if (values != null) {
            for (int i = 0; i < values.size(); i += 2) {
                String name = (String) values.get(i);
                Object value = values.get(i + 1);
                accept(av, name, value);
            }
        }
        av.visitEnd();
    }
}
 
Example 16
Source File: AnnotationNode.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Makes the given visitor visit this annotation.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 */
public void accept(final AnnotationVisitor av) {
    if (av != null) {
        if (values != null) {
            for (int i = 0; i < values.size(); i += 2) {
                String name = (String) values.get(i);
                Object value = values.get(i + 1);
                accept(av, name, value);
            }
        }
        av.visitEnd();
    }
}
 
Example 17
Source File: AnnotationNode.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Makes the given visitor visit this annotation.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 */
public void accept(final AnnotationVisitor av) {
    if (av != null) {
        if (values != null) {
            for (int i = 0; i < values.size(); i += 2) {
                String name = (String) values.get(i);
                Object value = values.get(i + 1);
                accept(av, name, value);
            }
        }
        av.visitEnd();
    }
}
 
Example 18
Source File: AnnotationNode.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Makes the given visitor visit this annotation.
 *
 * @param av an annotation visitor. Maybe <tt>null</tt>.
 */
public void accept(final AnnotationVisitor av) {
    if (av != null) {
        if (values != null) {
            for (int i = 0; i < values.size(); i += 2) {
                String name = (String) values.get(i);
                Object value = values.get(i + 1);
                accept(av, name, value);
            }
        }
        av.visitEnd();
    }
}
 
Example 19
Source File: AnnotationNode.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Makes the given visitor visit this annotation.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 */
public void accept(final AnnotationVisitor av) {
    if (av != null) {
        if (values != null) {
            for (int i = 0; i < values.size(); i += 2) {
                String name = (String) values.get(i);
                Object value = values.get(i + 1);
                accept(av, name, value);
            }
        }
        av.visitEnd();
    }
}
 
Example 20
Source File: AnnotationNode.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Makes the given visitor visit this annotation.
 *
 * @param av
 *            an annotation visitor. Maybe <tt>null</tt>.
 */
public void accept(final AnnotationVisitor av) {
    if (av != null) {
        if (values != null) {
            for (int i = 0; i < values.size(); i += 2) {
                String name = (String) values.get(i);
                Object value = values.get(i + 1);
                accept(av, name, value);
            }
        }
        av.visitEnd();
    }
}