Merge commit 'bf05b1004fe108473bc33aa8930f4790984fc594' into dev-release
diff --git a/src/main/java/com/android/tools/r8/L8Command.java b/src/main/java/com/android/tools/r8/L8Command.java
index a085428..b552bb2 100644
--- a/src/main/java/com/android/tools/r8/L8Command.java
+++ b/src/main/java/com/android/tools/r8/L8Command.java
@@ -152,9 +152,6 @@
     InternalOptions internal = new InternalOptions(factory, getReporter());
     assert !internal.debug;
     internal.debug = getMode() == CompilationMode.DEBUG;
-    // TODO(b/180903899): Remove once -dontwarn sun.misc.Unsafe is in place.
-    assert !internal.ignoreMissingClasses;
-    internal.ignoreMissingClasses = true;
     assert internal.mainDexListConsumer == null;
     assert !internal.minimalMainDex;
     internal.minApiLevel = getMinApiLevel();
diff --git a/src/main/java/com/android/tools/r8/graph/DexReference.java b/src/main/java/com/android/tools/r8/graph/DexReference.java
index 27264bb..e813d7c 100644
--- a/src/main/java/com/android/tools/r8/graph/DexReference.java
+++ b/src/main/java/com/android/tools/r8/graph/DexReference.java
@@ -4,7 +4,9 @@
 package com.android.tools.r8.graph;
 
 import com.android.tools.r8.dex.IndexedItemCollection;
+import com.android.tools.r8.errors.Unreachable;
 import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
 import java.util.function.Consumer;
 import java.util.function.Function;
 
@@ -27,6 +29,22 @@
       BiConsumer<DexMethod, T> methodConsumer,
       T arg);
 
+  public static <R extends DexReference, T> T applyPair(
+      R one,
+      R other,
+      BiFunction<DexType, DexType, T> classConsumer,
+      BiFunction<DexField, DexField, T> fieldConsumer,
+      BiFunction<DexMethod, DexMethod, T> methodConsumer) {
+    if (one.isDexType()) {
+      return classConsumer.apply(one.asDexType(), other.asDexType());
+    } else if (one.isDexField()) {
+      return fieldConsumer.apply(one.asDexField(), other.asDexField());
+    } else if (one.isDexMethod()) {
+      return methodConsumer.apply(one.asDexMethod(), other.asDexMethod());
+    }
+    throw new Unreachable();
+  }
+
   public abstract void collectIndexedItems(IndexedItemCollection indexedItems);
 
   public abstract int compareTo(DexReference other);
diff --git a/src/main/java/com/android/tools/r8/graph/GraphLens.java b/src/main/java/com/android/tools/r8/graph/GraphLens.java
index a296543..43e733c 100644
--- a/src/main/java/com/android/tools/r8/graph/GraphLens.java
+++ b/src/main/java/com/android/tools/r8/graph/GraphLens.java
@@ -355,10 +355,12 @@
     return newMethod.lookupOnProgramClass(holder);
   }
 
