Add test for String init called from unresolvable class.
Bug: 20971268
(cherry-picked from f450cf6b06255ead0a43a9e94dc2f2175e6f9849)
Change-Id: I810f599b38a46e738bcacb15ca3c4537e1fb7b77
diff --git a/test/127-secondarydex/expected.txt b/test/127-secondarydex/expected.txt
index 29a1411..1c8defb 100644
--- a/test/127-secondarydex/expected.txt
+++ b/test/127-secondarydex/expected.txt
@@ -1,3 +1,4 @@
testSlowPathDirectInvoke
Test
Got null pointer exception
+Test
diff --git a/test/127-secondarydex/src/Main.java b/test/127-secondarydex/src/Main.java
index c921c5b..0ede8ed 100644
--- a/test/127-secondarydex/src/Main.java
+++ b/test/127-secondarydex/src/Main.java
@@ -24,6 +24,7 @@
public class Main {
public static void main(String[] args) {
testSlowPathDirectInvoke();
+ testString();
}
public static void testSlowPathDirectInvoke() {
@@ -40,4 +41,11 @@
System.out.println("Got unexpected exception " + e);
}
}
+
+ // For string change, test that String.<init> is compiled properly in
+ // secondary dex. See http://b/20870917
+ public static void testString() {
+ Test t = new Test();
+ System.out.println(t.toString());
+ }
}
diff --git a/test/127-secondarydex/src/Test.java b/test/127-secondarydex/src/Test.java
index 82cb901..8547e79 100644
--- a/test/127-secondarydex/src/Test.java
+++ b/test/127-secondarydex/src/Test.java
@@ -22,4 +22,8 @@
private void print() {
System.out.println("Test");
}
+
+ public String toString() {
+ return new String("Test");
+ }
}