Merge "Use std::string in javanano and javamicro plugins."
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_enum_field.cc b/src/google/protobuf/compiler/javamicro/javamicro_enum_field.cc
index e3bf485..f5d04c6 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_enum_field.cc
+++ b/src/google/protobuf/compiler/javamicro/javamicro_enum_field.cc
@@ -52,7 +52,7 @@
 // TODO(kenton):  Factor out a "SetCommonFieldVariables()" to get rid of
 //   repeat code between this and the other field types.
 void SetEnumVariables(const Params& params,
-    const FieldDescriptor* descriptor, std::map<string, string>* variables) {
+    const FieldDescriptor* descriptor, std::map<std::string, std::string>* variables) {
   (*variables)["name"] =
     UnderscoresToCamelCase(descriptor);
   (*variables)["capitalized_name"] =
@@ -129,7 +129,7 @@
     "}\n");
 }
 
-string EnumFieldGenerator::GetBoxedType() const {
+std::string EnumFieldGenerator::GetBoxedType() const {
   return ClassName(params_, descriptor_->enum_type());
 }
 
@@ -323,7 +323,7 @@
   printer->Print("}\n");
 }
 
-string RepeatedEnumFieldGenerator::GetBoxedType() const {
+std::string RepeatedEnumFieldGenerator::GetBoxedType() const {
   return ClassName(params_, descriptor_->enum_type());
 }
 
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_enum_field.h b/src/google/protobuf/compiler/javamicro/javamicro_enum_field.h
index 8e7b906..0a88360 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_enum_field.h
+++ b/src/google/protobuf/compiler/javamicro/javamicro_enum_field.h
@@ -56,11 +56,11 @@
   void GenerateSerializationCode(io::Printer* printer) const;
   void GenerateSerializedSizeCode(io::Printer* printer) const;
 
-  string GetBoxedType() const;
+  std::string GetBoxedType() const;
 
  private:
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
 };
@@ -77,11 +77,11 @@
   void GenerateSerializationCode(io::Printer* printer) const;
   void GenerateSerializedSizeCode(io::Printer* printer) const;
 
-  string GetBoxedType() const;
+  std::string GetBoxedType() const;
 
  private:
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator);
 };
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_field.h b/src/google/protobuf/compiler/javamicro/javamicro_field.h
index c4dad14..a341ad7 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_field.h
+++ b/src/google/protobuf/compiler/javamicro/javamicro_field.h
@@ -63,7 +63,7 @@
   virtual void GenerateSerializationCode(io::Printer* printer) const = 0;
   virtual void GenerateSerializedSizeCode(io::Printer* printer) const = 0;
 
-  virtual string GetBoxedType() const = 0;
+  virtual std::string GetBoxedType() const = 0;
 
  protected:
   const Params& params_;
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_file.cc b/src/google/protobuf/compiler/javamicro/javamicro_file.cc
index df01070..25613cb 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_file.cc
+++ b/src/google/protobuf/compiler/javamicro/javamicro_file.cc
@@ -92,7 +92,7 @@
 
 FileGenerator::~FileGenerator() {}
 
