< prev index next >

src/java.base/share/classes/jdk/internal/org/objectweb/asm/tree/AnnotationNode.java

Print this page
rev 47452 : imported patch jdk-new-asmv6.patch

*** 63,73 **** import jdk.internal.org.objectweb.asm.AnnotationVisitor; import jdk.internal.org.objectweb.asm.Opcodes; /** ! * A node that represents an annotationn. * * @author Eric Bruneton */ public class AnnotationNode extends AnnotationVisitor { --- 63,73 ---- import jdk.internal.org.objectweb.asm.AnnotationVisitor; import jdk.internal.org.objectweb.asm.Opcodes; /** ! * A node that represents an annotation. * * @author Eric Bruneton */ public class AnnotationNode extends AnnotationVisitor {
*** 79,90 **** /** * The name value pairs of this annotation. Each name value pair is stored * as two consecutive elements in the list. The name is a {@link String}, * and the value may be a {@link Byte}, {@link Boolean}, {@link Character}, * {@link Short}, {@link Integer}, {@link Long}, {@link Float}, ! * {@link Double}, {@link String} or {@link jdk.internal.org.objectweb.asm.Type}, or an ! * two elements String array (for enumeration values), a * {@link AnnotationNode}, or a {@link List} of values of one of the * preceding types. The list may be <tt>null</tt> if there is no name value * pair. */ public List<Object> values; --- 79,90 ---- /** * The name value pairs of this annotation. Each name value pair is stored * as two consecutive elements in the list. The name is a {@link String}, * and the value may be a {@link Byte}, {@link Boolean}, {@link Character}, * {@link Short}, {@link Integer}, {@link Long}, {@link Float}, ! * {@link Double}, {@link String} or {@link jdk.internal.org.objectweb.asm.Type}, or a ! * two elements String array (for enumeration values), an * {@link AnnotationNode}, or a {@link List} of values of one of the * preceding types. The list may be <tt>null</tt> if there is no name value * pair. */ public List<Object> values;
*** 98,108 **** * the class descriptor of the annotation class. * @throws IllegalStateException * If a subclass calls this constructor. */ public AnnotationNode(final String desc) { ! this(Opcodes.ASM5, desc); if (getClass() != AnnotationNode.class) { throw new IllegalStateException(); } } --- 98,108 ---- * the class descriptor of the annotation class. * @throws IllegalStateException * If a subclass calls this constructor. */ public AnnotationNode(final String desc) { ! this(Opcodes.ASM6, desc); if (getClass() != AnnotationNode.class) { throw new IllegalStateException(); } }
*** 109,119 **** /** * Constructs a new {@link AnnotationNode}. * * @param api * the ASM API version implemented by this visitor. Must be one ! * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}. * @param desc * the class descriptor of the annotation class. */ public AnnotationNode(final int api, final String desc) { super(api); --- 109,119 ---- /** * Constructs a new {@link AnnotationNode}. * * @param api * the ASM API version implemented by this visitor. Must be one ! * of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}. * @param desc * the class descriptor of the annotation class. */ public AnnotationNode(final int api, final String desc) { super(api);
*** 125,135 **** * * @param values * where the visited values must be stored. */ AnnotationNode(final List<Object> values) { ! super(Opcodes.ASM5); this.values = values; } // ------------------------------------------------------------------------ // Implementation of the AnnotationVisitor abstract class --- 125,135 ---- * * @param values * where the visited values must be stored. */ AnnotationNode(final List<Object> values) { ! super(Opcodes.ASM6); this.values = values; } // ------------------------------------------------------------------------ // Implementation of the AnnotationVisitor abstract class
*** 141,152 **** --- 141,210 ---- values = new ArrayList<Object>(this.desc != null ? 2 : 1); } if (this.desc != null) { values.add(name); } + if (value instanceof byte[]) { + byte[] v = (byte[]) value; + ArrayList<Byte> l = new ArrayList<Byte>(v.length); + for (byte b : v) { + l.add(b); + } + values.add(l); + } else if (value instanceof boolean[]) { + boolean[] v = (boolean[]) value; + ArrayList<Boolean> l = new ArrayList<Boolean>(v.length); + for (boolean b : v) { + l.add(b); + } + values.add(l); + } else if (value instanceof short[]) { + short[] v = (short[]) value; + ArrayList<Short> l = new ArrayList<Short>(v.length); + for (short s : v) { + l.add(s); + } + values.add(l); + } else if (value instanceof char[]) { + char[] v = (char[]) value; + ArrayList<Character> l = new ArrayList<Character>(v.length); + for (char c : v) { + l.add(c); + } + values.add(l); + } else if (value instanceof int[]) { + int[] v = (int[]) value; + ArrayList<Integer> l = new ArrayList<Integer>(v.length); + for (int i : v) { + l.add(i); + } + values.add(l); + } else if (value instanceof long[]) { + long[] v = (long[]) value; + ArrayList<Long> l = new ArrayList<Long>(v.length); + for (long lng : v) { + l.add(lng); + } + values.add(l); + } else if (value instanceof float[]) { + float[] v = (float[]) value; + ArrayList<Float> l = new ArrayList<Float>(v.length); + for (float f : v) { + l.add(f); + } + values.add(l); + } else if (value instanceof double[]) { + double[] v = (double[]) value; + ArrayList<Double> l = new ArrayList<Double>(v.length); + for (double d : v) { + l.add(d); + } + values.add(l); + } else { values.add(value); } + } @Override public void visitEnum(final String name, final String desc, final String value) { if (values == null) {
*** 198,209 **** * version. This methods checks that this node, and all its nodes * recursively, do not contain elements that were introduced in more recent * versions of the ASM API than the given version. * * @param api ! * an ASM API version. Must be one of {@link Opcodes#ASM4} or ! * {@link Opcodes#ASM5}. */ public void check(final int api) { // nothing to do } --- 256,267 ---- * version. This methods checks that this node, and all its nodes * recursively, do not contain elements that were introduced in more recent * versions of the ASM API than the given version. * * @param api ! * an ASM API version. Must be one of {@link Opcodes#ASM4}, ! * {@link Opcodes#ASM5} or {@link Opcodes#ASM6}. */ public void check(final int api) { // nothing to do }
< prev index next >