Breaking change: Remove deprecated std::string error collector overrides

PiperOrigin-RevId: 590740727
diff --git a/src/google/protobuf/compiler/importer.h b/src/google/protobuf/compiler/importer.h
index 539021b..6bb127a 100644
--- a/src/google/protobuf/compiler/importer.h
+++ b/src/google/protobuf/compiler/importer.h
@@ -181,30 +181,12 @@
   // Line and column numbers are zero-based.  A line number of -1 indicates
   // an error with the entire file (e.g. "not found").
   virtual void RecordError(absl::string_view filename, int line, int column,
-                           absl::string_view message) {
-    PROTOBUF_IGNORE_DEPRECATION_START
-    AddError(std::string(filename), line, column, std::string(message));
-    PROTOBUF_IGNORE_DEPRECATION_STOP
-  }
+                           absl::string_view message)
+      = 0;
   virtual void RecordWarning(absl::string_view filename, int line, int column,
                              absl::string_view message) {
-    PROTOBUF_IGNORE_DEPRECATION_START
-    AddWarning(std::string(filename), line, column, std::string(message));
-    PROTOBUF_IGNORE_DEPRECATION_STOP
   }
 
- private:
-  // These should never be called directly, but if a legacy class overrides
-  // them they'll get routed to by the Record* methods.
-  ABSL_DEPRECATED("Use RecordError")
-  virtual void AddError(const std::string& filename, int line, int column,
-                        const std::string& message) {
-    ABSL_LOG(FATAL) << "AddError or RecordError must be implemented.";
-  }
-
-  ABSL_DEPRECATED("Use RecordWarning")
-  virtual void AddWarning(const std::string& filename, int line, int column,
-                          const std::string& message) {}
 };
 
 // Abstract interface which represents a directory tree containing proto files.
diff --git a/src/google/protobuf/descriptor.h b/src/google/protobuf/descriptor.h
index dfb71df..9b24cb1 100644
--- a/src/google/protobuf/descriptor.h
+++ b/src/google/protobuf/descriptor.h
@@ -2156,12 +2156,8 @@
     virtual void RecordError(absl::string_view filename,
                              absl::string_view element_name,
                              const Message* descriptor, ErrorLocation location,
-                             absl::string_view message) {
-      PROTOBUF_IGNORE_DEPRECATION_START
-      AddError(std::string(filename), std::string(element_name), descriptor,
-               location, std::string(message));
-      PROTOBUF_IGNORE_DEPRECATION_STOP
-    }
+                             absl::string_view message)
+        = 0;
 
     // Reports a warning in the FileDescriptorProto. Use this function if the
     // problem occurred should NOT interrupt building the FileDescriptorProto.
@@ -2176,27 +2172,8 @@
                                const Message* descriptor,
                                ErrorLocation location,
                                absl::string_view message) {
-      PROTOBUF_IGNORE_DEPRECATION_START
-      AddWarning(std::string(filename), std::string(element_name), descriptor,
-                 location, std::string(message));
-      PROTOBUF_IGNORE_DEPRECATION_STOP
     }
 
-   private:
-    // These should never be called directly, but if a legacy class overrides
-    // them they'll get routed to by the Record* methods.
-    ABSL_DEPRECATED("Use RecordError")
-    virtual void AddError(const std::string& filename,
-                          const std::string& element_name,
-                          const Message* descriptor, ErrorLocation location,
-                          const std::string& message) {
-      ABSL_LOG(FATAL) << "AddError or RecordError must be implemented.";
-    }
-    ABSL_DEPRECATED("Use RecordWarning")
-    virtual void AddWarning(const std::string& filename,
-                            const std::string& element_name,
-                            const Message* descriptor, ErrorLocation location,
-                            const std::string& message) {}
   };
 
   // Convert the FileDescriptorProto to real descriptors and place them in
diff --git a/src/google/protobuf/io/tokenizer.h b/src/google/protobuf/io/tokenizer.h
index 0855a17..007d090 100644
--- a/src/google/protobuf/io/tokenizer.h
+++ b/src/google/protobuf/io/tokenizer.h
@@ -55,33 +55,16 @@
   // column numbers.  The numbers are zero-based, so you may want to add
   // 1 to each before printing them.
   virtual void RecordError(int line, ColumnNumber column,
-                           absl::string_view message) {
-    PROTOBUF_IGNORE_DEPRECATION_START
-    AddError(line, column, std::string(message));
-    PROTOBUF_IGNORE_DEPRECATION_STOP
-  }
+                           absl::string_view message)
+      = 0;
 
   // Indicates that there was a warning in the input at the given line and
   // column numbers.  The numbers are zero-based, so you may want to add
   // 1 to each before printing them.
   virtual void RecordWarning(int line, ColumnNumber column,
                              absl::string_view message) {
-    PROTOBUF_IGNORE_DEPRECATION_START
-    AddWarning(line, column, std::string(message));
-    PROTOBUF_IGNORE_DEPRECATION_STOP
   }
 
