Change kMultiDexSeparator from ':' to '!'
The ':' separator is commonly used to separate class path elements. That
means that we cannot easily encode multidex location in a classpath
without complicating the parsing logic unnecessarily (e.g. when encoding
classpaths in the oat file).
For easy parsing and understanding kMultiDexSeparator and
kClassPathSeparator should have different values. ':' is a wide spread
classpath separator so this CL changes the value of kMultiDexSeparator to
'!' which is also commonly used to denote an object inside a given
container.
Test: m test-art-host
Bug: 38138251
Change-Id: I30995c553d9131478c6c071b27327df6d2de06a7
diff --git a/runtime/dex_file_test.cc b/runtime/dex_file_test.cc
index 78d5c5f..1a73062 100644
--- a/runtime/dex_file_test.cc
+++ b/runtime/dex_file_test.cc
@@ -535,9 +535,9 @@
std::string dex_location_str = "/system/app/framework.jar";
const char* dex_location = dex_location_str.c_str();
ASSERT_EQ("/system/app/framework.jar", DexFile::GetMultiDexLocation(0, dex_location));
- ASSERT_EQ("/system/app/framework.jar:classes2.dex",
+ ASSERT_EQ("/system/app/framework.jar!classes2.dex",
DexFile::GetMultiDexLocation(1, dex_location));
- ASSERT_EQ("/system/app/framework.jar:classes101.dex",
+ ASSERT_EQ("/system/app/framework.jar!classes101.dex",
DexFile::GetMultiDexLocation(100, dex_location));
}
@@ -563,11 +563,11 @@
TEST(DexFileUtilsTest, GetBaseLocationAndMultiDexSuffix) {
EXPECT_EQ("/foo/bar/baz.jar", DexFile::GetBaseLocation("/foo/bar/baz.jar"));
- EXPECT_EQ("/foo/bar/baz.jar", DexFile::GetBaseLocation("/foo/bar/baz.jar:classes2.dex"));
- EXPECT_EQ("/foo/bar/baz.jar", DexFile::GetBaseLocation("/foo/bar/baz.jar:classes8.dex"));
+ EXPECT_EQ("/foo/bar/baz.jar", DexFile::GetBaseLocation("/foo/bar/baz.jar!classes2.dex"));
+ EXPECT_EQ("/foo/bar/baz.jar", DexFile::GetBaseLocation("/foo/bar/baz.jar!classes8.dex"));
EXPECT_EQ("", DexFile::GetMultiDexSuffix("/foo/bar/baz.jar"));
- EXPECT_EQ(":classes2.dex", DexFile::GetMultiDexSuffix("/foo/bar/baz.jar:classes2.dex"));
- EXPECT_EQ(":classes8.dex", DexFile::GetMultiDexSuffix("/foo/bar/baz.jar:classes8.dex"));
+ EXPECT_EQ("!classes2.dex", DexFile::GetMultiDexSuffix("/foo/bar/baz.jar!classes2.dex"));
+ EXPECT_EQ("!classes8.dex", DexFile::GetMultiDexSuffix("/foo/bar/baz.jar!classes8.dex"));
}
TEST_F(DexFileTest, ZipOpenClassesPresent) {