Use Java strings for Method's name.
Change-Id: Ibf0a847358a1b480069f49a0aefc783ad96a0332
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 593b3e0..3e1eb06 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -94,7 +94,8 @@
java_lang_reflect_Method->object_size_ = sizeof(Method);
class_roots_->Set(kJavaLangReflectMethod, java_lang_reflect_Method);
- FindSystemClass("Ljava/lang/String;");
+ Class* String_class = FindSystemClass("Ljava/lang/String;");
+ CHECK_EQ(java_lang_String, String_class);
CHECK_EQ(java_lang_String->object_size_, sizeof(String));
java_lang_String->object_size_ = sizeof(String);
class_roots_->Set(kJavaLangString, java_lang_String);
@@ -141,7 +142,9 @@
class_roots_->Set(kPrimitiveVoid, CreatePrimitiveClass("V"));
// now we can use FindSystemClass for anything, including for "[C"
- class_roots_->Set(kCharArrayClass, FindSystemClass("[C"));
+ Class* char_array = FindSystemClass("[C");
+ class_roots_->Set(kCharArrayClass, char_array);
+ String::InitClasses(java_lang_String, char_array);
// Now AllocString* can be used
// ensure all class_roots_ were initialized
@@ -426,7 +429,7 @@
Method* dst) {
const DexFile::MethodId& method_id = dex_file.GetMethodId(src.method_idx_);
dst->klass_ = klass;
- dst->name_.set(dex_file.dexStringById(method_id.name_idx_));
+ dst->java_name_ = ResolveString(klass, method_id.name_idx_);
dst->proto_idx_ = method_id.proto_idx_;
dst->shorty_.set(dex_file.GetShorty(method_id.proto_idx_));
dst->access_flags_ = src.access_flags_;
diff --git a/src/class_linker.h b/src/class_linker.h
index b504095..9f5df47 100644
--- a/src/class_linker.h
+++ b/src/class_linker.h
@@ -130,7 +130,7 @@
}
bool HasSameName(const Method* m1, const Method* m2) const {
- return m1->GetName() == m2->GetName();
+ return String::Equals(m1->GetName(), m2->GetName());
}
bool HasSamePrototype(const Method* m1, const Method* m2) const {
@@ -206,7 +206,6 @@
FRIEND_TEST(DexCacheTest, Open);
friend class ObjectTest;
FRIEND_TEST(ObjectTest, AllocObjectArray);
- FRIEND_TEST(ObjectTest, StringEquals);
DISALLOW_COPY_AND_ASSIGN(ClassLinker);
};
diff --git a/src/class_linker_test.cc b/src/class_linker_test.cc
index b71baef..8672cf9 100644
--- a/src/class_linker_test.cc
+++ b/src/class_linker_test.cc
@@ -100,7 +100,7 @@
if (klass->IsInterface()) {
EXPECT_TRUE(klass->IsAbstract());
if (klass->NumDirectMethods() == 1) {
- EXPECT_EQ("<clinit>", klass->GetDirectMethod(0)->GetName());
+ EXPECT_PRED2(String::EqualsUtf8, klass->GetDirectMethod(0)->GetName(), "<clinit>");
} else {
EXPECT_EQ(0U, klass->NumDirectMethods());
}
@@ -306,16 +306,16 @@
ASSERT_EQ(4U, klass->NumVirtualMethods());
Method* m1 = klass->GetVirtualMethod(0);
- ASSERT_EQ("m1", m1->GetName());
+ EXPECT_PRED2(String::EqualsUtf8, m1->GetName(), "m1");
Method* m2 = klass->GetVirtualMethod(1);
- ASSERT_EQ("m2", m2->GetName());
+ EXPECT_PRED2(String::EqualsUtf8, m2->GetName(), "m2");
Method* m3 = klass->GetVirtualMethod(2);
- ASSERT_EQ("m3", m3->GetName());
+ EXPECT_PRED2(String::EqualsUtf8, m3->GetName(), "m3");
Method* m4 = klass->GetVirtualMethod(3);
- ASSERT_EQ("m4", m4->GetName());
+ EXPECT_PRED2(String::EqualsUtf8, m4->GetName(), "m4");
EXPECT_TRUE(linker->HasSameReturnType(m1, m2));
EXPECT_TRUE(linker->HasSameReturnType(m2, m1));
@@ -362,22 +362,22 @@
ASSERT_TRUE(klass2 != NULL);
Method* m1_1 = klass1->GetVirtualMethod(0);
- ASSERT_EQ("m1", m1_1->GetName());
+ EXPECT_PRED2(String::EqualsUtf8, m1_1->GetName(), "m1");
Method* m2_1 = klass1->GetVirtualMethod(1);
- ASSERT_EQ("m2", m2_1->GetName());
+ EXPECT_PRED2(String::EqualsUtf8, m2_1->GetName(), "m2");
Method* m3_1 = klass1->GetVirtualMethod(2);
- ASSERT_EQ("m3", m3_1->GetName());
+ EXPECT_PRED2(String::EqualsUtf8, m3_1->GetName(), "m3");
Method* m4_1 = klass1->GetVirtualMethod(3);
- ASSERT_EQ("m4", m4_1->GetName());
+ EXPECT_PRED2(String::EqualsUtf8, m4_1->GetName(), "m4");
Method* m1_2 = klass2->GetVirtualMethod(0);
- ASSERT_EQ("m1", m1_2->GetName());
+ EXPECT_PRED2(String::EqualsUtf8, m1_2->GetName(), "m1");
Method* m2_2 = klass2->GetVirtualMethod(1);
- ASSERT_EQ("m2", m2_2->GetName());
+ EXPECT_PRED2(String::EqualsUtf8, m2_2->GetName(), "m2");
Method* m3_2 = klass2->GetVirtualMethod(2);
- ASSERT_EQ("m3", m3_2->GetName());
+ EXPECT_PRED2(String::EqualsUtf8, m3_2->GetName(), "m3");
Method* m4_2 = klass2->GetVirtualMethod(3);
- ASSERT_EQ("m4", m4_2->GetName());
+ EXPECT_PRED2(String::EqualsUtf8, m4_2->GetName(), "m4");
EXPECT_TRUE(linker->HasSameNameAndPrototype(m1_1, m1_2));
EXPECT_TRUE(linker->HasSameNameAndPrototype(m1_2, m1_1));
@@ -405,37 +405,37 @@
UseLibCoreDex();
Class* string = class_linker_->FindClass( "Ljava/lang/String;", NULL, java_lang_dex_file_.get());
ASSERT_EQ(4U, string->NumInstanceFields());
- EXPECT_PRED2(String::Equals, string->GetInstanceField(0)->GetName(), "value");
- EXPECT_PRED2(String::Equals, string->GetInstanceField(1)->GetName(), "hashCode");
- EXPECT_PRED2(String::Equals, string->GetInstanceField(2)->GetName(), "offset");
- EXPECT_PRED2(String::Equals, string->GetInstanceField(3)->GetName(), "count");
+ EXPECT_PRED2(String::EqualsUtf8, string->GetInstanceField(0)->GetName(), "value");
+ EXPECT_PRED2(String::EqualsUtf8, string->GetInstanceField(1)->GetName(), "hashCode");
+ EXPECT_PRED2(String::EqualsUtf8, string->GetInstanceField(2)->GetName(), "offset");
+ EXPECT_PRED2(String::EqualsUtf8, string->GetInstanceField(3)->GetName(), "count");
Class* accessible_object = class_linker_->FindClass("Ljava/lang/reflect/AccessibleObject;", NULL, java_lang_dex_file_.get());
ASSERT_EQ(1U, accessible_object->NumInstanceFields());
- EXPECT_PRED2(String::Equals, accessible_object->GetInstanceField(0)->GetName(), "flag");
+ EXPECT_PRED2(String::EqualsUtf8, accessible_object->GetInstanceField(0)->GetName(), "flag");
Class* field = class_linker_->FindClass("Ljava/lang/reflect/Field;", NULL, java_lang_dex_file_.get());
ASSERT_EQ(6U, field->NumInstanceFields());
- EXPECT_PRED2(String::Equals, field->GetInstanceField(0)->GetName(), "declaringClass");
- EXPECT_PRED2(String::Equals, field->GetInstanceField(1)->GetName(), "genericType");
- EXPECT_PRED2(String::Equals, field->GetInstanceField(2)->GetName(), "type");
- EXPECT_PRED2(String::Equals, field->GetInstanceField(3)->GetName(), "name");
- EXPECT_PRED2(String::Equals, field->GetInstanceField(4)->GetName(), "slot");
- EXPECT_PRED2(String::Equals, field->GetInstanceField(5)->GetName(), "genericTypesAreInitialized");
+ EXPECT_PRED2(String::EqualsUtf8, field->GetInstanceField(0)->GetName(), "declaringClass");
+ EXPECT_PRED2(String::EqualsUtf8, field->GetInstanceField(1)->GetName(), "genericType");
+ EXPECT_PRED2(String::EqualsUtf8, field->GetInstanceField(2)->GetName(), "type");
+ EXPECT_PRED2(String::EqualsUtf8, field->GetInstanceField(3)->GetName(), "name");
+ EXPECT_PRED2(String::EqualsUtf8, field->GetInstanceField(4)->GetName(), "slot");
+ EXPECT_PRED2(String::EqualsUtf8, field->GetInstanceField(5)->GetName(), "genericTypesAreInitialized");
Class* method = class_linker_->FindClass("Ljava/lang/reflect/Method;", NULL, java_lang_dex_file_.get());
ASSERT_EQ(11U, method->NumInstanceFields());
- EXPECT_PRED2(String::Equals, method->GetInstanceField( 0)->GetName(), "declaringClass");
- EXPECT_PRED2(String::Equals, method->GetInstanceField( 1)->GetName(), "exceptionTypes");
- EXPECT_PRED2(String::Equals, method->GetInstanceField( 2)->GetName(), "formalTypeParameters");
- EXPECT_PRED2(String::Equals, method->GetInstanceField( 3)->GetName(), "genericExceptionTypes");
- EXPECT_PRED2(String::Equals, method->GetInstanceField( 4)->GetName(), "genericParameterTypes");
- EXPECT_PRED2(String::Equals, method->GetInstanceField( 5)->GetName(), "genericReturnType");
- EXPECT_PRED2(String::Equals, method->GetInstanceField( 6)->GetName(), "returnType");
- EXPECT_PRED2(String::Equals, method->GetInstanceField( 7)->GetName(), "name");
- EXPECT_PRED2(String::Equals, method->GetInstanceField( 8)->GetName(), "parameterTypes");
- EXPECT_PRED2(String::Equals, method->GetInstanceField( 9)->GetName(), "genericTypesAreInitialized");
- EXPECT_PRED2(String::Equals, method->GetInstanceField(10)->GetName(), "slot");
+ EXPECT_PRED2(String::EqualsUtf8, method->GetInstanceField( 0)->GetName(), "declaringClass");
+ EXPECT_PRED2(String::EqualsUtf8, method->GetInstanceField( 1)->GetName(), "exceptionTypes");
+ EXPECT_PRED2(String::EqualsUtf8, method->GetInstanceField( 2)->GetName(), "formalTypeParameters");
+ EXPECT_PRED2(String::EqualsUtf8, method->GetInstanceField( 3)->GetName(), "genericExceptionTypes");
+ EXPECT_PRED2(String::EqualsUtf8, method->GetInstanceField( 4)->GetName(), "genericParameterTypes");
+ EXPECT_PRED2(String::EqualsUtf8, method->GetInstanceField( 5)->GetName(), "genericReturnType");
+ EXPECT_PRED2(String::EqualsUtf8, method->GetInstanceField( 6)->GetName(), "returnType");
+ EXPECT_PRED2(String::EqualsUtf8, method->GetInstanceField( 7)->GetName(), "name");
+ EXPECT_PRED2(String::EqualsUtf8, method->GetInstanceField( 8)->GetName(), "parameterTypes");
+ EXPECT_PRED2(String::EqualsUtf8, method->GetInstanceField( 9)->GetName(), "genericTypesAreInitialized");
+ EXPECT_PRED2(String::EqualsUtf8, method->GetInstanceField(10)->GetName(), "slot");
}
} // namespace art
diff --git a/src/jni_compiler_test.cc b/src/jni_compiler_test.cc
index d6017b5..ddf8f69 100644
--- a/src/jni_compiler_test.cc
+++ b/src/jni_compiler_test.cc
@@ -206,7 +206,7 @@
scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_->RegisterDexFile(dex.get());
Class* klass = class_linker_->FindClass("LMyClass;", NULL, dex.get());
- Method* method = klass->FindVirtualMethod("foo");
+ Method* method = klass->FindVirtualMethod(String::AllocFromAscii("foo"));
Assembler jni_asm;
JniCompiler jni_compiler;
@@ -231,7 +231,7 @@
scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_->RegisterDexFile(dex.get());
Class* klass = class_linker_->FindClass("LMyClass;", NULL, dex.get());
- Method* method = klass->FindVirtualMethod("fooI");
+ Method* method = klass->FindVirtualMethod(String::AllocFromAscii("fooI"));
Assembler jni_asm;
JniCompiler jni_compiler;
@@ -258,7 +258,7 @@
scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_->RegisterDexFile(dex.get());
Class* klass = class_linker_->FindClass("LMyClass;", NULL, dex.get());
- Method* method = klass->FindVirtualMethod("fooII");
+ Method* method = klass->FindVirtualMethod(String::AllocFromAscii("fooII"));
Assembler jni_asm;
JniCompiler jni_compiler;
@@ -288,7 +288,7 @@
scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_->RegisterDexFile(dex.get());
Class* klass = class_linker_->FindClass("LMyClass;", NULL, dex.get());
- Method* method = klass->FindVirtualMethod("fooDD");
+ Method* method = klass->FindVirtualMethod(String::AllocFromAscii("fooDD"));
Assembler jni_asm;
JniCompiler jni_compiler;
@@ -317,7 +317,7 @@
scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_->RegisterDexFile(dex.get());
Class* klass = class_linker_->FindClass("LMyClass;", NULL, dex.get());
- Method* method = klass->FindVirtualMethod("fooIOO");
+ Method* method = klass->FindVirtualMethod(String::AllocFromAscii("fooIOO"));
Assembler jni_asm;
JniCompiler jni_compiler;
@@ -372,7 +372,7 @@
scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_->RegisterDexFile(dex.get());
Class* klass = class_linker_->FindClass("LMyClass;", NULL, dex.get());
- Method* method = klass->FindDirectMethod("fooSIOO");
+ Method* method = klass->FindDirectMethod(String::AllocFromAscii("fooSIOO"));
Assembler jni_asm;
JniCompiler jni_compiler;
@@ -424,7 +424,7 @@
scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_->RegisterDexFile(dex.get());
Class* klass = class_linker_->FindClass("LMyClass;", NULL, dex.get());
- Method* method = klass->FindDirectMethod("fooSSIOO");
+ Method* method = klass->FindDirectMethod(String::AllocFromAscii("fooSSIOO"));
Assembler jni_asm;
JniCompiler jni_compiler;
@@ -474,7 +474,7 @@
int gSuspendCounterHandler_calls;
void SuspendCountHandler(Method** frame) {
- EXPECT_EQ(0, (*frame)->GetName().compare("fooI"));
+ EXPECT_PRED2(String::EqualsUtf8, (*frame)->GetName(), "fooI");
gSuspendCounterHandler_calls++;
Thread::Current()->DecrementSuspendCount();
}
@@ -482,7 +482,7 @@
scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_->RegisterDexFile(dex.get());
Class* klass = class_linker_->FindClass("LMyClass;", NULL, dex.get());
- Method* method = klass->FindVirtualMethod("fooI");
+ Method* method = klass->FindVirtualMethod(String::AllocFromAscii("fooI"));
Assembler jni_asm;
JniCompiler jni_compiler;
@@ -515,7 +515,7 @@
int gExceptionHandler_calls;
void ExceptionHandler(Method** frame) {
- EXPECT_EQ(0, (*frame)->GetName().compare("foo"));
+ EXPECT_PRED2(String::EqualsUtf8, (*frame)->GetName(), "foo");
gExceptionHandler_calls++;
Thread::Current()->ClearException();
}
@@ -523,7 +523,7 @@
scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_->RegisterDexFile(dex.get());
Class* klass = class_linker_->FindClass("LMyClass;", NULL, dex.get());
- Method* method = klass->FindVirtualMethod("foo");
+ Method* method = klass->FindVirtualMethod(String::AllocFromAscii("foo"));
Assembler jni_asm;
JniCompiler jni_compiler;
diff --git a/src/object.cc b/src/object.cc
index 69b093d..96c5116 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -157,11 +157,11 @@
return ShortyCharToSize(shorty_[0]);
}
-Method* Class::FindDirectMethod(const StringPiece& name) const {
+Method* Class::FindDirectMethod(const String* name) const {
Method* result = NULL;
for (size_t i = 0; i < NumDirectMethods(); i++) {
Method* method = GetDirectMethod(i);
- if (method->GetName().compare(name) == 0) {
+ if (String::Equals(method->GetName(), name)) {
result = method;
break;
}
@@ -169,11 +169,11 @@
return result;
}
-Method* Class::FindVirtualMethod(const StringPiece& name) const {
+Method* Class::FindVirtualMethod(const String* name) const {
Method* result = NULL;
for (size_t i = 0; i < NumVirtualMethods(); i++) {
Method* method = GetVirtualMethod(i);
- if (method->GetName().compare(name) == 0) {
+ if (String::Equals(method->GetName(), name)) {
result = method;
break;
}
@@ -186,6 +186,15 @@
return NULL; // TODO
}
+// TODO: get global references for these
+Class* String::java_lang_String_ = NULL;
+Class* String::char_array_ = NULL;
+
+void String::InitClasses(Class* java_lang_String, Class* char_array) {
+ java_lang_String_ = java_lang_String;
+ char_array_ = char_array;
+}
+
static const char* kClassStatusNames[] = {
"Error",
"NotReady",
diff --git a/src/object.h b/src/object.h
index 0f89411..0063f58 100644
--- a/src/object.h
+++ b/src/object.h
@@ -378,8 +378,8 @@
class Method : public AccessibleObject {
public:
// Returns the method name, e.g. "<init>" or "eatLunch"
- const StringPiece& GetName() const {
- return name_;
+ const String* GetName() const {
+ return java_name_;
}
Class* GetDeclaringClass() const {
@@ -837,9 +837,9 @@
reference_offsets_ = new_reference_offsets;
}
- Method* FindDirectMethod(const StringPiece& name) const;
+ Method* FindDirectMethod(const String* name) const;
- Method* FindVirtualMethod(const StringPiece& name) const;
+ Method* FindVirtualMethod(const String* name) const;
size_t NumInterfaces() const {
return (interfaces_ != NULL) ? interfaces_->GetLength() : 0;
@@ -1054,6 +1054,17 @@
return string;
}
+ // Creates a String of the given ASCII characters. It is an error to call this
+ // using non-ASCII characters as this function assumes one char per byte.
+ static String* AllocFromAscii(const char* ascii_data_in) {
+ DCHECK(java_lang_String_ != NULL);
+ DCHECK(char_array_ != NULL);
+ return AllocFromModifiedUtf8(java_lang_String_,
+ char_array_,
+ strlen(ascii_data_in),
+ ascii_data_in);
+ }
+
public: // TODO: private
// Field order required by test "ValidateFieldOrderOfJavaCppUnionClasses".
CharArray* array_;
@@ -1064,6 +1075,8 @@
int32_t count_;
+ static void InitClasses(Class* java_lang_String, Class* char_array);
+
static String* Alloc(Class* java_lang_String,
Class* char_array,
int32_t utf16_length) {
@@ -1123,7 +1136,7 @@
return hash;
}
- static bool Equals(const String* string, const char* other) {
+ static bool EqualsUtf8(const String* string, const char* other) {
uint16_t* chars = string->array_->GetChars();
for (int32_t i = 0; i < string->count_; i++) {
uint16_t c = GetUtf16FromUtf8(&other);
@@ -1134,8 +1147,29 @@
return *other == '\0';
}
+ static bool Equals(const String* a, const String* b) {
+ // TODO short circuit on hash_code_
+ int32_t a_count = a->count_;
+ if (a_count != b->count_) {
+ return false;
+ }
+ int32_t a_offset = a->offset_;
+ int32_t b_offset = b->offset_;
+ uint16_t* a_chars = a->array_->GetChars();
+ uint16_t* b_chars = b->array_->GetChars();
+ for (int32_t i = 0; i < a_count; i++) {
+ if (a_chars[a_offset + i] != b_chars[b_offset + i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
private:
String();
+
+ static Class* java_lang_String_;
+ static Class* char_array_;
};
class InterfaceEntry {
diff --git a/src/object_test.cc b/src/object_test.cc
index 7800855..46e9cca 100644
--- a/src/object_test.cc
+++ b/src/object_test.cc
@@ -32,7 +32,7 @@
ASSERT_TRUE(string->array_ != NULL);
ASSERT_TRUE(string->array_->GetChars() != NULL);
// strlen is necessary because the 1-character string "\0" is interpreted as ""
- ASSERT_TRUE(String::Equals(string, utf8_in) || length != strlen(utf8_in));
+ ASSERT_TRUE(String::EqualsUtf8(string, utf8_in) || length != strlen(utf8_in));
for (size_t i = 0; i < length; i++) {
EXPECT_EQ(utf16_expected[i], string->array_->GetChar(i));
}
@@ -90,22 +90,40 @@
AssertString(3, "h\xe1\x88\xb4i", "\x00\x68\x12\x34\x00\x69", (31 * ((31 * 0x68) + 0x1234)) + 0x69);
}
-static bool StringNotEquals(const String* a, const char* b) {
+static bool StringNotEqualsUtf8(const String* a, const char* b) {
+ return !String::EqualsUtf8(a, b);
+}
+
+TEST_F(ObjectTest, StringEqualsUtf8) {
+ String* string = String::AllocFromAscii("android");
+ EXPECT_PRED2(String::EqualsUtf8, string, "android");
+ EXPECT_PRED2(StringNotEqualsUtf8, string, "Android");
+ EXPECT_PRED2(StringNotEqualsUtf8, string, "ANDROID");
+ EXPECT_PRED2(StringNotEqualsUtf8, string, "");
+ EXPECT_PRED2(StringNotEqualsUtf8, string, "and");
+ EXPECT_PRED2(StringNotEqualsUtf8, string, "androids");
+
+ String* empty = String::AllocFromAscii("");
+ EXPECT_PRED2(String::EqualsUtf8, empty, "");
+ EXPECT_PRED2(StringNotEqualsUtf8, empty, "a");
+}
+
+static bool StringNotEquals(const String* a, const String* b) {
return !String::Equals(a, b);
}
TEST_F(ObjectTest, StringEquals) {
- String* string = class_linker_->AllocStringFromModifiedUtf8(7, "android");
- EXPECT_PRED2(String::Equals, string, "android");
- EXPECT_PRED2(StringNotEquals, string, "Android");
- EXPECT_PRED2(StringNotEquals, string, "ANDROID");
- EXPECT_PRED2(StringNotEquals, string, "");
- EXPECT_PRED2(StringNotEquals, string, "and");
- EXPECT_PRED2(StringNotEquals, string, "androids");
+ String* string = String::AllocFromAscii("android");
+ EXPECT_PRED2(String::Equals, string, String::AllocFromAscii("android"));
+ EXPECT_PRED2(StringNotEquals, string, String::AllocFromAscii("Android"));
+ EXPECT_PRED2(StringNotEquals, string, String::AllocFromAscii("ANDROID"));
+ EXPECT_PRED2(StringNotEquals, string, String::AllocFromAscii(""));
+ EXPECT_PRED2(StringNotEquals, string, String::AllocFromAscii("and"));
+ EXPECT_PRED2(StringNotEquals, string, String::AllocFromAscii("androids"));
- String* empty = class_linker_->AllocStringFromModifiedUtf8(0, "");
- EXPECT_PRED2(String::Equals, empty, "");
- EXPECT_PRED2(StringNotEquals, empty, "a");
+ String* empty = String::AllocFromAscii("");
+ EXPECT_PRED2(String::Equals, empty, String::AllocFromAscii(""));
+ EXPECT_PRED2(StringNotEquals, empty, String::AllocFromAscii("a"));
}
} // namespace art