Skip to content
Permalink
Browse files

Down integrate to GitHub

  • Loading branch information...
Hao Nguyen
Hao Nguyen committed Jun 11, 2019
1 parent 6153f80 commit 09cab821a96c52b7b3482bd993177a33098012a8
Showing with 1,794 additions and 2,012 deletions.
  1. +2 −2 java/core/src/main/java/com/google/protobuf/AbstractMessage.java
  2. +13 −3 java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java
  3. +1 −1 java/core/src/main/java/com/google/protobuf/Message.java
  4. +288 −120 java/core/src/main/java/com/google/protobuf/TextFormat.java
  5. +2 −2 java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java
  6. +1 −1 java/core/src/test/java/com/google/protobuf/MapForProto2Test.java
  7. +1 −1 java/core/src/test/java/com/google/protobuf/MapTest.java
  8. +61 −40 java/core/src/test/java/com/google/protobuf/TextFormatTest.java
  9. +1 −1 java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java
  10. +11 −11 js/message.js
  11. +1 −0 protobuf.pc.in
  12. +76 −8 python/google/protobuf/internal/descriptor_pool_test.py
  13. +17 −0 python/google/protobuf/internal/json_format_test.py
  14. +9 −7 python/google/protobuf/json_format.py
  15. +81 −49 python/google/protobuf/pyext/descriptor_pool.cc
  16. +4 −0 python/google/protobuf/pyext/descriptor_pool.h
  17. +1 −0 python/setup.py
  18. +0 −9 src/google/protobuf/any.pb.cc
  19. +8 −3 src/google/protobuf/any.pb.h
  20. +0 −37 src/google/protobuf/api.pb.cc
  21. +34 −19 src/google/protobuf/api.pb.h
  22. +1 −1 src/google/protobuf/arena.h
  23. +4 −0 src/google/protobuf/compiler/command_line_interface_unittest.cc
  24. +3 −3 src/google/protobuf/compiler/cpp/cpp_helpers.cc
  25. +39 −52 src/google/protobuf/compiler/cpp/cpp_message.cc
  26. +13 −5 src/google/protobuf/compiler/js/js_generator.cc
  27. +1 −1 src/google/protobuf/compiler/js/js_generator.h
  28. +0 −41 src/google/protobuf/compiler/plugin.pb.cc
  29. +37 −17 src/google/protobuf/compiler/plugin.pb.h
  30. +4 −1 src/google/protobuf/compiler/subprocess.cc
  31. +0 −718 src/google/protobuf/descriptor.pb.cc
  32. +529 −178 src/google/protobuf/descriptor.pb.h
  33. +0 −24 src/google/protobuf/duration.pb.cc
  34. +17 −4 src/google/protobuf/duration.pb.h
  35. +0 −22 src/google/protobuf/empty.pb.cc
  36. +13 −2 src/google/protobuf/empty.pb.h
  37. +1 −2 src/google/protobuf/extension_set_inl.h
  38. +0 −23 src/google/protobuf/field_mask.pb.cc
  39. +16 −3 src/google/protobuf/field_mask.pb.h
  40. +9 −0 src/google/protobuf/generated_message_util.cc
  41. +1 −0 src/google/protobuf/generated_message_util.h
  42. +8 −1 src/google/protobuf/message.cc
  43. +1 −1 src/google/protobuf/message.h
  44. +8 −6 src/google/protobuf/parse_context.cc
  45. +3 −3 src/google/protobuf/parse_context.h
  46. +43 −41 src/google/protobuf/repeated_field.h
  47. +0 −8 src/google/protobuf/source_context.pb.cc
  48. +7 −2 src/google/protobuf/source_context.pb.h
  49. +0 −74 src/google/protobuf/struct.pb.cc
  50. +53 −14 src/google/protobuf/struct.pb.h
  51. +1 −2 src/google/protobuf/stubs/mathutil.h
  52. +0 −24 src/google/protobuf/timestamp.pb.cc
  53. +17 −4 src/google/protobuf/timestamp.pb.h
  54. +0 −136 src/google/protobuf/type.pb.cc
  55. +101 −36 src/google/protobuf/type.pb.h
  56. +8 −6 src/google/protobuf/unknown_field_set.cc
  57. +4 −3 src/google/protobuf/unknown_field_set.h
  58. +14 −0 src/google/protobuf/util/field_comparator_test.cc
  59. +11 −0 src/google/protobuf/util/json_format.proto
  60. +9 −3 src/google/protobuf/util/message_differencer.cc
  61. +59 −0 src/google/protobuf/util/message_differencer_unittest.cc
  62. +3 −3 src/google/protobuf/wire_format_lite.h
  63. +0 −207 src/google/protobuf/wrappers.pb.cc
  64. +144 −27 src/google/protobuf/wrappers.pb.h
@@ -108,7 +108,7 @@ public FieldDescriptor getOneofFieldDescriptor(OneofDescriptor oneof) {

@Override
public final String toString() {
return TextFormat.printToString(this);
return TextFormat.printer().printToString(this);
}

@Override
@@ -468,7 +468,7 @@ public BuilderType mergeUnknownFields(final UnknownFieldSet unknownFields) {

@Override
public String toString() {
return TextFormat.printToString(this);
return TextFormat.printer().printToString(this);
}

/** Construct an UninitializedMessageException reporting missing fields in the given message. */
@@ -76,6 +76,10 @@
// applications. Need to support this feature on smaller granularity.
private static volatile boolean eagerlyParseMessageSets = false;

// short circuit the ExtensionRegistryFactory via assumevalues trickery
@SuppressWarnings("JavaOptionalSuggestions")
private static boolean doFullRuntimeInheritanceCheck = true;

// Visible for testing.
static final String EXTENSION_CLASS_NAME = "com.google.protobuf.Extension";

@@ -107,7 +111,9 @@ public static void setEagerlyParseMessageSets(boolean isEagerlyParse) {
* available.
*/
public static ExtensionRegistryLite newInstance() {
return ExtensionRegistryFactory.create();
return doFullRuntimeInheritanceCheck
? ExtensionRegistryFactory.create()
: new ExtensionRegistryLite();
}

private static volatile ExtensionRegistryLite emptyRegistry;
@@ -122,7 +128,11 @@ public static ExtensionRegistryLite getEmptyRegistry() {
synchronized (ExtensionRegistryLite.class) {
result = emptyRegistry;
if (result == null) {
result = emptyRegistry = ExtensionRegistryFactory.createEmpty();
result =
emptyRegistry =
doFullRuntimeInheritanceCheck
? ExtensionRegistryFactory.createEmpty()
: EMPTY_REGISTRY_LITE;
}
}
}
@@ -163,7 +173,7 @@ public final void add(ExtensionLite<?, ?> extension) {
if (GeneratedMessageLite.GeneratedExtension.class.isAssignableFrom(extension.getClass())) {
add((GeneratedMessageLite.GeneratedExtension<?, ?>) extension);
}
if (ExtensionRegistryFactory.isFullRegistry(this)) {
if (doFullRuntimeInheritanceCheck && ExtensionRegistryFactory.isFullRegistry(this)) {
try {
this.getClass().getMethod("add", extensionClass).invoke(this, extension);
} catch (Exception e) {
@@ -85,7 +85,7 @@

/**
* Converts the message to a string in protocol buffer text format. This is just a trivial wrapper
* around {@link TextFormat#printToString(MessageOrBuilder)}.
* around {@link TextFormat.Printer#printToString(MessageOrBuilder)}.
*/
@Override
String toString();

0 comments on commit 09cab82

Please sign in to comment.
You can’t perform that action at this time.