-  // Predicate indicating if a rewritten type is a simple renaming, meaning the move from type to
-  // rewritten is just a renaming of the type to another. In other words, the content of the
-  // definition, including the definition of all of its members is the same modulo the renaming.
-  public boolean isSimpleRenaming(DexType from, DexType to) {
+  // Predicate indicating if a rewritten reference is a simple renaming, meaning the move from one
+  // reference to another is simply either just a renaming or/also renaming of the references. In
+  // other words, the content of the definition, including the definition of all of its members is
+  // the same modulo the renaming.
+  public <T extends DexReference> boolean isSimpleRenaming(T from, T to) {
+    assert from != to;
     return false;
   }
 
diff --git a/src/main/java/com/android/tools/r8/repackaging/RepackagingConstraintGraph.java b/src/main/java/com/android/tools/r8/repackaging/RepackagingConstraintGraph.java
index ca181fd..ab5b01b 100644
--- a/src/main/java/com/android/tools/r8/repackaging/RepackagingConstraintGraph.java
+++ b/src/main/java/com/android/tools/r8/repackaging/RepackagingConstraintGraph.java
@@ -100,7 +100,8 @@
   }
 
   private void registerReferencesFromClass(DexProgramClass clazz) {
-    RepackagingUseRegistry registry = new RepackagingUseRegistry(appView, this, clazz);
+    RepackagingUseRegistry registry =
+        new RepackagingUseRegistry(appView, this, clazz, libraryBoundaryNode);
 
     // Trace the references to the immediate super types.
     registry.registerTypeReference(clazz.getSuperType());
@@ -133,7 +134,8 @@
   }
 
   private void registerReferencesFromField(ProgramField field) {
-    RepackagingUseRegistry registry = new RepackagingUseRegistry(appView, this, field);
+    RepackagingUseRegistry registry =
+        new RepackagingUseRegistry(appView, this, field, libraryBoundaryNode);
 
     // Trace the type of the field.
     registry.registerTypeReference(field.getReference().getType());
@@ -144,7 +146,8 @@
 
   private void registerReferencesFromMethod(ProgramMethod method) {
     DexEncodedMethod definition = method.getDefinition();
-    RepackagingUseRegistry registry = new RepackagingUseRegistry(appView, this, method);
+    RepackagingUseRegistry registry =
+        new RepackagingUseRegistry(appView, this, method, libraryBoundaryNode);
 
     // Trace the type references in the method signature.
     definition.getProto().forEachType(registry::registerTypeReference);
diff --git a/src/main/java/com/android/tools/r8/repackaging/RepackagingLens.java b/src/main/java/com/android/tools/r8/repackaging/RepackagingLens.java
index 0fe63b8..63b8d06 100644
--- a/src/main/java/com/android/tools/r8/repackaging/RepackagingLens.java
+++ b/src/main/java/com/android/tools/r8/repackaging/RepackagingLens.java
@@ -6,10 +6,13 @@
 
 import com.android.tools.r8.graph.AppView;
 import com.android.tools.r8.graph.DexField;
+import com.android.tools.r8.graph.DexMember;
 import com.android.tools.r8.graph.DexMethod;
+import com.android.tools.r8.graph.DexReference;
 import com.android.tools.r8.graph.DexType;
 import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
 import com.android.tools.r8.shaking.AppInfoWithLiveness;
+import com.android.tools.r8.utils.IterableUtils;
 import com.android.tools.r8.utils.collections.BidirectionalOneToOneHashMap;
 import com.android.tools.r8.utils.collections.BidirectionalOneToOneMap;
 import com.android.tools.r8.utils.collections.MutableBidirectionalOneToOneMap;
@@ -42,8 +45,36 @@
   }
 
   @Override
-  public boolean isSimpleRenaming(DexType from, DexType to) {
-    return originalTypes.get(to) == from || super.isSimpleRenaming(from, to);
+  public <T extends DexReference> boolean isSimpleRenaming(T from, T to) {
+    if (from == to) {
+      assert false : "The from and to references should not be equal";
+      return false;
+    }
+    if (super.isSimpleRenaming(from, to)) {
+      // Repackaging only move classes and therefore if a previous lens has a simple renaming it
+      // will be maintained here.
+      return true;
+    }
+    return DexReference.applyPair(
+        from,
+        to,
+        this::isSimpleTypeRenamingOrEqual,
+        this::isSimpleTypeRenamingOrEqual,
+        this::isSimpleTypeRenamingOrEqual);
+  }
+
+  private boolean isSimpleTypeRenamingOrEqual(DexType from, DexType to) {
+    return from == to || originalTypes.get(to) == from;
+  }
+
+  private boolean isSimpleTypeRenamingOrEqual(DexMember<?, ?> from, DexMember<?, ?> to) {
+    if (!isSimpleTypeRenamingOrEqual(from.getHolderType(), to.getHolderType())) {
+      return false;
+    }
+    return IterableUtils.testPairs(
+        this::isSimpleTypeRenamingOrEqual,
+        from.getReferencedBaseTypes(dexItemFactory),
+        to.getReferencedBaseTypes(dexItemFactory));
   }
 
   public static class Builder {
diff --git a/src/main/java/com/android/tools/r8/repackaging/RepackagingUseRegistry.java b/src/main/java/com/android/tools/r8/repackaging/RepackagingUseRegistry.java
index a6ffc40..a013212 100644
--- a/src/main/java/com/android/tools/r8/repackaging/RepackagingUseRegistry.java
+++ b/src/main/java/com/android/tools/r8/repackaging/RepackagingUseRegistry.java
@@ -40,11 +40,13 @@
   private final ProgramDefinition context;
   private final InitClassLens initClassLens;
   private final RepackagingConstraintGraph.Node node;
+  private final RepackagingConstraintGraph.Node missingTypeNode;
 
   public RepackagingUseRegistry(
       AppView<AppInfoWithLiveness> appView,
       RepackagingConstraintGraph constraintGraph,
-      ProgramDefinition context) {
+      ProgramDefinition context,
+      RepackagingConstraintGraph.Node missingTypeNode) {
     super(appView.dexItemFactory());
     this.appInfo = appView.appInfo();
     this.options = appView.options();
@@ -52,6 +54,7 @@
     this.context = context;
     this.initClassLens = appView.initClassLens();
     this.node = constraintGraph.getNode(context.getDefinition());
+    this.missingTypeNode = missingTypeNode;
   }
 
   private boolean isOnlyAccessibleFromSamePackage(DexClass referencedClass) {
@@ -111,16 +114,21 @@
 
   private void registerMemberAccess(
       MemberResolutionResult<?, ?> resolutionResult, boolean isInvoke) {
-    SuccessfulMemberResolutionResult<?, ?> successfulResolutionResult =
-        resolutionResult.asSuccessfulMemberResolutionResult();
-    if (successfulResolutionResult == null) {
-      // TODO(b/165783399): If we want to preserve errors in the original program, we need to look
-      //  at the failure dependencies. For example, if this method accesses in a package-private
-      //  method in another package, and we move the two methods to the same package, then the
-      //  invoke would no longer fail with an IllegalAccessError.
+    if (!resolutionResult.isSuccessfulMemberResolutionResult()) {
+      // To preserve errors in the original program, we need to look at the failure dependencies.
+      // For example, if this method accesses in a package-private method in another package, and we
+      // move the two methods to the same package, then the invoke would no longer fail with an
+      // IllegalAccessError.
+      if (isInvoke) {
+        // TODO(b/150589374): Only add this if we are in the minification mode of repackaging.
+        node.addNeighbor(missingTypeNode);
+      }
       return;
     }
 
+    SuccessfulMemberResolutionResult<?, ?> successfulResolutionResult =
+        resolutionResult.asSuccessfulMemberResolutionResult();
+
     // Check access to the initial resolution holder.
     DexClass initialResolutionHolder = successfulResolutionResult.getInitialResolutionHolder();
     registerClassTypeAccess(initialResolutionHolder);
@@ -153,6 +161,9 @@
     DexClass clazz = appInfo.definitionFor(type);
     if (clazz != null) {
       consumer.accept(clazz);
+    } else {
+      // The missing type reference can be package private and we cannot repackage.
+      node.addNeighbor(missingTypeNode);
     }
   }
 
diff --git a/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java b/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
index 06c03e7..b186a52 100644
--- a/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
+++ b/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
@@ -959,6 +959,11 @@
     if (!keepInfo.getInfo(clazz).isRepackagingAllowed(options())) {
       return false;
     }
+    for (DexType superType : clazz.allImmediateSupertypes()) {
+      if (definitionFor(superType) == null) {
+        return false;
+      }
+    }
     return clazz
         .traverseProgramMembers(
             member -> {
diff --git a/src/main/java/com/android/tools/r8/shaking/MissingClasses.java b/src/main/java/com/android/tools/r8/shaking/MissingClasses.java
index de249d8..c2d6a7c 100644
--- a/src/main/java/com/android/tools/r8/shaking/MissingClasses.java
+++ b/src/main/java/com/android/tools/r8/shaking/MissingClasses.java
@@ -133,7 +133,9 @@
           getMissingClassesToBeReported(appView, synthesizingContextOracle);
       if (!missingClassesToBeReported.isEmpty()) {
         MissingDefinitionsDiagnostic diagnostic = createDiagnostic(missingClassesToBeReported);
-        if (appView.options().ignoreMissingClasses) {
+        InternalOptions options = appView.options();
+        // TODO(b/180903899): Remove L8 special handling when -dontwarn sun.misc.Unsafe is in place.
+        if (options.ignoreMissingClasses || options.isDesugaredLibraryCompilation()) {
           appView.reporter().warning(diagnostic);
         } else {
           throw appView.reporter().fatalError(diagnostic);
diff --git a/src/main/java/com/android/tools/r8/synthesis/SyntheticMethodReference.java b/src/main/java/com/android/tools/r8/synthesis/SyntheticMethodReference.java
index fd63ea2..dfc240b 100644
--- a/src/main/java/com/android/tools/r8/synthesis/SyntheticMethodReference.java
+++ b/src/main/java/com/android/tools/r8/synthesis/SyntheticMethodReference.java
@@ -57,7 +57,7 @@
     DexMethod rewritten = lens.lookupMethod(method);
     // If the reference has been non-trivially rewritten the compiler has changed it and it can no
     // longer be considered a synthetic. The context may or may not have changed.
-    if (method != rewritten && !lens.isSimpleRenaming(method.holder, rewritten.holder)) {
+    if (method != rewritten && !lens.isSimpleRenaming(method, rewritten)) {
       // If the referenced item is rewritten, it should be moved to another holder as the
       // synthetic holder is no longer part of the synthetic collection.
       assert method.holder != rewritten.holder : "The synthetic method reference should have moved";
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 2b0267d..ce8396f 100644
--- a/src/main/java/com/android/tools/r8/utils/IterableUtils.java
+++ b/src/main/java/com/android/tools/r8/utils/IterableUtils.java
@@ -8,8 +8,10 @@
 import com.google.common.collect.Iterators;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 import java.util.function.BiFunction;
+import java.util.function.BiPredicate;
 import java.util.function.Function;
 import java.util.function.Predicate;
 
@@ -130,4 +132,23 @@
       return iterable;
     }
   }
+
+  /**
+   * Utility method for testing the the elements in one and other pair-wise. Returns false if the
+   * lengths differ.
+   */
+  public static <T> boolean testPairs(
+      BiPredicate<T, T> predicate, Iterable<T> one, Iterable<T> other) {
+    Iterator<T> iterator = other.iterator();
+    for (T first : one) {
+      if (!iterator.hasNext()) {
+        return false;
+      }
+      T second = iterator.next();
+      if (!predicate.test(first, second)) {
+        return false;
+      }
+    }
+    return !iterator.hasNext();
+  }
 }
diff --git a/src/test/java/com/android/tools/r8/repackage/RepackageLambdaMissingInterfaceTest.java b/src/test/java/com/android/tools/r8/repackage/RepackageLambdaMissingInterfaceTest.java
index 622b8fe..63201fa 100644
--- a/src/test/java/com/android/tools/r8/repackage/RepackageLambdaMissingInterfaceTest.java
+++ b/src/test/java/com/android/tools/r8/repackage/RepackageLambdaMissingInterfaceTest.java
@@ -4,12 +4,12 @@
 
 package com.android.tools.r8.repackage;
 
+import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.MatcherAssert.assertThat;
 
 import com.android.tools.r8.NeverInline;
 import com.android.tools.r8.R8TestRunResult;
 import com.android.tools.r8.TestParameters;
-import com.android.tools.r8.ToolHelper.DexVm.Version;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -31,19 +31,16 @@
 
   @Test
   public void testR8() throws Exception {
-    R8TestRunResult r8TestRunResult = runTest(true);
-    if (parameters.isDexRuntime()
-        && parameters.getDexRuntimeVersion().isOlderThanOrEqual(Version.V4_4_4)) {
-      r8TestRunResult.assertFailureWithErrorThatThrows(NoClassDefFoundError.class);
-    } else {
-      r8TestRunResult.assertFailureWithErrorThatThrows(IllegalAccessError.class);
-    }
+    runTest(true)
+        .assertFailureWithErrorThatThrowsIf(parameters.isDexRuntime(), AbstractMethodError.class)
+        .assertSuccessWithOutputLinesIf(parameters.isCfRuntime(), "0");
   }
 
   private R8TestRunResult runTest(boolean repackage) throws Exception {
     return testForR8(parameters.getBackend())
         .addProgramClasses(ClassWithLambda.class, Main.class)
         .addKeepMainRule(Main.class)
+        .addKeepAttributeInnerClassesAndEnclosingMethod()
         .applyIf(repackage, this::configureRepackaging)
         .setMinApi(parameters.getApiLevel())
         .addDontWarn(MissingInterface.class)
@@ -52,8 +49,20 @@
         .compile()
         .inspect(
             inspector -> {
-              // TODO(b/179889105): This should probably not be repackaged.
-              assertThat(ClassWithLambda.class, isRepackagedIf(inspector, repackage));
+              // Find the generated lambda class
+              assertThat(
+                  ClassWithLambda.class,
+                  isRepackagedIf(inspector, repackage && parameters.isDexRuntime()));
+              if (!parameters.isDexRuntime()) {
+                return;
+              }
+              inspector.forAllClasses(
+                  clazz -> {
+                    if (clazz.isSynthesizedJavaLambdaClass()) {
+                      assertThat(
+                          clazz.getFinalName(), containsString(Main.class.getPackage().getName()));
+                    }
+                  });
             })
         .addRunClasspathClasses(MissingInterface.class)
         .run(parameters.getRuntime(), Main.class);
diff --git a/src/test/java/com/android/tools/r8/repackage/RepackageMissingMemberReferenceTest.java b/src/test/java/com/android/tools/r8/repackage/RepackageMissingMemberReferenceTest.java
index e6f8e93..9dc8746 100644
--- a/src/test/java/com/android/tools/r8/repackage/RepackageMissingMemberReferenceTest.java
+++ b/src/test/java/com/android/tools/r8/repackage/RepackageMissingMemberReferenceTest.java
@@ -9,7 +9,6 @@
 import com.android.tools.r8.NeverInline;
 import com.android.tools.r8.R8TestRunResult;
 import com.android.tools.r8.TestParameters;
-import com.android.tools.r8.ToolHelper.DexVm.Version;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -31,12 +30,7 @@
 
   @Test
   public void testR8() throws Exception {
-    R8TestRunResult r8TestRunResult = runTest(true);
-    if (parameters.isDexRuntime() && parameters.getDexRuntimeVersion() == Version.V8_1_0) {
-      r8TestRunResult.assertSuccessWithOutputLines(EXPECTED);
-    } else {
-      r8TestRunResult.assertFailureWithErrorThatThrows(IllegalAccessError.class);
-    }
+    runTest(true).assertSuccessWithOutputLines(EXPECTED);
   }
 
   private R8TestRunResult runTest(boolean repackage) throws Exception {
@@ -49,11 +43,8 @@
         .enableInliningAnnotations()
         .compile()
         .inspect(
-            inspector -> {
-              // TODO(b/179889105): This should probably not be repackaged.
-              assertThat(
-                  ClassWithMissingReferenceInCode.class, isRepackagedIf(inspector, repackage));
-            })
+            inspector ->
+                assertThat(ClassWithMissingReferenceInCode.class, isNotRepackaged(inspector)))
         .addRunClasspathClasses(MissingReference.class)
         .run(parameters.getRuntime(), Main.class);
   }
diff --git a/src/test/java/com/android/tools/r8/repackage/RepackageMissingSuperInterfaceTestTest.java b/src/test/java/com/android/tools/r8/repackage/RepackageMissingSuperInterfaceTestTest.java
index 8f08c58..c853a99 100644
--- a/src/test/java/com/android/tools/r8/repackage/RepackageMissingSuperInterfaceTestTest.java
+++ b/src/test/java/com/android/tools/r8/repackage/RepackageMissingSuperInterfaceTestTest.java
@@ -10,7 +10,6 @@
 import com.android.tools.r8.NeverInline;
 import com.android.tools.r8.R8TestRunResult;
 import com.android.tools.r8.TestParameters;
-import com.android.tools.r8.ToolHelper.DexVm.Version;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -18,6 +17,8 @@
 @RunWith(Parameterized.class)
 public class RepackageMissingSuperInterfaceTestTest extends RepackageTestBase {
 
+  private final String[] EXPECTED = new String[] {"ClassImplementingMissingInterface::bar"};
+
   public RepackageMissingSuperInterfaceTestTest(
       String flattenPackageHierarchyOrRepackageClasses, TestParameters parameters) {
     super(flattenPackageHierarchyOrRepackageClasses, parameters);
@@ -25,18 +26,12 @@
 
   @Test
   public void testR8WithoutRepackaging() throws Exception {
-    runTest(false).assertSuccessWithOutputLines("ClassImplementingMissingInterface::bar");
+    runTest(false).assertSuccessWithOutputLines(EXPECTED);
   }
 
   @Test
   public void testR8() throws Exception {
-    R8TestRunResult r8TestRunResult = runTest(true);
-    if (parameters.isDexRuntime()
-        && parameters.getDexRuntimeVersion().isOlderThanOrEqual(Version.V4_4_4)) {
-      r8TestRunResult.assertFailureWithErrorThatThrows(NoClassDefFoundError.class);
-    } else {
-      r8TestRunResult.assertFailureWithErrorThatThrows(IllegalAccessError.class);
-    }
+    runTest(true).assertSuccessWithOutputLines(EXPECTED);
   }
 
   private R8TestRunResult runTest(boolean repackage) throws Exception {
@@ -51,9 +46,7 @@
         .compile()
         .inspect(
             inspector -> {
-              // TODO(b/179889105): This should probably not be repackaged.
-              assertThat(
-                  ClassImplementingMissingInterface.class, isRepackagedIf(inspector, repackage));
+              assertThat(ClassImplementingMissingInterface.class, isNotRepackaged(inspector));
             })
         .addRunClasspathClasses(MissingInterface.class)
         .run(parameters.getRuntime(), Main.class);
diff --git a/src/test/java/com/android/tools/r8/repackage/RepackageMissingSuperTypeTest.java b/src/test/java/com/android/tools/r8/repackage/RepackageMissingSuperTypeTest.java
index cb2ce41..5880f86 100644
--- a/src/test/java/com/android/tools/r8/repackage/RepackageMissingSuperTypeTest.java
+++ b/src/test/java/com/android/tools/r8/repackage/RepackageMissingSuperTypeTest.java
@@ -10,7 +10,6 @@
 import com.android.tools.r8.NeverInline;
 import com.android.tools.r8.R8TestRunResult;
 import com.android.tools.r8.TestParameters;
-import com.android.tools.r8.ToolHelper.DexVm.Version;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -18,6 +17,14 @@
 @RunWith(Parameterized.class)
 public class RepackageMissingSuperTypeTest extends RepackageTestBase {
 
+  private final String[] EXPECTED =
+      new String[] {
+        "ClassWithSuperCall::foo",
+        "MissingSuperType::foo",
+        "ClassWithoutSuperCall::foo",
+        "MissingSuperType::foo"
+      };
+
   public RepackageMissingSuperTypeTest(
       String flattenPackageHierarchyOrRepackageClasses, TestParameters parameters) {
     super(flattenPackageHierarchyOrRepackageClasses, parameters);
@@ -25,23 +32,12 @@
 
   @Test
   public void testR8WithoutRepackaging() throws Exception {
-    runTest(false)
-        .assertSuccessWithOutputLines(
-            "ClassWithSuperCall::foo",
-            "MissingSuperType::foo",
-            "ClassWithoutSuperCall::foo",
-            "MissingSuperType::foo");
+    runTest(false).assertSuccessWithOutputLines(EXPECTED);
   }
 
   @Test
   public void testR8() throws Exception {
-    R8TestRunResult r8TestRunResult = runTest(true);
-    if (parameters.isDexRuntime()
-        && parameters.getDexRuntimeVersion().isOlderThanOrEqual(Version.V4_4_4)) {
-      r8TestRunResult.assertFailureWithErrorThatThrows(NoClassDefFoundError.class);
-    } else {
-      r8TestRunResult.assertFailureWithErrorThatThrows(IllegalAccessError.class);
-    }
+    runTest(true).assertSuccessWithOutputLines(EXPECTED);
   }
 
   private R8TestRunResult runTest(boolean repackage) throws Exception {
@@ -60,9 +56,8 @@
         .compile()
         .inspect(
             inspector -> {
-              // TODO(b/179889105): These should probably not be repackaged.
-              assertThat(ClassWithSuperCall.class, isRepackagedIf(inspector, repackage));
-              assertThat(ClassWithoutSuperCall.class, isRepackagedIf(inspector, repackage));
+              assertThat(ClassWithSuperCall.class, isNotRepackaged(inspector));
+              assertThat(ClassWithoutSuperCall.class, isNotRepackaged(inspector));
             })
         .addRunClasspathClasses(MissingSuperType.class)
         .run(parameters.getRuntime(), Main.class);
diff --git a/src/test/java/com/android/tools/r8/repackage/RepackageParameterSyntheticOutlineTest.java b/src/test/java/com/android/tools/r8/repackage/RepackageParameterSyntheticOutlineTest.java
index 0636a50..9e2f6c2 100644
--- a/src/test/java/com/android/tools/r8/repackage/RepackageParameterSyntheticOutlineTest.java
+++ b/src/test/java/com/android/tools/r8/repackage/RepackageParameterSyntheticOutlineTest.java
@@ -4,11 +4,8 @@
 
 package com.android.tools.r8.repackage;
 
-import static com.android.tools.r8.DiagnosticsMatcher.diagnosticMessage;
 import static com.android.tools.r8.shaking.ProguardConfigurationParser.REPACKAGE_CLASSES;
-import static org.hamcrest.CoreMatchers.containsString;
 
-import com.android.tools.r8.CompilationFailedException;
 import com.android.tools.r8.NeverInline;
 import com.android.tools.r8.TestParameters;
 import com.android.tools.r8.utils.DescriptorUtils;
@@ -49,7 +46,7 @@
         .assertSuccessWithOutputLines(EXPECTED);
   }
 
-  @Test(expected = CompilationFailedException.class)
+  @Test
   public void testR8() throws Exception {
     testForR8(parameters.getBackend())
         .addProgramClasses(Param.class, Return.class)
@@ -67,13 +64,8 @@
             })
         .apply(this::configureRepackaging)
         .addKeepPackageNamesRule("bar**")
-        .compileWithExpectedDiagnostics(
-            diagnostics -> {
-              // TODO(b/180092122): This should not fail.
-              diagnostics.assertErrorsMatch(
-                  diagnosticMessage(
-                      containsString("The synthetic method reference should have moved")));
-            });
+        .run(parameters.getRuntime(), Main.class)
+        .assertSuccessWithOutputLines(EXPECTED);
   }
 
   private byte[] rewrittenPackageForClassWithCodeToBeOutlined() throws Exception {