Remove dex2oat warnings by providing "." class path defaulting only to JNI callers

Change-Id: Ibc532b4a6e72ad92d7b537896447949a2a764166
diff --git a/src/dalvik_system_VMRuntime.cc b/src/dalvik_system_VMRuntime.cc
index 5dcbb41..76da622 100644
--- a/src/dalvik_system_VMRuntime.cc
+++ b/src/dalvik_system_VMRuntime.cc
@@ -98,12 +98,21 @@
   return toStringArray(env, Runtime::Current()->GetProperties());
 }
 
+// This is for backward compatibility with dalvik which returned the
+// meaningless "." when no boot classpath or classpath was
+// specified. Unfortunately, some tests were using java.class.path to
+// lookup relative file locations, so they are counting on this to be
+// ".", presumably some applications or libraries could have as well.
+const char* DefaultToDot(const std::string& class_path) {
+  return class_path.empty() ? "." : class_path.c_str();
+}
+
 jstring VMRuntime_bootClassPath(JNIEnv* env, jobject) {
-  return env->NewStringUTF(Runtime::Current()->GetBootClassPath().c_str());
+  return env->NewStringUTF(DefaultToDot(Runtime::Current()->GetBootClassPath()));
 }
 
 jstring VMRuntime_classPath(JNIEnv* env, jobject) {
-  return env->NewStringUTF(Runtime::Current()->GetClassPath().c_str());
+  return env->NewStringUTF(DefaultToDot(Runtime::Current()->GetClassPath()));
 }
 
 jstring VMRuntime_vmVersion(JNIEnv* env, jobject) {