From f8be43cebfe5d9ee80e838c883fb305969ece743 Mon Sep 17 00:00:00 2001 From: cushon Date: Fri, 2 Nov 2018 16:29:39 -0700 Subject: [PATCH] Automatic code cleanup. PiperOrigin-RevId: 219881070 --- .../devtools/build/importdeps/ClassCache.java | 2 +- .../build/importdeps/DepsCheckerClassVisitor.java | 8 ++++---- .../android/desugar/CorePackageRenamerTest.java | 4 ++-- .../android/desugar/BytecodeTypeInference.java | 2 +- .../desugar/CloseResourceMethodScanner.java | 4 ++-- .../desugar/CoreLibraryInvocationRewriter.java | 4 ++-- .../android/desugar/DefaultMethodClassFixer.java | 12 ++++++------ .../android/desugar/EmulatedInterfaceRewriter.java | 2 +- .../build/android/desugar/InterfaceDesugaring.java | 12 ++++++------ .../InvokeDynamicLambdaMethodCollector.java | 4 ++-- .../build/android/desugar/Java7Compatibility.java | 10 +++++----- .../build/android/desugar/LambdaClassFixer.java | 14 +++++++------- .../build/android/desugar/LambdaDesugaring.java | 5 ++--- .../android/desugar/LongCompareMethodRewriter.java | 6 +++--- .../ObjectsRequireNonNullMethodRewriter.java | 6 +++--- .../android/desugar/TryWithResourcesRewriter.java | 10 +++++----- .../android/desugar/io/CoreLibraryRewriter.java | 2 +- .../android/desugar/io/HeaderClassLoader.java | 8 ++++---- .../desugar/scan/PrefixReferenceScanner.java | 8 ++++---- 19 files changed, 61 insertions(+), 62 deletions(-) diff --git a/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/ClassCache.java b/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/ClassCache.java index 2355d3ccd491e5..d6f7f3eaf87323 100644 --- a/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/ClassCache.java +++ b/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/ClassCache.java @@ -356,7 +356,7 @@ private static class ClassInfoBuilder extends ClassVisitor { private boolean directDep; public ClassInfoBuilder() { - super(Opcodes.ASM6); + super(Opcodes.ASM7); } @Override diff --git a/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/DepsCheckerClassVisitor.java b/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/DepsCheckerClassVisitor.java index 8fadf101eebac2..00fcaaede49054 100644 --- a/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/DepsCheckerClassVisitor.java +++ b/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/DepsCheckerClassVisitor.java @@ -43,7 +43,7 @@ public class DepsCheckerClassVisitor extends ClassVisitor { private final DepsCheckerMethodVisitor defaultMethodChecker = new DepsCheckerMethodVisitor(); public DepsCheckerClassVisitor(ClassCache classCache, ResultCollector resultCollector) { - super(Opcodes.ASM6); + super(Opcodes.ASM7); this.classCache = classCache; this.resultCollector = resultCollector; } @@ -221,7 +221,7 @@ private void checkInternalNameArray(@Nullable String[] internalNames) { private class DepsCheckerAnnotationVisitor extends AnnotationVisitor { DepsCheckerAnnotationVisitor() { - super(Opcodes.ASM6); + super(Opcodes.ASM7); } @Override @@ -262,7 +262,7 @@ public void visitEnum(String name, String desc, String value) { private class DepsCheckerFieldVisitor extends FieldVisitor { DepsCheckerFieldVisitor() { - super(Opcodes.ASM6); + super(Opcodes.ASM7); } @Override @@ -283,7 +283,7 @@ public AnnotationVisitor visitTypeAnnotation( private class DepsCheckerMethodVisitor extends MethodVisitor { DepsCheckerMethodVisitor() { - super(Opcodes.ASM6); + super(Opcodes.ASM7); } @Override diff --git a/src/test/java/com/google/devtools/build/android/desugar/CorePackageRenamerTest.java b/src/test/java/com/google/devtools/build/android/desugar/CorePackageRenamerTest.java index 5220ed6f18d2fe..fc404595bca2be 100644 --- a/src/test/java/com/google/devtools/build/android/desugar/CorePackageRenamerTest.java +++ b/src/test/java/com/google/devtools/build/android/desugar/CorePackageRenamerTest.java @@ -70,7 +70,7 @@ private static class MockClassVisitor extends ClassVisitor { final MockMethodVisitor mv = new MockMethodVisitor(); public MockClassVisitor() { - super(Opcodes.ASM6); + super(Opcodes.ASM7); } @Override @@ -86,7 +86,7 @@ private static class MockMethodVisitor extends MethodVisitor { String desc; public MockMethodVisitor() { - super(Opcodes.ASM6); + super(Opcodes.ASM7); } @Override diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/BytecodeTypeInference.java b/src/tools/android/java/com/google/devtools/build/android/desugar/BytecodeTypeInference.java index ce36071be4e17a..d8183e97d7561b 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/BytecodeTypeInference.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/BytecodeTypeInference.java @@ -46,7 +46,7 @@ public final class BytecodeTypeInference extends MethodVisitor { private final String methodSignature; public BytecodeTypeInference(int access, String owner, String name, String methodDescriptor) { - super(Opcodes.ASM6); + super(Opcodes.ASM7); localVariableSlots = createInitialLocalVariableTypes(access, owner, name, methodDescriptor); previousFrame = FrameInfo.create(ImmutableList.copyOf(localVariableSlots), ImmutableList.of()); this.methodSignature = owner + "." + name + methodDescriptor; diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/CloseResourceMethodScanner.java b/src/tools/android/java/com/google/devtools/build/android/desugar/CloseResourceMethodScanner.java index 75675155f149f7..649a8f79d61970 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/CloseResourceMethodScanner.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/CloseResourceMethodScanner.java @@ -30,7 +30,7 @@ public class CloseResourceMethodScanner extends ClassVisitor { private int classFileVersion; public CloseResourceMethodScanner() { - super(Opcodes.ASM6); + super(Opcodes.ASM7); } @Override @@ -73,7 +73,7 @@ private class StackMapFrameCollector extends MethodVisitor { private boolean hasStackMapFrame; public StackMapFrameCollector(String name, String desc) { - super(Opcodes.ASM6); + super(Opcodes.ASM7); methodSignature = internalName + '.' + name + desc; } diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/CoreLibraryInvocationRewriter.java b/src/tools/android/java/com/google/devtools/build/android/desugar/CoreLibraryInvocationRewriter.java index 381a3443c7fc06..6672d088b1caf1 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/CoreLibraryInvocationRewriter.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/CoreLibraryInvocationRewriter.java @@ -33,7 +33,7 @@ public class CoreLibraryInvocationRewriter extends ClassVisitor { private final CoreLibrarySupport support; public CoreLibraryInvocationRewriter(ClassVisitor cv, CoreLibrarySupport support) { - super(Opcodes.ASM6, cv); + super(Opcodes.ASM7, cv); this.support = support; } @@ -46,7 +46,7 @@ public MethodVisitor visitMethod( private class CoreLibraryMethodInvocationRewriter extends MethodVisitor { public CoreLibraryMethodInvocationRewriter(MethodVisitor mv) { - super(Opcodes.ASM6, mv); + super(Opcodes.ASM7, mv); } @Override diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/DefaultMethodClassFixer.java b/src/tools/android/java/com/google/devtools/build/android/desugar/DefaultMethodClassFixer.java index 51a6a44b53b012..4b195b28ab84a2 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/DefaultMethodClassFixer.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/DefaultMethodClassFixer.java @@ -65,7 +65,7 @@ public DefaultMethodClassFixer( @Nullable CoreLibrarySupport coreLibrarySupport, ClassReaderFactory bootclasspath, ClassLoader targetLoader) { - super(Opcodes.ASM6, dest); + super(Opcodes.ASM7, dest); this.classpath = classpath; this.coreLibrarySupport = coreLibrarySupport; this.bootclasspath = bootclasspath; @@ -454,7 +454,7 @@ private class DefaultMethodStubber extends ClassVisitor { public DefaultMethodStubber( boolean isBootclasspathInterface, boolean mayNeedStubsForSuperclass) { - super(Opcodes.ASM6); + super(Opcodes.ASM7); this.isBootclasspathInterface = isBootclasspathInterface; this.mayNeedStubsForSuperclass = mayNeedStubsForSuperclass; } @@ -617,7 +617,7 @@ private class DefaultMethodFinder extends ClassVisitor { private boolean found; public DefaultMethodFinder() { - super(Opcodes.ASM6); + super(Opcodes.ASM7); } @Override @@ -663,7 +663,7 @@ private class InstanceMethodRecorder extends ClassVisitor { private String className; public InstanceMethodRecorder(boolean ignoreEmulatedMethods) { - super(Opcodes.ASM6); + super(Opcodes.ASM7); this.ignoreEmulatedMethods = ignoreEmulatedMethods; } @@ -711,7 +711,7 @@ private static class InterfaceInitializationNecessityDetector extends ClassVisit private boolean hasDefaultMethods; public InterfaceInitializationNecessityDetector(String internalName) { - super(Opcodes.ASM6); + super(Opcodes.ASM7); this.internalName = internalName; } @@ -745,7 +745,7 @@ public MethodVisitor visitMethod( hasDefaultMethods = isNonBridgeDefaultMethod(access); } if ("".equals(name)) { - return new MethodVisitor(Opcodes.ASM6) { + return new MethodVisitor(Opcodes.ASM7) { @Override public void visitFieldInsn(int opcode, String owner, String name, String desc) { if (opcode == Opcodes.PUTSTATIC && internalName.equals(owner)) { diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/EmulatedInterfaceRewriter.java b/src/tools/android/java/com/google/devtools/build/android/desugar/EmulatedInterfaceRewriter.java index 355dd9713c5cec..49a8d0690bf71d 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/EmulatedInterfaceRewriter.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/EmulatedInterfaceRewriter.java @@ -32,7 +32,7 @@ public class EmulatedInterfaceRewriter extends ClassVisitor { private final CoreLibrarySupport support; public EmulatedInterfaceRewriter(ClassVisitor dest, CoreLibrarySupport support) { - super(Opcodes.ASM6, dest); + super(Opcodes.ASM7, dest); this.support = support; } diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/InterfaceDesugaring.java b/src/tools/android/java/com/google/devtools/build/android/desugar/InterfaceDesugaring.java index e9e31994282751..06ce60bdce10bb 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/InterfaceDesugaring.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/InterfaceDesugaring.java @@ -71,7 +71,7 @@ public InterfaceDesugaring( ClassLoader targetLoader, GeneratedClassStore store, boolean legacyJaCoCo) { - super(Opcodes.ASM6, dest); + super(Opcodes.ASM7, dest); this.interfaceCache = interfaceCache; this.depsCollector = depsCollector; this.coreLibrarySupport = coreLibrarySupport; @@ -338,7 +338,7 @@ private ClassVisitor companion() { private class InterfaceFieldWriteCollector extends MethodVisitor { public InterfaceFieldWriteCollector(MethodVisitor mv) { - super(Opcodes.ASM6, mv); + super(Opcodes.ASM7, mv); } @Override @@ -384,7 +384,7 @@ public InterfaceInvocationRewriter( ClassLoader targetLoader, DependencyCollector depsCollector, String declaringClass) { - super(Opcodes.ASM6, dest); + super(Opcodes.ASM7, dest); this.interfaceName = knownInterfaceName; this.bootclasspath = bootclasspath; this.targetLoader = targetLoader; @@ -478,7 +478,7 @@ private Method findDefaultMethod(String owner, String name, String desc) { private static class MoveJacocoFieldAccess extends MethodVisitor { public MoveJacocoFieldAccess(MethodVisitor mv) { - super(Opcodes.ASM6, mv); + super(Opcodes.ASM7, mv); } @Override @@ -501,7 +501,7 @@ private static class MultiplexAnnotations extends MethodVisitor { private final MethodVisitor annotationOnlyDest; public MultiplexAnnotations(@Nullable MethodVisitor dest, MethodVisitor annotationOnlyDest) { - super(Opcodes.ASM6, dest); + super(Opcodes.ASM7, dest); this.annotationOnlyDest = annotationOnlyDest; } @@ -546,7 +546,7 @@ private static class MultiplexAnnotationVisitor extends AnnotationVisitor { public MultiplexAnnotationVisitor( @Nullable AnnotationVisitor dest, AnnotationVisitor... moreDestinations) { - super(Opcodes.ASM6, dest); + super(Opcodes.ASM7, dest); this.moreDestinations = moreDestinations; } diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/InvokeDynamicLambdaMethodCollector.java b/src/tools/android/java/com/google/devtools/build/android/desugar/InvokeDynamicLambdaMethodCollector.java index 002c08b2a7f26f..58bd0e66dbf1f8 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/InvokeDynamicLambdaMethodCollector.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/InvokeDynamicLambdaMethodCollector.java @@ -32,7 +32,7 @@ class InvokeDynamicLambdaMethodCollector extends ClassVisitor { private boolean needOuterClassRewrite = false; public InvokeDynamicLambdaMethodCollector() { - super(Opcodes.ASM6); + super(Opcodes.ASM7); } /** @@ -64,7 +64,7 @@ public void visitOuterClass(String owner, String name, String desc) { private class LambdaMethodCollector extends MethodVisitor { public LambdaMethodCollector(MethodVisitor dest) { - super(Opcodes.ASM6, dest); + super(Opcodes.ASM7, dest); } @Override diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/Java7Compatibility.java b/src/tools/android/java/com/google/devtools/build/android/desugar/Java7Compatibility.java index 4ac29a41c53efd..a786f1f47a9a86 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/Java7Compatibility.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/Java7Compatibility.java @@ -48,7 +48,7 @@ public class Java7Compatibility extends ClassVisitor { public Java7Compatibility( ClassVisitor cv, ClassReaderFactory factory, ClassReaderFactory bootclasspathReader) { - super(Opcodes.ASM6, cv); + super(Opcodes.ASM7, cv); this.factory = factory; this.bootclasspathReader = bootclasspathReader; } @@ -128,7 +128,7 @@ private class UpdateBytecodeVersionIfNecessary extends MethodVisitor { boolean updated = false; public UpdateBytecodeVersionIfNecessary(MethodVisitor methodVisitor) { - super(Opcodes.ASM6, methodVisitor); + super(Opcodes.ASM7, methodVisitor); } @Override @@ -160,7 +160,7 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc, private class InlineJacocoInit extends MethodVisitor { public InlineJacocoInit(MethodVisitor dest) { - super(Opcodes.ASM6, dest); + super(Opcodes.ASM7, dest); } @Override @@ -186,7 +186,7 @@ private static class InlineOneMethod extends ClassVisitor { private int copied = 0; public InlineOneMethod(String methodName, MethodVisitor dest) { - super(Opcodes.ASM6); + super(Opcodes.ASM7); this.methodName = methodName; this.dest = dest; } @@ -220,7 +220,7 @@ private static class InlineMethodBody extends MethodVisitor { public InlineMethodBody(MethodVisitor dest) { // We'll set the destination visitor in visitCode() to reduce the risk of copying anything // we didn't mean to copy - super(Opcodes.ASM6, (MethodVisitor) null); + super(Opcodes.ASM7, (MethodVisitor) null); this.dest = dest; } diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/LambdaClassFixer.java b/src/tools/android/java/com/google/devtools/build/android/desugar/LambdaClassFixer.java index 180dc0980a9783..f5d78ce74b48dc 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/LambdaClassFixer.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/LambdaClassFixer.java @@ -72,7 +72,7 @@ public LambdaClassFixer( ImmutableSet interfaceLambdaMethods, boolean allowDefaultMethods, boolean copyBridgeMethods) { - super(Opcodes.ASM6, dest); + super(Opcodes.ASM7, dest); checkArgument(!allowDefaultMethods || interfaceLambdaMethods.isEmpty()); checkArgument(allowDefaultMethods || copyBridgeMethods); this.lambdaInfo = lambdaInfo; @@ -241,7 +241,7 @@ private void copyBridgeMethods(ImmutableList interfaces) { /** Rewriter for methods in generated lambda classes. */ private class LambdaClassMethodRewriter extends MethodVisitor { public LambdaClassMethodRewriter(MethodVisitor dest) { - super(Opcodes.ASM6, dest); + super(Opcodes.ASM7, dest); } @Override @@ -301,7 +301,7 @@ public AnnotationVisitor visitAnnotation(String desc, boolean visible) { private static class LambdaClassInvokeSpecialRewriter extends MethodVisitor { public LambdaClassInvokeSpecialRewriter(MethodVisitor dest) { - super(Opcodes.ASM6, dest); + super(Opcodes.ASM7, dest); } @Override @@ -326,7 +326,7 @@ private class CopyBridgeMethods extends ClassVisitor { public CopyBridgeMethods() { // No delegate visitor; instead we'll add methods to the outer class's delegate where needed - super(Opcodes.ASM6); + super(Opcodes.ASM7); } @Override @@ -371,7 +371,7 @@ private class CopyOneMethod extends ClassVisitor { public CopyOneMethod(String methodName) { // No delegate visitor; instead we'll add methods to the outer class's delegate where needed - super(Opcodes.ASM6); + super(Opcodes.ASM7); checkState(!allowDefaultMethods, "Couldn't copy interface lambda bodies"); this.methodName = methodName; } @@ -416,7 +416,7 @@ public MethodVisitor visitMethod( */ private static class AvoidJacocoInit extends MethodVisitor { public AvoidJacocoInit(MethodVisitor dest) { - super(Opcodes.ASM6, dest); + super(Opcodes.ASM7, dest); } @Override @@ -445,7 +445,7 @@ public UseBridgeMethod( String desc, String signature, String[] exceptions) { - super(Opcodes.ASM6, access, name, desc, signature, exceptions); + super(Opcodes.ASM7, access, name, desc, signature, exceptions); this.dest = dest; this.lambdaInfo = lambdaInfo; this.classLoader = classLoader; diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/LambdaDesugaring.java b/src/tools/android/java/com/google/devtools/build/android/desugar/LambdaDesugaring.java index f9b531698dd999..a30175c3d18d25 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/LambdaDesugaring.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/LambdaDesugaring.java @@ -17,7 +17,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; import static java.lang.invoke.MethodHandles.publicLookup; -import static org.objectweb.asm.Opcodes.ASM6; import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableSet; @@ -74,7 +73,7 @@ public LambdaDesugaring( ImmutableSet.Builder aggregateInterfaceLambdaMethods, ImmutableSet lambdaMethodsUsedInInvokeDyanmic, boolean allowDefaultMethods) { - super(Opcodes.ASM6, dest); + super(Opcodes.ASM7, dest); this.targetLoader = targetLoader; this.lambdas = lambdas; this.aggregateInterfaceLambdaMethods = aggregateInterfaceLambdaMethods; @@ -382,7 +381,7 @@ public InvokedynamicRewriter( String desc, String signature, String[] exceptions) { - super(ASM6, access, name, desc, signature, exceptions); + super(Opcodes.ASM7, access, name, desc, signature, exceptions); this.dest = checkNotNull(dest, "Null destination for %s.%s : %s", internalName, name, desc); } diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/LongCompareMethodRewriter.java b/src/tools/android/java/com/google/devtools/build/android/desugar/LongCompareMethodRewriter.java index 7f2f35525f76c6..8f8d6a980e331e 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/LongCompareMethodRewriter.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/LongCompareMethodRewriter.java @@ -13,13 +13,13 @@ // limitations under the License. package com.google.devtools.build.android.desugar; -import static org.objectweb.asm.Opcodes.ASM6; import static org.objectweb.asm.Opcodes.INVOKESTATIC; import static org.objectweb.asm.Opcodes.LCMP; import com.google.devtools.build.android.desugar.io.CoreLibraryRewriter; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; /** * This class rewrites any call to Long.compare with the JVM instruction lcmp that is semantically @@ -30,7 +30,7 @@ public class LongCompareMethodRewriter extends ClassVisitor { private final CoreLibraryRewriter rewriter; public LongCompareMethodRewriter(ClassVisitor cv, CoreLibraryRewriter rewriter) { - super(ASM6, cv); + super(Opcodes.ASM7, cv); this.rewriter = rewriter; } @@ -44,7 +44,7 @@ public MethodVisitor visitMethod( private class LongCompareMethodVisitor extends MethodVisitor { public LongCompareMethodVisitor(MethodVisitor visitor) { - super(ASM6, visitor); + super(Opcodes.ASM7, visitor); } @Override diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/ObjectsRequireNonNullMethodRewriter.java b/src/tools/android/java/com/google/devtools/build/android/desugar/ObjectsRequireNonNullMethodRewriter.java index 931459ae0e251d..cdb66a787a9007 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/ObjectsRequireNonNullMethodRewriter.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/ObjectsRequireNonNullMethodRewriter.java @@ -13,7 +13,6 @@ // limitations under the License. package com.google.devtools.build.android.desugar; -import static org.objectweb.asm.Opcodes.ASM6; import static org.objectweb.asm.Opcodes.DUP; import static org.objectweb.asm.Opcodes.INVOKESTATIC; import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL; @@ -22,6 +21,7 @@ import com.google.devtools.build.android.desugar.io.CoreLibraryRewriter; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; /** * This class desugars any call to Objects.requireNonNull(Object o), Objects.requireNonNull(Object @@ -33,7 +33,7 @@ public class ObjectsRequireNonNullMethodRewriter extends ClassVisitor { private final CoreLibraryRewriter rewriter; public ObjectsRequireNonNullMethodRewriter(ClassVisitor cv, CoreLibraryRewriter rewriter) { - super(ASM6, cv); + super(Opcodes.ASM7, cv); this.rewriter = rewriter; } @@ -47,7 +47,7 @@ public MethodVisitor visitMethod( private class ObjectsMethodInlinerMethodVisitor extends MethodVisitor { public ObjectsMethodInlinerMethodVisitor(MethodVisitor mv) { - super(ASM6, mv); + super(Opcodes.ASM7, mv); } @Override diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/TryWithResourcesRewriter.java b/src/tools/android/java/com/google/devtools/build/android/desugar/TryWithResourcesRewriter.java index 98eef45d88e451..45ac7c46cd343c 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/TryWithResourcesRewriter.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/TryWithResourcesRewriter.java @@ -17,7 +17,6 @@ import static com.google.common.base.Preconditions.checkState; import static org.objectweb.asm.Opcodes.ACC_STATIC; import static org.objectweb.asm.Opcodes.ACC_SYNTHETIC; -import static org.objectweb.asm.Opcodes.ASM6; import static org.objectweb.asm.Opcodes.INVOKEINTERFACE; import static org.objectweb.asm.Opcodes.INVOKESTATIC; import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL; @@ -39,6 +38,7 @@ import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; import org.objectweb.asm.commons.ClassRemapper; import org.objectweb.asm.commons.Remapper; import org.objectweb.asm.tree.MethodNode; @@ -131,7 +131,7 @@ public TryWithResourcesRewriter( Set visitedExceptionTypes, AtomicInteger numOfTryWithResourcesInvoked, boolean hasCloseResourceMethod) { - super(ASM6, classVisitor); + super(Opcodes.ASM7, classVisitor); this.classLoader = classLoader; this.visitedExceptionTypes = visitedExceptionTypes; this.numOfTryWithResourcesInvoked = numOfTryWithResourcesInvoked; @@ -185,7 +185,7 @@ public MethodVisitor visitMethod( } if (isSyntheticCloseResourceMethod(access, name, desc)) { checkState(closeResourceMethod == null, "The TWR rewriter has been used."); - closeResourceMethod = new MethodNode(ASM6, access, name, desc, signature, exceptions); + closeResourceMethod = new MethodNode(Opcodes.ASM7, access, name, desc, signature, exceptions); // Run the TWR desugar pass over the $closeResource(Throwable, AutoCloseable) first, for // example, to rewrite calls to AutoCloseable.close().. TryWithResourceVisitor twrVisitor = @@ -263,7 +263,7 @@ public TryWithResourceVisitor( MethodVisitor methodVisitor, ClassLoader classLoader, @Nullable BytecodeTypeInference typeInference) { - super(ASM6, methodVisitor); + super(Opcodes.ASM7, methodVisitor); this.classLoader = classLoader; this.internalName = internalName; this.methodSignature = methodSignature; @@ -432,7 +432,7 @@ public String map(String typeName) { public MethodVisitor visitMethod( int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); - return new MethodVisitor(ASM6, mv) { + return new MethodVisitor(Opcodes.ASM7, mv) { @Override public void visitMethodInsn( int opcode, String owner, String name, String desc, boolean itf) { diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/io/CoreLibraryRewriter.java b/src/tools/android/java/com/google/devtools/build/android/desugar/io/CoreLibraryRewriter.java index f3c546c1c3c7a7..a63bc05d378605 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/io/CoreLibraryRewriter.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/io/CoreLibraryRewriter.java @@ -160,7 +160,7 @@ public class UnprefixingClassWriter extends ClassVisitor { private String finalClassName; UnprefixingClassWriter(int flags) { - super(Opcodes.ASM6); + super(Opcodes.ASM7); this.writer = new ClassWriter(flags); this.cv = this.writer; if (!prefix.isEmpty()) { diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/io/HeaderClassLoader.java b/src/tools/android/java/com/google/devtools/build/android/desugar/io/HeaderClassLoader.java index f70dc0e3e2b4c5..ee718f70e8202b 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/io/HeaderClassLoader.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/io/HeaderClassLoader.java @@ -87,7 +87,7 @@ private static class NonPrimitiveFieldCollector extends ClassVisitor { private String internalName; public NonPrimitiveFieldCollector() { - super(Opcodes.ASM6); + super(Opcodes.ASM7); } @Override @@ -132,7 +132,7 @@ private static class CodeStubber extends ClassVisitor { private final ImmutableList interfaceFields; public CodeStubber(ClassVisitor cv, ImmutableList interfaceFields) { - super(Opcodes.ASM6, cv); + super(Opcodes.ASM7, cv); this.interfaceFields = interfaceFields; } @@ -178,7 +178,7 @@ private static class InterfaceInitializerEraser extends MethodVisitor { public InterfaceInitializerEraser( MethodVisitor mv, String internalName, ImmutableList interfaceFields) { - super(Opcodes.ASM6); + super(Opcodes.ASM7); dest = mv; this.interfaceFields = interfaceFields; } @@ -209,7 +209,7 @@ private static class BodyStubber extends MethodVisitor { private boolean hasCode = false; public BodyStubber(MethodVisitor mv) { - super(Opcodes.ASM6, mv); + super(Opcodes.ASM7, mv); } @Override diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/scan/PrefixReferenceScanner.java b/src/tools/android/java/com/google/devtools/build/android/desugar/scan/PrefixReferenceScanner.java index b899ccc41d32e3..c2e9eaa27fa0fb 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/scan/PrefixReferenceScanner.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/scan/PrefixReferenceScanner.java @@ -52,7 +52,7 @@ public static ImmutableSet scan(ClassReader reader, String prefix private final String prefix; public PrefixReferenceScanner(String prefix) { - super(Opcodes.ASM6); + super(Opcodes.ASM7); this.prefix = prefix; } @@ -228,7 +228,7 @@ void handleReference(Handle handle) { private class PrefixReferenceMethodVisitor extends MethodVisitor { public PrefixReferenceMethodVisitor() { - super(Opcodes.ASM6); + super(Opcodes.ASM7); } @Override @@ -356,7 +356,7 @@ public AnnotationVisitor visitLocalVariableAnnotation( private class PrefixReferenceFieldVisitor extends FieldVisitor { public PrefixReferenceFieldVisitor() { - super(Opcodes.ASM6); + super(Opcodes.ASM7); } @Override @@ -376,7 +376,7 @@ public AnnotationVisitor visitTypeAnnotation( private class PrefixReferenceAnnotationVisitor extends AnnotationVisitor { public PrefixReferenceAnnotationVisitor() { - super(Opcodes.ASM6); + super(Opcodes.ASM7); } @Override