-bool FileGenerator::Validate(string* error) {
+bool FileGenerator::Validate(std::string* error) {
   // Check for extensions
   FileDescriptorProto file_proto;
   file_->CopyTo(&file_proto);
@@ -193,13 +193,13 @@
 }
 
 template<typename GeneratorClass, typename DescriptorClass>
-static void GenerateSibling(const string& package_dir,
-                            const string& java_package,
+static void GenerateSibling(const std::string& package_dir,
+                            const std::string& java_package,
                             const DescriptorClass* descriptor,
                             OutputDirectory* output_directory,
-                            std::vector<string>* file_list,
+                            std::vector<std::string>* file_list,
                             const Params& params) {
-  string filename = package_dir + descriptor->name() + ".java";
+  std::string filename = package_dir + descriptor->name() + ".java";
   file_list->push_back(filename);
 
   std::unique_ptr<io::ZeroCopyOutputStream> output(
@@ -219,9 +219,9 @@
   GeneratorClass(descriptor, params).Generate(&printer);
 }
 
-void FileGenerator::GenerateSiblings(const string& package_dir,
+void FileGenerator::GenerateSiblings(const std::string& package_dir,
                                      OutputDirectory* output_directory,
-                                     std::vector<string>* file_list) {
+                                     std::vector<std::string>* file_list) {
   if (params_.java_multiple_files(file_->name())) {
     for (int i = 0; i < file_->message_type_count(); i++) {
       GenerateSibling<MessageGenerator>(package_dir, java_package_,
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_file.h b/src/google/protobuf/compiler/javamicro/javamicro_file.h
index 3aa0010..ca23c36 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_file.h
+++ b/src/google/protobuf/compiler/javamicro/javamicro_file.h
@@ -61,25 +61,25 @@
   // Checks for problems that would otherwise lead to cryptic compile errors.
   // Returns true if there are no problems, or writes an error description to
   // the given string and returns false otherwise.
-  bool Validate(string* error);
+  bool Validate(std::string* error);
 
   void Generate(io::Printer* printer);
 
   // If we aren't putting everything into one file, this will write all the
   // files other than the outer file (i.e. one for each message, enum, and
   // service type).
-  void GenerateSiblings(const string& package_dir,
+  void GenerateSiblings(const std::string& package_dir,
                         OutputDirectory* output_directory,
-                        std::vector<string>* file_list);
+                        std::vector<std::string>* file_list);
 
-  const string& java_package() { return java_package_; }
-  const string& classname()    { return classname_;    }
+  const std::string& java_package() { return java_package_; }
+  const std::string& classname()    { return classname_;    }
 
  private:
   const FileDescriptor* file_;
   const Params& params_;
-  string java_package_;
-  string classname_;
+  std::string java_package_;
+  std::string classname_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
 };
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_generator.cc b/src/google/protobuf/compiler/javamicro/javamicro_generator.cc
index 90f28e6..5ab0161 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_generator.cc
+++ b/src/google/protobuf/compiler/javamicro/javamicro_generator.cc
@@ -73,10 +73,10 @@
 JavaMicroGenerator::~JavaMicroGenerator() {}
 
 bool JavaMicroGenerator::Generate(const FileDescriptor* file,
-                             const string& parameter,
+                             const std::string& parameter,
                              OutputDirectory* output_directory,
-                             string* error) const {
-  std::vector<std::pair<string, string> > options;
+                             std::string* error) const {
+  std::vector<std::pair<std::string, std::string> > options;
 
 //  GOOGLE_LOG(INFO) << "wink: JavaMicroGenerator::Generate INFO";
 //  GOOGLE_LOG(WARNING) << "wink: JavaMicroGenerator::Generate WARNING";
@@ -90,7 +90,7 @@
 
   // Name a file where we will write a list of generated file names, one
   // per line.
-  string output_list_file;
+  std::string output_list_file;
   Params params(file->name());
 
   // Update per file params
@@ -113,7 +113,7 @@
         return false;
       }
     } else if (options[i].first == "java_package") {
-        std::vector<string> parts;
+        std::vector<std::string> parts;
         SplitStringUsing(options[i].second, "|", &parts);
         if (parts.size() != 2) {
           *error = "Bad java_package, expecting filename|PackageName found '"
@@ -122,7 +122,7 @@
         }
         params.set_java_package(parts[0], parts[1]);
     } else if (options[i].first == "java_outer_classname") {
-        std::vector<string> parts;
+        std::vector<std::string> parts;
         SplitStringUsing(options[i].second, "|", &parts);
         if (parts.size() != 2) {
           *error = "Bad java_outer_classname, "
@@ -167,14 +167,14 @@
     return false;
   }
 
-  string package_dir =
+  std::string package_dir =
     StringReplace(file_generator.java_package(), ".", "/", true);
   if (!package_dir.empty()) package_dir += "/";
 
-  std::vector<string> all_files;
+  std::vector<std::string> all_files;
 
   if (IsOuterClassNeeded(params, file)) {
-    string java_filename = package_dir;
+    std::string java_filename = package_dir;
     java_filename += file_generator.classname();
     java_filename += ".java";
     all_files.push_back(java_filename);
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_generator.h b/src/google/protobuf/compiler/javamicro/javamicro_generator.h
index a1c33b7..6a439ec 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_generator.h
+++ b/src/google/protobuf/compiler/javamicro/javamicro_generator.h
@@ -56,9 +56,9 @@
 
   // implements CodeGenerator ----------------------------------------
   bool Generate(const FileDescriptor* file,
-                const string& parameter,
+                const std::string& parameter,
                 OutputDirectory* output_directory,
-                string* error) const;
+                std::string* error) const;
 
  private:
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(JavaMicroGenerator);
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_helpers.cc b/src/google/protobuf/compiler/javamicro/javamicro_helpers.cc
index 07a5ae0..f9dcb6e 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_helpers.cc
+++ b/src/google/protobuf/compiler/javamicro/javamicro_helpers.cc
@@ -55,7 +55,7 @@
 
 const char* kDefaultPackage = "";
 
-const string& FieldName(const FieldDescriptor* field) {
+const std::string& FieldName(const FieldDescriptor* field) {
   // Groups are hacky:  The name of the field is just the lower-cased name
   // of the group type.  In Java, though, we would like to retain the original
   // capitalization of the type name.
@@ -66,8 +66,8 @@
   }
 }
 
-string UnderscoresToCamelCaseImpl(const string& input, bool cap_next_letter) {
-  string result;
+std::string UnderscoresToCamelCaseImpl(const std::string& input, bool cap_next_letter) {
+  std::string result;
   // Note:  I distrust ctype.h due to locales.
   for (int i = 0; i < input.size(); i++) {
     if ('a' <= input[i] && input[i] <= 'z') {
@@ -99,19 +99,19 @@
 
 }  // namespace
 
-string UnderscoresToCamelCase(const FieldDescriptor* field) {
+std::string UnderscoresToCamelCase(const FieldDescriptor* field) {
   return UnderscoresToCamelCaseImpl(FieldName(field), false);
 }
 
-string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field) {
+std::string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field) {
   return UnderscoresToCamelCaseImpl(FieldName(field), true);
 }
 
-string UnderscoresToCamelCase(const MethodDescriptor* method) {
+std::string UnderscoresToCamelCase(const MethodDescriptor* method) {
   return UnderscoresToCamelCaseImpl(method->name(), false);
 }
 
-string StripProto(const string& filename) {
+std::string StripProto(const std::string& filename) {
   if (HasSuffixString(filename, ".protodevel")) {
     return StripSuffixString(filename, ".protodevel");
   } else {
@@ -119,15 +119,15 @@
   }
 }
 
-string FileClassName(const Params& params, const FileDescriptor* file) {
+std::string FileClassName(const Params& params, const FileDescriptor* file) {
   if (params.has_java_outer_classname(file->name())) {
     return params.java_outer_classname(file->name());
   } else {
     // Use the filename itself with underscores removed
     // and a CamelCase style name.
-    string basename;
-    string::size_type last_slash = file->name().find_last_of('/');
-    if (last_slash == string::npos) {
+    std::string basename;
+    std::string::size_type last_slash = file->name().find_last_of('/');
+    if (last_slash == std::string::npos) {
       basename = file->name();
     } else {
       basename = file->name().substr(last_slash + 1);
@@ -136,11 +136,11 @@
   }
 }
 
-string FileJavaPackage(const Params& params, const FileDescriptor* file) {
+std::string FileJavaPackage(const Params& params, const FileDescriptor* file) {
   if (params.has_java_package(file->name())) {
     return params.java_package(file->name());
   } else {
-    string result = kDefaultPackage;
+    std::string result = kDefaultPackage;
     if (!file->package().empty()) {
       if (!result.empty()) result += '.';
       result += file->package();
@@ -158,9 +158,9 @@
   return !params.java_multiple_files(file->name());
 }
 
-string ToJavaName(const Params& params, const string& name, bool is_class,
+std::string ToJavaName(const Params& params, const std::string& name, bool is_class,
     const Descriptor* parent, const FileDescriptor* file) {
-  string result;
+  std::string result;
   if (parent != NULL) {
     result.append(ClassName(params, parent));
   } else if (is_class && params.java_multiple_files(file->name())) {
@@ -173,14 +173,14 @@
   return result;
 }
 
-string ClassName(const Params& params, const FileDescriptor* descriptor) {
-  string result = FileJavaPackage(params, descriptor);
+std::string ClassName(const Params& params, const FileDescriptor* descriptor) {
+  std::string result = FileJavaPackage(params, descriptor);
   if (!result.empty()) result += '.';
   result += FileClassName(params, descriptor);
   return result;
 }
 
-string ClassName(const Params& params, const EnumDescriptor* descriptor) {
+std::string ClassName(const Params& params, const EnumDescriptor* descriptor) {
   // An enum's class name is the enclosing message's class name or the outer
   // class name.
   const Descriptor* parent = descriptor->containing_type();
@@ -191,8 +191,8 @@
   }
 }
 
-string FieldConstantName(const FieldDescriptor *field) {
-  string name = field->name() + "_FIELD_NUMBER";
+std::string FieldConstantName(const FieldDescriptor *field) {
+  std::string name = field->name() + "_FIELD_NUMBER";
   UpperString(&name);
   return name;
 }
@@ -263,7 +263,7 @@
   return NULL;
 }
 
-bool AllAscii(const string& text) {
+bool AllAscii(const std::string& text) {
   for (int i = 0; i < text.size(); i++) {
     if ((text[i] & 0x80) != 0) {
       return false;
@@ -272,7 +272,7 @@
   return true;
 }
 
-string DefaultValue(const Params& params, const FieldDescriptor* field) {
+std::string DefaultValue(const Params& params, const FieldDescriptor* field) {
   // Switch on cpp_type since we need to know which default_value_* method
   // of FieldDescriptor to call.
   switch (field->cpp_type()) {
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_helpers.h b/src/google/protobuf/compiler/javamicro/javamicro_helpers.h
index 6131c15..e8108ab 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_helpers.h
+++ b/src/google/protobuf/compiler/javamicro/javamicro_helpers.h
@@ -52,22 +52,22 @@
 
 // Converts the field's name to camel-case, e.g. "foo_bar_baz" becomes
 // "fooBarBaz" or "FooBarBaz", respectively.
-string UnderscoresToCamelCase(const FieldDescriptor* field);
-string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field);
+std::string UnderscoresToCamelCase(const FieldDescriptor* field);
+std::string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field);
 
 // Similar, but for method names.  (Typically, this merely has the effect
 // of lower-casing the first letter of the name.)
-string UnderscoresToCamelCase(const MethodDescriptor* method);
+std::string UnderscoresToCamelCase(const MethodDescriptor* method);
 
 // Strips ".proto" or ".protodevel" from the end of a filename.
-string StripProto(const string& filename);
+std::string StripProto(const std::string& filename);
 
 // Gets the unqualified class name for the file.  Each .proto file becomes a
 // single Java class, with all its contents nested in that class.
-string FileClassName(const Params& params, const FileDescriptor* file);
+std::string FileClassName(const Params& params, const FileDescriptor* file);
 
 // Returns the file's Java package name.
-string FileJavaPackage(const Params& params, const FileDescriptor* file);
+std::string FileJavaPackage(const Params& params, const FileDescriptor* file);
 
 // Returns whether the Java outer class is needed, i.e. whether the option
 // java_multiple_files is false, or the proto file contains any file-scope
@@ -80,30 +80,30 @@
 // outer class name should be included in the return value depends on factors
 // inferrable from the given arguments, including is_class which indicates
 // whether the entity translates to a Java class.
-string ToJavaName(const Params& params, const string& name, bool is_class,
+std::string ToJavaName(const Params& params, const std::string& name, bool is_class,
     const Descriptor* parent, const FileDescriptor* file);
 
 // These return the fully-qualified class name corresponding to the given
 // descriptor.
-inline string ClassName(const Params& params, const Descriptor* descriptor) {
+inline std::string ClassName(const Params& params, const Descriptor* descriptor) {
   return ToJavaName(params, descriptor->name(), true,
                     descriptor->containing_type(), descriptor->file());
 }
-string ClassName(const Params& params, const EnumDescriptor* descriptor);
-inline string ClassName(const Params& params,
+std::string ClassName(const Params& params, const EnumDescriptor* descriptor);
+inline std::string ClassName(const Params& params,
     const ServiceDescriptor* descriptor) {
   return ToJavaName(params, descriptor->name(), true, NULL, descriptor->file());
 }
-inline string ExtensionIdentifierName(const Params& params,
+inline std::string ExtensionIdentifierName(const Params& params,
     const FieldDescriptor* descriptor) {
   return ToJavaName(params, descriptor->name(), false,
                     descriptor->extension_scope(), descriptor->file());
 }
-string ClassName(const Params& params, const FileDescriptor* descriptor);
+std::string ClassName(const Params& params, const FileDescriptor* descriptor);
 
 // Get the unqualified name that should be used for a field's field
 // number constant.
-string FieldConstantName(const FieldDescriptor *field);
+std::string FieldConstantName(const FieldDescriptor *field);
 
 enum JavaType {
   JAVATYPE_INT,
@@ -128,7 +128,7 @@
 // types.
 const char* BoxedPrimitiveTypeName(JavaType type);
 
-string DefaultValue(const Params& params, const FieldDescriptor* field);
+std::string DefaultValue(const Params& params, const FieldDescriptor* field);
 
 }  // namespace javamicro
 }  // namespace compiler
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_message.cc b/src/google/protobuf/compiler/javamicro/javamicro_message.cc
index 7fdb20d..73a8930 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_message.cc
+++ b/src/google/protobuf/compiler/javamicro/javamicro_message.cc
@@ -56,7 +56,7 @@
 void PrintFieldComment(io::Printer* printer, const FieldDescriptor* field) {
   // Print the field's proto-syntax definition as a comment.  We don't want to
   // print group bodies so we cut off after the first line.
-  string def = field->DebugString();
+  std::string def = field->DebugString();
   printer->Print("// $def$\n",
     "def", def.substr(0, def.find_first_of('\n')));
 }
@@ -84,7 +84,7 @@
 // Get an identifier that uniquely identifies this type within the file.
 // This is used to declare static variables related to this type at the
 // outermost file scope.
-string UniqueFileScopeIdentifier(const Descriptor* descriptor) {
+std::string UniqueFileScopeIdentifier(const Descriptor* descriptor) {
   return "static_" + StringReplace(descriptor->full_name(), ".", "_", true);
 }
 
@@ -170,7 +170,7 @@
 }
 
 void MessageGenerator::Generate(io::Printer* printer) {
-  const string& file_name = descriptor_->file()->name();
+  const std::string& file_name = descriptor_->file()->name();
   bool is_own_file =
     params_.java_multiple_files(file_name)
       && descriptor_->containing_type() == NULL;
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_message_field.cc b/src/google/protobuf/compiler/javamicro/javamicro_message_field.cc
index dbfdba5..46d53af 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_message_field.cc
+++ b/src/google/protobuf/compiler/javamicro/javamicro_message_field.cc
@@ -51,7 +51,7 @@
 // TODO(kenton):  Factor out a "SetCommonFieldVariables()" to get rid of
 //   repeat code between this and the other field types.
 void SetMessageVariables(const Params& params,
-    const FieldDescriptor* descriptor, std::map<string, string>* variables) {
+    const FieldDescriptor* descriptor, std::map<std::string, std::string>* variables) {
   (*variables)["name"] =
     UnderscoresToCamelCase(descriptor);
   (*variables)["capitalized_name"] =
@@ -144,7 +144,7 @@
     "}\n");
 }
 
-string MessageFieldGenerator::GetBoxedType() const {
+std::string MessageFieldGenerator::GetBoxedType() const {
   return ClassName(params_, descriptor_->message_type());
 }
 
@@ -292,7 +292,7 @@
   }
 }
 
-string RepeatedMessageFieldGenerator::GetBoxedType() const {
+std::string RepeatedMessageFieldGenerator::GetBoxedType() const {
   return ClassName(params_, descriptor_->message_type());
 }
 
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_message_field.h b/src/google/protobuf/compiler/javamicro/javamicro_message_field.h
index 1c73a27..7e4634d 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_message_field.h
+++ b/src/google/protobuf/compiler/javamicro/javamicro_message_field.h
@@ -56,11 +56,11 @@
   void GenerateSerializationCode(io::Printer* printer) const;
   void GenerateSerializedSizeCode(io::Printer* printer) const;
 
-  string GetBoxedType() const;
+  std::string GetBoxedType() const;
 
  private:
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
 };
@@ -78,11 +78,11 @@
   void GenerateSerializationCode(io::Printer* printer) const;
   void GenerateSerializedSizeCode(io::Printer* printer) const;
 
-  string GetBoxedType() const;
+  std::string GetBoxedType() const;
 
  private:
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator);
 };
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_params.h b/src/google/protobuf/compiler/javamicro/javamicro_params.h
index 16c4864..3fd61e6 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_params.h
+++ b/src/google/protobuf/compiler/javamicro/javamicro_params.h
@@ -48,11 +48,11 @@
 // Parameters for used by the generators
 class Params {
  public:
-  typedef std::map<string, string> NameMap;
-  typedef std::set<string> NameSet;
+  typedef std::map<std::string, std::string> NameMap;
+  typedef std::set<std::string> NameSet;
  private:
-  string empty_;
-  string base_name_;
+  std::string empty_;
+  std::string base_name_;
   eOptimization optimization_;
   eMultipleFiles override_java_multiple_files_;
   bool java_use_vector_;
@@ -61,7 +61,7 @@
   NameSet java_multiple_files_;
 
  public:
-  Params(const string & base_name) :
+  Params(const std::string & base_name) :
     empty_(""),
     base_name_(base_name),
     optimization_(JAVAMICRO_OPT_DEFAULT),
@@ -69,19 +69,19 @@
     java_use_vector_(false) {
   }
 
-  const string& base_name() const {
+  const std::string& base_name() const {
     return base_name_;
   }
 
-  bool has_java_package(const string& file_name) const {
+  bool has_java_package(const std::string& file_name) const {
     return java_packages_.find(file_name)
                         != java_packages_.end();
   }
-  void set_java_package(const string& file_name,
-      const string& java_package) {
+  void set_java_package(const std::string& file_name,
+      const std::string& java_package) {
     java_packages_[file_name] = java_package;
   }
-  const string& java_package(const string& file_name) const {
+  const std::string& java_package(const std::string& file_name) const {
     NameMap::const_iterator itr;
 
     itr = java_packages_.find(file_name);
@@ -95,15 +95,15 @@
     return java_packages_;
   }
 
-  bool has_java_outer_classname(const string& file_name) const {
+  bool has_java_outer_classname(const std::string& file_name) const {
     return java_outer_classnames_.find(file_name)
                         != java_outer_classnames_.end();
   }
-  void set_java_outer_classname(const string& file_name,
-      const string& java_outer_classname) {
+  void set_java_outer_classname(const std::string& file_name,
+      const std::string& java_outer_classname) {
     java_outer_classnames_[file_name] = java_outer_classname;
   }
-  const string& java_outer_classname(const string& file_name) const {
+  const std::string& java_outer_classname(const std::string& file_name) const {
     NameMap::const_iterator itr;
 
     itr = java_outer_classnames_.find(file_name);
@@ -135,14 +135,14 @@
     override_java_multiple_files_ = JAVAMICRO_MUL_UNSET;
   }
 
-  void set_java_multiple_files(const string& file_name, bool value) {
+  void set_java_multiple_files(const std::string& file_name, bool value) {
     if (value) {
       java_multiple_files_.insert(file_name);
     } else {
       java_multiple_files_.erase(file_name);
     }
   }
-  bool java_multiple_files(const string& file_name) const {
+  bool java_multiple_files(const std::string& file_name) const {
     switch (override_java_multiple_files_) {
       case JAVAMICRO_MUL_FALSE:
         return false;
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_primitive_field.cc b/src/google/protobuf/compiler/javamicro/javamicro_primitive_field.cc
index b5f95ac..2907e41 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_primitive_field.cc
+++ b/src/google/protobuf/compiler/javamicro/javamicro_primitive_field.cc
@@ -182,7 +182,7 @@
 }
 
 void SetPrimitiveVariables(const FieldDescriptor* descriptor, const Params params,
-                           std::map<string, string>* variables) {
+                           std::map<std::string, std::string>* variables) {
   (*variables)["name"] =
     UnderscoresToCamelCase(descriptor);
   (*variables)["capitalized_name"] =
@@ -323,7 +323,7 @@
   }
 }
 
-string PrimitiveFieldGenerator::GetBoxedType() const {
+std::string PrimitiveFieldGenerator::GetBoxedType() const {
   return BoxedPrimitiveTypeName(GetJavaType(descriptor_));
 }
 
@@ -666,7 +666,7 @@
   printer->Print("}\n");
 }
 
-string RepeatedPrimitiveFieldGenerator::GetBoxedType() const {
+std::string RepeatedPrimitiveFieldGenerator::GetBoxedType() const {
   return BoxedPrimitiveTypeName(GetJavaType(descriptor_));
 }
 
diff --git a/src/google/protobuf/compiler/javamicro/javamicro_primitive_field.h b/src/google/protobuf/compiler/javamicro/javamicro_primitive_field.h
index cc9d9b4..a3df7d8 100644
--- a/src/google/protobuf/compiler/javamicro/javamicro_primitive_field.h
+++ b/src/google/protobuf/compiler/javamicro/javamicro_primitive_field.h
@@ -56,11 +56,11 @@
   void GenerateSerializationCode(io::Printer* printer) const;
   void GenerateSerializedSizeCode(io::Printer* printer) const;
 
-  string GetBoxedType() const;
+  std::string GetBoxedType() const;
 
  private:
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator);
 };
@@ -77,11 +77,11 @@
   void GenerateSerializationCode(io::Printer* printer) const;
   void GenerateSerializedSizeCode(io::Printer* printer) const;
 
-  string GetBoxedType() const;
+  std::string GetBoxedType() const;
 
  private:
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator);
 };
diff --git a/src/google/protobuf/compiler/javanano/javanano_enum.cc b/src/google/protobuf/compiler/javanano/javanano_enum.cc
index c6e8dfe..72a6143 100644
--- a/src/google/protobuf/compiler/javanano/javanano_enum.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_enum.cc
@@ -73,7 +73,7 @@
       "// enum $classname$\n",
       "classname", descriptor_->name());
 
-  const string classname = RenameJavaKeywords(descriptor_->name());
+  const std::string classname = RenameJavaKeywords(descriptor_->name());
 
   // Start of container interface
   // If generating intdefs, we use the container interface as the intdef if
@@ -89,7 +89,7 @@
       "@android.support.annotation.IntDef({\n");
     printer->Indent();
     for (int i = 0; i < canonical_values_.size(); i++) {
-      const string constant_name =
+      const std::string constant_name =
           RenameJavaKeywords(canonical_values_[i]->name());
       if (use_shell_class) {
         printer->Print("$classname$.$name$,\n",
diff --git a/src/google/protobuf/compiler/javanano/javanano_enum_field.cc b/src/google/protobuf/compiler/javanano/javanano_enum_field.cc
index ea67a81..522eb3c 100644
--- a/src/google/protobuf/compiler/javanano/javanano_enum_field.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_enum_field.cc
@@ -52,7 +52,7 @@
 // TODO(kenton):  Factor out a "SetCommonFieldVariables()" to get rid of
 //   repeat code between this and the other field types.
 void SetEnumVariables(const Params& params,
-    const FieldDescriptor* descriptor, std::map<string, string>* variables) {
+    const FieldDescriptor* descriptor, std::map<std::string, std::string>* variables) {
   (*variables)["name"] =
     RenameJavaKeywords(UnderscoresToCamelCase(descriptor));
   (*variables)["capitalized_name"] =
@@ -83,8 +83,8 @@
 }
 
 void LoadEnumValues(const Params& params,
-    const EnumDescriptor* enum_descriptor, std::vector<string>* canonical_values) {
-  string enum_class_name = ClassName(params, enum_descriptor);
+    const EnumDescriptor* enum_descriptor, std::vector<std::string>* canonical_values) {
+  std::string enum_class_name = ClassName(params, enum_descriptor);
   for (int i = 0; i < enum_descriptor->value_count(); i++) {
     const EnumValueDescriptor* value = enum_descriptor->value(i);
     const EnumValueDescriptor* canonical_value =
@@ -97,7 +97,7 @@
 }
 
 void PrintCaseLabels(
-    io::Printer* printer, const std::vector<string>& canonical_values) {
+    io::Printer* printer, const std::vector<std::string>& canonical_values) {
   for (int i = 0; i < canonical_values.size(); i++) {
     printer->Print(
       "  case $value$:\n",
diff --git a/src/google/protobuf/compiler/javanano/javanano_enum_field.h b/src/google/protobuf/compiler/javanano/javanano_enum_field.h
index 8cd0e24..cd062fa 100644
--- a/src/google/protobuf/compiler/javanano/javanano_enum_field.h
+++ b/src/google/protobuf/compiler/javanano/javanano_enum_field.h
@@ -62,8 +62,8 @@
 
  private:
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
-  std::vector<string> canonical_values_;
+  std::map<std::string, std::string> variables_;
+  std::vector<std::string> canonical_values_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
 };
@@ -85,8 +85,8 @@
 
  private:
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
-  std::vector<string> canonical_values_;
+  std::map<std::string, std::string> variables_;
+  std::vector<std::string> canonical_values_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(AccessorEnumFieldGenerator);
 };
@@ -112,8 +112,8 @@
   void GenerateRepeatedDataSizeCode(io::Printer* printer) const;
 
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
-  std::vector<string> canonical_values_;
+  std::map<std::string, std::string> variables_;
+  std::vector<std::string> canonical_values_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator);
 };
diff --git a/src/google/protobuf/compiler/javanano/javanano_extension.cc b/src/google/protobuf/compiler/javanano/javanano_extension.cc
index 4c61f91..1297c5d 100644
--- a/src/google/protobuf/compiler/javanano/javanano_extension.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_extension.cc
@@ -78,17 +78,17 @@
 }  // namespace
 
 void SetVariables(const FieldDescriptor* descriptor, const Params params,
-                  std::map<string, string>* variables) {
+                  std::map<std::string, std::string>* variables) {
   (*variables)["extends"] = ClassName(params, descriptor->containing_type());
   (*variables)["name"] = RenameJavaKeywords(UnderscoresToCamelCase(descriptor));
   bool repeated = descriptor->is_repeated();
   (*variables)["repeated"] = repeated ? "Repeated" : "";
   (*variables)["type"] = GetTypeConstantName(descriptor->type());
   JavaType java_type = GetJavaType(descriptor->type());
-  string tag = SimpleItoa(WireFormat::MakeTag(descriptor));
+  std::string tag = SimpleItoa(WireFormat::MakeTag(descriptor));
   if (java_type == JAVATYPE_MESSAGE) {
     (*variables)["ext_type"] = "MessageTyped";
-    string message_type = ClassName(params, descriptor->message_type());
+    std::string message_type = ClassName(params, descriptor->message_type());
     if (repeated) {
       message_type += "[]";
     }
@@ -108,13 +108,13 @@
         (*variables)["tag_params"] = tag + ", " + tag + ", 0";
       } else if (descriptor->options().packed()) {
         // Packable and packed: tag == packedTag
-        string non_packed_tag = SimpleItoa(WireFormatLite::MakeTag(
+        std::string non_packed_tag = SimpleItoa(WireFormatLite::MakeTag(
             descriptor->number(),
             WireFormat::WireTypeForFieldType(descriptor->type())));
         (*variables)["tag_params"] = tag + ", " + non_packed_tag + ", " + tag;
       } else {
         // Packable and not packed: tag == nonPackedTag
-        string packed_tag = SimpleItoa(WireFormatLite::MakeTag(
+        std::string packed_tag = SimpleItoa(WireFormatLite::MakeTag(
             descriptor->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED));
         (*variables)["tag_params"] = tag + ", " + tag + ", " + packed_tag;
       }
@@ -147,4 +147,3 @@
 }  // namespace compiler
 }  // namespace protobuf
 }  // namespace google
-
diff --git a/src/google/protobuf/compiler/javanano/javanano_extension.h b/src/google/protobuf/compiler/javanano/javanano_extension.h
index f4e9eb2..ea50744 100644
--- a/src/google/protobuf/compiler/javanano/javanano_extension.h
+++ b/src/google/protobuf/compiler/javanano/javanano_extension.h
@@ -61,7 +61,7 @@
  private:
   const Params& params_;
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
 };
diff --git a/src/google/protobuf/compiler/javanano/javanano_field.cc b/src/google/protobuf/compiler/javanano/javanano_field.cc
index 0c134fe..c9e172c 100644
--- a/src/google/protobuf/compiler/javanano/javanano_field.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_field.cc
@@ -151,7 +151,7 @@
 }
 
 void SetCommonOneofVariables(const FieldDescriptor* descriptor,
-                             std::map<string, string>* variables) {
+                             std::map<std::string, std::string>* variables) {
   (*variables)["oneof_name"] =
       UnderscoresToCamelCase(descriptor->containing_oneof());
   (*variables)["oneof_capitalized_name"] =
@@ -169,7 +169,7 @@
 }
 
 void GenerateOneofFieldEquals(const FieldDescriptor* descriptor,
-                              const std::map<string, string>& variables,
+                              const std::map<std::string, std::string>& variables,
                               io::Printer* printer) {
   if (GetJavaType(descriptor) == JAVATYPE_BYTES) {
     printer->Print(variables,
@@ -190,7 +190,7 @@
 }
 
 void GenerateOneofFieldHashCode(const FieldDescriptor* descriptor,
-                                const std::map<string, string>& variables,
+                                const std::map<std::string, std::string>& variables,
                                 io::Printer* printer) {
   if (GetJavaType(descriptor) == JAVATYPE_BYTES) {
     printer->Print(variables,
diff --git a/src/google/protobuf/compiler/javanano/javanano_field.h b/src/google/protobuf/compiler/javanano/javanano_field.h
index e3701f1..fdeabec 100644
--- a/src/google/protobuf/compiler/javanano/javanano_field.h
+++ b/src/google/protobuf/compiler/javanano/javanano_field.h
@@ -114,12 +114,12 @@
 };
 
 void SetCommonOneofVariables(const FieldDescriptor* descriptor,
-                             std::map<string, string>* variables);
+                             std::map<std::string, std::string>* variables);
 void GenerateOneofFieldEquals(const FieldDescriptor* descriptor,
-                              const std::map<string, string>& variables,
+                              const std::map<std::string, std::string>& variables,
                               io::Printer* printer);
 void GenerateOneofFieldHashCode(const FieldDescriptor* descriptor,
-                                const std::map<string, string>& variables,
+                                const std::map<std::string, std::string>& variables,
                                 io::Printer* printer);
 
 }  // namespace javanano
diff --git a/src/google/protobuf/compiler/javanano/javanano_file.cc b/src/google/protobuf/compiler/javanano/javanano_file.cc
index b7f650e..ed55fe7 100644
--- a/src/google/protobuf/compiler/javanano/javanano_file.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_file.cc
@@ -93,7 +93,7 @@
 
 FileGenerator::~FileGenerator() {}
 
-bool FileGenerator::Validate(string* error) {
+bool FileGenerator::Validate(std::string* error) {
   // Check for extensions
   FileDescriptorProto file_proto;
   file_->CopyTo(&file_proto);
@@ -212,13 +212,13 @@
 }
 
 template<typename GeneratorClass, typename DescriptorClass>
-static void GenerateSibling(const string& package_dir,
-                            const string& java_package,
+static void GenerateSibling(const std::string& package_dir,
+                            const std::string& java_package,
                             const DescriptorClass* descriptor,
                             GeneratorContext* output_directory,
-                            std::vector<string>* file_list,
+                            std::vector<std::string>* file_list,
                             const Params& params) {
-  string filename = package_dir + descriptor->name() + ".java";
+  std::string filename = package_dir + descriptor->name() + ".java";
   file_list->push_back(filename);
 
   std::unique_ptr<io::ZeroCopyOutputStream> output(
@@ -237,9 +237,9 @@
   GeneratorClass(descriptor, params).Generate(&printer);
 }
 
-void FileGenerator::GenerateSiblings(const string& package_dir,
+void FileGenerator::GenerateSiblings(const std::string& package_dir,
                                      GeneratorContext* output_directory,
-                                     std::vector<string>* file_list) {
+                                     std::vector<std::string>* file_list) {
   if (params_.java_multiple_files(file_->name())) {
     for (int i = 0; i < file_->message_type_count(); i++) {
       GenerateSibling<MessageGenerator>(package_dir, java_package_,
diff --git a/src/google/protobuf/compiler/javanano/javanano_file.h b/src/google/protobuf/compiler/javanano/javanano_file.h
index 4ad3868..a72502e 100644
--- a/src/google/protobuf/compiler/javanano/javanano_file.h
+++ b/src/google/protobuf/compiler/javanano/javanano_file.h
@@ -63,25 +63,25 @@
   // Checks for problems that would otherwise lead to cryptic compile errors.
   // Returns true if there are no problems, or writes an error description to
   // the given string and returns false otherwise.
-  bool Validate(string* error);
+  bool Validate(std::string* error);
 
   void Generate(io::Printer* printer);
 
   // If we aren't putting everything into one file, this will write all the
   // files other than the outer file (i.e. one for each message, enum, and
   // service type).
-  void GenerateSiblings(const string& package_dir,
+  void GenerateSiblings(const std::string& package_dir,
                         GeneratorContext* output_directory,
-                        std::vector<string>* file_list);
+                        std::vector<std::string>* file_list);
 
-  const string& java_package() { return java_package_; }
-  const string& classname()    { return classname_;    }
+  const std::string& java_package() { return java_package_; }
+  const std::string& classname()    { return classname_;    }
 
  private:
   const FileDescriptor* file_;
   const Params& params_;
-  string java_package_;
-  string classname_;
+  std::string java_package_;
+  std::string classname_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
 };
diff --git a/src/google/protobuf/compiler/javanano/javanano_generator.cc b/src/google/protobuf/compiler/javanano/javanano_generator.cc
index 64ba333..b2d738c 100644
--- a/src/google/protobuf/compiler/javanano/javanano_generator.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_generator.cc
@@ -48,12 +48,12 @@
 
 namespace {
 
-string TrimString(const string& s) {
-  string::size_type start = s.find_first_not_of(" \n\r\t");
-  if (start == string::npos) {
+std::string TrimString(const std::string& s) {
+  std::string::size_type start = s.find_first_not_of(" \n\r\t");
+  if (start == std::string::npos) {
     return "";
   }
-  string::size_type end = s.find_last_not_of(" \n\r\t") + 1;
+  std::string::size_type end = s.find_last_not_of(" \n\r\t") + 1;
   return s.substr(start, end - start);
 }
 
@@ -67,7 +67,7 @@
       file->name(), file->options().java_outer_classname());
   }
   if (file->options().has_java_package()) {
-    string result = file->options().java_package();
+    std::string result = file->options().java_package();
     if (!result.empty()) {
       result += ".";
     }
@@ -91,10 +91,10 @@
 JavaNanoGenerator::~JavaNanoGenerator() {}
 
 bool JavaNanoGenerator::Generate(const FileDescriptor* file,
-                             const string& parameter,
+                             const std::string& parameter,
                              GeneratorContext* output_directory,
-                             string* error) const {
-  std::vector<std::pair<string, string> > options;
+                             std::string* error) const {
+  std::vector<std::pair<std::string, std::string> > options;
 
   ParseGeneratorParameter(parameter, &options);
 
@@ -103,7 +103,7 @@
 
   // Name a file where we will write a list of generated file names, one
   // per line.
-  string output_list_file;
+  std::string output_list_file;
   Params params(file->name());
 
   // Update per file params
@@ -111,12 +111,12 @@
 
   // Replace any existing options with ones from command line
   for (int i = 0; i < options.size(); i++) {
-    string option_name = TrimString(options[i].first);
-    string option_value = TrimString(options[i].second);
+    std::string option_name = TrimString(options[i].first);
+    std::string option_value = TrimString(options[i].second);
     if (option_name == "output_list_file") {
       output_list_file = option_value;
     } else if (option_name == "java_package") {
-      std::vector<string> parts;
+      std::vector<std::string> parts;
       SplitStringUsing(option_value, "|", &parts);
       if (parts.size() != 2) {
         *error = "Bad java_package, expecting filename|PackageName found '"
@@ -125,7 +125,7 @@
       }
       params.set_java_package(parts[0], parts[1]);
     } else if (option_name == "java_outer_classname") {
-      std::vector<string> parts;
+      std::vector<std::string> parts;
       SplitStringUsing(option_value, "|", &parts);
       if (parts.size() != 2) {
         *error = "Bad java_outer_classname, "
@@ -187,14 +187,14 @@
     return false;
   }
 
-  string package_dir =
+  std::string package_dir =
     StringReplace(file_generator.java_package(), ".", "/", true);
   if (!package_dir.empty()) package_dir += "/";
 
-  std::vector<string> all_files;
+  std::vector<std::string> all_files;
 
   if (IsOuterClassNeeded(params, file)) {
-    string java_filename = package_dir;
+    std::string java_filename = package_dir;
     java_filename += file_generator.classname();
     java_filename += ".java";
     all_files.push_back(java_filename);
diff --git a/src/google/protobuf/compiler/javanano/javanano_generator.h b/src/google/protobuf/compiler/javanano/javanano_generator.h
index 6f9f7f2..e124ba4 100644
--- a/src/google/protobuf/compiler/javanano/javanano_generator.h
+++ b/src/google/protobuf/compiler/javanano/javanano_generator.h
@@ -56,9 +56,9 @@
 
   // implements CodeGenerator ----------------------------------------
   bool Generate(const FileDescriptor* file,
-                const string& parameter,
+                const std::string& parameter,
                 GeneratorContext* output_directory,
-                string* error) const;
+                std::string* error) const;
 
  private:
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(JavaNanoGenerator);
diff --git a/src/google/protobuf/compiler/javanano/javanano_helpers.cc b/src/google/protobuf/compiler/javanano/javanano_helpers.cc
index 0c5d4d3..a0e18d3 100644
--- a/src/google/protobuf/compiler/javanano/javanano_helpers.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_helpers.cc
@@ -54,7 +54,7 @@
 
 class RenameKeywords {
  private:
-  std::unordered_set<string> java_keywords_set_;
+  std::unordered_set<std::string> java_keywords_set_;
 
  public:
   RenameKeywords() {
@@ -80,8 +80,8 @@
   // Used to rename the a field name if it's a java keyword.  Specifically
   // this is used to rename the ["name"] or ["capitalized_name"] field params.
   // (http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html)
-  string RenameJavaKeywordsImpl(const string& input) {
-    string result = input;
+  std::string RenameJavaKeywordsImpl(const std::string& input) {
+    std::string result = input;
 
     if (java_keywords_set_.find(result) != java_keywords_set_.end()) {
       result += "_";
@@ -98,7 +98,7 @@
 
 const char* kDefaultPackage = "";
 
-const string& FieldName(const FieldDescriptor* field) {
+const std::string& FieldName(const FieldDescriptor* field) {
   // Groups are hacky:  The name of the field is just the lower-cased name
   // of the group type.  In Java, though, we would like to retain the original
   // capitalization of the type name.
@@ -109,8 +109,8 @@
   }
 }
 
-string UnderscoresToCamelCaseImpl(const string& input, bool cap_next_letter) {
-  string result;
+std::string UnderscoresToCamelCaseImpl(const std::string& input, bool cap_next_letter) {
+  std::string result;
   // Note:  I distrust ctype.h due to locales.
   for (int i = 0; i < input.size(); i++) {
     if ('a' <= input[i] && input[i] <= 'z') {
@@ -142,31 +142,31 @@
 
 }  // namespace
 
-string UnderscoresToCamelCase(const FieldDescriptor* field) {
+std::string UnderscoresToCamelCase(const FieldDescriptor* field) {
   return UnderscoresToCamelCaseImpl(FieldName(field), false);
 }
 
-string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field) {
+std::string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field) {
   return UnderscoresToCamelCaseImpl(FieldName(field), true);
 }
 
-string UnderscoresToCamelCase(const MethodDescriptor* method) {
+std::string UnderscoresToCamelCase(const MethodDescriptor* method) {
   return UnderscoresToCamelCaseImpl(method->name(), false);
 }
 
-string UnderscoresToCamelCase(const OneofDescriptor* oneof) {
+std::string UnderscoresToCamelCase(const OneofDescriptor* oneof) {
   return UnderscoresToCamelCaseImpl(oneof->name(), false);
 }
 
-string UnderscoresToCapitalizedCamelCase(const OneofDescriptor* oneof) {
+std::string UnderscoresToCapitalizedCamelCase(const OneofDescriptor* oneof) {
   return UnderscoresToCamelCaseImpl(oneof->name(), true);
 }
 
-string RenameJavaKeywords(const string& input) {
+std::string RenameJavaKeywords(const std::string& input) {
   return sRenameKeywords.RenameJavaKeywordsImpl(input);
 }
 
-string StripProto(const string& filename) {
+std::string StripProto(const std::string& filename) {
   if (HasSuffixString(filename, ".protodevel")) {
     return StripSuffixString(filename, ".protodevel");
   } else {
@@ -174,15 +174,15 @@
   }
 }
 
-string FileClassName(const Params& params, const FileDescriptor* file) {
+std::string FileClassName(const Params& params, const FileDescriptor* file) {
   if (params.has_java_outer_classname(file->name())) {
     return params.java_outer_classname(file->name());
   } else {
     // Use the filename itself with underscores removed
     // and a CamelCase style name.
-    string basename;
-    string::size_type last_slash = file->name().find_last_of('/');
-    if (last_slash == string::npos) {
+    std::string basename;
+    std::string::size_type last_slash = file->name().find_last_of('/');
+    if (last_slash == std::string::npos) {
       basename = file->name();
     } else {
       basename = file->name().substr(last_slash + 1);
@@ -191,11 +191,11 @@
   }
 }
 
-string FileJavaPackage(const Params& params, const FileDescriptor* file) {
+std::string FileJavaPackage(const Params& params, const FileDescriptor* file) {
   if (params.has_java_package(file->name())) {
     return params.java_package(file->name());
   } else {
-    string result = kDefaultPackage;
+    std::string result = kDefaultPackage;
     if (!file->package().empty()) {
       if (!result.empty()) result += '.';
       result += file->package();
@@ -230,9 +230,9 @@
   return false;
 }
 
-string ToJavaName(const Params& params, const string& name, bool is_class,
+std::string ToJavaName(const Params& params, const std::string& name, bool is_class,
     const Descriptor* parent, const FileDescriptor* file) {
-  string result;
+  std::string result;
   if (parent != NULL) {
     result.append(ClassName(params, parent));
   } else if (is_class && params.java_multiple_files(file->name())) {
@@ -245,14 +245,14 @@
   return result;
 }
 
-string ClassName(const Params& params, const FileDescriptor* descriptor) {
-  string result = FileJavaPackage(params, descriptor);
+std::string ClassName(const Params& params, const FileDescriptor* descriptor) {
+  std::string result = FileJavaPackage(params, descriptor);
   if (!result.empty()) result += '.';
   result += FileClassName(params, descriptor);
   return result;
 }
 
-string ClassName(const Params& params, const EnumDescriptor* descriptor) {
+std::string ClassName(const Params& params, const EnumDescriptor* descriptor) {
   const Descriptor* parent = descriptor->containing_type();
   // When using Java enum style, an enum's class name contains the enum name.
   // Use the standard ToJavaName translation.
@@ -268,26 +268,26 @@
   }
 }
 
-string FieldConstantName(const FieldDescriptor *field) {
-  string name = field->name() + "_FIELD_NUMBER";
+std::string FieldConstantName(const FieldDescriptor *field) {
+  std::string name = field->name() + "_FIELD_NUMBER";
   UpperString(&name);
   return name;
 }
 
-string FieldDefaultConstantName(const FieldDescriptor *field) {
+std::string FieldDefaultConstantName(const FieldDescriptor *field) {
   return "_" + RenameJavaKeywords(UnderscoresToCamelCase(field)) + "Default";
 }
 
 void PrintFieldComment(io::Printer* printer, const FieldDescriptor* field) {
   // We don't want to print group bodies so we cut off after the first line
   // (the second line for extensions).
-  string def = field->DebugString();
-  string::size_type first_line_end = def.find_first_of('\n');
+  std::string def = field->DebugString();
+  std::string::size_type first_line_end = def.find_first_of('\n');
   printer->Print("// $def$\n",
     "def", def.substr(0, first_line_end));
   if (field->is_extension()) {
-    string::size_type second_line_start = first_line_end + 1;
-    string::size_type second_line_length =
+    std::string::size_type second_line_start = first_line_end + 1;
+    std::string::size_type second_line_length =
         def.find('\n', second_line_start) - second_line_start;
     printer->Print("// $def$\n",
       "def", def.substr(second_line_start, second_line_length));
@@ -340,7 +340,7 @@
   return JAVATYPE_INT;
 }
 
-string PrimitiveTypeName(JavaType type) {
+std::string PrimitiveTypeName(JavaType type) {
   switch (type) {
     case JAVATYPE_INT    : return "int";
     case JAVATYPE_LONG   : return "long";
@@ -360,7 +360,7 @@
   return "";
 }
 
-string BoxedPrimitiveTypeName(JavaType type) {
+std::string BoxedPrimitiveTypeName(JavaType type) {
   switch (type) {
     case JAVATYPE_INT    : return "java.lang.Integer";
     case JAVATYPE_LONG   : return "java.lang.Long";
@@ -380,7 +380,7 @@
   return "";
 }
 
-string EmptyArrayName(const Params& params, const FieldDescriptor* field) {
+std::string EmptyArrayName(const Params& params, const FieldDescriptor* field) {
   switch (GetJavaType(field)) {
     case JAVATYPE_INT    : return "com.google.protobuf.nano.WireFormatNano.EMPTY_INT_ARRAY";
     case JAVATYPE_LONG   : return "com.google.protobuf.nano.WireFormatNano.EMPTY_LONG_ARRAY";
@@ -400,7 +400,7 @@
   return "";
 }
 
-string DefaultValue(const Params& params, const FieldDescriptor* field) {
+std::string DefaultValue(const Params& params, const FieldDescriptor* field) {
   if (field->label() == FieldDescriptor::LABEL_REPEATED) {
     return EmptyArrayName(params, field);
   }
@@ -518,56 +518,56 @@
   "0x80000000",
 };
 
-string GetBitFieldName(int index) {
-  string var_name = "bitField";
+std::string GetBitFieldName(int index) {
+  std::string var_name = "bitField";
   var_name += SimpleItoa(index);
   var_name += "_";
   return var_name;
 }
 
-string GetBitFieldNameForBit(int bit_index) {
+std::string GetBitFieldNameForBit(int bit_index) {
   return GetBitFieldName(bit_index / 32);
 }
 
-string GenerateGetBit(int bit_index) {
-  string var_name = GetBitFieldNameForBit(bit_index);
+std::string GenerateGetBit(int bit_index) {
+  std::string var_name = GetBitFieldNameForBit(bit_index);
   int bit_in_var_index = bit_index % 32;
 
-  string mask = kBitMasks[bit_in_var_index];
-  string result = "((" + var_name + " & " + mask + ") != 0)";
+  std::string mask = kBitMasks[bit_in_var_index];
+  std::string result = "((" + var_name + " & " + mask + ") != 0)";
   return result;
 }
 
-string GenerateSetBit(int bit_index) {
-  string var_name = GetBitFieldNameForBit(bit_index);
+std::string GenerateSetBit(int bit_index) {
+  std::string var_name = GetBitFieldNameForBit(bit_index);
   int bit_in_var_index = bit_index % 32;
 
-  string mask = kBitMasks[bit_in_var_index];
-  string result = var_name + " |= " + mask;
+  std::string mask = kBitMasks[bit_in_var_index];
+  std::string result = var_name + " |= " + mask;
   return result;
 }
 
-string GenerateClearBit(int bit_index) {
-  string var_name = GetBitFieldNameForBit(bit_index);
+std::string GenerateClearBit(int bit_index) {
+  std::string var_name = GetBitFieldNameForBit(bit_index);
   int bit_in_var_index = bit_index % 32;
 
-  string mask = kBitMasks[bit_in_var_index];
-  string result = var_name + " = (" + var_name + " & ~" + mask + ")";
+  std::string mask = kBitMasks[bit_in_var_index];
+  std::string result = var_name + " = (" + var_name + " & ~" + mask + ")";
   return result;
 }
 
-string GenerateDifferentBit(int bit_index) {
-  string var_name = GetBitFieldNameForBit(bit_index);
+std::string GenerateDifferentBit(int bit_index) {
+  std::string var_name = GetBitFieldNameForBit(bit_index);
   int bit_in_var_index = bit_index % 32;
 
-  string mask = kBitMasks[bit_in_var_index];
-  string result = "((" + var_name + " & " + mask
+  std::string mask = kBitMasks[bit_in_var_index];
+  std::string result = "((" + var_name + " & " + mask
       + ") != (other." + var_name + " & " + mask + "))";
   return result;
 }
 
-void SetBitOperationVariables(const string name,
-    int bitIndex, std::map<string, string>* variables) {
+void SetBitOperationVariables(const std::string name,
+    int bitIndex, std::map<std::string, std::string>* variables) {
   (*variables)["get_" + name] = GenerateGetBit(bitIndex);
   (*variables)["set_" + name] = GenerateSetBit(bitIndex);
   (*variables)["clear_" + name] = GenerateClearBit(bitIndex);
diff --git a/src/google/protobuf/compiler/javanano/javanano_helpers.h b/src/google/protobuf/compiler/javanano/javanano_helpers.h
index 04b2d63..4958529 100644
--- a/src/google/protobuf/compiler/javanano/javanano_helpers.h
+++ b/src/google/protobuf/compiler/javanano/javanano_helpers.h
@@ -53,28 +53,28 @@
 
 // Converts the field's name to camel-case, e.g. "foo_bar_baz" becomes
 // "fooBarBaz" or "FooBarBaz", respectively.
-string UnderscoresToCamelCase(const FieldDescriptor* field);
-string UnderscoresToCamelCase(const OneofDescriptor* oneof);
-string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field);
-string UnderscoresToCapitalizedCamelCase(const OneofDescriptor* oneof);
+std::string UnderscoresToCamelCase(const FieldDescriptor* field);
+std::string UnderscoresToCamelCase(const OneofDescriptor* oneof);
+std::string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field);
+std::string UnderscoresToCapitalizedCamelCase(const OneofDescriptor* oneof);
 
 // Appends an "_" to the end of a field where the name is a reserved java
 // keyword.  For example int32 public = 1 will generate int public_.
-string RenameJavaKeywords(const string& input);
+std::string RenameJavaKeywords(const std::string& input);
 
 // Similar, but for method names.  (Typically, this merely has the effect
 // of lower-casing the first letter of the name.)
-string UnderscoresToCamelCase(const MethodDescriptor* method);
+std::string UnderscoresToCamelCase(const MethodDescriptor* method);
 
 // Strips ".proto" or ".protodevel" from the end of a filename.
-string StripProto(const string& filename);
+std::string StripProto(const std::string& filename);
 
 // Gets the unqualified class name for the file.  Each .proto file becomes a
 // single Java class, with all its contents nested in that class.
-string FileClassName(const Params& params, const FileDescriptor* file);
+std::string FileClassName(const Params& params, const FileDescriptor* file);
 
 // Returns the file's Java package name.
-string FileJavaPackage(const Params& params, const FileDescriptor* file);
+std::string FileJavaPackage(const Params& params, const FileDescriptor* file);
 
 // Returns whether the Java outer class is needed, i.e. whether the option
 // java_multiple_files is false, or the proto file contains any file-scope
@@ -87,32 +87,32 @@
 // outer class name should be included in the return value depends on factors
 // inferrable from the given arguments, including is_class which indicates
 // whether the entity translates to a Java class.
-string ToJavaName(const Params& params, const string& name, bool is_class,
+std::string ToJavaName(const Params& params, const std::string& name, bool is_class,
     const Descriptor* parent, const FileDescriptor* file);
 
 // These return the fully-qualified class name corresponding to the given
 // descriptor.
-inline string ClassName(const Params& params, const Descriptor* descriptor) {
+inline std::string ClassName(const Params& params, const Descriptor* descriptor) {
   return ToJavaName(params, descriptor->name(), true,
                     descriptor->containing_type(), descriptor->file());
 }
-string ClassName(const Params& params, const EnumDescriptor* descriptor);
-inline string ClassName(const Params& params,
+std::string ClassName(const Params& params, const EnumDescriptor* descriptor);
+inline std::string ClassName(const Params& params,
     const ServiceDescriptor* descriptor) {
   return ToJavaName(params, descriptor->name(), true, NULL, descriptor->file());
 }
-inline string ExtensionIdentifierName(const Params& params,
+inline std::string ExtensionIdentifierName(const Params& params,
     const FieldDescriptor* descriptor) {
   return ToJavaName(params, descriptor->name(), false,
                     descriptor->extension_scope(), descriptor->file());
 }
-string ClassName(const Params& params, const FileDescriptor* descriptor);
+std::string ClassName(const Params& params, const FileDescriptor* descriptor);
 
 // Get the unqualified name that should be used for a field's field
 // number constant.
-string FieldConstantName(const FieldDescriptor *field);
+std::string FieldConstantName(const FieldDescriptor *field);
 
-string FieldDefaultConstantName(const FieldDescriptor *field);
+std::string FieldDefaultConstantName(const FieldDescriptor *field);
 
 // Print the field's proto-syntax definition as a comment.
 void PrintFieldComment(io::Printer* printer, const FieldDescriptor* field);
@@ -135,53 +135,53 @@
   return GetJavaType(field->type());
 }
 
-string PrimitiveTypeName(JavaType type);
+std::string PrimitiveTypeName(JavaType type);
 
 // Get the fully-qualified class name for a boxed primitive type, e.g.
 // "java.lang.Integer" for JAVATYPE_INT.  Returns NULL for enum and message
 // types.
-string BoxedPrimitiveTypeName(JavaType type);
+std::string BoxedPrimitiveTypeName(JavaType type);
 
-string EmptyArrayName(const Params& params, const FieldDescriptor* field);
+std::string EmptyArrayName(const Params& params, const FieldDescriptor* field);
 
-string DefaultValue(const Params& params, const FieldDescriptor* field);
+std::string DefaultValue(const Params& params, const FieldDescriptor* field);
 
 
 // Methods for shared bitfields.
 
 // Gets the name of the shared bitfield for the given field index.
-string GetBitFieldName(int index);
+std::string GetBitFieldName(int index);
 
 // Gets the name of the shared bitfield for the given bit index.
 // Effectively, GetBitFieldName(bit_index / 32)
-string GetBitFieldNameForBit(int bit_index);
+std::string GetBitFieldNameForBit(int bit_index);
 
 // Generates the java code for the expression that returns whether the bit at
 // the given bit index is set.
 // Example: "((bitField1_ & 0x04000000) != 0)"
-string GenerateGetBit(int bit_index);
+std::string GenerateGetBit(int bit_index);
 
 // Generates the java code for the expression that sets the bit at the given
 // bit index.
 // Example: "bitField1_ |= 0x04000000"
-string GenerateSetBit(int bit_index);
+std::string GenerateSetBit(int bit_index);
 
 // Generates the java code for the expression that clears the bit at the given
 // bit index.
 // Example: "bitField1_ = (bitField1_ & ~0x04000000)"
-string GenerateClearBit(int bit_index);
+std::string GenerateClearBit(int bit_index);
 
 // Generates the java code for the expression that returns whether the bit at
 // the given bit index contains different values in the current object and
 // another object accessible via the variable 'other'.
 // Example: "((bitField1_ & 0x04000000) != (other.bitField1_ & 0x04000000))"
-string GenerateDifferentBit(int bit_index);
+std::string GenerateDifferentBit(int bit_index);
 
 // Sets the 'get_*', 'set_*', 'clear_*' and 'different_*' variables, where * is
 // the given name of the bit, to the appropriate Java expressions for the given
 // bit index.
-void SetBitOperationVariables(const string name,
-    int bitIndex, std::map<string, string>* variables);
+void SetBitOperationVariables(const std::string name,
+    int bitIndex, std::map<std::string, std::string>* variables);
 
 inline bool IsMapEntry(const Descriptor* descriptor) {
   // TODO(liujisi): Add an option to turn on maps for proto2 syntax as well.
diff --git a/src/google/protobuf/compiler/javanano/javanano_map_field.cc b/src/google/protobuf/compiler/javanano/javanano_map_field.cc
index a4ab885..8c54f10 100644
--- a/src/google/protobuf/compiler/javanano/javanano_map_field.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_map_field.cc
@@ -42,7 +42,7 @@
 
 namespace {
 
-string TypeName(const Params& params, const FieldDescriptor* field,
+std::string TypeName(const Params& params, const FieldDescriptor* field,
                 bool boxed) {
   JavaType java_type = GetJavaType(field);
   switch (java_type) {
@@ -84,7 +84,7 @@
 }
 
 void SetMapVariables(const Params& params,
-    const FieldDescriptor* descriptor, std::map<string, string>* variables) {
+    const FieldDescriptor* descriptor, std::map<std::string, std::string>* variables) {
   const FieldDescriptor* key = KeyField(descriptor);
   const FieldDescriptor* value = ValueField(descriptor);
   (*variables)["name"] =
diff --git a/src/google/protobuf/compiler/javanano/javanano_map_field.h b/src/google/protobuf/compiler/javanano/javanano_map_field.h
index 81e5915..9036127 100644
--- a/src/google/protobuf/compiler/javanano/javanano_map_field.h
+++ b/src/google/protobuf/compiler/javanano/javanano_map_field.h
@@ -58,7 +58,7 @@
 
  private:
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator);
 };
diff --git a/src/google/protobuf/compiler/javanano/javanano_message.cc b/src/google/protobuf/compiler/javanano/javanano_message.cc
index e849521..943c4da 100644
--- a/src/google/protobuf/compiler/javanano/javanano_message.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_message.cc
@@ -114,7 +114,7 @@
         "'store_unknown_fields' generator option is 'true'\n";
   }
 
-  const string& file_name = descriptor_->file()->name();
+  const std::string& file_name = descriptor_->file()->name();
   bool is_own_file =
     params_.java_multiple_files(file_name)
       && descriptor_->containing_type() == NULL;
@@ -182,7 +182,7 @@
   }
 
   // oneof
-  std::map<string, string> vars;
+  std::map<std::string, std::string> vars;
   vars["message_name"] = descriptor_->name();
   for (int i = 0; i < descriptor_->oneof_decl_count(); i++) {
     const OneofDescriptor* oneof_desc = descriptor_->oneof_decl(i);
diff --git a/src/google/protobuf/compiler/javanano/javanano_message_field.cc b/src/google/protobuf/compiler/javanano/javanano_message_field.cc
index 2ed8a3a..6002652 100644
--- a/src/google/protobuf/compiler/javanano/javanano_message_field.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_message_field.cc
@@ -54,7 +54,7 @@
 // TODO(kenton):  Factor out a "SetCommonFieldVariables()" to get rid of
 //   repeat code between this and the other field types.
 void SetMessageVariables(const Params& params,
-    const FieldDescriptor* descriptor, std::map<string, string>* variables) {
+    const FieldDescriptor* descriptor, std::map<std::string, std::string>* variables) {
   (*variables)["name"] =
     RenameJavaKeywords(UnderscoresToCamelCase(descriptor));
   (*variables)["capitalized_name"] =
diff --git a/src/google/protobuf/compiler/javanano/javanano_message_field.h b/src/google/protobuf/compiler/javanano/javanano_message_field.h
index 0ae8879..12c40c2 100644
--- a/src/google/protobuf/compiler/javanano/javanano_message_field.h
+++ b/src/google/protobuf/compiler/javanano/javanano_message_field.h
@@ -62,7 +62,7 @@
 
  private:
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
 };
@@ -85,7 +85,7 @@
 
  private:
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageOneofFieldGenerator);
 };
@@ -108,7 +108,7 @@
 
  private:
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator);
 };
diff --git a/src/google/protobuf/compiler/javanano/javanano_params.h b/src/google/protobuf/compiler/javanano/javanano_params.h
index 3594767..35a7a98 100644
--- a/src/google/protobuf/compiler/javanano/javanano_params.h
+++ b/src/google/protobuf/compiler/javanano/javanano_params.h
@@ -47,11 +47,11 @@
 // Parameters for used by the generators
 class Params {
  public:
-  typedef std::map<string, string> NameMap;
-  typedef std::set<string> NameSet;
+  typedef std::map<std::string, std::string> NameMap;
+  typedef std::set<std::string> NameSet;
  private:
-  string empty_;
-  string base_name_;
+  std::string empty_;
+  std::string base_name_;
   eMultipleFiles override_java_multiple_files_;
   bool store_unknown_fields_;
   NameMap java_packages_;
@@ -70,7 +70,7 @@
   bool generate_intdefs_;
 
  public:
-  Params(const string & base_name) :
+  Params(const std::string & base_name) :
     empty_(""),
     base_name_(base_name),
     override_java_multiple_files_(JAVANANO_MUL_UNSET),
@@ -88,19 +88,19 @@
     generate_intdefs_(false) {
   }
 
-  const string& base_name() const {
+  const std::string& base_name() const {
     return base_name_;
   }
 
-  bool has_java_package(const string& file_name) const {
+  bool has_java_package(const std::string& file_name) const {
     return java_packages_.find(file_name)
                         != java_packages_.end();
   }
-  void set_java_package(const string& file_name,
-      const string& java_package) {
+  void set_java_package(const std::string& file_name,
+      const std::string& java_package) {
     java_packages_[file_name] = java_package;
   }
-  const string& java_package(const string& file_name) const {
+  const std::string& java_package(const std::string& file_name) const {
     NameMap::const_iterator itr;
 
     itr = java_packages_.find(file_name);
@@ -114,15 +114,15 @@
     return java_packages_;
   }
 
-  bool has_java_outer_classname(const string& file_name) const {
+  bool has_java_outer_classname(const std::string& file_name) const {
     return java_outer_classnames_.find(file_name)
                         != java_outer_classnames_.end();
   }
-  void set_java_outer_classname(const string& file_name,
-      const string& java_outer_classname) {
+  void set_java_outer_classname(const std::string& file_name,
+      const std::string& java_outer_classname) {
     java_outer_classnames_[file_name] = java_outer_classname;
   }
-  const string& java_outer_classname(const string& file_name) const {
+  const std::string& java_outer_classname(const std::string& file_name) const {
     NameMap::const_iterator itr;
 
     itr = java_outer_classnames_.find(file_name);
@@ -147,14 +147,14 @@
     override_java_multiple_files_ = JAVANANO_MUL_UNSET;
   }
 
-  void set_java_multiple_files(const string& file_name, bool value) {
+  void set_java_multiple_files(const std::string& file_name, bool value) {
     if (value) {
       java_multiple_files_.insert(file_name);
     } else {
       java_multiple_files_.erase(file_name);
     }
   }
-  bool java_multiple_files(const string& file_name) const {
+  bool java_multiple_files(const std::string& file_name) const {
     switch (override_java_multiple_files_) {
       case JAVANANO_MUL_FALSE:
         return false;
diff --git a/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc b/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc
index 66a0ff0..5fb793f 100644
--- a/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc
@@ -155,7 +155,7 @@
   return -1;
 }
 
-bool AllAscii(const string& text) {
+bool AllAscii(const std::string& text) {
   for (int i = 0; i < text.size(); i++) {
     if ((text[i] & 0x80) != 0) {
       return false;
@@ -166,7 +166,7 @@
 
 
 void SetPrimitiveVariables(const FieldDescriptor* descriptor, const Params params,
-                           std::map<string, string>* variables) {
+                           std::map<std::string, std::string>* variables) {
   (*variables)["name"] =
     RenameJavaKeywords(UnderscoresToCamelCase(descriptor));
   (*variables)["capitalized_name"] =
diff --git a/src/google/protobuf/compiler/javanano/javanano_primitive_field.h b/src/google/protobuf/compiler/javanano/javanano_primitive_field.h
index d7d72d5..003f0ec 100644
--- a/src/google/protobuf/compiler/javanano/javanano_primitive_field.h
+++ b/src/google/protobuf/compiler/javanano/javanano_primitive_field.h
@@ -65,7 +65,7 @@
   void GenerateSerializationConditional(io::Printer* printer) const;
 
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator);
 };
@@ -89,7 +89,7 @@
 
  private:
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(AccessorPrimitiveFieldGenerator);
 };
@@ -111,7 +111,7 @@
 
  private:
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveOneofFieldGenerator);
 };
@@ -137,7 +137,7 @@
   void GenerateRepeatedDataSizeCode(io::Printer* printer) const;
 
   const FieldDescriptor* descriptor_;
-  std::map<string, string> variables_;
+  std::map<std::string, std::string> variables_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator);
 };