Replace lambdas by method reference

Change-Id: Ia9e53884109e3f9f16d0b6aa8bba525bb33052d3
diff --git a/src/main/java/com/android/tools/r8/ReadProguardMap.java b/src/main/java/com/android/tools/r8/ReadProguardMap.java
index 31bc2d8..0e02ce0 100644
--- a/src/main/java/com/android/tools/r8/ReadProguardMap.java
+++ b/src/main/java/com/android/tools/r8/ReadProguardMap.java
@@ -38,7 +38,7 @@
     if (args.length == 0) {
       readProguardMapFile(DEFAULT_MAP_FILE_NAME);
     } else {
-      Arrays.asList(args).forEach((String name) -> readProguardMapFile(name));
+      Arrays.asList(args).forEach(this::readProguardMapFile);
     }
     timing.report();
   }
diff --git a/src/main/java/com/android/tools/r8/dex/InheritanceClassInDexDistributor.java b/src/main/java/com/android/tools/r8/dex/InheritanceClassInDexDistributor.java
index 8e8750a..1183590 100644
--- a/src/main/java/com/android/tools/r8/dex/InheritanceClassInDexDistributor.java
+++ b/src/main/java/com/android/tools/r8/dex/InheritanceClassInDexDistributor.java
@@ -548,7 +548,7 @@
   private void updateGroupsNumberOfIds(List<ClassGroup> groups) {
     Collection<Future<?>> updateIdsTasks = new ArrayList<>(groups.size());
     for (ClassGroup group : groups) {
-      updateIdsTasks.add(executorService.submit(() -> group.updateNumbersOfIds()));
+      updateIdsTasks.add(executorService.submit(group::updateNumbersOfIds));
     }
     try {
       ThreadUtils.awaitFutures(updateIdsTasks);
diff --git a/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java b/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java
index dd88661..dcb601b 100644
--- a/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java
+++ b/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java
@@ -352,7 +352,7 @@
   private static void syntheticSpecify(StructuralSpecification<DexEncodedMethod, ?> spec) {
     spec.withItem(m -> m.method)
         .withItem(m -> m.accessFlags)
-        .withItem(m -> m.annotations())
+        .withItem(DexDefinition::annotations)
         .withItem(m -> m.parameterAnnotationsList)
         .withNullableItem(m -> m.classFileVersion)
         .withBool(m -> m.d8R8Synthesized)
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassMethodsBuilder.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassMethodsBuilder.java
index 13c01eb..b87c6ad 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassMethodsBuilder.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassMethodsBuilder.java
@@ -35,9 +35,9 @@
 
   public void setClassMethods(DexProgramClass clazz) {
     assert virtualMethods.stream().allMatch(method -> method.getHolderType() == clazz.type);
-    assert virtualMethods.stream().allMatch(method -> method.belongsToVirtualPool());
+    assert virtualMethods.stream().allMatch(DexEncodedMethod::belongsToVirtualPool);
     assert directMethods.stream().allMatch(method -> method.getHolderType() == clazz.type);
-    assert directMethods.stream().allMatch(method -> method.belongsToDirectPool());
+    assert directMethods.stream().allMatch(DexEncodedMethod::belongsToDirectPool);
     clazz.setVirtualMethods(virtualMethods);
     clazz.setDirectMethods(directMethods);
   }
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java b/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java
index 27a8c72..1bee2d4 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java
@@ -2402,7 +2402,7 @@
     }
 
     // Move all normal successors to the new block.
-    currentBlockInfo.normalSuccessors.forEach((Integer offset) -> info.addNormalSuccessor(offset));
+    currentBlockInfo.normalSuccessors.forEach(info::addNormalSuccessor);
     currentBlockInfo.normalSuccessors.clear();
 
     // Link the two blocks.
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/peepholes/PeepholeLayout.java b/src/main/java/com/android/tools/r8/ir/optimize/peepholes/PeepholeLayout.java
index 6e36d48..86958a5 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/peepholes/PeepholeLayout.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/peepholes/PeepholeLayout.java
@@ -35,9 +35,9 @@
 
   public Match test(InstructionListIterator it) {
     if (backwards) {
-      return testDirection(() -> it.hasPrevious(), () -> it.previous(), () -> it.next());
+      return testDirection(it::hasPrevious, it::previous, it::next);
     } else {
-      return testDirection(() -> it.hasNext(), () -> it.next(), () -> it.previous());
+      return testDirection(it::hasNext, it::next, it::previous);
     }
   }
 
diff --git a/src/main/java/com/android/tools/r8/shaking/GraphReporter.java b/src/main/java/com/android/tools/r8/shaking/GraphReporter.java
index 86b0d08..6459b7f 100644
--- a/src/main/java/com/android/tools/r8/shaking/GraphReporter.java
+++ b/src/main/java/com/android/tools/r8/shaking/GraphReporter.java
@@ -423,7 +423,7 @@
   }
 
   GraphEdgeInfo getEdgeInfo(EdgeKind kind) {
-    return reasonInfo.computeIfAbsent(kind, k -> new GraphEdgeInfo(k));
+    return reasonInfo.computeIfAbsent(kind, GraphEdgeInfo::new);
   }
 
   private DexClass definitionFor(DexType type) {
diff --git a/src/main/java/com/android/tools/r8/utils/FilteredArchiveClassFileProvider.java b/src/main/java/com/android/tools/r8/utils/FilteredArchiveClassFileProvider.java
index 43cbb4d..483315e 100644
--- a/src/main/java/com/android/tools/r8/utils/FilteredArchiveClassFileProvider.java
+++ b/src/main/java/com/android/tools/r8/utils/FilteredArchiveClassFileProvider.java
@@ -10,6 +10,6 @@
 class FilteredArchiveClassFileProvider extends InternalArchiveClassFileProvider {
 
   FilteredArchiveClassFileProvider(FilteredClassPath archive) throws IOException {
-    super(archive.getPath(), entry -> archive.matchesFile(entry));
+    super(archive.getPath(), archive::matchesFile);
   }
 }
diff --git a/src/main/java/com/android/tools/r8/utils/IterableUtils.java b/src/main/java/com/android/tools/r8/utils/IterableUtils.java
index 914307f..2b0267d 100644
--- a/src/main/java/com/android/tools/r8/utils/IterableUtils.java
+++ b/src/main/java/com/android/tools/r8/utils/IterableUtils.java
@@ -110,13 +110,13 @@
   }
 
   public static <F> int sumInt(Iterable<F> iterable, Function<? super F, Integer> fn) {
-    Iterable<Integer> integers = Iterables.transform(iterable, i -> fn.apply(i));
+    Iterable<Integer> integers = Iterables.transform(iterable, fn::apply);
     return sumInt(integers);
   }
 
   public static <T, U> Iterable<U> flatMap(
       Iterable<T> iterable, Function<? super T, Iterable<U>> map) {
-    return Iterables.concat(Iterables.transform(iterable, val -> map.apply(val)));
+    return Iterables.concat(Iterables.transform(iterable, map::apply));
   }
 
   public static <T> Iterable<T> empty() {
diff --git a/src/main/java/com/android/tools/r8/utils/structural/CompareToVisitor.java b/src/main/java/com/android/tools/r8/utils/structural/CompareToVisitor.java
index a0b2104..90e3b16 100644
--- a/src/main/java/com/android/tools/r8/utils/structural/CompareToVisitor.java
+++ b/src/main/java/com/android/tools/r8/utils/structural/CompareToVisitor.java
@@ -37,10 +37,7 @@
 
   public final <S extends StructuralItem<S>> int visitItemCollection(
       Collection<S> items1, Collection<S> items2) {
-    return visitItemIterator(
-        items1.iterator(),
-        items2.iterator(),
-        (s, other, visitor) -> s.acceptCompareTo(other, visitor));
+    return visitItemIterator(items1.iterator(), items2.iterator(), StructuralItem::acceptCompareTo);
   }
 
   public abstract int visitDexString(DexString string1, DexString string2);
diff --git a/src/test/java/com/android/tools/r8/D8LazyRunExamplesAndroidOTest.java b/src/test/java/com/android/tools/r8/D8LazyRunExamplesAndroidOTest.java
index 1d9ec50..78bbcf3 100644
--- a/src/test/java/com/android/tools/r8/D8LazyRunExamplesAndroidOTest.java
+++ b/src/test/java/com/android/tools/r8/D8LazyRunExamplesAndroidOTest.java
@@ -92,9 +92,7 @@
     // Build each class individually using tmpClassesDir as classpath for desugaring.
     List<ProgramResource> individalDexes = new ArrayList<>();
     List<Path> individualClassFiles =
-        Files.walk(tmpClassesDir)
-        .filter(classFile -> FileUtils.isClassFile(classFile))
-        .collect(Collectors.toList());
+        Files.walk(tmpClassesDir).filter(FileUtils::isClassFile).collect(Collectors.toList());
     for (Path classFile : individualClassFiles) {
       D8Command.Builder builder =
           D8Command.builder()
diff --git a/src/test/java/com/android/tools/r8/RunExamplesAndroidOTest.java b/src/test/java/com/android/tools/r8/RunExamplesAndroidOTest.java
index c72a3ea..b7bb5d2 100644
--- a/src/test/java/com/android/tools/r8/RunExamplesAndroidOTest.java
+++ b/src/test/java/com/android/tools/r8/RunExamplesAndroidOTest.java
@@ -611,14 +611,15 @@
     Assume.assumeTrue(ToolHelper.artSupported() || ToolHelper.compareAgaintsGoldenFiles());
     boolean expectedToFail = expectedToFail(testName);
     try {
-      String output = ToolHelper.runArtNoVerificationErrors(
-          Arrays.stream(dexes).map(path -> path.toString()).collect(Collectors.toList()),
-          qualifiedMainClass,
-          builder -> {
-            for (String arg : args) {
-              builder.appendProgramArgument(arg);
-            }
-          });
+      String output =
+          ToolHelper.runArtNoVerificationErrors(
+              Arrays.stream(dexes).map(Path::toString).collect(Collectors.toList()),
+              qualifiedMainClass,
+              builder -> {
+                for (String arg : args) {
+                  builder.appendProgramArgument(arg);
+                }
+              });
       if (!expectedToFail
           && !skipRunningOnJvm(testName)
           && !ToolHelper.compareAgaintsGoldenFiles()) {
diff --git a/src/test/java/com/android/tools/r8/RunExamplesAndroidPTest.java b/src/test/java/com/android/tools/r8/RunExamplesAndroidPTest.java
index d06d976..ed69ecf 100644
--- a/src/test/java/com/android/tools/r8/RunExamplesAndroidPTest.java
+++ b/src/test/java/com/android/tools/r8/RunExamplesAndroidPTest.java
@@ -248,10 +248,11 @@
     if (expectedToFail) {
       thrown.expect(Throwable.class);
     }
-    String output = ToolHelper.runArtNoVerificationErrors(
-        Arrays.stream(dexes).map(path -> path.toString()).collect(Collectors.toList()),
-        qualifiedMainClass,
-        null);
+    String output =
+        ToolHelper.runArtNoVerificationErrors(
+            Arrays.stream(dexes).map(Path::toString).collect(Collectors.toList()),
+            qualifiedMainClass,
+            null);
     if (!expectedToFail) {
       ToolHelper.ProcessResult javaResult =
           ToolHelper.runJava(ImmutableList.copyOf(jars), qualifiedMainClass);
diff --git a/src/test/java/com/android/tools/r8/TestDiagnosticMessagesImpl.java b/src/test/java/com/android/tools/r8/TestDiagnosticMessagesImpl.java
index 3935988..f1b6e73 100644
--- a/src/test/java/com/android/tools/r8/TestDiagnosticMessagesImpl.java
+++ b/src/test/java/com/android/tools/r8/TestDiagnosticMessagesImpl.java
@@ -92,7 +92,7 @@
         "Expected no "
             + type
             + " messages, got:\n"
-            + String.join("\n", ListUtils.map(messages, m -> m.getDiagnosticMessage())),
+            + String.join("\n", ListUtils.map(messages, Diagnostic::getDiagnosticMessage)),
         0,
         messages.size());
   }
diff --git a/src/test/java/com/android/tools/r8/TestParametersBuilder.java b/src/test/java/com/android/tools/r8/TestParametersBuilder.java
index ffa34fe..c5811f9 100644
--- a/src/test/java/com/android/tools/r8/TestParametersBuilder.java
+++ b/src/test/java/com/android/tools/r8/TestParametersBuilder.java
@@ -75,12 +75,12 @@
 
   /** Add all available CF runtimes starting from and including {@param startInclusive}. */
   public TestParametersBuilder withCfRuntimesStartingFromIncluding(CfVm startInclusive) {
-    return withCfRuntimeFilter(vm -> startInclusive.lessThanOrEqual(vm));
+    return withCfRuntimeFilter(startInclusive::lessThanOrEqual);
   }
 
   /** Add all available CF runtimes starting from and excluding {@param startExcluding}. */
   public TestParametersBuilder withCfRuntimesStartingFromExcluding(CfVm startExcluding) {
-    return withCfRuntimeFilter(vm -> startExcluding.lessThan(vm));
+    return withCfRuntimeFilter(startExcluding::lessThan);
   }
 
   /** Add all available CF runtimes ending at and including {@param endInclusive}. */
@@ -122,7 +122,7 @@
 
   /** Add all available DEX runtimes starting from and including {@param startInclusive}. */
   public TestParametersBuilder withDexRuntimesStartingFromIncluding(DexVm.Version startInclusive) {
-    return withDexRuntimeFilter(vm -> startInclusive.isOlderThanOrEqual(vm));
+    return withDexRuntimeFilter(startInclusive::isOlderThanOrEqual);
   }
 
   /** Add all available DEX runtimes starting from and excluding {@param startExcluding}. */
diff --git a/src/test/java/com/android/tools/r8/ToolHelper.java b/src/test/java/com/android/tools/r8/ToolHelper.java
index a85ae6a..08664a8 100644
--- a/src/test/java/com/android/tools/r8/ToolHelper.java
+++ b/src/test/java/com/android/tools/r8/ToolHelper.java
@@ -510,7 +510,7 @@
   }
 
   private static List<File> toFileList(List<String> filePathList) {
-    return filePathList.stream().map(path -> new File(path)).collect(Collectors.toList());
+    return filePathList.stream().map(File::new).collect(Collectors.toList());
   }
 
   public static class DXCommandBuilder extends CommandBuilder {
@@ -1541,7 +1541,7 @@
       assert goldenFileDir.isDirectory();
       processResult =
           compareAgainstGoldenFiles(
-              files.stream().map(f -> new File(f)).collect(Collectors.toList()), goldenFileDir);
+              files.stream().map(File::new).collect(Collectors.toList()), goldenFileDir);
       if (processResult.exitCode == 0) {
         processResult = readProcessResult(goldenFileDir);
       }
@@ -1553,8 +1553,7 @@
     if (goldenFilesDirToProp != null) {
       File goldenFileDir = new File(goldenFilesDirToProp);
       assert goldenFileDir.isDirectory();
-      storeAsGoldenFiles(
-          files.stream().map(f -> new File(f)).collect(Collectors.toList()), goldenFileDir);
+      storeAsGoldenFiles(files.stream().map(File::new).collect(Collectors.toList()), goldenFileDir);
       storeProcessResult(processResult, goldenFileDir);
     }
 
diff --git a/src/test/java/com/android/tools/r8/cf/SillyBlockOrderTest.java b/src/test/java/com/android/tools/r8/cf/SillyBlockOrderTest.java
index 4484519..d1e4ef7 100644
--- a/src/test/java/com/android/tools/r8/cf/SillyBlockOrderTest.java
+++ b/src/test/java/com/android/tools/r8/cf/SillyBlockOrderTest.java
@@ -10,6 +10,7 @@
 import com.android.tools.r8.TestParametersCollection;
 import com.android.tools.r8.utils.StringUtils;
 import com.android.tools.r8.utils.codeinspector.CodeInspector;
+import com.android.tools.r8.utils.codeinspector.InstructionSubject;
 import com.android.tools.r8.utils.codeinspector.MethodSubject;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -53,7 +54,8 @@
     try {
       MethodSubject method =
           inspector.method(TestClass.class.getMethod("doubleConditional", boolean.class));
-      assertEquals(expected, method.streamInstructions().filter(i -> i.isGoto()).count());
+      assertEquals(
+          expected, method.streamInstructions().filter(InstructionSubject::isGoto).count());
     } catch (NoSuchMethodException e) {
       throw new RuntimeException(e);
     }
diff --git a/src/test/java/com/android/tools/r8/classmerging/horizontal/ClassesWithNativeMethodsTest.java b/src/test/java/com/android/tools/r8/classmerging/horizontal/ClassesWithNativeMethodsTest.java
index 1f0e3e6..04bb9d7 100644
--- a/src/test/java/com/android/tools/r8/classmerging/horizontal/ClassesWithNativeMethodsTest.java
+++ b/src/test/java/com/android/tools/r8/classmerging/horizontal/ClassesWithNativeMethodsTest.java
@@ -12,6 +12,7 @@
 import com.android.tools.r8.NeverClassInline;
 import com.android.tools.r8.NeverInline;
 import com.android.tools.r8.TestParameters;
+import com.android.tools.r8.utils.codeinspector.HorizontallyMergedClassesInspector;
 import org.junit.Test;
 
 public class ClassesWithNativeMethodsTest extends HorizontalClassMergingTestBase {
@@ -31,7 +32,8 @@
         .enableInliningAnnotations()
         .enableNeverClassInliningAnnotations()
         .setMinApi(parameters.getApiLevel())
-        .addHorizontallyMergedClassesInspector(inspector -> inspector.assertNoClassesMerged())
+        .addHorizontallyMergedClassesInspector(
+            HorizontallyMergedClassesInspector::assertNoClassesMerged)
         .run(parameters.getRuntime(), Main.class)
         .assertFailureWithErrorThatMatches(
             allOf(
diff --git a/src/test/java/com/android/tools/r8/classmerging/horizontal/dispatch/OverrideAbstractMethodWithDefaultTest.java b/src/test/java/com/android/tools/r8/classmerging/horizontal/dispatch/OverrideAbstractMethodWithDefaultTest.java
index e456600..635ec43 100644
--- a/src/test/java/com/android/tools/r8/classmerging/horizontal/dispatch/OverrideAbstractMethodWithDefaultTest.java
+++ b/src/test/java/com/android/tools/r8/classmerging/horizontal/dispatch/OverrideAbstractMethodWithDefaultTest.java
@@ -11,6 +11,7 @@
 import com.android.tools.r8.NoVerticalClassMerging;
 import com.android.tools.r8.TestParameters;
 import com.android.tools.r8.classmerging.horizontal.HorizontalClassMergingTestBase;
+import com.android.tools.r8.utils.codeinspector.HorizontallyMergedClassesInspector;
 import org.junit.Test;
 
 public class OverrideAbstractMethodWithDefaultTest extends HorizontalClassMergingTestBase {
@@ -31,7 +32,7 @@
         .enableNoVerticalClassMergingAnnotations()
         .setMinApi(parameters.getApiLevel())
         .addHorizontallyMergedClassesInspectorIf(
-            enableHorizontalClassMerging, inspector -> inspector.assertNoClassesMerged())
+            enableHorizontalClassMerging, HorizontallyMergedClassesInspector::assertNoClassesMerged)
         .run(parameters.getRuntime(), Main.class)
         .assertSuccessWithOutputLines("J", "B2")
         .inspect(
diff --git a/src/test/java/com/android/tools/r8/classmerging/horizontal/dispatch/OverrideMergeAbsentTest.java b/src/test/java/com/android/tools/r8/classmerging/horizontal/dispatch/OverrideMergeAbsentTest.java
index 526aa00..9a727f5 100644
--- a/src/test/java/com/android/tools/r8/classmerging/horizontal/dispatch/OverrideMergeAbsentTest.java
+++ b/src/test/java/com/android/tools/r8/classmerging/horizontal/dispatch/OverrideMergeAbsentTest.java
@@ -12,6 +12,7 @@
 import com.android.tools.r8.NoVerticalClassMerging;
 import com.android.tools.r8.TestParameters;
 import com.android.tools.r8.classmerging.horizontal.HorizontalClassMergingTestBase;
+import com.android.tools.r8.utils.codeinspector.HorizontallyMergedClassesInspector;
 import org.junit.Test;
 
 public class OverrideMergeAbsentTest extends HorizontalClassMergingTestBase {
@@ -32,7 +33,7 @@
         .enableNoVerticalClassMergingAnnotations()
         .setMinApi(parameters.getApiLevel())
         .addHorizontallyMergedClassesInspectorIf(
-            enableHorizontalClassMerging, inspector -> inspector.assertNoClassesMerged())
+            enableHorizontalClassMerging, HorizontallyMergedClassesInspector::assertNoClassesMerged)
         .run(parameters.getRuntime(), Main.class)
         .assertSuccessWithOutputLines("A", "B", "A", "J")
         .inspect(
diff --git a/src/test/java/com/android/tools/r8/debug/LocalsTest.java b/src/test/java/com/android/tools/r8/debug/LocalsTest.java
index 7eeed7d..68b67a9 100644
--- a/src/test/java/com/android/tools/r8/debug/LocalsTest.java
+++ b/src/test/java/com/android/tools/r8/debug/LocalsTest.java
@@ -285,41 +285,46 @@
         "Locals",
         breakpoint("Locals", "breakpoint"),
         run(),
-        inspect(state -> {
-          // 1st breakpoint: all lengthOfArray[N] are set to 0
-          FrameInspector outerFrame = state.getFrame(1);
+        inspect(
+            state -> {
+              // 1st breakpoint: all lengthOfArray[N] are set to 0
+              FrameInspector outerFrame = state.getFrame(1);
 
-          Map<String, Value> localValues = outerFrame.getLocalValues();
+              Map<String, Value> localValues = outerFrame.getLocalValues();
 
-          for (int i = minIndex; i <= maxIndex; ++i) {
-            String varName = "lengthOfArray" + i;
-            Assert.assertTrue(localValues.containsKey(varName));
-            Assert.assertEquals(Value.createInt(0), localValues.get(varName));
-          }
+              for (int i = minIndex; i <= maxIndex; ++i) {
+                String varName = "lengthOfArray" + i;
+                Assert.assertTrue(localValues.containsKey(varName));
+                Assert.assertEquals(Value.createInt(0), localValues.get(varName));
+              }
 
-          // Capture IDs of arrays.
-          for (int i = minIndex; i <= maxIndex; ++i) {
-            String varName = "array" + i;
-            Assert.assertTrue(localValues.containsKey(varName));
-            arrayLocals.put(varName, localValues.get(varName));
-          }
-        }),
+              // Capture IDs of arrays.
+              for (int i = minIndex; i <= maxIndex; ++i) {
+                String varName = "array" + i;
+                Assert.assertTrue(localValues.containsKey(varName));
+                arrayLocals.put(varName, localValues.get(varName));
+              }
+            }),
         // Step out to reach next instructions in the tested method
         stepOut(),
-        inspect(state -> {
-          Assert.assertEquals("Locals.java", state.getSourceFile());
-          Assert.assertEquals(107, state.getLineNumber());
-          // Verify that all arrays have the same value.
-          arrayLocals.forEach((name, value) -> state.checkLocal(name, value));
-        }),
+        inspect(
+            state -> {
+              Assert.assertEquals("Locals.java", state.getSourceFile());
+              Assert.assertEquals(107, state.getLineNumber());
+              // Verify that all arrays have the same value.
+              arrayLocals.forEach(state::checkLocal);
+            }),
         // Step instruction by instruction to ensure all locals previously declared are safe.
-        stepUntil(StepKind.OVER, StepLevel.INSTRUCTION, state -> {
-          final String sourceFile = state.getSourceFile();
-          final int lineNumber = state.getLineNumber();
-          arrayLocals.forEach((name, value) -> state.checkLocal(name, value));
-          // Stop when we reach the expected line.
-          return lineNumber == 125 && sourceFile.equals("Locals.java");
-        }),
+        stepUntil(
+            StepKind.OVER,
+            StepLevel.INSTRUCTION,
+            state -> {
+              final String sourceFile = state.getSourceFile();
+              final int lineNumber = state.getLineNumber();
+              arrayLocals.forEach(state::checkLocal);
+              // Stop when we reach the expected line.
+              return lineNumber == 125 && sourceFile.equals("Locals.java");
+            }),
         run());
   }
 
diff --git a/src/test/java/com/android/tools/r8/debug/SynchronizedBlockTest.java b/src/test/java/com/android/tools/r8/debug/SynchronizedBlockTest.java
index 0c9c4b1..208c2cb 100644
--- a/src/test/java/com/android/tools/r8/debug/SynchronizedBlockTest.java
+++ b/src/test/java/com/android/tools/r8/debug/SynchronizedBlockTest.java
@@ -28,8 +28,8 @@
   public static Collection<Object[]> setup() {
     DelayedDebugTestConfig cf =
         temp -> new CfDebugTestConfig().addPaths(DebugTestBase.DEBUGGEE_JAR);
-    DelayedDebugTestConfig r8cf = temp -> new R8CfDebugTestResourcesConfig(temp);
-    DelayedDebugTestConfig d8 = temp -> new D8DebugTestResourcesConfig(temp);
+    DelayedDebugTestConfig r8cf = R8CfDebugTestResourcesConfig::new;
+    DelayedDebugTestConfig d8 = D8DebugTestResourcesConfig::new;
     return ImmutableList.of(
         new Object[] {"CF", cf},
         new Object[] {"D8", d8},
diff --git a/src/test/java/com/android/tools/r8/desugar/DesugarToClassFile.java b/src/test/java/com/android/tools/r8/desugar/DesugarToClassFile.java
index dc6e894..a0b196f 100644
--- a/src/test/java/com/android/tools/r8/desugar/DesugarToClassFile.java
+++ b/src/test/java/com/android/tools/r8/desugar/DesugarToClassFile.java
@@ -10,6 +10,7 @@
 import com.android.tools.r8.TestParameters;
 import com.android.tools.r8.TestParametersCollection;
 import com.android.tools.r8.utils.codeinspector.CodeInspector;
+import com.android.tools.r8.utils.codeinspector.FoundClassSubject;
 import java.nio.file.Path;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -47,8 +48,7 @@
 
   private void checkHasLambdaClass(CodeInspector inspector) {
     assertTrue(
-        inspector.allClasses().stream()
-            .anyMatch(subject -> subject.isSynthesizedJavaLambdaClass()));
+        inspector.allClasses().stream().anyMatch(FoundClassSubject::isSynthesizedJavaLambdaClass));
   }
 
   @Test
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/CustomCollectionSuperCallsTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/CustomCollectionSuperCallsTest.java
index 1455d77..ce35ef0 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/CustomCollectionSuperCallsTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/CustomCollectionSuperCallsTest.java
@@ -9,6 +9,7 @@
 import com.android.tools.r8.D8TestRunResult;
 import com.android.tools.r8.R8TestRunResult;
 import com.android.tools.r8.TestParameters;
+import com.android.tools.r8.TestShrinkerBuilder;
 import com.android.tools.r8.utils.AndroidApiLevel;
 import com.android.tools.r8.utils.BooleanUtils;
 import java.nio.file.Path;
@@ -109,7 +110,7 @@
             .addKeepMainRule(Executor.class)
             .applyIf(
                 parameters.getApiLevel().isLessThan(AndroidApiLevel.N),
-                builder -> builder.addDontWarnVivifiedClasses())
+                TestShrinkerBuilder::addDontWarnVivifiedClasses)
             .setMinApi(parameters.getApiLevel())
             .enableCoreLibraryDesugaring(parameters.getApiLevel(), keepRuleConsumer)
             .compile()
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryDeterminismTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryDeterminismTest.java
index bfb1885..9623e7c 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryDeterminismTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryDeterminismTest.java
@@ -69,9 +69,13 @@
       assertTrue(clazz.isPresent());
       FoundClassSubject clazz2 = clazz.asFoundClassSubject();
       Set<String> methods1 =
-          clazz1.allMethods().stream().map(m -> m.toString()).collect(Collectors.toSet());
+          clazz1.allMethods().stream()
+              .map(FoundMethodSubject::toString)
+              .collect(Collectors.toSet());
       Set<String> methods2 =
-          clazz2.allMethods().stream().map(m -> m.toString()).collect(Collectors.toSet());
+          clazz2.allMethods().stream()
+              .map(FoundMethodSubject::toString)
+              .collect(Collectors.toSet());
       SetView<String> union = Sets.union(methods1, methods2);
       assertEquals(
           "Inspector 1 contains more methods",
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/FeatureSplitTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/FeatureSplitTest.java
index aee313b..9447057 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/FeatureSplitTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/FeatureSplitTest.java
@@ -11,6 +11,7 @@
 import com.android.tools.r8.CompilationFailedException;
 import com.android.tools.r8.TestParameters;
 import com.android.tools.r8.TestRuntime;
+import com.android.tools.r8.TestShrinkerBuilder;
 import com.android.tools.r8.ToolHelper;
 import com.android.tools.r8.ToolHelper.ArtCommandBuilder;
 import com.android.tools.r8.ToolHelper.ProcessResult;
@@ -249,7 +250,7 @@
           .addKeepAllClassesRule()
           .applyIf(
               parameters.getApiLevel().isLessThan(AndroidApiLevel.N),
-              builder -> builder.addDontWarnEmulatedLibraryClasses())
+              TestShrinkerBuilder::addDontWarnEmulatedLibraryClasses)
           .enableCoreLibraryDesugaring(parameters.getApiLevel(), keepRuleConsumer)
           .compile()
           .writeToZip(basePath);
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/JavaTimeTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/JavaTimeTest.java
index c5b73a6..ff7577f 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/JavaTimeTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/JavaTimeTest.java
@@ -14,6 +14,7 @@
 import com.android.tools.r8.TestBase;
 import com.android.tools.r8.TestCompileResult;
 import com.android.tools.r8.TestParameters;
+import com.android.tools.r8.TestShrinkerBuilder;
 import com.android.tools.r8.graph.DexType;
 import com.android.tools.r8.utils.AndroidApiLevel;
 import com.android.tools.r8.utils.BooleanUtils;
@@ -266,7 +267,7 @@
             .addKeepMainRule(TestClass.class)
             .applyIf(
                 parameters.getApiLevel().isLessThan(AndroidApiLevel.O),
-                builder -> builder.addDontWarnRetargetLibraryMembers())
+                TestShrinkerBuilder::addDontWarnRetargetLibraryMembers)
             .enableNoVerticalClassMergingAnnotations()
             .setMinApi(parameters.getApiLevel())
             .enableCoreLibraryDesugaring(parameters.getApiLevel(), keepRuleConsumer)
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/SynchronizedCollectionTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/SynchronizedCollectionTest.java
index df9d84e..9496b9c4 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/SynchronizedCollectionTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/SynchronizedCollectionTest.java
@@ -6,6 +6,7 @@
 
 import com.android.tools.r8.TestParameters;
 import com.android.tools.r8.TestRuntime.CfVm;
+import com.android.tools.r8.TestShrinkerBuilder;
 import com.android.tools.r8.ToolHelper;
 import com.android.tools.r8.utils.AndroidApiLevel;
 import com.android.tools.r8.utils.BooleanUtils;
@@ -82,7 +83,7 @@
         .addKeepMainRule(MAIN_CLASS)
         .applyIf(
             parameters.getApiLevel().isLessThan(AndroidApiLevel.N),
-            builder -> builder.addDontWarnEmulatedLibraryClasses())
+            TestShrinkerBuilder::addDontWarnEmulatedLibraryClasses)
         .setMinApi(parameters.getApiLevel())
         .enableCoreLibraryDesugaring(parameters.getApiLevel(), keepRuleConsumer)
         .compile()
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/jdktests/Jdk11StreamTests.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/jdktests/Jdk11StreamTests.java
index 7a1d422..0901c28 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/jdktests/Jdk11StreamTests.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/jdktests/Jdk11StreamTests.java
@@ -289,7 +289,7 @@
               parameters.getRuntime(), "TestNGMainRunner", verbosity, runnableTests.get(path));
       String stdout = result.getStdOut();
       if (stdout.contains("java.lang.NoSuchMethodError")
-          && Arrays.stream(missingDesugaredMethods()).anyMatch(method -> stdout.contains(method))) {
+          && Arrays.stream(missingDesugaredMethods()).anyMatch(stdout::contains)) {
         // TODO(b/134732760): support Java 9 APIs.
       } else if (stdout.contains("java.lang.NoSuchMethodError")
           && stdout.contains("org.openjdk.tests.java.util.stream.IterateTest.testIterate")) {
diff --git a/src/test/java/com/android/tools/r8/desugaring/lambdanames/PackageDependentLambdaNamesTest.java b/src/test/java/com/android/tools/r8/desugaring/lambdanames/PackageDependentLambdaNamesTest.java
index 771a77f..e76e476 100644
--- a/src/test/java/com/android/tools/r8/desugaring/lambdanames/PackageDependentLambdaNamesTest.java
+++ b/src/test/java/com/android/tools/r8/desugaring/lambdanames/PackageDependentLambdaNamesTest.java
@@ -12,6 +12,7 @@
 import com.android.tools.r8.utils.BooleanUtils;
 import com.android.tools.r8.utils.DescriptorUtils;
 import com.android.tools.r8.utils.StringUtils;
+import com.android.tools.r8.utils.codeinspector.FoundClassSubject;
 import java.util.List;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -51,7 +52,7 @@
             assertEquals(
                 2,
                 inspector.allClasses().stream()
-                    .filter(c -> c.isSynthesizedJavaLambdaClass())
+                    .filter(FoundClassSubject::isSynthesizedJavaLambdaClass)
                     .count());
           });
     }
diff --git a/src/test/java/com/android/tools/r8/diagnostics/ErrorDuringIrConversionTest.java b/src/test/java/com/android/tools/r8/diagnostics/ErrorDuringIrConversionTest.java
index b9eabe6..89088ac 100644
--- a/src/test/java/com/android/tools/r8/diagnostics/ErrorDuringIrConversionTest.java
+++ b/src/test/java/com/android/tools/r8/diagnostics/ErrorDuringIrConversionTest.java
@@ -86,7 +86,8 @@
     try {
       testForD8()
           .apply(addTestClassWithOrigin())
-          .addOptionsModification(options -> options.testing.hookInIrConversion = () -> throwNPE())
+          .addOptionsModification(
+              options -> options.testing.hookInIrConversion = ErrorDuringIrConversionTest::throwNPE)
           .compileWithExpectedDiagnostics(
               diagnostics -> {
                 // Check that the error is reported as an error to the diagnostics handler.
diff --git a/src/test/java/com/android/tools/r8/kotlin/KotlinClassInlinerTest.java b/src/test/java/com/android/tools/r8/kotlin/KotlinClassInlinerTest.java
index 19c0b89..e4622be 100644
--- a/src/test/java/com/android/tools/r8/kotlin/KotlinClassInlinerTest.java
+++ b/src/test/java/com/android/tools/r8/kotlin/KotlinClassInlinerTest.java
@@ -16,6 +16,7 @@
 import com.android.tools.r8.KotlinCompilerTool.KotlinCompiler;
 import com.android.tools.r8.R8FullTestBuilder;
 import com.android.tools.r8.R8TestRunResult;
+import com.android.tools.r8.TestShrinkerBuilder;
 import com.android.tools.r8.ThrowableConsumer;
 import com.android.tools.r8.ToolHelper.KotlinTargetVersion;
 import com.android.tools.r8.code.NewInstance;
@@ -287,7 +288,7 @@
     runTestWithDefaults(
             "class_inliner_data_class",
             mainClassName,
-            builder -> builder.addDontWarnJetBrainsAnnotations())
+            TestShrinkerBuilder::addDontWarnJetBrainsAnnotations)
         .inspect(
             inspector -> {
               ClassSubject clazz = inspector.clazz(mainClassName);
diff --git a/src/test/java/com/android/tools/r8/kotlin/ProcessKotlinReflectionLibTest.java b/src/test/java/com/android/tools/r8/kotlin/ProcessKotlinReflectionLibTest.java
index b80d89f..3137d61 100644
--- a/src/test/java/com/android/tools/r8/kotlin/ProcessKotlinReflectionLibTest.java
+++ b/src/test/java/com/android/tools/r8/kotlin/ProcessKotlinReflectionLibTest.java
@@ -9,6 +9,7 @@
 import com.android.tools.r8.KotlinTestBase;
 import com.android.tools.r8.R8FullTestBuilder;
 import com.android.tools.r8.TestParameters;
+import com.android.tools.r8.TestShrinkerBuilder;
 import com.android.tools.r8.ThrowableConsumer;
 import com.android.tools.r8.ToolHelper;
 import com.android.tools.r8.ToolHelper.KotlinTargetVersion;
@@ -100,12 +101,12 @@
 
   @Test
   public void testDontOptimize() throws Exception {
-    test(builder -> builder.noOptimization());
+    test(TestShrinkerBuilder::noOptimization);
   }
 
   @Test
   public void testDontObfuscate() throws Exception {
-    test(builder -> builder.noMinification());
+    test(TestShrinkerBuilder::noMinification);
   }
 
 }
diff --git a/src/test/java/com/android/tools/r8/kotlin/ProcessKotlinStdlibTest.java b/src/test/java/com/android/tools/r8/kotlin/ProcessKotlinStdlibTest.java
index 5c6c724..7166aed 100644
--- a/src/test/java/com/android/tools/r8/kotlin/ProcessKotlinStdlibTest.java
+++ b/src/test/java/com/android/tools/r8/kotlin/ProcessKotlinStdlibTest.java
@@ -9,6 +9,7 @@
 import com.android.tools.r8.KotlinTestBase;
 import com.android.tools.r8.R8FullTestBuilder;
 import com.android.tools.r8.TestParameters;
+import com.android.tools.r8.TestShrinkerBuilder;
 import com.android.tools.r8.ThrowableConsumer;
 import com.android.tools.r8.ToolHelper;
 import com.android.tools.r8.ToolHelper.KotlinTargetVersion;
@@ -59,14 +60,14 @@
   public void testAsIs() throws Exception {
     test(
         ImmutableList.of("-dontshrink", "-dontoptimize", "-dontobfuscate"),
-        builder -> builder.addDontWarnJetBrainsAnnotations());
+        TestShrinkerBuilder::addDontWarnJetBrainsAnnotations);
   }
 
   @Test
   public void testDontShrinkAndDontOptimize() throws Exception {
     test(
         ImmutableList.of("-dontshrink", "-dontoptimize"),
-        builder -> builder.addDontWarnJetBrainsAnnotations());
+        TestShrinkerBuilder::addDontWarnJetBrainsAnnotations);
   }
 
   @Test
@@ -89,12 +90,12 @@
   public void testDontShrinkAndDontObfuscate() throws Exception {
     test(
         ImmutableList.of("-dontshrink", "-dontobfuscate"),
-        builder -> builder.addDontWarnJetBrainsAnnotations());
+        TestShrinkerBuilder::addDontWarnJetBrainsAnnotations);
   }
 
   @Test
   public void testDontShrink() throws Exception {
-    test(ImmutableList.of("-dontshrink"), builder -> builder.addDontWarnJetBrainsAnnotations());
+    test(ImmutableList.of("-dontshrink"), TestShrinkerBuilder::addDontWarnJetBrainsAnnotations);
   }
 
   @Test
diff --git a/src/test/java/com/android/tools/r8/kotlin/R8KotlinAccessorTest.java b/src/test/java/com/android/tools/r8/kotlin/R8KotlinAccessorTest.java
index 3e3b8a2..882bc22 100644
--- a/src/test/java/com/android/tools/r8/kotlin/R8KotlinAccessorTest.java
+++ b/src/test/java/com/android/tools/r8/kotlin/R8KotlinAccessorTest.java
@@ -11,6 +11,7 @@
 
 import com.android.tools.r8.KotlinCompilerTool.KotlinCompiler;
 import com.android.tools.r8.R8TestBuilder;
+import com.android.tools.r8.TestShrinkerBuilder;
 import com.android.tools.r8.ToolHelper;
 import com.android.tools.r8.ToolHelper.KotlinTargetVersion;
 import com.android.tools.r8.ToolHelper.ProcessResult;
@@ -270,7 +271,7 @@
     runTest(
             PROPERTIES_PACKAGE_NAME,
             mainClass,
-            builder -> builder.addDontWarnJetBrainsAnnotations())
+            TestShrinkerBuilder::addDontWarnJetBrainsAnnotations)
         .inspect(
             inspector -> {
               ClassSubject outerClass =
@@ -302,7 +303,7 @@
     runTest(
             PROPERTIES_PACKAGE_NAME,
             mainClass,
-            builder -> builder.addDontWarnJetBrainsAnnotations())
+            TestShrinkerBuilder::addDontWarnJetBrainsAnnotations)
         .inspect(
             inspector -> {
               ClassSubject outerClass =
@@ -380,7 +381,7 @@
     String mainClass =
         addMainToClasspath(
             "accessors.PropertyAccessorForInnerClassKt", "noUseOfPropertyAccessorFromInnerClass");
-    runTest("accessors", mainClass, builder -> builder.addDontWarnJetBrainsNotNullAnnotation())
+    runTest("accessors", mainClass, TestShrinkerBuilder::addDontWarnJetBrainsNotNullAnnotation)
         .inspect(
             inspector -> {
               // Class is removed because the instantiation of the inner class has no side effects.
diff --git a/src/test/java/com/android/tools/r8/kotlin/TestKotlinDataClass.java b/src/test/java/com/android/tools/r8/kotlin/TestKotlinDataClass.java
index 62cda72..0426d41 100644
--- a/src/test/java/com/android/tools/r8/kotlin/TestKotlinDataClass.java
+++ b/src/test/java/com/android/tools/r8/kotlin/TestKotlinDataClass.java
@@ -36,18 +36,20 @@
   }
 
   public MemberNaming.MethodSignature getCopySignature() {
-    List<String> propertiesTypes = properties.values().stream()
-        .sorted(Comparator.comparingInt(p -> p.getIndex()))
-        .map(p -> p.getType())
-        .collect(Collectors.toList());
+    List<String> propertiesTypes =
+        properties.values().stream()
+            .sorted(Comparator.comparingInt(KotlinProperty::getIndex))
+            .map(KotlinProperty::getType)
+            .collect(Collectors.toList());
     return new MemberNaming.MethodSignature("copy", className, propertiesTypes);
   }
 
   public MemberNaming.MethodSignature getCopyDefaultSignature() {
-    List<String> propertiesTypes = properties.values().stream()
-        .sorted(Comparator.comparingInt(p -> p.getIndex()))
-        .map(p -> p.getType())
-        .collect(Collectors.toList());
+    List<String> propertiesTypes =
+        properties.values().stream()
+            .sorted(Comparator.comparingInt(KotlinProperty::getIndex))
+            .map(KotlinProperty::getType)
+            .collect(Collectors.toList());
 
     List<String> copyDefaultParameterTypes = new ArrayList<>(propertiesTypes.size() + 3);
     copyDefaultParameterTypes.add(className);
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingAfterVerticalMergingMethodTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingAfterVerticalMergingMethodTest.java
index 4d000bb..3cb240b 100644
--- a/src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingAfterVerticalMergingMethodTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingAfterVerticalMergingMethodTest.java
@@ -123,7 +123,8 @@
               List<FoundMethodSubject> methods =
                   inspector.clazz(LibrarySubclass.class).allMethods();
               assertEquals(3, methods.size());
-              assertEquals(1, methods.stream().filter(m -> m.isInstanceInitializer()).count());
+              assertEquals(
+                  1, methods.stream().filter(FoundMethodSubject::isInstanceInitializer).count());
               assertEquals(
                   1, methods.stream().filter(m -> m.getFinalName().contains("main")).count());
               assertEquals(
diff --git a/src/test/java/com/android/tools/r8/resolution/SingleStaticTargetLookupTestRunner.java b/src/test/java/com/android/tools/r8/resolution/SingleStaticTargetLookupTestRunner.java
index fef40af..8edefd8 100644
--- a/src/test/java/com/android/tools/r8/resolution/SingleStaticTargetLookupTestRunner.java
+++ b/src/test/java/com/android/tools/r8/resolution/SingleStaticTargetLookupTestRunner.java
@@ -17,6 +17,7 @@
 import com.android.tools.r8.TestShrinkerBuilder;
 import com.android.tools.r8.utils.StringUtils;
 import com.android.tools.r8.utils.codeinspector.ClassSubject;
+import com.android.tools.r8.utils.codeinspector.InstructionSubject;
 import com.android.tools.r8.utils.codeinspector.MethodSubject;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -65,7 +66,8 @@
               assertThat(clazz, isPresent());
               assertThat(main, isPresent());
               assertEquals(keepFoo, staticFoo.isPresent());
-              assertEquals(keepFoo, main.streamInstructions().anyMatch(i -> i.isInvokeStatic()));
+              assertEquals(
+                  keepFoo, main.streamInstructions().anyMatch(InstructionSubject::isInvokeStatic));
             });
   }
 
diff --git a/src/test/java/com/android/tools/r8/shaking/KeepAnnotatedMemberTest.java b/src/test/java/com/android/tools/r8/shaking/KeepAnnotatedMemberTest.java
index 0564197..993a658 100644
--- a/src/test/java/com/android/tools/r8/shaking/KeepAnnotatedMemberTest.java
+++ b/src/test/java/com/android/tools/r8/shaking/KeepAnnotatedMemberTest.java
@@ -18,6 +18,7 @@
 import com.android.tools.r8.ToolHelper;
 import com.android.tools.r8.utils.codeinspector.ClassSubject;
 import com.android.tools.r8.utils.codeinspector.CodeInspector;
+import com.android.tools.r8.utils.codeinspector.FoundClassSubject;
 import com.android.tools.r8.utils.codeinspector.FoundMethodSubject;
 import com.android.tools.r8.utils.codeinspector.MethodSubject;
 import com.android.tools.r8.utils.graphinspector.GraphInspector;
@@ -276,12 +277,12 @@
     Set<String> referenceClasses =
         new TreeSet<>(
             referenceResult.codeInspector().allClasses().stream()
-                .map(c -> c.getOriginalName())
+                .map(FoundClassSubject::getOriginalName)
                 .collect(Collectors.toSet()));
 
     Set<String> conditionalClasses =
         conditionalResult.codeInspector().allClasses().stream()
-            .map(c -> c.getOriginalName())
+            .map(FoundClassSubject::getOriginalName)
             .collect(Collectors.toSet());
     {
       SetView<String> notInReference = Sets.difference(conditionalClasses, referenceClasses);
diff --git a/src/test/java/com/android/tools/r8/shaking/keptgraph/KeptByConditionalRuleTestRunner.java b/src/test/java/com/android/tools/r8/shaking/keptgraph/KeptByConditionalRuleTestRunner.java
index c813307..32c8662 100644
--- a/src/test/java/com/android/tools/r8/shaking/keptgraph/KeptByConditionalRuleTestRunner.java
+++ b/src/test/java/com/android/tools/r8/shaking/keptgraph/KeptByConditionalRuleTestRunner.java
@@ -108,7 +108,7 @@
 
     // Check baz is kept by the if rule.
     QueryNode barMethodNode = inspector.method(bazMethod).assertNotRenamed();
-    ifRuleInstances.assertAllMatch(n -> barMethodNode.isKeptBy(n));
+    ifRuleInstances.assertAllMatch(barMethodNode::isKeptBy);
 
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     whyAreYouKeepingConsumer.printWhyAreYouKeeping(bazMethod, new PrintStream(baos));
diff --git a/src/test/java/com/android/tools/r8/utils/codeinspector/DexTryCatchSubject.java b/src/test/java/com/android/tools/r8/utils/codeinspector/DexTryCatchSubject.java
index c1fa59a..fea4fbd 100644
--- a/src/test/java/com/android/tools/r8/utils/codeinspector/DexTryCatchSubject.java
+++ b/src/test/java/com/android/tools/r8/utils/codeinspector/DexTryCatchSubject.java
@@ -54,7 +54,7 @@
   @Override
   public Stream<TypeSubject> streamGuards() {
     return Arrays.stream(tryHandler.pairs)
-        .map(pair -> pair.getType())
+        .map(TypeAddrPair::getType)
         .map(type -> new TypeSubject(inspector, type));
   }