Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMPRESS-582: Bump Pack200 packages from ASM 3.2 to 7.0. #216

Merged
merged 1 commit into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Brotli, Zstandard and ar, cpio, jar, tar, zip, dump, 7z, arj.
<commons.jacoco.version>0.8.7</commons.jacoco.version>
<commons.japicmp.version>0.15.3</commons.japicmp.version>
<commons.javadoc.version>3.3.0</commons.javadoc.version>
<asm.version>7.0</asm.version>
</properties>

<issueManagement>
Expand Down Expand Up @@ -119,9 +120,9 @@ Brotli, Zstandard and ar, cpio, jar, tar, zip, dump, 7z, arj.

<!-- Pack200 -->
<dependency>
<groupId>asm</groupId>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>3.2</version>
<version>${asm.version}</version>
<optional>true</optional>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public int readUnsignedShort(final int index) {
// Doing this to check whether last load-constant instruction was ldc (18) or ldc_w (19)
// TODO: Assess whether this impacts on performance
final int unsignedShort = super.readUnsignedShort(index);
if (b[index - 1] == 19) {
if (index > 0 && b[index - 1] == 19) {
lastUnsignedShort = unsignedShort;
} else {
lastUnsignedShort = Short.MIN_VALUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,20 @@
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;


/**
* A Pack200 archive consists of one or more Segments.
*/
public class Segment implements ClassVisitor {
public class Segment extends ClassVisitor {

public static int ASM_API = Opcodes.ASM4; /* see https://asm.ow2.io/javadoc/org/objectweb/asm/Opcodes.html#ASM4 */

public Segment() {
super(ASM_API);
}

private SegmentHeader segmentHeader;
private CpBands cpBands;
Expand Down Expand Up @@ -255,8 +263,12 @@ public void visitEnd() {
*
* It delegates to BcBands for bytecode related visits and to ClassBands for everything else.
*/
public class SegmentMethodVisitor implements MethodVisitor {

public class SegmentMethodVisitor extends MethodVisitor {

public SegmentMethodVisitor() {
super(ASM_API);
}

@Override
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
return new SegmentAnnotationVisitor(MetadataBandGroup.CONTEXT_METHOD, desc, visible);
Expand Down Expand Up @@ -427,7 +439,7 @@ public ClassBands getClassBands() {
/**
* SegmentAnnotationVisitor implements <code>AnnotationVisitor</code> to visit Annotations found in a class file.
*/
public class SegmentAnnotationVisitor implements AnnotationVisitor {
public class SegmentAnnotationVisitor extends AnnotationVisitor {

private int context = -1;
private int parameter = -1;
Expand All @@ -443,17 +455,20 @@ public class SegmentAnnotationVisitor implements AnnotationVisitor {
private final List nestPairN = new ArrayList();

public SegmentAnnotationVisitor(final int context, final String desc, final boolean visible) {
super(ASM_API);
this.context = context;
this.desc = desc;
this.visible = visible;
}

public SegmentAnnotationVisitor(final int context) {
super(ASM_API);
this.context = context;
}

public SegmentAnnotationVisitor(final int context, final int parameter, final String desc,
final boolean visible) {
super(ASM_API);
this.context = context;
this.parameter = parameter;
this.desc = desc;
Expand All @@ -478,7 +493,7 @@ public AnnotationVisitor visitAnnotation(String name, final String desc) {
nameRU.add(name);
nestTypeRS.add(desc);
nestPairN.add(Integer.valueOf(0));
return new AnnotationVisitor() {
return new AnnotationVisitor(context, av) {
@Override
public void visit(final String name, final Object value) {
final Integer numPairs = (Integer) nestPairN.remove(nestPairN.size() - 1);
Expand Down Expand Up @@ -552,7 +567,7 @@ public void visitEnum(String name, final String desc, final String value) {
}
}

public class ArrayVisitor implements AnnotationVisitor {
public class ArrayVisitor extends AnnotationVisitor {

private final int indexInCaseArrayN;
private final List caseArrayN;
Expand All @@ -561,6 +576,8 @@ public class ArrayVisitor implements AnnotationVisitor {
private final List T;

public ArrayVisitor(final List caseArrayN, final List T, final List nameRU, final List values) {
super(ASM_API);

this.caseArrayN = caseArrayN;
this.T = T;
this.nameRU = nameRU;
Expand Down Expand Up @@ -612,7 +629,11 @@ public void visitEnum(final String name, final String desc, final String value)
* SegmentFieldVisitor implements <code>FieldVisitor</code> to visit the metadata relating to fields in a class
* file.
*/
public class SegmentFieldVisitor implements FieldVisitor {
public class SegmentFieldVisitor extends FieldVisitor {

public SegmentFieldVisitor() {
super(ASM_API);
}

@Override
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
Expand Down
Empty file.