Skip to content

Commit 584664c

Browse files
jansupolsenivam
authored andcommitted
Update ASM to 7.2 (#4279)
Signed-off-by: Jan Supol <jan.supol@oracle.com>
1 parent 94945df commit 584664c

15 files changed

+57
-43
lines changed

core-server/src/main/java/jersey/repackaged/org/objectweb/asm/AnnotationVisitor.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ public abstract class AnnotationVisitor {
4343
*/
4444
protected final int api;
4545

46-
/** The annotation visitor to which this visitor must delegate method calls. May be null. */
46+
/**
47+
* The annotation visitor to which this visitor must delegate method calls. May be {@literal
48+
* null}.
49+
*/
4750
protected AnnotationVisitor av;
4851

4952
/**
@@ -62,7 +65,7 @@ public AnnotationVisitor(final int api) {
6265
* @param api the ASM API version implemented by this visitor. Must be one of {@link
6366
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}.
6467
* @param annotationVisitor the annotation visitor to which this visitor must delegate method
65-
* calls. May be null.
68+
* calls. May be {@literal null}.
6669
*/
6770
public AnnotationVisitor(final int api, final AnnotationVisitor annotationVisitor) {
6871
if (api != Opcodes.ASM7 && api != Opcodes.ASM6 && api != Opcodes.ASM5 && api != Opcodes.ASM4) {

core-server/src/main/java/jersey/repackaged/org/objectweb/asm/AnnotationWriter.java

+9-7
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ final class AnnotationWriter extends AnnotationVisitor {
104104
* the visited content must be stored. This ByteVector must already contain all the fields of
105105
* the structure except the last one (the element_value_pairs array).
106106
* @param previousAnnotation the previously visited annotation of the
107-
* Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or null in
108-
* other cases (e.g. nested or array annotations).
107+
* Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or
108+
* {@literal null} in other cases (e.g. nested or array annotations).
109109
*/
110110
AnnotationWriter(
111111
final SymbolTable symbolTable,
@@ -130,8 +130,9 @@ final class AnnotationWriter extends AnnotationVisitor {
130130
* @param symbolTable where the constants used in this AnnotationWriter must be stored.
131131
* @param descriptor the class descriptor of the annotation class.
132132
* @param previousAnnotation the previously visited annotation of the
133-
* Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or null in
134-
* other cases (e.g. nested or array annotations).
133+
* Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or
134+
* {@literal null} in other cases (e.g. nested or array annotations).
135+
* @return a new {@link AnnotationWriter} for the given annotation descriptor.
135136
*/
136137
static AnnotationWriter create(
137138
final SymbolTable symbolTable,
@@ -159,8 +160,9 @@ static AnnotationWriter create(
159160
* 'typeRef' as a whole.
160161
* @param descriptor the class descriptor of the annotation class.
161162
* @param previousAnnotation the previously visited annotation of the
162-
* Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or null in
163-
* other cases (e.g. nested or array annotations).
163+
* Runtime[In]Visible[Type]Annotations attribute to which this annotation belongs, or
164+
* {@literal null} in other cases (e.g. nested or array annotations).
165+
* @return a new {@link AnnotationWriter} for the given type annotation reference and descriptor.
164166
*/
165167
static AnnotationWriter create(
166168
final SymbolTable symbolTable,
@@ -322,7 +324,7 @@ public void visitEnd() {
322324
* and all its <i>predecessors</i> (see {@link #previousAnnotation}. Also adds the attribute name
323325
* to the constant pool of the class (if not null).
324326
*
325-
* @param attributeName one of "Runtime[In]Visible[Type]Annotations", or null.
327+
* @param attributeName one of "Runtime[In]Visible[Type]Annotations", or {@literal null}.
326328
* @return the size in bytes of a Runtime[In]Visible[Type]Annotations attribute containing this
327329
* annotation and all its predecessors. This includes the size of the attribute_name_index and
328330
* attribute_length fields.

core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassReader.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ public ClassReader(
193193
this.b = classFileBuffer;
194194
// Check the class' major_version. This field is after the magic and minor_version fields, which
195195
// use 4 and 2 bytes respectively.
196-
if (checkClassVersion && readShort(classFileOffset + 6) == Opcodes.V14) {
196+
if (checkClassVersion && readShort(classFileOffset + 6) == Opcodes.V15) {
197197
LOGGER.warning("Unsupported class file major version " + readShort(classFileOffset + 6));
198198
}
199-
if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V14) {
199+
if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V15) {
200200
throw new IllegalArgumentException(
201201
"Unsupported class file major version " + readShort(classFileOffset + 6));
202202
}
@@ -711,7 +711,8 @@ public void accept(
711711
* attribute_name_index and attribute_length fields).
712712
* @param modulePackagesOffset the offset of the ModulePackages attribute (excluding the
713713
* attribute_info's attribute_name_index and attribute_length fields), or 0.
714-
* @param moduleMainClass the string corresponding to the ModuleMainClass attribute, or null.
714+
* @param moduleMainClass the string corresponding to the ModuleMainClass attribute, or {@literal
715+
* null}.
715716
*/
716717
private void readModuleAttributes(
717718
final ClassVisitor classVisitor,
@@ -2599,7 +2600,7 @@ private int[] readTypeAnnotations(
25992600
* -1 if there is no such type_annotation of if it does not have a bytecode offset.
26002601
*
26012602
* @param typeAnnotationOffsets the offset of each 'type_annotation' entry in a
2602-
* Runtime[In]VisibleTypeAnnotations attribute, or null.
2603+
* Runtime[In]VisibleTypeAnnotations attribute, or {@literal null}.
26032604
* @param typeAnnotationIndex the index a 'type_annotation' entry in typeAnnotationOffsets.
26042605
* @return bytecode offset corresponding to the specified JVMS 'type_annotation' structure, or -1
26052606
* if there is no such type_annotation of if it does not have a bytecode offset.

core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassVisitor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public abstract class ClassVisitor {
4444
*/
4545
protected final int api;
4646

47-
/** The class visitor to which this visitor must delegate method calls. May be null. */
47+
/** The class visitor to which this visitor must delegate method calls. May be {@literal null}. */
4848
protected ClassVisitor cv;
4949

5050
/**

core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassWriter.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public final ModuleVisitor visitModule(
298298
}
299299

300300
@Override
301-
public void visitNestHost(final String nestHost) {
301+
public final void visitNestHost(final String nestHost) {
302302
nestHostClassIndex = symbolTable.addConstantClass(nestHost).index;
303303
}
304304

@@ -344,7 +344,7 @@ public final void visitAttribute(final Attribute attribute) {
344344
}
345345

346346
@Override
347-
public void visitNestMember(final String nestMember) {
347+
public final void visitNestMember(final String nestMember) {
348348
if (nestMemberClasses == null) {
349349
nestMemberClasses = new ByteVector();
350350
}

core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ConstantDynamic.java

-5
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,6 @@ public int getSize() {
142142
return (firstCharOfDescriptor == 'J' || firstCharOfDescriptor == 'D') ? 2 : 1;
143143
}
144144

145-
void accept(final MethodVisitor methodVisitor) {
146-
methodVisitor.visitInvokeDynamicInsn(
147-
name, descriptor, bootstrapMethod, bootstrapMethodArguments);
148-
}
149-
150145
@Override
151146
public boolean equals(final Object object) {
152147
if (object == this) {

core-server/src/main/java/jersey/repackaged/org/objectweb/asm/FieldVisitor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public abstract class FieldVisitor {
4242
*/
4343
protected final int api;
4444

45-
/** The field visitor to which this visitor must delegate method calls. May be null. */
45+
/** The field visitor to which this visitor must delegate method calls. May be {@literal null}. */
4646
protected FieldVisitor fv;
4747

4848
/**

core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Frame.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@
8989
* <p>Output frames can contain abstract types of any kind and with a positive or negative array
9090
* dimension (and even unassigned types, represented by 0 - which does not correspond to any valid
9191
* abstract type value). Input frames can only contain CONSTANT_KIND, REFERENCE_KIND or
92-
* UNINITIALIZED_KIND abstract types of positive or null array dimension. In all cases the type
93-
* table contains only internal type names (array type descriptors are forbidden - array dimensions
94-
* must be represented through the DIM field).
92+
* UNINITIALIZED_KIND abstract types of positive or {@literal null} array dimension. In all cases
93+
* the type table contains only internal type names (array type descriptors are forbidden - array
94+
* dimensions must be represented through the DIM field).
9595
*
9696
* <p>The LONG and DOUBLE types are always represented by using two slots (LONG + TOP or DOUBLE +
9797
* 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(
12531253
* @param symbolTable the type table to use to lookup and store type {@link Symbol}.
12541254
* @param sourceType the abstract type with which the abstract type array element must be merged.
12551255
* This type should be of {@link #CONSTANT_KIND}, {@link #REFERENCE_KIND} or {@link
1256-
* #UNINITIALIZED_KIND} kind, with positive or null array dimensions.
1256+
* #UNINITIALIZED_KIND} kind, with positive or {@literal null} array dimensions.
12571257
* @param dstTypes an array of abstract types. These types should be of {@link #CONSTANT_KIND},
1258-
* {@link #REFERENCE_KIND} or {@link #UNINITIALIZED_KIND} kind, with positive or null array
1259-
* dimensions.
1258+
* {@link #REFERENCE_KIND} or {@link #UNINITIALIZED_KIND} kind, with positive or {@literal
1259+
* null} array dimensions.
12601260
* @param dstIndex the index of the type that must be merged in dstTypes.
12611261
* @return {@literal true} if the type array has been modified by this operation.
12621262
*/

core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Label.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ public class Label {
227227

228228
/**
229229
* The maximum height reached by the output stack, relatively to the top of the input stack, in
230-
* the basic block corresponding to this label. This maximum is always positive or null.
230+
* the basic block corresponding to this label. This maximum is always positive or {@literal
231+
* null}.
231232
*/
232233
short outputStackMax;
233234

@@ -264,12 +265,12 @@ public class Label {
264265
Edge outgoingEdges;
265266

266267
/**
267-
* The next element in the list of labels to which this label belongs, or null if it does not
268-
* belong to any list. All lists of labels must end with the {@link #EMPTY_LIST} sentinel, in
269-
* order to ensure that this field is null if and only if this label does not belong to a list of
270-
* labels. Note that there can be several lists of labels at the same time, but that a label can
271-
* belong to at most one list at a time (unless some lists share a common tail, but this is not
272-
* used in practice).
268+
* The next element in the list of labels to which this label belongs, or {@literal null} if it
269+
* does not belong to any list. All lists of labels must end with the {@link #EMPTY_LIST}
270+
* sentinel, in order to ensure that this field is null if and only if this label does not belong
271+
* to a list of labels. Note that there can be several lists of labels at the same time, but that
272+
* a label can belong to at most one list at a time (unless some lists share a common tail, but
273+
* this is not used in practice).
273274
*
274275
* <p>List of labels are used in {@link MethodWriter#computeAllFrames} and {@link
275276
* MethodWriter#computeMaxStackAndLocal} to compute stack map frames and the maximum stack size,

core-server/src/main/java/jersey/repackaged/org/objectweb/asm/MethodVisitor.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ public abstract class MethodVisitor {
5656
*/
5757
protected final int api;
5858

59-
/** The method visitor to which this visitor must delegate method calls. May be null. */
59+
/**
60+
* The method visitor to which this visitor must delegate method calls. May be {@literal null}.
61+
*/
6062
protected MethodVisitor mv;
6163

6264
/**
@@ -92,7 +94,7 @@ public MethodVisitor(final int api, final MethodVisitor methodVisitor) {
9294
/**
9395
* Visits a parameter of this method.
9496
*
95-
* @param name parameter name or null if none is provided.
97+
* @param name parameter name or {@literal null} if none is provided.
9698
* @param access the parameter's access flags, only {@code ACC_FINAL}, {@code ACC_SYNTHETIC}
9799
* or/and {@code ACC_MANDATED} are allowed (see {@link Opcodes}).
98100
*/

core-server/src/main/java/jersey/repackaged/org/objectweb/asm/MethodWriter.java

+3
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,9 @@ public void visitFrame(
775775
}
776776
visitFrameEnd();
777777
} else {
778+
if (symbolTable.getMajorVersion() < Opcodes.V1_6) {
779+
throw new IllegalArgumentException("Class versions V1_5 or less must use F_NEW frames.");
780+
}
778781
int offsetDelta;
779782
if (stackMapTableEntries == null) {
780783
stackMapTableEntries = new ByteVector();

core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ModuleVisitor.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ public abstract class ModuleVisitor {
4242
*/
4343
protected final int api;
4444

45-
/** The module visitor to which this visitor must delegate method calls. May be null. */
45+
/**
46+
* The module visitor to which this visitor must delegate method calls. May be {@literal null}.
47+
*/
4648
protected ModuleVisitor mv;
4749

4850
/**

core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Opcodes.java

+1
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ public interface Opcodes {
270270
int V12 = 0 << 16 | 56;
271271
int V13 = 0 << 16 | 57;
272272
int V14 = 0 << 16 | 58;
273+
int V15 = 0 << 16 | 59;
273274

274275
/**
275276
* Version flag indicating that the class is using 'preview' features.

core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Type.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ public static Type[] getArgumentTypes(final String methodDescriptor) {
305305
}
306306
if (methodDescriptor.charAt(currentOffset++) == 'L') {
307307
// Skip the argument descriptor content.
308-
currentOffset = methodDescriptor.indexOf(';', currentOffset) + 1;
308+
int semiColumnOffset = methodDescriptor.indexOf(';', currentOffset);
309+
currentOffset = Math.max(currentOffset, semiColumnOffset + 1);
309310
}
310311
++numArgumentTypes;
311312
}
@@ -323,7 +324,8 @@ public static Type[] getArgumentTypes(final String methodDescriptor) {
323324
}
324325
if (methodDescriptor.charAt(currentOffset++) == 'L') {
325326
// Skip the argument descriptor content.
326-
currentOffset = methodDescriptor.indexOf(';', currentOffset) + 1;
327+
int semiColumnOffset = methodDescriptor.indexOf(';', currentOffset);
328+
currentOffset = Math.max(currentOffset, semiColumnOffset + 1);
327329
}
328330
argumentTypes[currentArgumentTypeIndex++] =
329331
getTypeInternal(methodDescriptor, currentArgumentTypeOffset, currentOffset);
@@ -393,7 +395,8 @@ static int getReturnTypeOffset(final String methodDescriptor) {
393395
}
394396
if (methodDescriptor.charAt(currentOffset++) == 'L') {
395397
// Skip the argument descriptor content.
396-
currentOffset = methodDescriptor.indexOf(';', currentOffset) + 1;
398+
int semiColumnOffset = methodDescriptor.indexOf(';', currentOffset);
399+
currentOffset = Math.max(currentOffset, semiColumnOffset + 1);
397400
}
398401
}
399402
return currentOffset + 1;
@@ -737,7 +740,8 @@ public static int getArgumentsAndReturnSizes(final String methodDescriptor) {
737740
}
738741
if (methodDescriptor.charAt(currentOffset++) == 'L') {
739742
// Skip the argument descriptor content.
740-
currentOffset = methodDescriptor.indexOf(';', currentOffset) + 1;
743+
int semiColumnOffset = methodDescriptor.indexOf(';', currentOffset);
744+
currentOffset = Math.max(currentOffset, semiColumnOffset + 1);
741745
}
742746
argumentsSize += 1;
743747
}

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2055,7 +2055,7 @@
20552055
<jersey.version>${project.version}</jersey.version>
20562056
<!-- asm is now source integrated - keeping this property to see the version -->
20572057
<!-- see core-server/src/main/java/jersey/repackaged/asm/.. -->
2058-
<asm.version>7.1</asm.version>
2058+
<asm.version>7.2</asm.version>
20592059
<bnd.plugin.version>2.3.6</bnd.plugin.version>
20602060
<cdi.api.version>1.1</cdi.api.version>
20612061
<commons-lang3.version>3.3.2</commons-lang3.version>

0 commit comments

Comments
 (0)