Fix outline test after assuming library types to always be present
Change-Id: Id1604271f17b1eb8136d442122ac2df91ffc5d8a
diff --git a/src/test/java/com/android/tools/r8/smali/OutlineTest.java b/src/test/java/com/android/tools/r8/smali/OutlineTest.java
index da3ef50..c9eda1c 100644
--- a/src/test/java/com/android/tools/r8/smali/OutlineTest.java
+++ b/src/test/java/com/android/tools/r8/smali/OutlineTest.java
@@ -46,6 +46,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.function.Consumer;
import org.junit.Assert;
@@ -1385,6 +1386,13 @@
// Do not allow dead code elimination of the new-instance instructions.
opts.apiModelingOptions().enableApiCallerIdentification = false;
+ // Do not allow dead code elimination of the new-instance instructions. This can be
+ // achieved by not assuming that StringBuilder is present.
+ DexItemFactory dexItemFactory = opts.itemFactory;
+ opts.itemFactory.libraryTypesAssumedToBePresent =
+ new HashSet<>(dexItemFactory.libraryTypesAssumedToBePresent);
+ dexItemFactory.libraryTypesAssumedToBePresent.remove(
+ dexItemFactory.stringBuilderType);
});
AndroidApp originalApplication = buildApplicationWithAndroidJar(builder);