- private:
-  // These should never be called directly, but if a legacy class overrides
-  // them they'll get routed to by the Record* methods.
-  ABSL_DEPRECATED("Use RecordError")
-  virtual void AddError(int line, ColumnNumber column,
-                        const std::string& message) {
-    ABSL_LOG(FATAL) << "AddError or RecordError must be implemented.";
-  }
-  ABSL_DEPRECATED("Use RecordWarning")
-  virtual void AddWarning(int line, ColumnNumber column,
-                          const std::string& message) {}
 };
 
 // This class converts a stream of raw text into a stream of tokens for
diff --git a/src/google/protobuf/retention_test.cc b/src/google/protobuf/retention_test.cc
index 32b502d..8b77769 100644
--- a/src/google/protobuf/retention_test.cc
+++ b/src/google/protobuf/retention_test.cc
@@ -13,6 +13,7 @@
 
 #include "google/protobuf/descriptor.pb.h"
 #include <gtest/gtest.h>
+#include "absl/strings/string_view.h"
 #include "absl/strings/substitute.h"
 #include "google/protobuf/compiler/parser.h"
 #include "google/protobuf/dynamic_message.h"
@@ -160,6 +161,12 @@
           .GetExtension(protobuf_unittest::method_option));
 }
 
+class SimpleErrorCollector : public io::ErrorCollector {
+ public:
+  SimpleErrorCollector() = default;
+  void RecordError(int line, io::ColumnNumber column,
+                   absl::string_view message) override{};
+};
 
 TEST(RetentionTest, StripSourceRetentionOptionsWithSourceCodeInfo) {
   // The tests above make assertions against the generated code, but this test
@@ -202,7 +209,7 @@
                        FileDescriptorSet::descriptor()->file()->name());
   io::ArrayInputStream input_stream(proto_file.data(),
                                     static_cast<int>(proto_file.size()));
-  io::ErrorCollector error_collector;
+  SimpleErrorCollector error_collector;
   io::Tokenizer tokenizer(&input_stream, &error_collector);
   compiler::Parser parser;
   FileDescriptorProto file_descriptor;
@@ -242,7 +249,7 @@
                        FileDescriptorSet::descriptor()->file()->name());
   io::ArrayInputStream input_stream(proto_file.data(),
                                     static_cast<int>(proto_file.size()));
-  io::ErrorCollector error_collector;
+  SimpleErrorCollector error_collector;
   io::Tokenizer tokenizer(&input_stream, &error_collector);
   compiler::Parser parser;
   FileDescriptorProto file_descriptor;
@@ -282,7 +289,7 @@
                        FileDescriptorSet::descriptor()->file()->name());
   io::ArrayInputStream input_stream(proto_file.data(),
                                     static_cast<int>(proto_file.size()));
-  io::ErrorCollector error_collector;
+  SimpleErrorCollector error_collector;
   io::Tokenizer tokenizer(&input_stream, &error_collector);
   compiler::Parser parser;
   FileDescriptorProto file_descriptor_proto;
@@ -331,7 +338,7 @@
                        FileDescriptorSet::descriptor()->file()->name());
   io::ArrayInputStream input_stream(proto_file.data(),
                                     static_cast<int>(proto_file.size()));
-  io::ErrorCollector error_collector;
+  SimpleErrorCollector error_collector;
   io::Tokenizer tokenizer(&input_stream, &error_collector);
   compiler::Parser parser;
   FileDescriptorProto file_descriptor_proto;
@@ -387,7 +394,7 @@
                        FileDescriptorSet::descriptor()->file()->name());
   io::ArrayInputStream input_stream(proto_file.data(),
                                     static_cast<int>(proto_file.size()));
-  io::ErrorCollector error_collector;
+  SimpleErrorCollector error_collector;
   io::Tokenizer tokenizer(&input_stream, &error_collector);
   compiler::Parser parser;
   FileDescriptorProto file_descriptor_proto;
diff --git a/upb/util/def_to_proto_test.h b/upb/util/def_to_proto_test.h
index fdd102a..f8e017c 100644
--- a/upb/util/def_to_proto_test.h
+++ b/upb/util/def_to_proto_test.h
@@ -46,9 +46,9 @@
 }
 
 class NullErrorCollector : public google::protobuf::DescriptorPool::ErrorCollector {
-  void AddError(const std::string& filename, const std::string& element_name,
-                const google::protobuf::Message* descriptor, ErrorLocation location,
-                const std::string& message) override {}
+  void RecordError(absl::string_view filename, absl::string_view element_name,
+                   const google::protobuf::Message* descriptor, ErrorLocation location,
+                   absl::string_view message) override {}
   void RecordWarning(absl::string_view filename, absl::string_view element_name,
                      const google::protobuf::Message* descriptor, ErrorLocation location,
                      absl::string_view message) override {}