From 7afaa1ae771ab7e41e977e035fbca0b50bda3e62 Mon Sep 17 00:00:00 2001 From: Jan Supol Date: Wed, 2 Oct 2019 16:32:59 +0200 Subject: [PATCH] Update ASM to 7.2 Signed-off-by: Jan Supol --- .../org/objectweb/asm/AnnotationVisitor.java | 7 +++++-- .../org/objectweb/asm/AnnotationWriter.java | 16 +++++++++------- .../org/objectweb/asm/ClassReader.java | 9 +++++---- .../org/objectweb/asm/ClassVisitor.java | 2 +- .../org/objectweb/asm/ClassWriter.java | 4 ++-- .../org/objectweb/asm/ConstantDynamic.java | 5 ----- .../org/objectweb/asm/FieldVisitor.java | 2 +- .../repackaged/org/objectweb/asm/Frame.java | 12 ++++++------ .../repackaged/org/objectweb/asm/Label.java | 15 ++++++++------- .../org/objectweb/asm/MethodVisitor.java | 6 ++++-- .../org/objectweb/asm/MethodWriter.java | 3 +++ .../org/objectweb/asm/ModuleVisitor.java | 4 +++- .../repackaged/org/objectweb/asm/Opcodes.java | 1 + .../repackaged/org/objectweb/asm/Type.java | 12 ++++++++---- pom.xml | 2 +- 15 files changed, 57 insertions(+), 43 deletions(-) diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/AnnotationVisitor.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/AnnotationVisitor.java index 545b79f4d8..9bb9e92382 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/AnnotationVisitor.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/AnnotationVisitor.java @@ -43,7 +43,10 @@ public abstract class AnnotationVisitor { */ protected final int api; - /** The annotation visitor to which this visitor must delegate method calls. May be null. */ + /** + * The annotation visitor to which this visitor must delegate method calls. May be {@literal + * null}. + */ protected AnnotationVisitor av; /** @@ -62,7 +65,7 @@ public AnnotationVisitor(final int api) { * @param api the ASM API version implemented by this visitor. Must be one of {@link * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. * @param annotationVisitor the annotation visitor to which this visitor must delegate method - * calls. May be null. + * calls. May be {@literal null}. */ public AnnotationVisitor(final int api, final AnnotationVisitor annotationVisitor) { if (api != Opcodes.ASM7 && api != Opcodes.ASM6 && api != Opcodes.ASM5 && api != Opcodes.ASM4) { diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/AnnotationWriter.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/AnnotationWriter.java index 2cf9f0feef..79a13fcead 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/AnnotationWriter.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/AnnotationWriter.java @@ -104,8 +104,8 @@ final class AnnotationWriter extends AnnotationVisitor { * the visited content must be stored. This ByteVector must already contain all the fields of * the structure except the last one (the element_value_pairs array). * @param previousAnnotation the previously visited annotation of the - * Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or null in - * other cases (e.g. nested or array annotations). + * Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or + * {@literal null} in other cases (e.g. nested or array annotations). */ AnnotationWriter( final SymbolTable symbolTable, @@ -130,8 +130,9 @@ final class AnnotationWriter extends AnnotationVisitor { * @param symbolTable where the constants used in this AnnotationWriter must be stored. * @param descriptor the class descriptor of the annotation class. * @param previousAnnotation the previously visited annotation of the - * Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or null in - * other cases (e.g. nested or array annotations). + * Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or + * {@literal null} in other cases (e.g. nested or array annotations). + * @return a new {@link AnnotationWriter} for the given annotation descriptor. */ static AnnotationWriter create( final SymbolTable symbolTable, @@ -159,8 +160,9 @@ static AnnotationWriter create( * 'typeRef' as a whole. * @param descriptor the class descriptor of the annotation class. * @param previousAnnotation the previously visited annotation of the - * Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or null in - * other cases (e.g. nested or array annotations). + * Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or + * {@literal null} in other cases (e.g. nested or array annotations). + * @return a new {@link AnnotationWriter} for the given type annotation reference and descriptor. */ static AnnotationWriter create( final SymbolTable symbolTable, @@ -322,7 +324,7 @@ public void visitEnd() { * and all its predecessors (see {@link #previousAnnotation}. Also adds the attribute name * to the constant pool of the class (if not null). * - * @param attributeName one of "Runtime[In]Visible[Type]Annotations", or null. + * @param attributeName one of "Runtime[In]Visible[Type]Annotations", or {@literal null}. * @return the size in bytes of a Runtime[In]Visible[Type]Annotations attribute containing this * annotation and all its predecessors. This includes the size of the attribute_name_index and * attribute_length fields. diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassReader.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassReader.java index 29e9b7aae8..84ec8c5592 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassReader.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassReader.java @@ -193,10 +193,10 @@ public ClassReader( this.b = classFileBuffer; // Check the class' major_version. This field is after the magic and minor_version fields, which // use 4 and 2 bytes respectively. - if (checkClassVersion && readShort(classFileOffset + 6) == Opcodes.V14) { + if (checkClassVersion && readShort(classFileOffset + 6) == Opcodes.V15) { LOGGER.warning("Unsupported class file major version " + readShort(classFileOffset + 6)); } - if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V14) { + if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V15) { throw new IllegalArgumentException( "Unsupported class file major version " + readShort(classFileOffset + 6)); } @@ -711,7 +711,8 @@ public void accept( * attribute_name_index and attribute_length fields). * @param modulePackagesOffset the offset of the ModulePackages attribute (excluding the * attribute_info's attribute_name_index and attribute_length fields), or 0. - * @param moduleMainClass the string corresponding to the ModuleMainClass attribute, or null. + * @param moduleMainClass the string corresponding to the ModuleMainClass attribute, or {@literal + * null}. */ private void readModuleAttributes( final ClassVisitor classVisitor, @@ -2599,7 +2600,7 @@ private int[] readTypeAnnotations( * -1 if there is no such type_annotation of if it does not have a bytecode offset. * * @param typeAnnotationOffsets the offset of each 'type_annotation' entry in a - * Runtime[In]VisibleTypeAnnotations attribute, or null. + * Runtime[In]VisibleTypeAnnotations attribute, or {@literal null}. * @param typeAnnotationIndex the index a 'type_annotation' entry in typeAnnotationOffsets. * @return bytecode offset corresponding to the specified JVMS 'type_annotation' structure, or -1 * if there is no such type_annotation of if it does not have a bytecode offset. diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassVisitor.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassVisitor.java index 49b5de3327..7f97d47a9b 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassVisitor.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassVisitor.java @@ -44,7 +44,7 @@ public abstract class ClassVisitor { */ protected final int api; - /** The class visitor to which this visitor must delegate method calls. May be null. */ + /** The class visitor to which this visitor must delegate method calls. May be {@literal null}. */ protected ClassVisitor cv; /** diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassWriter.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassWriter.java index 80f0e7cda5..5bdf68c674 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassWriter.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassWriter.java @@ -298,7 +298,7 @@ public final ModuleVisitor visitModule( } @Override - public void visitNestHost(final String nestHost) { + public final void visitNestHost(final String nestHost) { nestHostClassIndex = symbolTable.addConstantClass(nestHost).index; } @@ -344,7 +344,7 @@ public final void visitAttribute(final Attribute attribute) { } @Override - public void visitNestMember(final String nestMember) { + public final void visitNestMember(final String nestMember) { if (nestMemberClasses == null) { nestMemberClasses = new ByteVector(); } diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ConstantDynamic.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ConstantDynamic.java index 5a98fb94e3..4cc820998b 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ConstantDynamic.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ConstantDynamic.java @@ -142,11 +142,6 @@ public int getSize() { return (firstCharOfDescriptor == 'J' || firstCharOfDescriptor == 'D') ? 2 : 1; } - void accept(final MethodVisitor methodVisitor) { - methodVisitor.visitInvokeDynamicInsn( - name, descriptor, bootstrapMethod, bootstrapMethodArguments); - } - @Override public boolean equals(final Object object) { if (object == this) { diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/FieldVisitor.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/FieldVisitor.java index 0df3e62b70..64d39d3729 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/FieldVisitor.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/FieldVisitor.java @@ -42,7 +42,7 @@ public abstract class FieldVisitor { */ protected final int api; - /** The field visitor to which this visitor must delegate method calls. May be null. */ + /** The field visitor to which this visitor must delegate method calls. May be {@literal null}. */ protected FieldVisitor fv; /** diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Frame.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Frame.java index c7ce621c44..41d9ef410f 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Frame.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Frame.java @@ -89,9 +89,9 @@ *

Output frames can contain abstract types of any kind and with a positive or negative array * dimension (and even unassigned types, represented by 0 - which does not correspond to any valid * abstract type value). Input frames can only contain CONSTANT_KIND, REFERENCE_KIND or - * UNINITIALIZED_KIND abstract types of positive or null array dimension. In all cases the type - * table contains only internal type names (array type descriptors are forbidden - array dimensions - * must be represented through the DIM field). + * UNINITIALIZED_KIND abstract types of positive or {@literal null} array dimension. In all cases + * the type table contains only internal type names (array type descriptors are forbidden - array + * dimensions must be represented through the DIM field). * *

The LONG and DOUBLE types are always represented by using two slots (LONG + TOP or DOUBLE + * TOP), for local variables as well as in the operand stack. This is necessary to be able to @@ -1253,10 +1253,10 @@ final boolean merge( * @param symbolTable the type table to use to lookup and store type {@link Symbol}. * @param sourceType the abstract type with which the abstract type array element must be merged. * This type should be of {@link #CONSTANT_KIND}, {@link #REFERENCE_KIND} or {@link - * #UNINITIALIZED_KIND} kind, with positive or null array dimensions. + * #UNINITIALIZED_KIND} kind, with positive or {@literal null} array dimensions. * @param dstTypes an array of abstract types. These types should be of {@link #CONSTANT_KIND}, - * {@link #REFERENCE_KIND} or {@link #UNINITIALIZED_KIND} kind, with positive or null array - * dimensions. + * {@link #REFERENCE_KIND} or {@link #UNINITIALIZED_KIND} kind, with positive or {@literal + * null} array dimensions. * @param dstIndex the index of the type that must be merged in dstTypes. * @return {@literal true} if the type array has been modified by this operation. */ diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Label.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Label.java index 25814e1234..a01326cacf 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Label.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Label.java @@ -227,7 +227,8 @@ public class Label { /** * The maximum height reached by the output stack, relatively to the top of the input stack, in - * the basic block corresponding to this label. This maximum is always positive or null. + * the basic block corresponding to this label. This maximum is always positive or {@literal + * null}. */ short outputStackMax; @@ -264,12 +265,12 @@ public class Label { Edge outgoingEdges; /** - * The next element in the list of labels to which this label belongs, or null if it does not - * belong to any list. All lists of labels must end with the {@link #EMPTY_LIST} sentinel, in - * order to ensure that this field is null if and only if this label does not belong to a list of - * labels. Note that there can be several lists of labels at the same time, but that a label can - * belong to at most one list at a time (unless some lists share a common tail, but this is not - * used in practice). + * The next element in the list of labels to which this label belongs, or {@literal null} if it + * does not belong to any list. All lists of labels must end with the {@link #EMPTY_LIST} + * sentinel, in order to ensure that this field is null if and only if this label does not belong + * to a list of labels. Note that there can be several lists of labels at the same time, but that + * a label can belong to at most one list at a time (unless some lists share a common tail, but + * this is not used in practice). * *

List of labels are used in {@link MethodWriter#computeAllFrames} and {@link * MethodWriter#computeMaxStackAndLocal} to compute stack map frames and the maximum stack size, diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/MethodVisitor.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/MethodVisitor.java index b202cf71dd..e88b6bf605 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/MethodVisitor.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/MethodVisitor.java @@ -56,7 +56,9 @@ public abstract class MethodVisitor { */ protected final int api; - /** The method visitor to which this visitor must delegate method calls. May be null. */ + /** + * The method visitor to which this visitor must delegate method calls. May be {@literal null}. + */ protected MethodVisitor mv; /** @@ -92,7 +94,7 @@ public MethodVisitor(final int api, final MethodVisitor methodVisitor) { /** * Visits a parameter of this method. * - * @param name parameter name or null if none is provided. + * @param name parameter name or {@literal null} if none is provided. * @param access the parameter's access flags, only {@code ACC_FINAL}, {@code ACC_SYNTHETIC} * or/and {@code ACC_MANDATED} are allowed (see {@link Opcodes}). */ diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/MethodWriter.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/MethodWriter.java index 2cb03548ad..ecded6684b 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/MethodWriter.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/MethodWriter.java @@ -775,6 +775,9 @@ public void visitFrame( } visitFrameEnd(); } else { + if (symbolTable.getMajorVersion() < Opcodes.V1_6) { + throw new IllegalArgumentException("Class versions V1_5 or less must use F_NEW frames."); + } int offsetDelta; if (stackMapTableEntries == null) { stackMapTableEntries = new ByteVector(); diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ModuleVisitor.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ModuleVisitor.java index 4a7f8faa1a..ff5062b0b6 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ModuleVisitor.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ModuleVisitor.java @@ -42,7 +42,9 @@ public abstract class ModuleVisitor { */ protected final int api; - /** The module visitor to which this visitor must delegate method calls. May be null. */ + /** + * The module visitor to which this visitor must delegate method calls. May be {@literal null}. + */ protected ModuleVisitor mv; /** diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Opcodes.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Opcodes.java index 41353c6d67..6a1019fd0a 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Opcodes.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Opcodes.java @@ -270,6 +270,7 @@ public interface Opcodes { int V12 = 0 << 16 | 56; int V13 = 0 << 16 | 57; int V14 = 0 << 16 | 58; + int V15 = 0 << 16 | 59; /** * Version flag indicating that the class is using 'preview' features. diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Type.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Type.java index f8006f5d13..dbe11cce59 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Type.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Type.java @@ -305,7 +305,8 @@ public static Type[] getArgumentTypes(final String methodDescriptor) { } if (methodDescriptor.charAt(currentOffset++) == 'L') { // Skip the argument descriptor content. - currentOffset = methodDescriptor.indexOf(';', currentOffset) + 1; + int semiColumnOffset = methodDescriptor.indexOf(';', currentOffset); + currentOffset = Math.max(currentOffset, semiColumnOffset + 1); } ++numArgumentTypes; } @@ -323,7 +324,8 @@ public static Type[] getArgumentTypes(final String methodDescriptor) { } if (methodDescriptor.charAt(currentOffset++) == 'L') { // Skip the argument descriptor content. - currentOffset = methodDescriptor.indexOf(';', currentOffset) + 1; + int semiColumnOffset = methodDescriptor.indexOf(';', currentOffset); + currentOffset = Math.max(currentOffset, semiColumnOffset + 1); } argumentTypes[currentArgumentTypeIndex++] = getTypeInternal(methodDescriptor, currentArgumentTypeOffset, currentOffset); @@ -393,7 +395,8 @@ static int getReturnTypeOffset(final String methodDescriptor) { } if (methodDescriptor.charAt(currentOffset++) == 'L') { // Skip the argument descriptor content. - currentOffset = methodDescriptor.indexOf(';', currentOffset) + 1; + int semiColumnOffset = methodDescriptor.indexOf(';', currentOffset); + currentOffset = Math.max(currentOffset, semiColumnOffset + 1); } } return currentOffset + 1; @@ -737,7 +740,8 @@ public static int getArgumentsAndReturnSizes(final String methodDescriptor) { } if (methodDescriptor.charAt(currentOffset++) == 'L') { // Skip the argument descriptor content. - currentOffset = methodDescriptor.indexOf(';', currentOffset) + 1; + int semiColumnOffset = methodDescriptor.indexOf(';', currentOffset); + currentOffset = Math.max(currentOffset, semiColumnOffset + 1); } argumentsSize += 1; } diff --git a/pom.xml b/pom.xml index 033bb36a95..871a403468 100644 --- a/pom.xml +++ b/pom.xml @@ -2055,7 +2055,7 @@ ${project.version} - 7.1 + 7.2 2.3.6 1.1 3.3.2