Skip to content

Commit

Permalink
Update ASM API level in desugar tests to not reject Java 11 bytecode
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 322472311
  • Loading branch information
cushon authored and copybara-github committed Jul 21, 2020
1 parent 2decd3e commit e3e46e3
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private static byte[] convertClass(ZipFile file, ZipEntry entry) throws IOExcept
ClassReader reader = new ClassReader(content);
ClassWriter writer = new ClassWriter(0);
ClassVisitor converter =
new ClassVisitor(Opcodes.ASM5, writer) {
new ClassVisitor(Opcodes.ASM8, writer) {
@Override
public MethodVisitor visitMethod(
int access, String name, String desc, String signature, String[] exceptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private static class ClassWithTypeDumper extends ClassVisitor {
private final PrintWriter printWriter;

public ClassWithTypeDumper(PrintWriter printWriter) {
super(Opcodes.ASM5);
super(Opcodes.ASM8);
this.printWriter = printWriter;
}

Expand Down Expand Up @@ -96,7 +96,7 @@ public MethodVisitor visitMethod(
private static final class TextifierExt extends Textifier {

public TextifierExt() {
super(Opcodes.ASM5);
super(Opcodes.ASM8);
}

public void print(String string) {
Expand All @@ -112,7 +112,7 @@ private static class MethodIrTypeDumper extends MethodVisitor {

public MethodIrTypeDumper(
MethodVisitor visitor, BytecodeTypeInference inference, PrintWriter printWriter) {
super(Opcodes.ASM5, visitor);
super(Opcodes.ASM8, visitor);
this.inference = inference;
this.printWriter = printWriter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ private void checkClinitForDefaultInterfaceMethodWithStaticInitializerTestInterf
byte[] classContent) {
ClassReader reader = new ClassReader(classContent);
reader.accept(
new ClassVisitor(Opcodes.ASM5) {
new ClassVisitor(Opcodes.ASM8) {

class ClinitMethod extends MethodNode {

public ClinitMethod(
int access, String name, String desc, String signature, String[] exceptions) {
super(Opcodes.ASM5, access, name, desc, signature, exceptions);
super(Opcodes.ASM8, access, name, desc, signature, exceptions);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void testClassCallingLongCompareHasNoReferenceToLong_compare() {
AtomicInteger counter = new AtomicInteger(0);

reader.accept(
new ClassVisitor(Opcodes.ASM5) {
new ClassVisitor(Opcodes.ASM8) {
@Override
public MethodVisitor visitMethod(
int access, String name, String desc, String signature, String[] exceptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void testClassCallingRequireNonNullHasNoReferenceToRequiresNonNull() {
AtomicInteger counterForSupplier = new AtomicInteger(0);

reader.accept(
new ClassVisitor(Opcodes.ASM5) {
new ClassVisitor(Opcodes.ASM8) {
@Override
public MethodVisitor visitMethod(
int access, String name, String desc, String signature, String[] exceptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private static class ClassTester extends ClassVisitor {
int clinitMethods;

private ClassTester() {
super(Opcodes.ASM5, null);
super(Opcodes.ASM8, null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.fail;
import static org.objectweb.asm.ClassWriter.COMPUTE_MAXS;
import static org.objectweb.asm.Opcodes.ASM5;
import static org.objectweb.asm.Opcodes.ASM8;
import static org.objectweb.asm.Opcodes.INVOKESTATIC;
import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;

Expand Down Expand Up @@ -254,7 +254,7 @@ private static boolean hasAutoCloseable(byte[] classContent) {
ClassReader reader = new ClassReader(classContent);
final AtomicInteger counter = new AtomicInteger();
ClassVisitor visitor =
new ClassVisitor(Opcodes.ASM5) {
new ClassVisitor(Opcodes.ASM8) {
@Override
public MethodVisitor visitMethod(
int access, String name, String desc, String signature, String[] exceptions) {
Expand All @@ -276,7 +276,7 @@ private static class DesugaredThrowableMethodCallCounter extends ClassVisitor {
private int syntheticCloseResourceCount;

public DesugaredThrowableMethodCallCounter(ClassLoader loader) {
super(ASM5);
super(ASM8);
classLoader = loader;
counterMap = new HashMap<>();
TryWithResourcesRewriter.TARGET_METHODS
Expand Down Expand Up @@ -307,7 +307,7 @@ public MethodVisitor visitMethod(
private class InvokeCounter extends MethodVisitor {

public InvokeCounter() {
super(ASM5);
super(ASM8);
}

private boolean isAssignableToThrowable(String owner) {
Expand Down

0 comments on commit e3e46e3

Please sign in to comment.