Internal change

PiperOrigin-RevId: 566426899
pull/14107/head
Sandy Zhang 2 years ago committed by Copybara-Service
parent f54f8b2a20
commit 81068e8e8c
  1. 2
      .github/workflows/test_cpp.yml
  2. 4
      .github/workflows/test_python.yml
  3. 8
      .github/workflows/test_ruby.yml
  4. 2
      .github/workflows/test_runner.yml
  5. 2
      BUILD.bazel
  6. 6
      conformance/binary_json_conformance_suite.cc
  7. 2
      conformance/conformance_python.py
  8. 4
      conformance/conformance_test_runner.cc
  9. 2
      conformance/failure_list_cpp.txt
  10. 2
      conformance/failure_list_python_cpp.txt
  11. 4
      csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs
  12. 4
      csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
  13. 2
      csharp/src/Google.Protobuf/CodedInputStream.cs
  14. 4
      csharp/src/Google.Protobuf/CodedOutputStream.cs
  15. 2
      csharp/src/Google.Protobuf/ParsingPrimitives.cs
  16. 2
      csharp/src/Google.Protobuf/WritingPrimitives.cs
  17. 12
      java/core/src/main/java/com/google/protobuf/AbstractMessage.java
  18. 2
      java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java
  19. 2
      java/core/src/main/java/com/google/protobuf/ArrayDecoders.java
  20. 4
      java/core/src/main/java/com/google/protobuf/BinaryReader.java
  21. 18
      java/core/src/main/java/com/google/protobuf/BinaryWriter.java
  22. 8
      java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java
  23. 4
      java/core/src/main/java/com/google/protobuf/ByteString.java
  24. 2
      java/core/src/main/java/com/google/protobuf/CanIgnoreReturnValue.java
  25. 24
      java/core/src/main/java/com/google/protobuf/CodedInputStream.java
  26. 14
      java/core/src/main/java/com/google/protobuf/CodedOutputStream.java
  27. 4
      java/core/src/main/java/com/google/protobuf/DynamicMessage.java
  28. 4
      java/core/src/main/java/com/google/protobuf/Extension.java
  29. 2
      java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java
  30. 6
      java/core/src/main/java/com/google/protobuf/ExtensionSchemaLite.java
  31. 2
      java/core/src/main/java/com/google/protobuf/FieldInfo.java
  32. 8
      java/core/src/main/java/com/google/protobuf/GeneratedMessage.java
  33. 18
      java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java
  34. 150
      java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
  35. 2
      java/core/src/main/java/com/google/protobuf/Java8Compatibility.java
  36. 4
      java/core/src/main/java/com/google/protobuf/LazyFieldLite.java
  37. 2
      java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java
  38. 4
      java/core/src/main/java/com/google/protobuf/MessageLiteToString.java
  39. 6
      java/core/src/main/java/com/google/protobuf/MessageReflection.java
  40. 30
      java/core/src/main/java/com/google/protobuf/MessageSchema.java
  41. 8
      java/core/src/main/java/com/google/protobuf/MessageSetSchema.java
  42. 2
      java/core/src/main/java/com/google/protobuf/NewInstanceSchemaLite.java
  43. 2
      java/core/src/main/java/com/google/protobuf/NioByteString.java
  44. 2
      java/core/src/main/java/com/google/protobuf/OneofInfo.java
  45. 2
      java/core/src/main/java/com/google/protobuf/Protobuf.java
  46. 8
      java/core/src/main/java/com/google/protobuf/Reader.java
  47. 8
      java/core/src/main/java/com/google/protobuf/SchemaUtil.java
  48. 4
      java/core/src/main/java/com/google/protobuf/TextFormat.java
  49. 2
      java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java
  50. 4
      java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java
  51. 16
      java/core/src/main/java/com/google/protobuf/Utf8.java
  52. 6
      java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java
  53. 2
      java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java
  54. 2
      java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java
  55. 2
      java/core/src/test/java/com/google/protobuf/TestUtil.java
  56. 4
      java/core/src/test/java/com/google/protobuf/TextFormatTest.java
  57. 2
      java/core/src/test/proto/com/google/protobuf/deprecated_file.proto
  58. 6
      java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto
  59. 2
      java/kotlin/src/main/kotlin/com/google/protobuf/DslList.kt
  60. 2
      java/kotlin/src/main/kotlin/com/google/protobuf/DslMap.kt
  61. 2
      java/lite/src/test/java/com/google/protobuf/LiteTest.java
  62. 8
      java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java
  63. 6
      java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
  64. 2
      java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java
  65. 2
      objectivec/GPBCodedInputStream.m
  66. 2
      objectivec/GPBCodedOutputStream.m
  67. 2
      objectivec/Tests/GPBDictionaryTests.pddm
  68. 2
      objectivec/Tests/GPBMessageTests+Merge.m
  69. 2
      objectivec/Tests/GPBMessageTests+Runtime.m
  70. 2
      objectivec/Tests/GPBMessageTests+Serialization.m
  71. 2
      objectivec/Tests/GPBMessageTests.m
  72. 2
      objectivec/Tests/unittest.proto
  73. 2
      php/ext/google/protobuf/def.c
  74. 6
      php/ext/google/protobuf/message.c
  75. 8
      php/src/Google/Protobuf/Internal/EnumOptions.php
  76. 8
      php/src/Google/Protobuf/Internal/Message.php
  77. 8
      php/src/Google/Protobuf/Internal/MessageOptions.php
  78. 2
      php/tests/EncodeDecodeTest.php
  79. 2
      php/tests/MapFieldTest.php
  80. 2
      php/tests/memory_leak_test.php
  81. 18
      python/google/protobuf/descriptor.py
  82. 4
      python/google/protobuf/descriptor_database.py
  83. 2
      python/google/protobuf/descriptor_pool.py
  84. 4
      python/google/protobuf/internal/api_implementation.py
  85. 2
      python/google/protobuf/internal/builder.py
  86. 6
      python/google/protobuf/internal/containers.py
  87. 18
      python/google/protobuf/internal/descriptor_pool_test.py
  88. 8
      python/google/protobuf/internal/descriptor_test.py
  89. 4
      python/google/protobuf/internal/extension_dict.py
  90. 6
      python/google/protobuf/internal/generator_test.py
  91. 12
      python/google/protobuf/internal/message_test.py
  92. 2
      python/google/protobuf/internal/more_messages.proto
  93. 30
      python/google/protobuf/internal/python_message.py
  94. 16
      python/google/protobuf/internal/reflection_test.py
  95. 2
      python/google/protobuf/internal/text_format_test.py
  96. 20
      python/google/protobuf/message.py
  97. 4
      python/google/protobuf/message_factory.py
  98. 2
      python/google/protobuf/pyext/cpp_message.py
  99. 4
      python/google/protobuf/pyext/descriptor.cc
  100. 4
      python/google/protobuf/pyext/descriptor_pool.cc
  101. Some files were not shown because too many files have changed in this diff Show More

@ -122,7 +122,7 @@ jobs:
flags: -Dprotobuf_BUILD_SHARED_LIBS=ON -Dprotobuf_BUILD_EXAMPLES=ON -DCMAKE_CXX_STANDARD=14
- name: C++17
flags: -DCMAKE_CXX_STANDARD=17
# TODO(b/300096720) Re-enable this.
# TODO Re-enable this.
#- name: C++20
# flags: -DCMAKE_CXX_STANDARD=20

@ -28,7 +28,7 @@ jobs:
- type: C++
version: aarch64
targets: //python/... //python:aarch64_test
# TODO(b/262628111) Enable this once conformance tests are fixed.
# TODO Enable this once conformance tests are fixed.
flags: --define=use_fast_cpp_protos=true --test_tag_filters=-conformance
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-63dd26c0c7a808d92673a3e52e848189d4ab0f17
@ -53,7 +53,7 @@ jobs:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
type: [ Pure, C++]
# TODO(b/267550843) Consider expanding this set of versions.
# TODO Consider expanding this set of versions.
version: [ "3.10" ]
include:
- type: Pure

@ -20,12 +20,12 @@ jobs:
# Test both FFI and Native implementations on the highest and lowest
# Ruby versions for CRuby and JRuby, but only on Bazel 5.x.
- { name: Ruby 2.7, ruby: ruby-2.7.0, ffi: NATIVE }
# TODO(b/294608485) Re-enable these once flakes are fixed
# TODO Re-enable these once flakes are fixed
#- { name: Ruby 2.7, ruby: ruby-2.7.0, ffi: FFI }
- { name: Ruby 3.0, ruby: ruby-3.0.2 }
- { name: Ruby 3.1, ruby: ruby-3.1.0 }
- { name: Ruby 3.2, ruby: ruby-3.2.0, ffi: NATIVE }
# TODO(b/294608485) Re-enable these once flakes are fixed
# TODO Re-enable these once flakes are fixed
#- { name: Ruby 3.2, ruby: ruby-3.2.0, ffi: FFI }
- { name: JRuby 9.4, ruby: jruby-9.4.3.0, ffi: NATIVE }
- { name: JRuby 9.4, ruby: jruby-9.4.3.0, ffi: FFI }
@ -117,12 +117,12 @@ jobs:
# Ruby versions for CRuby, but only on Bazel 5.x.
# Quote versions numbers otherwise 3.0 will render as 3
- { version: "2.7", ffi: NATIVE }
# TODO(b/294608485) Re-enable these once flakes are fixed
# TODO Re-enable these once flakes are fixed
#- { version: "2.7", ffi: FFI }
- { version: "3.0" }
- { version: "3.1" }
- { version: "3.2", ffi: NATIVE }
# TODO(b/294608485) Re-enable these once flakes are fixed
# TODO Re-enable these once flakes are fixed
#- { version: "3.2", ffi: FFI }
name: MacOS Ruby ${{ matrix.version }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }}

@ -12,7 +12,7 @@ name: Tests
on:
# continuous
schedule:
# TODO(mkruskal) Run daily at 10 AM UTC (2 AM PDT)
# TODO Run daily at 10 AM UTC (2 AM PDT)
# Run every hour for now to gather statistics
- cron: 0 * * * *

@ -242,7 +242,7 @@ cc_library(
# This provides just the header files for use in projects that need to build
# shared libraries for dynamic loading. This target is available until Bazel
# adds native support for such use cases.
# TODO(keveman): Remove this target once the support gets added to Bazel.
# TODO: Remove this target once the support gets added to Bazel.
alias(
name = "protobuf_headers",
actual = "//src/google/protobuf:protobuf_headers",

@ -440,7 +440,7 @@ void BinaryAndJsonConformanceSuite::ExpectParseFailureForProto(
// by valid protobuf data. We can try running this twice: once with this
// data verbatim and once with this data followed by some valid data.
//
// TODO(haberman): implement the second of these.
// TODO: implement the second of these.
void BinaryAndJsonConformanceSuite::ExpectHardParseFailureForProto(
const string& proto, const string& test_name, ConformanceLevel level) {
return ExpectParseFailureForProto(proto, test_name, level);
@ -1626,14 +1626,14 @@ void BinaryAndJsonConformanceSuite::RunSuiteImpl() {
// Additional test to check merging oneof message.
TestMergeOneofMessage();
// TODO(haberman):
// TODO:
// TestValidDataForType(FieldDescriptor::TYPE_GROUP
// Unknown fields.
{
TestAllTypesProto3 messageProto3;
TestAllTypesProto2 messageProto2;
// TODO(yilunchong): update this behavior when unknown field's behavior
// TODO: update this behavior when unknown field's behavior
// changed in open source. Also delete
// Required.Proto3.ProtobufInput.UnknownVarint.ProtobufOutput
// from failure list of python_cpp python java

@ -34,7 +34,7 @@ def do_test(request):
if request.message_type == "conformance.FailureSet":
failure_set = conformance_pb2.FailureSet()
failures = []
# TODO(gerbens): Remove, this is a hack to detect if the old vs new
# TODO: Remove, this is a hack to detect if the old vs new
# parser is used by the cpp code. Relying on a bug in the old parser.
hack_proto = test_messages_proto2_pb2.TestAllTypesProto2()
old_parser = True

@ -235,7 +235,7 @@ int ForkPipeRunner::Run(int argc, char *argv[],
return all_ok ? EXIT_SUCCESS : EXIT_FAILURE;
}
// TODO(haberman): make this work on Windows, instead of using these
// TODO: make this work on Windows, instead of using these
// UNIX-specific APIs.
//
// There is a platform-agnostic API in
@ -325,7 +325,7 @@ bool ForkPipeRunner::TryRead(int fd, void *buf, size_t len) {
if (status == std::future_status::timeout) {
ABSL_LOG(ERROR) << current_test_name_ << ": timeout from test program";
kill(child_pid_, SIGQUIT);
// TODO(sandyzhang): Only log in flag-guarded mode, since reading output
// TODO: Only log in flag-guarded mode, since reading output
// from SIGQUIT is slow and verbose.
std::vector<char> err;
err.resize(5000);

@ -4,7 +4,7 @@
# By listing them here we can keep tabs on which ones are failing and be sure
# that we don't introduce regressions in other tests.
#
# TODO(haberman): insert links to corresponding bugs tracking the issue.
# TODO: insert links to corresponding bugs tracking the issue.
# Should we use GitHub issues or the Google-internal bug tracker?
Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput

@ -4,7 +4,7 @@
# By listing them here we can keep tabs on which ones are failing and be sure
# that we don't introduce regressions in other tests.
#
# TODO(haberman): insert links to corresponding bugs tracking the issue.
# TODO: insert links to corresponding bugs tracking the issue.
# Should we use GitHub issues or the Google-internal bug tracker?
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInOptionalField.ProtobufOutput

@ -629,7 +629,7 @@ namespace Google.Protobuf
stream.Position = 0;
var parsed = TestAllTypes.Parser.ParseFrom(stream);
// TODO(jieluo): Add test back after DiscardUnknownFields is supported
// TODO: Add test back after DiscardUnknownFields is supported
// Assert.AreEqual(message, parsed);
}
@ -639,7 +639,7 @@ namespace Google.Protobuf
// Simple way of ensuring we can skip all kinds of fields.
var data = SampleMessages.CreateFullTestAllTypes().ToByteArray();
var empty = Empty.Parser.ParseFrom(data);
// TODO(jieluo): Add test back after DiscardUnknownField is supported.
// TODO: Add test back after DiscardUnknownField is supported.
// Assert.AreEqual(new Empty(), empty);
}

@ -686,7 +686,7 @@ namespace Google.Protobuf
stream.ToArray(),
parsed =>
{
// TODO(jieluo): Add test back when DiscardUnknownFields API is supported.
// TODO: Add test back when DiscardUnknownFields API is supported.
// Assert.AreEqual(message, parsed);
});
}
@ -703,7 +703,7 @@ namespace Google.Protobuf
data,
parsed =>
{
// TODO(jieluo): Add test back when DiscardUnknownFields API is supported.
// TODO: Add test back when DiscardUnknownFields API is supported.
// Assert.AreNotEqual(new Empty(), empty);
});
}

@ -403,7 +403,7 @@ namespace Google.Protobuf
/// </summary>
public void ReadMessage(IMessage builder)
{
// TODO(jtattermusch): if the message doesn't implement IBufferMessage (and thus does not provide the InternalMergeFrom method),
// TODO: if the message doesn't implement IBufferMessage (and thus does not provide the InternalMergeFrom method),
// what we're doing here works fine, but could be more efficient.
// What happens is that we first initialize a ParseContext from the current coded input stream only to parse the length of the message, at which point
// we will need to switch back again to CodedInputStream-based parsing (which involves copying and storing the state) to be able to

@ -237,7 +237,7 @@ namespace Google.Protobuf
/// <param name="value">The value to write</param>
public void WriteMessage(IMessage value)
{
// TODO(jtattermusch): if the message doesn't implement IBufferMessage (and thus does not provide the InternalWriteTo method),
// TODO: if the message doesn't implement IBufferMessage (and thus does not provide the InternalWriteTo method),
// what we're doing here works fine, but could be more efficient.
// For now, this inefficiency is fine, considering this is only a backward-compatibility scenario (and regenerating the code fixes it).
var span = new Span<byte>(buffer);
@ -259,7 +259,7 @@ namespace Google.Protobuf
/// <param name="value">The value to write</param>
public void WriteRawMessage(IMessage value)
{
// TODO(jtattermusch): if the message doesn't implement IBufferMessage (and thus does not provide the InternalWriteTo method),
// TODO: if the message doesn't implement IBufferMessage (and thus does not provide the InternalWriteTo method),
// what we're doing here works fine, but could be more efficient.
// For now, this inefficiency is fine, considering this is only a backward-compatibility scenario (and regenerating the code fixes it).
var span = new Span<byte>(buffer);

@ -47,7 +47,7 @@ namespace Google.Protobuf
{
// The "nextTag" logic is there only as an optimization for reading non-packed repeated / map
// fields and is strictly speaking not necessary.
// TODO(jtattermusch): look into simplifying the ParseTag logic.
// TODO: look into simplifying the ParseTag logic.
if (state.hasNextTag)
{
state.lastTag = state.nextTag;

@ -74,7 +74,7 @@ namespace Google.Protobuf
{
const int length = sizeof(float);
// TODO(jtattermusch): deduplicate the code. Populating the span is the same as for the fastpath.
// TODO: deduplicate the code. Populating the span is the same as for the fastpath.
Span<byte> floatSpan = stackalloc byte[length];
Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(floatSpan), value);
if (!BitConverter.IsLittleEndian)

@ -27,7 +27,7 @@ import java.util.Map;
* @author kenton@google.com Kenton Varda
*/
public abstract class AbstractMessage
// TODO(dweis): Update GeneratedMessage to parameterize with MessageType and BuilderType.
// TODO: Update GeneratedMessage to parameterize with MessageType and BuilderType.
extends AbstractMessageLite implements Message {
@Override
@ -70,13 +70,13 @@ public abstract class AbstractMessage
return MessageReflection.delimitWithCommas(findInitializationErrors());
}
// TODO(jieluo): Clear it when all subclasses have implemented this method.
// TODO: Clear it when all subclasses have implemented this method.
@Override
public boolean hasOneof(OneofDescriptor oneof) {
throw new UnsupportedOperationException("hasOneof() is not implemented.");
}
// TODO(jieluo): Clear it when all subclasses have implemented this method.
// TODO: Clear it when all subclasses have implemented this method.
@Override
public FieldDescriptor getOneofFieldDescriptor(OneofDescriptor oneof) {
throw new UnsupportedOperationException("getOneofFieldDescriptor() is not implemented.");
@ -301,19 +301,19 @@ public abstract class AbstractMessage
throw new UnsupportedOperationException("clone() should be implemented in subclasses.");
}
/** TODO(jieluo): Clear it when all subclasses have implemented this method. */
/** TODO: Clear it when all subclasses have implemented this method. */
@Override
public boolean hasOneof(OneofDescriptor oneof) {
throw new UnsupportedOperationException("hasOneof() is not implemented.");
}
/** TODO(jieluo): Clear it when all subclasses have implemented this method. */
/** TODO: Clear it when all subclasses have implemented this method. */
@Override
public FieldDescriptor getOneofFieldDescriptor(OneofDescriptor oneof) {
throw new UnsupportedOperationException("getOneofFieldDescriptor() is not implemented.");
}
/** TODO(jieluo): Clear it when all subclasses have implemented this method. */
/** TODO: Clear it when all subclasses have implemented this method. */
@Override
public BuilderType clearOneof(OneofDescriptor oneof) {
throw new UnsupportedOperationException("clearOneof() is not implemented.");

@ -386,7 +386,7 @@ public abstract class AbstractMessageLite<
if (values instanceof LazyStringList) {
// For StringOrByteStringLists, check the underlying elements to avoid
// forcing conversions of ByteStrings to Strings.
// TODO(dweis): Could we just prohibit nulls in all protobuf lists and get rid of this? Is
// TODO: Could we just prohibit nulls in all protobuf lists and get rid of this? Is
// if even possible to hit this condition as all protobuf methods check for null first,
// right?
List<?> lazyValues = ((LazyStringList) values).getUnderlyingElements();

@ -760,7 +760,7 @@ final class ArrayDecoders {
return decodeUnknownField(
tag, data, position, limit, getMutableUnknownFields(message), registers);
} else {
// TODO(b/230609037): remove the unused variable
// TODO: remove the unused variable
FieldSet<ExtensionDescriptor> unused =
((GeneratedMessageLite.ExtendableMessage<?, ?>) message).ensureExtensionsAreMutable();
return decodeExtension(

@ -44,10 +44,10 @@ abstract class BinaryReader implements Reader {
*/
public static BinaryReader newInstance(ByteBuffer buffer, boolean bufferIsImmutable) {
if (buffer.hasArray()) {
// TODO(nathanmittler): Add support for unsafe operations.
// TODO: Add support for unsafe operations.
return new SafeHeapReader(buffer, bufferIsImmutable);
}
// TODO(nathanmittler): Add support for direct buffers
// TODO: Add support for direct buffers
throw new IllegalArgumentException("Direct buffers not yet supported");
}

@ -659,7 +659,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
@Override
public <K, V> void writeMap(int fieldNumber, MapEntryLite.Metadata<K, V> metadata, Map<K, V> map)
throws IOException {
// TODO(liujisi): Reverse write those entries.
// TODO: Reverse write those entries.
for (Map.Entry<K, V> entry : map.entrySet()) {
int prevBytes = getTotalBytesWritten();
writeMapEntryField(this, MAP_VALUE_NUMBER, metadata.valueType, entry.getValue());
@ -1379,7 +1379,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
buffers.addFirst(AllocatedBuffer.wrap(value, offset, length));
// Advance the writer to the next buffer.
// TODO(nathanmittler): Consider slicing if space available above some threshold.
// TODO: Consider slicing if space available above some threshold.
nextBuffer();
return;
}
@ -1409,7 +1409,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
buffers.addFirst(AllocatedBuffer.wrap(value));
// Advance the writer to the next buffer.
// TODO(nathanmittler): Consider slicing if space available above some threshold.
// TODO: Consider slicing if space available above some threshold.
nextBuffer();
}
@ -1920,7 +1920,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
buffers.addFirst(AllocatedBuffer.wrap(value, offset, length));
// Advance the writer to the next buffer.
// TODO(nathanmittler): Consider slicing if space available above some threshold.
// TODO: Consider slicing if space available above some threshold.
nextBuffer();
return;
}
@ -1948,7 +1948,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
buffers.addFirst(AllocatedBuffer.wrap(value));
// Advance the writer to the next buffer.
// TODO(nathanmittler): Consider slicing if space available above some threshold.
// TODO: Consider slicing if space available above some threshold.
nextBuffer();
}
@ -2465,7 +2465,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
buffers.addFirst(AllocatedBuffer.wrap(value, offset, length));
// Advance the writer to the next buffer.
// TODO(nathanmittler): Consider slicing if space available above some threshold.
// TODO: Consider slicing if space available above some threshold.
nextBuffer();
return;
}
@ -2497,7 +2497,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
buffers.addFirst(AllocatedBuffer.wrap(value));
// Advance the writer to the next buffer.
// TODO(nathanmittler): Consider slicing if space available above some threshold.
// TODO: Consider slicing if space available above some threshold.
nextBuffer();
return;
}
@ -3006,7 +3006,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
buffers.addFirst(AllocatedBuffer.wrap(value, offset, length));
// Advance the writer to the next buffer.
// TODO(nathanmittler): Consider slicing if space available above some threshold.
// TODO: Consider slicing if space available above some threshold.
nextBuffer();
return;
}
@ -3038,7 +3038,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
buffers.addFirst(AllocatedBuffer.wrap(value));
// Advance the writer to the next buffer.
// TODO(nathanmittler): Consider slicing if space available above some threshold.
// TODO: Consider slicing if space available above some threshold.
nextBuffer();
return;
}

@ -25,18 +25,18 @@ final class ByteBufferWriter {
* Minimum size for a cached buffer. This prevents us from allocating buffers that are too small
* to be easily reused.
*/
// TODO(nathanmittler): tune this property or allow configuration?
// TODO: tune this property or allow configuration?
private static final int MIN_CACHED_BUFFER_SIZE = 1024;
/**
* Maximum size for a cached buffer. If a larger buffer is required, it will be allocated but not
* cached.
*/
// TODO(nathanmittler): tune this property or allow configuration?
// TODO: tune this property or allow configuration?
private static final int MAX_CACHED_BUFFER_SIZE = 16 * 1024;
/** The fraction of the requested buffer size under which the buffer will be reallocated. */
// TODO(nathanmittler): tune this property or allow configuration?
// TODO: tune this property or allow configuration?
private static final float BUFFER_REALLOCATION_THRESHOLD = 0.5f;
/**
@ -74,7 +74,7 @@ final class ByteBufferWriter {
output.write(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining());
} else if (!writeToChannel(buffer, output)) {
// Read all of the data from the buffer to an array.
// TODO(nathanmittler): Consider performance improvements for other "known" stream types.
// TODO: Consider performance improvements for other "known" stream types.
final byte[] array = getOrCreateBuffer(buffer.remaining());
while (buffer.hasRemaining()) {
int length = min(buffer.remaining(), array.length);

@ -427,7 +427,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
* to force a classload of ByteString before LiteralByteString.
*/
static ByteString wrap(byte[] bytes) {
// TODO(dweis): Return EMPTY when bytes are empty to reduce allocations?
// TODO: Return EMPTY when bytes are empty to reduce allocations?
return new LiteralByteString(bytes);
}
@ -1410,7 +1410,7 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
byte[] target, int sourceOffset, int targetOffset, int numberToCopy) {
// Optimized form, not for subclasses, since we don't call
// getOffsetIntoBytes() or check the 'numberToCopy' parameter.
// TODO(nathanmittler): Is not calling getOffsetIntoBytes really saving that much?
// TODO: Is not calling getOffsetIntoBytes really saving that much?
System.arraycopy(bytes, sourceOffset, target, targetOffset, numberToCopy);
}

@ -21,6 +21,6 @@ import java.lang.annotation.Target;
* annotated with {@code @CheckReturnValue} to exempt specific methods from the default.
*/
@Documented
@Target(METHOD) // TODO(kak): consider adding CONSTRUCTOR later if necessary
@Target(METHOD) // TODO: consider adding CONSTRUCTOR later if necessary
@Retention(CLASS)
@interface CanIgnoreReturnValue {}

@ -102,7 +102,7 @@ public abstract class CodedInputStream {
if (flag == 2) {
return new IterableDirectByteBufferDecoder(bufs, totalSize, bufferIsImmutable);
} else {
// TODO(yilunchong): add another decoders to deal case 1 and 3.
// TODO: add another decoders to deal case 1 and 3.
return newInstance(new IterableByteBufferInputStream(bufs));
}
}
@ -166,7 +166,7 @@ public abstract class CodedInputStream {
// The buffer is non-direct and does not expose the underlying array. Using the ByteBuffer API
// to access individual bytes is very slow, so just copy the buffer to an array.
// TODO(nathanmittler): Re-evaluate with Java 9
// TODO: Re-evaluate with Java 9
byte[] buffer = new byte[buf.remaining()];
buf.duplicate().get(buffer);
return newInstance(buffer, 0, buffer.length, true);
@ -907,7 +907,7 @@ public abstract class CodedInputStream {
? ByteBuffer.wrap(buffer, pos, size).slice()
: ByteBuffer.wrap(Arrays.copyOfRange(buffer, pos, pos + size));
pos += size;
// TODO(nathanmittler): Investigate making the ByteBuffer be made read-only
// TODO: Investigate making the ByteBuffer be made read-only
return result;
}
@ -1477,8 +1477,8 @@ public abstract class CodedInputStream {
public String readString() throws IOException {
final int size = readRawVarint32();
if (size > 0 && size <= remaining()) {
// TODO(nathanmittler): Is there a way to avoid this copy?
// TODO(anuraaga): It might be possible to share the optimized loop with
// TODO: Is there a way to avoid this copy?
// TODO: It might be possible to share the optimized loop with
// readStringRequireUtf8 by implementing Java replacement logic there.
// The same as readBytes' logic
byte[] bytes = new byte[size];
@ -1633,7 +1633,7 @@ public abstract class CodedInputStream {
pos += size;
return ByteBuffer.wrap(bytes);
}
// TODO(nathanmittler): Investigate making the ByteBuffer be made read-only
// TODO: Investigate making the ByteBuffer be made read-only
}
if (size == 0) {
@ -2408,7 +2408,7 @@ public abstract class CodedInputStream {
return result;
} else {
// Slow path: Build a byte array first then copy it.
// TODO(dweis): Do we want to protect from malicious input streams here?
// TODO: Do we want to protect from malicious input streams here?
return readRawBytesSlowPath(size, /* ensureNoLeakedReferences= */ false);
}
}
@ -2661,7 +2661,7 @@ public abstract class CodedInputStream {
@Override
public void enableAliasing(boolean enabled) {
// TODO(nathanmittler): Ideally we should throw here. Do nothing for backward compatibility.
// TODO: Ideally we should throw here. Do nothing for backward compatibility.
}
@Override
@ -2833,7 +2833,7 @@ public abstract class CodedInputStream {
pos = tempPos + size;
return Arrays.copyOfRange(buffer, tempPos, tempPos + size);
} else {
// TODO(dweis): Do we want to protect from malicious input streams here?
// TODO: Do we want to protect from malicious input streams here?
return readRawBytesSlowPath(size, /* ensureNoLeakedReferences= */ false);
}
}
@ -2915,7 +2915,7 @@ public abstract class CodedInputStream {
final int bufferedBytes = bufferSize - pos;
// Determine the number of bytes we need to read from the input stream.
int sizeLeft = size - bufferedBytes;
// TODO(nathanmittler): Consider using a value larger than DEFAULT_BUFFER_SIZE.
// TODO: Consider using a value larger than DEFAULT_BUFFER_SIZE.
if (sizeLeft < DEFAULT_BUFFER_SIZE || sizeLeft <= available(input)) {
// Either the bytes we need are known to be available, or the required buffer is
// within an allowed threshold - go ahead and allocate the buffer now.
@ -2960,7 +2960,7 @@ public abstract class CodedInputStream {
final List<byte[]> chunks = new ArrayList<>();
while (sizeLeft > 0) {
// TODO(nathanmittler): Consider using a value larger than DEFAULT_BUFFER_SIZE.
// TODO: Consider using a value larger than DEFAULT_BUFFER_SIZE.
final byte[] chunk = new byte[Math.min(sizeLeft, DEFAULT_BUFFER_SIZE)];
int tempPos = 0;
while (tempPos < chunk.length) {
@ -3366,7 +3366,7 @@ public abstract class CodedInputStream {
currentByteBufferPos += size;
return result;
} else if (size > 0 && size <= remaining()) {
// TODO(yilunchong): To use an underlying bytes[] instead of allocating a new bytes[]
// TODO: To use an underlying bytes[] instead of allocating a new bytes[]
byte[] bytes = new byte[size];
readRawBytesTo(bytes, 0, size);
String result = new String(bytes, UTF_8);

@ -433,7 +433,7 @@ public abstract class CodedOutputStream extends ByteOutput {
}
/** Write a {@code string} field to the stream. */
// TODO(dweis): Document behavior on ill-formed UTF-16 input.
// TODO: Document behavior on ill-formed UTF-16 input.
// Abstract to avoid overhead of additional virtual method calls.
public abstract void writeStringNoTag(String value) throws IOException;
@ -818,7 +818,7 @@ public abstract class CodedOutputStream extends ByteOutput {
try {
length = Utf8.encodedLength(value);
} catch (UnpairedSurrogateException e) {
// TODO(dweis): Consider using nio Charset methods instead.
// TODO: Consider using nio Charset methods instead.
final byte[] bytes = value.getBytes(Internal.UTF_8);
length = bytes.length;
}
@ -966,7 +966,7 @@ public abstract class CodedOutputStream extends ByteOutput {
// Unfortunately there does not appear to be any way to tell Java to encode
// UTF-8 directly into our buffer, so we have to let it create its own byte
// array and then copy.
// TODO(dweis): Consider using nio Charset methods instead.
// TODO: Consider using nio Charset methods instead.
final byte[] bytes = value.getBytes(Internal.UTF_8);
try {
writeUInt32NoTag(bytes.length);
@ -1456,7 +1456,7 @@ public abstract class CodedOutputStream extends ByteOutput {
// Roll back the change - we fall back to inefficient path.
position = oldPosition;
// TODO(nathanmittler): We should throw an IOException here instead.
// TODO: We should throw an IOException here instead.
inefficientWriteStringNoTag(value, e);
} catch (IndexOutOfBoundsException e) {
throw new OutOfSpaceException(e);
@ -1792,7 +1792,7 @@ public abstract class CodedOutputStream extends ByteOutput {
// Roll back the change and convert to an IOException.
Java8Compatibility.position(buffer, startPos);
// TODO(nathanmittler): We should throw an IOException here instead.
// TODO: We should throw an IOException here instead.
inefficientWriteStringNoTag(value, e);
} catch (IllegalArgumentException e) {
// Thrown by buffer.position() if out of range.
@ -2151,7 +2151,7 @@ public abstract class CodedOutputStream extends ByteOutput {
position = prevPos;
repositionBuffer(position);
// TODO(nathanmittler): We should throw an IOException here instead.
// TODO: We should throw an IOException here instead.
inefficientWriteStringNoTag(value, e);
} catch (IllegalArgumentException e) {
// Thrown by buffer.position() if out of range.
@ -2600,7 +2600,7 @@ public abstract class CodedOutputStream extends ByteOutput {
totalBytesWritten -= position - oldPosition;
position = oldPosition;
// TODO(nathanmittler): We should throw an IOException here instead.
// TODO: We should throw an IOException here instead.
inefficientWriteStringNoTag(value, e);
} catch (IndexOutOfBoundsException e) {
throw new OutOfSpaceException(e);

@ -498,7 +498,7 @@ public final class DynamicMessage extends AbstractMessage {
@Override
public Builder setField(FieldDescriptor field, Object value) {
verifyContainingType(field);
// TODO(xiaofeng): This check should really be put in FieldSet.setField()
// TODO: This check should really be put in FieldSet.setField()
// where all other such checks are done. However, currently
// FieldSet.setField() permits Integer value for enum fields probably
// because of some internal features we support. Should figure it out
@ -614,7 +614,7 @@ public final class DynamicMessage extends AbstractMessage {
throw new IllegalArgumentException(
"DynamicMessage should use EnumValueDescriptor to set Enum Value.");
}
// TODO(xiaofeng): Re-enable this check after Orgstore is fixed to not
// TODO: Re-enable this check after Orgstore is fixed to not
// set incorrect EnumValueDescriptors.
// EnumDescriptor fieldType = field.getEnumType();
// EnumDescriptor fieldValueType = ((EnumValueDescriptor) value).getType();

@ -7,7 +7,7 @@
package com.google.protobuf;
// TODO(chrisn): Change ContainingType to extend Message
// TODO: Change ContainingType to extend Message
/**
* Interface that generated extensions implement.
*
@ -15,7 +15,7 @@ package com.google.protobuf;
*/
public abstract class Extension<ContainingType extends MessageLite, Type>
extends ExtensionLite<ContainingType, Type> {
// TODO(chrisn): Add package-private constructor.
// TODO: Add package-private constructor.
/** {@inheritDoc} Overridden to return {@link Message} instead of {@link MessageLite}. */
@Override

@ -48,7 +48,7 @@ public class ExtensionRegistryLite {
// Set true to enable lazy parsing feature for MessageSet.
//
// TODO(xiangl): Now we use a global flag to control whether enable lazy
// TODO: Now we use a global flag to control whether enable lazy
// parsing feature for MessageSet, which may be too crude for some
// applications. Need to support this feature on smaller granularity.
private static volatile boolean eagerlyParseMessageSets = false;

@ -234,7 +234,7 @@ final class ExtensionSchemaLite extends ExtensionSchema<ExtensionDescriptor> {
case GROUP:
// Special case handling for non-repeated sub-messages: merge in-place rather than
// building up new sub-messages and merging those, which is too slow.
// TODO(b/249368670): clean this up
// TODO: clean this up
if (!extension.isRepeated()) {
Object oldValue = extensions.getField(extension.descriptor);
if (oldValue instanceof GeneratedMessageLite) {
@ -257,7 +257,7 @@ final class ExtensionSchemaLite extends ExtensionSchema<ExtensionDescriptor> {
case MESSAGE:
// Special case handling for non-repeated sub-messages: merge in-place rather than
// building up new sub-messages and merging those, which is too slow.
// TODO(b/249368670): clean this up
// TODO: clean this up
if (!extension.isRepeated()) {
Object oldValue = extensions.getField(extension.descriptor);
if (oldValue instanceof GeneratedMessageLite) {
@ -287,7 +287,7 @@ final class ExtensionSchemaLite extends ExtensionSchema<ExtensionDescriptor> {
switch (extension.getLiteType()) {
case MESSAGE:
case GROUP:
// TODO(b/249368670): this shouldn't be reachable, clean this up
// TODO: this shouldn't be reachable, clean this up
Object oldValue = extensions.getField(extension.descriptor);
if (oldValue != null) {
value = Internal.mergeMessage(oldValue, value);

@ -33,7 +33,7 @@ final class FieldInfo implements Comparable<FieldInfo> {
*/
private final Class<?> oneofStoredType;
// TODO(liujisi): make map default entry lazy?
// TODO: make map default entry lazy?
private final Object mapDefaultEntry;
private final EnumVerifier enumVerifier;

@ -316,13 +316,13 @@ public abstract class GeneratedMessage extends AbstractMessage implements Serial
}
/**
* TODO(xiaofeng): remove this after b/29368482 is fixed. We need to move this interface to
* TODO: remove this after b/29368482 is fixed. We need to move this interface to
* AbstractMessage in order to versioning GeneratedMessage but this move breaks binary
* compatibility for AppEngine. After AppEngine is fixed we can exclude this from google3.
*/
protected interface BuilderParent extends AbstractMessage.BuilderParent {}
/** TODO(xiaofeng): remove this together with GeneratedMessage.BuilderParent. */
/** TODO: remove this together with GeneratedMessage.BuilderParent. */
protected abstract Message.Builder newBuilderForType(BuilderParent parent);
@Override
@ -939,7 +939,7 @@ public abstract class GeneratedMessage extends AbstractMessage implements Serial
output.writeMessageSetExtension(descriptor.getNumber(), (Message) next.getValue());
}
} else {
// TODO(xiangl): Taken care of following code, it may cause
// TODO: Taken care of following code, it may cause
// problem when we use LazyField for normal fields/extensions.
// Due to the optional field can be duplicated at the end of
// serialized bytes, which will make the serialized size change
@ -1655,7 +1655,7 @@ public abstract class GeneratedMessage extends AbstractMessage implements Serial
*/
public static class GeneratedExtension<ContainingType extends Message, Type>
extends Extension<ContainingType, Type> {
// TODO(kenton): Find ways to avoid using Java reflection within this
// TODO: Find ways to avoid using Java reflection within this
// class. Also try to avoid suppressing unchecked warnings.
// We can't always initialize the descriptor of a GeneratedExtension when

@ -551,7 +551,7 @@ public abstract class GeneratedMessageLite<
throws IOException {
copyOnWrite();
try {
// TODO(yilunchong): Try to make input with type CodedInputStream.ArrayDecoder use
// TODO: Try to make input with type CodedInputStream.ArrayDecoder use
// fast path.
Protobuf.getInstance().schemaFor(instance).mergeFrom(
instance, CodedInputStreamReader.forCodedInput(input), extensionRegistry);
@ -620,7 +620,7 @@ public abstract class GeneratedMessageLite<
throws IOException {
int fieldNumber = WireFormat.getTagFieldNumber(tag);
// TODO(dweis): How much bytecode would be saved by not requiring the generated code to
// TODO: How much bytecode would be saved by not requiring the generated code to
// provide the default instance?
GeneratedExtension<MessageType, ?> extension =
extensionRegistry.findLiteExtensionByNumber(defaultInstance, fieldNumber);
@ -658,7 +658,7 @@ public abstract class GeneratedMessageLite<
return parseUnknownField(tag, input);
}
// TODO(b/230609037): remove the unused variable
// TODO: remove the unused variable
FieldSet<ExtensionDescriptor> unused = ensureExtensionsAreMutable();
if (packed) {
@ -754,13 +754,13 @@ public abstract class GeneratedMessageLite<
return true;
}
// TODO(dweis): Do we really want to support non message set wire format in message sets?
// TODO: Do we really want to support non message set wire format in message sets?
// Full runtime does... So we do for now.
int wireType = WireFormat.getTagWireType(tag);
if (wireType == WireFormat.WIRETYPE_LENGTH_DELIMITED) {
return parseUnknownField(defaultInstance, input, extensionRegistry, tag);
} else {
// TODO(dweis): Should we throw on invalid input? Full runtime does not...
// TODO: Should we throw on invalid input? Full runtime does not...
return input.skipField(tag);
}
}
@ -852,7 +852,7 @@ public abstract class GeneratedMessageLite<
throws IOException {
int fieldNumber = typeId;
int tag = WireFormat.makeTag(typeId, WireFormat.WIRETYPE_LENGTH_DELIMITED);
// TODO(b/230609037): remove the unused variable
// TODO: remove the unused variable
boolean unused = parseExtension(input, extensionRegistry, extension, tag, fieldNumber);
}
@ -1512,7 +1512,7 @@ public abstract class GeneratedMessageLite<
}
boolean isInitialized = Protobuf.getInstance().schemaFor(message).isInitialized(message);
if (shouldMemoize) {
// TODO(b/230609037): remove the unused variable
// TODO: remove the unused variable
Object unused =
message.dynamicMethod(
MethodToInvoke.SET_MEMOIZED_IS_INITIALIZED, isInitialized ? message : null);
@ -1613,14 +1613,14 @@ public abstract class GeneratedMessageLite<
* A static helper method for parsing a partial from input using the extension registry and the
* instance.
*/
// TODO(dweis): Should this verify that the last tag was 0?
// TODO: Should this verify that the last tag was 0?
static <T extends GeneratedMessageLite<T, ?>> T parsePartialFrom(
T instance, CodedInputStream input, ExtensionRegistryLite extensionRegistry)
throws InvalidProtocolBufferException {
@SuppressWarnings("unchecked") // Guaranteed by protoc
T result = instance.newMutableInstance();
try {
// TODO(yilunchong): Try to make input with type CodedInpuStream.ArrayDecoder use
// TODO: Try to make input with type CodedInpuStream.ArrayDecoder use
// fast path.
Schema<T> schema = Protobuf.getInstance().schemaFor(result);
schema.mergeFrom(result, CodedInputStreamReader.forCodedInput(input), extensionRegistry);

@ -66,7 +66,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
/**
* For use by generated code only.
*
* <p>TODO(b/258340024): mark this private and final (breaking change)
* <p>TODO: mark this private and final (breaking change)
*/
protected UnknownFieldSet unknownFields;
@ -78,14 +78,14 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
unknownFields = builder.getUnknownFields();
}
/** TODO(b/258340024): Remove this unnecessary intermediate implementation of this method. */
/** TODO: Remove this unnecessary intermediate implementation of this method. */
@Override
public Parser<? extends GeneratedMessageV3> getParserForType() {
throw new UnsupportedOperationException("This is supposed to be overridden by subclasses.");
}
/**
* TODO(b/249158148): Stop using SingleFieldBuilder and remove this setting
* TODO: Stop using SingleFieldBuilder and remove this setting
*
* @see #setAlwaysUseFieldBuildersForTesting(boolean)
*/
@ -99,7 +99,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
* tests can be reused to test the field builders. See {@link RepeatedFieldBuilder} and {@link
* SingleFieldBuilder}.
*
* <p>TODO(b/249158148): Stop using SingleFieldBuilder and remove this setting
* <p>TODO: Stop using SingleFieldBuilder and remove this setting
*/
static void setAlwaysUseFieldBuildersForTesting(boolean useBuilders) {
alwaysUseFieldBuilders = useBuilders;
@ -117,7 +117,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* TODO(b/248143958): This method should be removed. It enables parsing directly into an
* TODO: This method should be removed. It enables parsing directly into an
* "immutable" message. Have to leave it for now to support old gencode.
*
* @deprecated use newBuilder().mergeFrom() instead
@ -189,7 +189,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
return result;
}
// TODO(b/258342840): compute this at {@code build()} time in the Builder class.
// TODO: compute this at {@code build()} time in the Builder class.
@Override
public boolean isInitialized() {
for (final FieldDescriptor field : getDescriptorForType().getFields()) {
@ -278,13 +278,13 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
return internalGetFieldAccessorTable().getField(field).getRepeated(this, index);
}
// TODO(b/258340024): This method should be final.
// TODO: This method should be final.
@Override
public UnknownFieldSet getUnknownFields() {
return unknownFields;
}
// TODO(b/258348681): This should go away when Schema classes cannot modify immutable
// TODO: This should go away when Schema classes cannot modify immutable
// GeneratedMessageV3 objects anymore.
void setUnknownFields(UnknownFieldSet unknownFields) {
this.unknownFields = unknownFields;
@ -293,7 +293,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
/**
* Called by subclasses to parse an unknown field.
*
* <p>TODO(b/248153893) remove this method
* <p>TODO remove this method
*
* @return {@code true} unless the tag is an end-group tag.
*/
@ -313,7 +313,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
* Delegates to parseUnknownField. This method is obsolete, but we must retain it for
* compatibility with older generated code.
*
* <p>TODO(b/248153893) remove this method
* <p>TODO remove this method
*/
protected boolean parseUnknownFieldProto3(
CodedInputStream input,
@ -396,32 +396,32 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
return IntArrayList.emptyList();
}
// TODO(b/258340024): Unused. Remove.
// TODO: Unused. Remove.
protected static IntList newIntList() {
return new IntArrayList();
}
// TODO(b/258340024): Redundant with makeMutableCopy(). Remove.
// TODO: Redundant with makeMutableCopy(). Remove.
protected static IntList mutableCopy(IntList list) {
return makeMutableCopy(list);
}
// TODO(b/258340024): Redundant with makeMutableCopy(). Remove.
// TODO: Redundant with makeMutableCopy(). Remove.
protected static LongList mutableCopy(LongList list) {
return makeMutableCopy(list);
}
// TODO(b/258340024): Redundant with makeMutableCopy(). Remove.
// TODO: Redundant with makeMutableCopy(). Remove.
protected static FloatList mutableCopy(FloatList list) {
return makeMutableCopy(list);
}
// TODO(b/258340024): Redundant with makeMutableCopy(). Remove.
// TODO: Redundant with makeMutableCopy(). Remove.
protected static DoubleList mutableCopy(DoubleList list) {
return makeMutableCopy(list);
}
// TODO(b/258340024): Redundant with makeMutableCopy(). Remove.
// TODO: Redundant with makeMutableCopy(). Remove.
protected static BooleanList mutableCopy(BooleanList list) {
return makeMutableCopy(list);
}
@ -430,7 +430,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
return LongArrayList.emptyList();
}
// TODO(b/258340024): Unused. Remove.
// TODO: Unused. Remove.
protected static LongList newLongList() {
return new LongArrayList();
}
@ -439,7 +439,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
return FloatArrayList.emptyList();
}
// TODO(b/258340024): Unused. Remove.
// TODO: Unused. Remove.
protected static FloatList newFloatList() {
return new FloatArrayList();
}
@ -448,7 +448,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
return DoubleArrayList.emptyList();
}
// TODO(b/258340024): Unused. Remove.
// TODO: Unused. Remove.
protected static DoubleList newDoubleList() {
return new DoubleArrayList();
}
@ -457,7 +457,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
return BooleanArrayList.emptyList();
}
// TODO(b/258340024): Unused. Remove.
// TODO: Unused. Remove.
protected static BooleanList newBooleanList() {
return new BooleanArrayList();
}
@ -524,25 +524,25 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
/**
* Used by parsing constructors in generated classes.
*
* <p>TODO(b/258340024): remove unused method (extensions should be immutable after build)
* <p>TODO: remove unused method (extensions should be immutable after build)
*/
protected void makeExtensionsImmutable() {
// Noop for messages without extensions.
}
/**
* TODO(xiaofeng): remove this after b/29368482 is fixed. We need to move this interface to
* TODO: remove this after b/29368482 is fixed. We need to move this interface to
* AbstractMessage in order to versioning GeneratedMessageV3 but this move breaks binary
* compatibility for AppEngine. After AppEngine is fixed we can exclude this from google3.
*
* <p>TODO(b/258340024): Remove at breaking change since b/29368482 was fixed in 2020
* <p>TODO: Remove at breaking change since b/29368482 was fixed in 2020
*/
protected interface BuilderParent extends AbstractMessage.BuilderParent {}
/** TODO(b/258340024): remove this together with GeneratedMessageV3.BuilderParent. */
/** TODO: remove this together with GeneratedMessageV3.BuilderParent. */
protected abstract Message.Builder newBuilderForType(BuilderParent parent);
/** TODO(b/258340024): generated class should implement this directly */
/** TODO: generated class should implement this directly */
@Override
protected Message.Builder newBuilderForType(final AbstractMessage.BuilderParent parent) {
return newBuilderForType(
@ -940,7 +940,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
return internalGetMapField(fieldNumber);
}
/** TODO(b/258340024): Remove, exists for compatibility with generated code. */
/** TODO: Remove, exists for compatibility with generated code. */
@Deprecated
@SuppressWarnings({"unused", "rawtypes"})
protected MapField internalGetMapField(int fieldNumber) {
@ -955,7 +955,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
return internalGetMutableMapField(fieldNumber);
}
/** TODO(b/258340024): Remove, exists for compatibility with generated code. */
/** TODO: Remove, exists for compatibility with generated code. */
@Deprecated
@SuppressWarnings({"unused", "rawtypes"})
protected MapField internalGetMutableMapField(int fieldNumber) {
@ -989,50 +989,50 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
/**
* Check if a singular extension is present.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
<T> boolean hasExtension(
Extension<MessageT, T> extension);
/**
* Check if a singular extension is present.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
<T> boolean hasExtension(
GeneratedExtension<MessageT, T> extension);
/**
* Get the number of elements in a repeated extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
<T> int getExtensionCount(
Extension<MessageT, List<T>> extension);
/**
* Get the number of elements in a repeated extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
<T> int getExtensionCount(
GeneratedExtension<MessageT, List<T>> extension);
/**
* Get the value of an extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
<T> T getExtension(
Extension<MessageT, T> extension);
/**
* Get the value of an extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
<T> T getExtension(
GeneratedExtension<MessageT, T> extension);
/**
* Get one element of a repeated extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
<T> T getExtension(
Extension<MessageT, List<T>> extension,
int index);
/**
* Get one element of a repeated extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
<T> T getExtension(
GeneratedExtension<MessageT, List<T>> extension,
@ -1155,7 +1155,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
/**
* Check if a singular extension is present.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> boolean hasExtension(final Extension<MessageT, T> extension) {
@ -1163,7 +1163,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Check if a singular extension is present.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> boolean hasExtension(
@ -1172,7 +1172,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Get the number of elements in a repeated extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> int getExtensionCount(
@ -1181,7 +1181,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Get the number of elements in a repeated extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> int getExtensionCount(
@ -1190,7 +1190,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Get the value of an extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> T getExtension(final Extension<MessageT, T> extension) {
@ -1198,7 +1198,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Get the value of an extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> T getExtension(
@ -1207,7 +1207,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Get one element of a repeated extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> T getExtension(
@ -1216,7 +1216,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Get one element of a repeated extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> T getExtension(
@ -1229,13 +1229,13 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
return extensions.isInitialized();
}
// TODO(b/258342840): compute this in the builder at {@code build()} time.
// TODO: compute this in the builder at {@code build()} time.
@Override
public boolean isInitialized() {
return super.isInitialized() && extensionsAreInitialized();
}
// TODO(b/248153893): remove mutating method from immutable type
// TODO: remove mutating method from immutable type
@Override
protected boolean parseUnknownField(
CodedInputStream input,
@ -1256,7 +1256,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
* Delegates to parseUnknownField. This method is obsolete, but we must retain it for
* compatibility with older generated code.
*
* <p>TODO(b/248153893): remove mutating method from immutable type
* <p>TODO: remove mutating method from immutable type
*/
@Override
protected boolean parseUnknownFieldProto3(
@ -1271,7 +1271,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
/**
* Used by parsing constructors in generated classes.
*
* <p>TODO(b/258340024): remove unused method (extensions should be immutable after build)
* <p>TODO: remove unused method (extensions should be immutable after build)
*/
@Override
protected void makeExtensionsImmutable() {
@ -1312,7 +1312,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
output.writeMessageSetExtension(descriptor.getNumber(), (Message) next.getValue());
}
} else {
// TODO(xiangl): Taken care of following code, it may cause
// TODO: Taken care of following code, it may cause
// problem when we use LazyField for normal fields/extensions.
// Due to the optional field can be duplicated at the end of
// serialized bytes, which will make the serialized size change
@ -1614,7 +1614,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
/**
* Check if a singular extension is present.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> boolean hasExtension(final Extension<MessageT, T> extension) {
@ -1622,7 +1622,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Check if a singular extension is present.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> boolean hasExtension(
@ -1631,7 +1631,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Get the number of elements in a repeated extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> int getExtensionCount(
@ -1640,7 +1640,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Get the number of elements in a repeated extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> int getExtensionCount(
@ -1649,14 +1649,14 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Get the value of an extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> T getExtension(final Extension<MessageT, T> extension) {
return getExtension((ExtensionLite<MessageT, T>) extension);
}
/** Get the value of an extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> T getExtension(
@ -1665,7 +1665,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Get the value of an extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> T getExtension(
@ -1674,7 +1674,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Get the value of an extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
@Override
public final <T> T getExtension(
@ -1683,7 +1683,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Set the value of an extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
public final <T> BuilderT setExtension(
final Extension<MessageT, T> extension, final T value) {
@ -1691,7 +1691,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Set the value of an extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
public <T> BuilderT setExtension(
final GeneratedExtension<MessageT, T> extension, final T value) {
@ -1699,7 +1699,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Set the value of one element of a repeated extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
public final <T> BuilderT setExtension(
final Extension<MessageT, List<T>> extension,
@ -1708,7 +1708,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Set the value of one element of a repeated extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
public <T> BuilderT setExtension(
final GeneratedExtension<MessageT, List<T>> extension,
@ -1717,7 +1717,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Append a value to a repeated extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
public final <T> BuilderT addExtension(
final Extension<MessageT, List<T>> extension, final T value) {
@ -1725,7 +1725,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Append a value to a repeated extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
public <T> BuilderT addExtension(
final GeneratedExtension<MessageT, List<T>> extension, final T value) {
@ -1733,7 +1733,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Clear an extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
public final <T> BuilderT clearExtension(
final Extension<MessageT, T> extension) {
@ -1741,7 +1741,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Clears an extension.
* <p>TODO(b/258340024): handled by ExtensionLite version
* <p>TODO: handled by ExtensionLite version
*/
public <T> BuilderT clearExtension(
final GeneratedExtension<MessageT, T> extension) {
@ -2043,7 +2043,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
return internalGetMapField(fieldNumber);
}
/** TODO(b/258340024): Remove, exists for compatibility with generated code. */
/** TODO: Remove, exists for compatibility with generated code. */
@Deprecated
@SuppressWarnings({"rawtypes", "unused"})
protected MapField internalGetMapField(int fieldNumber) {
@ -2311,7 +2311,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
@Override
public void clear(final Builder<?> builder) {
// TODO(b/230609037): remove the unused variable
// TODO: remove the unused variable
Object unused = invokeOrDie(clearMethod, builder);
}
}
@ -2430,7 +2430,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
@Override
public void set(final GeneratedMessageV3.Builder<?> builder, final Object value) {
// TODO(b/230609037): remove the unused variable
// TODO: remove the unused variable
Object unused = invokeOrDie(setMethod, builder, value);
}
@ -2446,7 +2446,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
@Override
public void clear(final GeneratedMessageV3.Builder<?> builder) {
// TODO(b/230609037): remove the unused variable
// TODO: remove the unused variable
Object unused = invokeOrDie(clearMethod, builder);
}
}
@ -2660,13 +2660,13 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
@Override
public void setRepeated(
final GeneratedMessageV3.Builder<?> builder, final int index, final Object value) {
// TODO(b/230609037): remove the unused variable
// TODO: remove the unused variable
Object unused = invokeOrDie(setRepeatedMethod, builder, index, value);
}
@Override
public void addRepeated(final GeneratedMessageV3.Builder<?> builder, final Object value) {
// TODO(b/230609037): remove the unused variable
// TODO: remove the unused variable
Object unused = invokeOrDie(addRepeatedMethod, builder, value);
}
@ -2682,7 +2682,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
@Override
public void clear(final GeneratedMessageV3.Builder<?> builder) {
// TODO(b/230609037): remove the unused variable
// TODO: remove the unused variable
Object unused = invokeOrDie(clearMethod, builder);
}
}
@ -2981,7 +2981,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
@Override
public void set(final Builder<?> builder, final Object value) {
if (supportUnknownEnumValue) {
// TODO(b/230609037): remove the unused variable
// TODO: remove the unused variable
Object unused =
invokeOrDie(setValueMethod, builder, ((EnumValueDescriptor) value).getNumber());
return;
@ -3069,7 +3069,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
@Override
public void setRepeated(final Builder<?> builder, final int index, final Object value) {
if (supportUnknownEnumValue) {
// TODO(b/230609037): remove the unused variable
// TODO: remove the unused variable
Object unused =
invokeOrDie(
setRepeatedValueMethod,
@ -3084,7 +3084,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
@Override
public void addRepeated(final Builder<?> builder, final Object value) {
if (supportUnknownEnumValue) {
// TODO(b/230609037): remove the unused variable
// TODO: remove the unused variable
Object unused =
invokeOrDie(
addRepeatedValueMethod, builder, ((EnumValueDescriptor) value).getNumber());
@ -3130,7 +3130,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
@Override
public void set(GeneratedMessageV3.Builder<?> builder, Object value) {
if (value instanceof ByteString) {
// TODO(b/230609037): remove the unused variable
// TODO: remove the unused variable
Object unused = invokeOrDie(setBytesMethodBuilder, builder, value);
} else {
super.set(builder, value);

@ -13,7 +13,7 @@ import java.nio.Buffer;
* Wrappers around {@link Buffer} methods that are covariantly overridden in Java 9+. See
* https://github.com/protocolbuffers/protobuf/issues/11393
*
* <p>TODO(b/270454719) remove when Java 8 support is no longer needed.
* <p>TODO remove when Java 8 support is no longer needed.
*/
final class Java8Compatibility {
static void clear(Buffer b) {

@ -22,7 +22,7 @@ import java.io.IOException;
* All of the getters are expected to be thread-safe. When used in the context of a
* MessageLite.Builder, setters can be invoked, but there is no guarantee of thread safety.
*
* <p>TODO(yatin,dweis): Consider splitting this class's functionality and put the mutable methods
* <p>TODO: Consider splitting this class's functionality and put the mutable methods
* into a separate builder class to allow us to give stronger compile-time guarantees.
*
* <p>This class is internal implementation detail of the protobuf library, so you don't need to use
@ -86,7 +86,7 @@ public class LazyFieldLite {
/**
* The memoized bytes for {@code value}. This is an optimization for the toByteString() method to
* not have to recompute its return-value on each invocation. TODO(yatin): Figure out whether this
* not have to recompute its return-value on each invocation. TODO: Figure out whether this
* optimization is actually necessary.
*/
private volatile ByteString memoizedBytes;

@ -48,7 +48,7 @@ public class LazyStringArrayList extends AbstractProtobufList<String>
/**
* For compatibility with older runtimes.
*
* <p>TODO(b/258340024) Remove this in a breaking release.
* <p>TODO Remove this in a breaking release.
*
* @deprecated use {@link emptyList()} instead
*/

@ -145,14 +145,14 @@ final class MessageLiteToString {
// only works if the method names have not been proguarded out or renamed.
Method getMethod = getter.getValue();
Method hasMethod = hazzers.get("has" + suffix);
// TODO(dweis): Fix proto3 semantics.
// TODO: Fix proto3 semantics.
if (getMethod != null) {
Object value = GeneratedMessageLite.invokeOrDie(getMethod, messageLite);
final boolean hasValue =
hasMethod == null
? !isDefaultValue(value)
: (Boolean) GeneratedMessageLite.invokeOrDie(hasMethod, messageLite);
// TODO(dweis): This doesn't stop printing oneof case twice: value and enum style.
// TODO: This doesn't stop printing oneof case twice: value and enum style.
if (hasValue) {
printField(buffer, indent, suffix, value);
}

@ -637,7 +637,7 @@ class MessageReflection {
if (descriptor.needsUtf8Check()) {
return WireFormat.Utf8Validation.STRICT;
}
// TODO(liujisi): support lazy strings for repeated fields.
// TODO: support lazy strings for repeated fields.
if (!descriptor.isRepeated() && builder instanceof GeneratedMessage.Builder) {
return WireFormat.Utf8Validation.LAZY;
}
@ -850,7 +850,7 @@ class MessageReflection {
if (descriptor.needsUtf8Check()) {
return WireFormat.Utf8Validation.STRICT;
}
// TODO(b/248145492): support lazy strings for ExtesnsionSet.
// TODO: support lazy strings for ExtesnsionSet.
return WireFormat.Utf8Validation.LOOSE;
}
@ -1077,7 +1077,7 @@ class MessageReflection {
if (descriptor.needsUtf8Check()) {
return WireFormat.Utf8Validation.STRICT;
}
// TODO(b/248145492): support lazy strings for ExtesnsionSet.
// TODO: support lazy strings for ExtesnsionSet.
return WireFormat.Utf8Validation.LOOSE;
}

@ -153,7 +153,7 @@ final class MessageSchema<T> implements Schema<T> {
private final boolean hasExtensions;
private final boolean lite;
private final ProtoSyntax syntax;
// TODO(xiaofeng): Make both full-runtime and lite-runtime support cached field size.
// TODO: Make both full-runtime and lite-runtime support cached field size.
private final boolean useCachedSizeField;
/** Represents [checkInitialized positions, map field positions, repeated field offsets]. */
@ -468,7 +468,7 @@ final class MessageSchema<T> implements Schema<T> {
|| oneofFieldType == 17 /* FieldType.GROUP */) {
objects[bufferIndex / INTS_PER_FIELD * 2 + 1] = messageInfoObjects[objectsPosition++];
} else if (oneofFieldType == 12 /* FieldType.ENUM */) {
// TODO(b/279034699): Remove proto2 check once legacy gencode not setting this bit
// TODO: Remove proto2 check once legacy gencode not setting this bit
// no longer needs to be supported.
if (messageInfo.getSyntax().equals(ProtoSyntax.PROTO2)
|| (fieldTypeWithExtraBits & LEGACY_ENUM_IS_CLOSED_BIT) != 0) {
@ -514,7 +514,7 @@ final class MessageSchema<T> implements Schema<T> {
} else if (fieldType == 12 /* FieldType.ENUM */
|| fieldType == 30 /* FieldType.ENUM_LIST */
|| fieldType == 44 /* FieldType.ENUM_LIST_PACKED */) {
// TODO(b/279034699): Remove proto2 check once legacy gencode not setting this bit
// TODO: Remove proto2 check once legacy gencode not setting this bit
// no longer needs to be supported.
if (messageInfo.getSyntax() == ProtoSyntax.PROTO2
|| (fieldTypeWithExtraBits & LEGACY_ENUM_IS_CLOSED_BIT) != 0) {
@ -1479,7 +1479,7 @@ final class MessageSchema<T> implements Schema<T> {
if (fieldType <= 17) {
// Performance optimization to cache the presence field which is shared for multiple
// fields.
// TODO(b/279034699): Improve caching for case when fields alternate between having and not
// TODO: Improve caching for case when fields alternate between having and not
// having presence by caching presence field for last field with presence only.
if (presenceOrCachedSizeFieldOffset != currentPresenceFieldOffset) {
currentPresenceFieldOffset = presenceOrCachedSizeFieldOffset;
@ -1935,7 +1935,7 @@ final class MessageSchema<T> implements Schema<T> {
getMessageFieldSchema(i));
break;
case 50: // MAP:
// TODO(dweis): Use schema cache.
// TODO: Use schema cache.
size +=
mapFieldSchema.getSerializedSize(
number, unsafe.getObject(message, offset), getMapFieldDefaultEntry(i));
@ -2063,7 +2063,7 @@ final class MessageSchema<T> implements Schema<T> {
}
@Override
// TODO(nathanmittler): Consider serializing oneof fields last so that only one entry per
// TODO: Consider serializing oneof fields last so that only one entry per
// oneof is actually serialized. This would mean that we would violate the serialization order
// contract. It should also be noted that Go currently does this.
public void writeTo(T message, Writer writer) throws IOException {
@ -2102,7 +2102,7 @@ final class MessageSchema<T> implements Schema<T> {
// Performance optimization to cache the presence field which is shared for multiple
// fields.
// TODO(b/279034699): Improve caching for case when fields alternate between having and not
// TODO: Improve caching for case when fields alternate between having and not
// having presence by caching presence field for last field with presence only.
if (presenceFieldOffset != currentPresenceFieldOffset) {
currentPresenceFieldOffset = presenceFieldOffset;
@ -2305,7 +2305,7 @@ final class MessageSchema<T> implements Schema<T> {
numberAt(pos), (List<Long>) unsafe.getObject(message, offset), writer, false);
break;
case 35: // DOUBLE_LIST_PACKED:
// TODO(xiaofeng): Make use of cached field size to speed up serialization.
// TODO: Make use of cached field size to speed up serialization.
SchemaUtil.writeDoubleList(
numberAt(pos), (List<Double>) unsafe.getObject(message, offset), writer, true);
break;
@ -2370,7 +2370,7 @@ final class MessageSchema<T> implements Schema<T> {
getMessageFieldSchema(pos));
break;
case 50: // MAP:
// TODO(dweis): Use schema cache.
// TODO: Use schema cache.
writeMapHelper(writer, number, unsafe.getObject(message, offset), pos);
break;
case 51: // ONEOF_DOUBLE:
@ -2821,7 +2821,7 @@ final class MessageSchema<T> implements Schema<T> {
getMessageFieldSchema(pos));
break;
case 50: // MAP:
// TODO(dweis): Use schema cache.
// TODO: Use schema cache.
writeMapHelper(writer, number, UnsafeUtil.getObject(message, offset(typeAndOffset)), pos);
break;
case 51: // ONEOF_DOUBLE:
@ -3417,7 +3417,7 @@ final class MessageSchema<T> implements Schema<T> {
@SuppressWarnings("ReferenceEquality")
static UnknownFieldSetLite getMutableUnknownFields(Object message) {
// TODO(b/248560713) decide if we're keeping support for Full in schema classes and handle this
// TODO decide if we're keeping support for Full in schema classes and handle this
// better.
UnknownFieldSetLite unknownFields = ((GeneratedMessageLite) message).unknownFields;
if (unknownFields == UnknownFieldSetLite.getDefaultInstance()) {
@ -4306,7 +4306,7 @@ final class MessageSchema<T> implements Schema<T> {
return;
}
// TODO(b/248560713) decide if we're keeping support for Full in schema classes and handle this
// TODO decide if we're keeping support for Full in schema classes and handle this
// better.
if (message instanceof GeneratedMessageLite) {
GeneratedMessageLite<?, ?> generatedMessage = ((GeneratedMessageLite<?, ?>) message);
@ -4392,7 +4392,7 @@ final class MessageSchema<T> implements Schema<T> {
throws IOException {
long offset = offset(typeAndOffsetAt(pos));
Object mapField = UnsafeUtil.getObject(message, offset);
// TODO(xiaofeng): Consider creating separate implementations for full and lite. In lite
// TODO: Consider creating separate implementations for full and lite. In lite
// runtime map field will never be null but here we still need to check null because the
// code is shared by both full and lite. It might be better if full/lite uses different
// schema implementations.
@ -4577,7 +4577,7 @@ final class MessageSchema<T> implements Schema<T> {
if (metadata.valueType.getJavaType() != WireFormat.JavaType.MESSAGE) {
return true;
}
// TODO(dweis): Use schema cache.
// TODO: Use schema cache.
Schema schema = null;
for (Object nested : map.values()) {
if (schema == null) {
@ -4682,7 +4682,7 @@ final class MessageSchema<T> implements Schema<T> {
return false;
}
// TODO(b/248560713) decide if we're keeping support for Full in schema classes and handle this
// TODO decide if we're keeping support for Full in schema classes and handle this
// better.
if (message instanceof GeneratedMessageLite<?, ?>) {
return ((GeneratedMessageLite<?, ?>) message).isMutable();

@ -39,7 +39,7 @@ final class MessageSetSchema<T> implements Schema<T> {
@SuppressWarnings("unchecked")
@Override
public T newInstance() {
// TODO(b/248560713) decide if we're keeping support for Full in schema classes and handle this
// TODO decide if we're keeping support for Full in schema classes and handle this
// better.
if (defaultInstance instanceof GeneratedMessageLite) {
return (T) ((GeneratedMessageLite<?, ?>) defaultInstance).newMutableInstance();
@ -116,7 +116,7 @@ final class MessageSetSchema<T> implements Schema<T> {
public void mergeFrom(
T message, byte[] data, int position, int limit, ArrayDecoders.Registers registers)
throws IOException {
// TODO(b/248560713) decide if we're keeping support for Full in schema classes and handle this
// TODO decide if we're keeping support for Full in schema classes and handle this
// better.
UnknownFieldSetLite unknownFields = ((GeneratedMessageLite) message).unknownFields;
if (unknownFields == UnknownFieldSetLite.getDefaultInstance()) {
@ -166,7 +166,7 @@ final class MessageSetSchema<T> implements Schema<T> {
if (wireType == WireFormat.WIRETYPE_VARINT) {
position = ArrayDecoders.decodeVarint32(data, position, registers);
typeId = registers.int1;
// TODO(b/248560713) decide if we're keeping support for Full in schema classes and
// TODO decide if we're keeping support for Full in schema classes and
// handle this better.
extension =
(GeneratedMessageLite.GeneratedExtension<?, ?>)
@ -343,7 +343,7 @@ final class MessageSetSchema<T> implements Schema<T> {
// If there are any rawBytes left, it means the message content appears before the type ID.
if (rawBytes != null) {
if (extension != null) { // We known the type
// TODO(xiaofeng): Instead of reading into a temporary ByteString, maybe there is a way
// TODO: Instead of reading into a temporary ByteString, maybe there is a way
// to read directly from Reader to the submessage?
extensionSchema.parseMessageSetItem(rawBytes, extension, extensionRegistry, extensions);
} else {

@ -11,7 +11,7 @@ package com.google.protobuf;
final class NewInstanceSchemaLite implements NewInstanceSchema {
@Override
public Object newInstance(Object defaultInstance) {
// TODO(b/248560713) decide if we're keeping support for Full in schema classes and handle this
// TODO decide if we're keeping support for Full in schema classes and handle this
// better.
return ((GeneratedMessageLite<?, ?>) defaultInstance).newMutableInstance();
}

@ -143,7 +143,7 @@ final class NioByteString extends ByteString.LeafByteString {
offset = buffer.arrayOffset() + buffer.position();
length = buffer.remaining();
} else {
// TODO(nathanmittler): Can we optimize this?
// TODO: Can we optimize this?
bytes = toByteArray();
offset = 0;
length = bytes.length;

@ -10,7 +10,7 @@ package com.google.protobuf;
import java.lang.reflect.Field;
/** Information for a oneof within a protobuf message. */
// TODO(nathanmittler): make this private once all of experimental code is migrated to protobuf.
// TODO: make this private once all of experimental code is migrated to protobuf.
@ExperimentalApi
@CheckReturnValue
final class OneofInfo {

@ -24,7 +24,7 @@ final class Protobuf {
private final SchemaFactory schemaFactory;
// TODO(nathanmittler): Consider using ClassValue instead.
// TODO: Consider using ClassValue instead.
private final ConcurrentMap<Class<?>, Schema<?>> schemaCache =
new ConcurrentHashMap<Class<?>, Schema<?>>();

@ -12,7 +12,7 @@ import java.util.List;
import java.util.Map;
/** A reader of fields from a serialized protobuf message. */
// TODO(nathanmittler): Refactor to allow the reader to allocate properly sized lists.
// TODO: Refactor to allow the reader to allocate properly sized lists.
@ExperimentalApi
@CheckReturnValue
interface Reader {
@ -27,7 +27,7 @@ interface Reader {
/**
* Gets the field number for the current field being read.
*
* <p>TODO(liujisi): Rename it to make it more explicit about the side effect on the underlying
* <p>TODO: Rename it to make it more explicit about the side effect on the underlying
* buffer.
*
* @return the current field number or {@link #READ_DONE} if the end of input has been reached.
@ -112,7 +112,7 @@ interface Reader {
*/
String readStringRequireUtf8() throws IOException;
// TODO(yilunchong): the lack of other opinions for whether to expose this on the interface
// TODO: the lack of other opinions for whether to expose this on the interface
<T> T readMessageBySchemaWithCheck(Schema<T> schema, ExtensionRegistryLite extensionRegistry)
throws IOException;
@ -131,7 +131,7 @@ interface Reader {
@Deprecated
<T> T readGroup(Class<T> clazz, ExtensionRegistryLite extensionRegistry) throws IOException;
// TODO(yilunchong): the lack of other opinions for whether to expose this on the interface
// TODO: the lack of other opinions for whether to expose this on the interface
@Deprecated
<T> T readGroupBySchemaWithCheck(Schema<T> schema, ExtensionRegistryLite extensionRegistry)
throws IOException;

@ -35,7 +35,7 @@ final class SchemaUtil {
* GeneratedMessageLite}.
*/
public static void requireGeneratedMessage(Class<?> messageType) {
// TODO(b/248560713) decide if we're keeping support for Full in schema classes and handle this
// TODO decide if we're keeping support for Full in schema classes and handle this
// better.
if (!GeneratedMessageLite.class.isAssignableFrom(messageType)
&& GENERATED_MESSAGE_CLASS != null
@ -782,7 +782,7 @@ final class SchemaUtil {
private static Class<?> getGeneratedMessageClass() {
try {
// TODO(b/248560713) decide if we're keeping support for Full in schema classes and handle
// TODO decide if we're keeping support for Full in schema classes and handle
// this better.
return Class.forName("com.google.protobuf.GeneratedMessageV3");
} catch (Throwable e) {
@ -887,7 +887,7 @@ final class SchemaUtil {
if (enumMap == null) {
return unknownFields;
}
// TODO(dweis): Specialize for IntArrayList to avoid boxing.
// TODO: Specialize for IntArrayList to avoid boxing.
if (enumList instanceof RandomAccess) {
int writePos = 0;
int size = enumList.size();
@ -933,7 +933,7 @@ final class SchemaUtil {
if (enumVerifier == null) {
return unknownFields;
}
// TODO(dweis): Specialize for IntArrayList to avoid boxing.
// TODO: Specialize for IntArrayList to avoid boxing.
if (enumList instanceof RandomAccess) {
int writePos = 0;
int size = enumList.size();

@ -1692,7 +1692,7 @@ public final class TextFormat {
private static final int BUFFER_SIZE = 4096;
// TODO(chrisn): See if working around java.io.Reader#read(CharBuffer)
// TODO: See if working around java.io.Reader#read(CharBuffer)
// overhead is worthwhile
private static StringBuilder toStringBuilder(final Readable input) throws IOException {
final StringBuilder text = new StringBuilder();
@ -2189,7 +2189,7 @@ public final class TextFormat {
}
if (field.isRepeated()) {
// TODO(b/29122459): If field.isMapField() and FORBID_SINGULAR_OVERWRITES mode,
// TODO: If field.isMapField() and FORBID_SINGULAR_OVERWRITES mode,
// check for duplicate map keys here.
target.addRepeatedField(field, value);
} else {

@ -730,7 +730,7 @@ public final class UnknownFieldSet implements MessageLite {
*/
public ByteString toByteString(int fieldNumber) {
try {
// TODO(lukes): consider caching serialized size in a volatile long
// TODO: consider caching serialized size in a volatile long
ByteString.CodedBuilder out =
ByteString.newCodedBuilder(getSerializedSize(fieldNumber));
writeTo(fieldNumber, out.getCodedOutput());

@ -23,7 +23,7 @@ import java.util.Arrays;
public final class UnknownFieldSetLite {
// Arbitrarily chosen.
// TODO(dweis): Tune this number?
// TODO: Tune this number?
private static final int MIN_CAPACITY = 8;
private static final UnknownFieldSetLite DEFAULT_INSTANCE =
@ -209,7 +209,7 @@ public final class UnknownFieldSetLite {
}
break;
default:
// TODO(liujisi): Change writeTo to throw IOException?
// TODO: Change writeTo to throw IOException?
throw new RuntimeException(InvalidProtocolBufferException.invalidWireType());
}
}

@ -50,7 +50,7 @@ import java.util.Arrays;
*
* @author martinrb@google.com (Martin Buchholz)
*/
// TODO(nathanmittler): Copy changes in this class back to Guava
// TODO: Copy changes in this class back to Guava
final class Utf8 {
/**
@ -354,7 +354,7 @@ final class Utf8 {
}
/** A processor of UTF-8 strings, providing methods for checking validity and encoding. */
// TODO(nathanmittler): Add support for Memory/MemoryBlock on Android.
// TODO: Add support for Memory/MemoryBlock on Android.
abstract static class Processor {
/**
* Returns {@code true} if the given byte array slice is a well-formed UTF-8 byte sequence. The
@ -520,7 +520,7 @@ final class Utf8 {
for (; ; ) {
// Optimize for interior runs of ASCII bytes.
// TODO(nathanmittler): Consider checking 8 bytes at a time after some threshold?
// TODO: Consider checking 8 bytes at a time after some threshold?
// Maybe after seeing a few in a row that are ASCII, go back to fast mode?
int byte1;
do {
@ -568,7 +568,7 @@ final class Utf8 {
return incompleteStateFor(buffer, byte1, index, limit - index);
}
// TODO(nathanmittler): Consider using getInt() to improve performance.
// TODO: Consider using getInt() to improve performance.
int byte2 = buffer.get(index++);
if (byte2 > (byte) 0xBF
// Check that 1 <= plane <= 16. Tricky optimized form of:
@ -811,7 +811,7 @@ final class Utf8 {
if (inIx + 1 == inLength || !isSurrogatePair(c, (low = in.charAt(++inIx)))) {
throw new UnpairedSurrogateException(inIx, inLength);
}
// TODO(nathanmittler): Consider using putInt() to improve performance.
// TODO: Consider using putInt() to improve performance.
int codePoint = toCodePoint(c, low);
out.put(outIx++, (byte) ((0xF << 4) | (codePoint >>> 18)));
out.put(outIx++, (byte) (0x80 | (0x3F & (codePoint >>> 12))));
@ -823,7 +823,7 @@ final class Utf8 {
// Successfully encoded the entire string.
Java8Compatibility.position(out, outIx);
} catch (IndexOutOfBoundsException e) {
// TODO(nathanmittler): Consider making the API throw IndexOutOfBoundsException instead.
// TODO: Consider making the API throw IndexOutOfBoundsException instead.
// If we failed in the outer ASCII loop, outIx will not have been updated. In this case,
// use inIx to determine the bad write index.
@ -1651,7 +1651,7 @@ final class Utf8 {
for (; ; ) {
// Optimize for interior runs of ASCII bytes.
// TODO(nathanmittler): Consider checking 8 bytes at a time after some threshold?
// TODO: Consider checking 8 bytes at a time after some threshold?
// Maybe after seeing a few in a row that are ASCII, go back to fast mode?
int byte1 = 0;
for (; remaining > 0 && (byte1 = UnsafeUtil.getByte(bytes, offset++)) >= 0; --remaining) {}
@ -1725,7 +1725,7 @@ final class Utf8 {
for (; ; ) {
// Optimize for interior runs of ASCII bytes.
// TODO(nathanmittler): Consider checking 8 bytes at a time after some threshold?
// TODO: Consider checking 8 bytes at a time after some threshold?
// Maybe after seeing a few in a row that are ASCII, go back to fast mode?
int byte1 = 0;
for (; remaining > 0 && (byte1 = UnsafeUtil.getByte(address++)) >= 0; --remaining) {}

@ -416,7 +416,7 @@ public class CodedOutputStreamTest {
assertThat(coder.stream().getTotalBytesWritten()).isEqualTo((value.length * 1024) + stringSize);
}
// TODO(dweis): Write a comprehensive test suite for CodedOutputStream that covers more than just
// TODO: Write a comprehensive test suite for CodedOutputStream that covers more than just
// this case.
@Test
public void testWriteStringNoTag_fastpath() throws Exception {
@ -550,7 +550,7 @@ public class CodedOutputStreamTest {
CodedOutputStream outputWithByteBuffer =
CodedOutputStream.newInstance(ByteBuffer.allocate(10000));
for (String s : invalidStrings) {
// TODO(dweis): These should all fail; instead they are corrupting data.
// TODO: These should all fail; instead they are corrupting data.
CodedOutputStream.computeStringSizeNoTag(s);
outputWithStream.writeStringNoTag(s);
outputWithArray.writeStringNoTag(s);
@ -558,7 +558,7 @@ public class CodedOutputStreamTest {
}
}
// TODO(nathanmittler): This test can be deleted once we properly throw IOException while
// TODO: This test can be deleted once we properly throw IOException while
// encoding invalid UTF-8 strings.
@Test
public void testSerializeInvalidUtf8FollowedByOutOfSpace() throws Exception {

@ -601,7 +601,7 @@ public class GeneratedMessageTest {
// Create expected version passing foreign message instance explicitly.
.setOptionalForeignMessage(ForeignMessage.newBuilder().setC(123).build())
.build();
// TODO(ngd): Upgrade to using real #equals method once implemented
// TODO: Upgrade to using real #equals method once implemented
assertThat(message.toString()).isEqualTo(expectedMessage.toString());
}

@ -26,7 +26,7 @@ public class TestBadIdentifiers extends TestCase {
TestBadIdentifiersProto.Override.getDefaultInstance();
}
@SuppressWarnings({"IgnoredPureGetter", "CheckReturnValue"}) // TODO(b/221602772): Fix this
@SuppressWarnings({"IgnoredPureGetter", "CheckReturnValue"}) // TODO: Fix this
public void testGetDescriptor() {
TestBadIdentifiersProto.getDescriptor();
TestBadIdentifiersProto.Descriptor.getDefaultInstance().getDescriptor();

@ -2635,7 +2635,7 @@ public final class TestUtil {
break;
case FOO_NOT_SET:
break;
// TODO(b/18683919): go/enum-switch-lsc
// TODO: go/enum-switch-lsc
}
}

@ -1654,7 +1654,7 @@ public class TextFormatTest {
{
// With overwrite forbidden, same behavior.
// TODO(b/29122459): Expect parse exception here.
// TODO: Expect parse exception here.
TestMap.Builder builder = TestMap.newBuilder();
PARSER_WITH_OVERWRITE_FORBIDDEN.merge(text, builder);
TestMap map = builder.build();
@ -1664,7 +1664,7 @@ public class TextFormatTest {
{
// With overwrite forbidden and a dynamic message, same behavior.
// TODO(b/29122459): Expect parse exception here.
// TODO: Expect parse exception here.
Message.Builder builder = DynamicMessage.newBuilder(TestMap.getDescriptor());
PARSER_WITH_OVERWRITE_FORBIDDEN.merge(text, builder);
TestMap map =

@ -11,5 +11,5 @@ package deprecated_file;
option deprecated = true;
// TODO (liujisi): Add deprecation options on messages, enums fields as well and
// TODO : Add deprecation options on messages, enums fields as well and
// add tests to verify those annotations are actually generated.

@ -54,7 +54,7 @@ message ForbiddenWordsLeadingUnderscoreMessage {
optional bool _all_fields = 5;
optional bool _descriptor_for_type = 6;
optional bool _initialization_error_string = 7;
// TODO(b/219045204): re-enable
// TODO: re-enable
// optional bool _unknown_fields = 8;
// obsolete. kept for backwards compatibility of generated code
optional bool _cached_size = 9;
@ -75,7 +75,7 @@ message ForbiddenWordsCamelMessage {
optional bool initializationErrorString = 5;
optional bool descriptorForType = 6;
optional bool allFields = 7;
// TODO(b/219045204): re-enable
// TODO: re-enable
// optional bool unknownFields = 8;
// obsolete. kept for backwards compatibility of generated code
optional bool cachedSize = 9;
@ -154,7 +154,7 @@ service TestConflictingMethodNames {
}
message TestConflictingFieldNames {
// TODO(b/261750190) Remove these tests once this behavior is removed.
// TODO Remove these tests once this behavior is removed.
option deprecated_legacy_json_field_conflicts = true;
enum TestEnum {

@ -56,4 +56,4 @@ constructor(private val delegate: List<E>) : List<E> by delegate {
override fun toString(): String = delegate.toString()
}
// TODO(lowasser): investigate making this an inline class
// TODO: investigate making this an inline class

@ -61,4 +61,4 @@ constructor(private val delegate: Map<K, V>) : Map<K, V> by delegate {
override fun toString(): String = delegate.toString()
}
// TODO(lowasser): investigate making this an inline class
// TODO: investigate making this an inline class

@ -115,7 +115,7 @@ public class LiteTest {
@Test
public void testLiteExtensions() throws Exception {
// TODO(kenton): Unlike other features of the lite library, extensions are
// TODO: Unlike other features of the lite library, extensions are
// implemented completely differently from the regular library. We
// should probably test them more thoroughly.

@ -39,7 +39,7 @@ public final class FieldMaskUtil {
* Converts a FieldMask to a string.
*/
public static String toString(FieldMask fieldMask) {
// TODO(xiaofeng): Consider using com.google.common.base.Joiner here instead.
// TODO: Consider using com.google.common.base.Joiner here instead.
StringBuilder result = new StringBuilder();
boolean first = true;
for (String value : fieldMask.getPathsList()) {
@ -61,7 +61,7 @@ public final class FieldMaskUtil {
* Parses from a string to a FieldMask.
*/
public static FieldMask fromString(String value) {
// TODO(xiaofeng): Consider using com.google.common.base.Splitter here instead.
// TODO: Consider using com.google.common.base.Splitter here instead.
return fromStringList(Arrays.asList(value.split(FIELD_PATH_SEPARATOR_REGEX)));
}
@ -71,7 +71,7 @@ public final class FieldMaskUtil {
* @throws IllegalArgumentException if any of the field path is invalid.
*/
public static FieldMask fromString(Class<? extends Message> type, String value) {
// TODO(xiaofeng): Consider using com.google.common.base.Splitter here instead.
// TODO: Consider using com.google.common.base.Splitter here instead.
return fromStringList(type, Arrays.asList(value.split(FIELD_PATH_SEPARATOR_REGEX)));
}
@ -285,7 +285,7 @@ public final class FieldMaskUtil {
public static final class MergeOptions {
private boolean replaceMessageFields = false;
private boolean replaceRepeatedFields = false;
// TODO(b/28277137): change the default behavior to always replace primitive fields after
// TODO: change the default behavior to always replace primitive fields after
// fixing all failing TAP tests.
private boolean replacePrimitiveFields = false;

@ -329,7 +329,7 @@ public class JsonFormat {
* @throws IOException if writing to the output fails
*/
public void appendTo(MessageOrBuilder message, Appendable output) throws IOException {
// TODO(xiaofeng): Investigate the allocation overhead and optimize for
// TODO: Investigate the allocation overhead and optimize for
// mobile.
new PrinterImpl(
registry,
@ -443,7 +443,7 @@ public class JsonFormat {
* proto3 format or there are unknown fields in the input.
*/
public void merge(String json, Message.Builder builder) throws InvalidProtocolBufferException {
// TODO(xiaofeng): Investigate the allocation overhead and optimize for
// TODO: Investigate the allocation overhead and optimize for
// mobile.
new ParserImpl(registry, oldRegistry, ignoringUnknownFields, recursionLimit)
.merge(json, builder);
@ -457,7 +457,7 @@ public class JsonFormat {
* @throws IOException if reading from the input throws
*/
public void merge(Reader json, Message.Builder builder) throws IOException {
// TODO(xiaofeng): Investigate the allocation overhead and optimize for
// TODO: Investigate the allocation overhead and optimize for
// mobile.
new ParserImpl(registry, oldRegistry, ignoringUnknownFields, recursionLimit)
.merge(json, builder);

@ -562,7 +562,7 @@ public class JsonFormatTest {
@Test
public void testParserRejectDuplicatedFields() throws Exception {
// TODO(xiaofeng): The parser we are currently using (GSON) will accept and keep the last
// TODO: The parser we are currently using (GSON) will accept and keep the last
// one if multiple entries have the same name. This is not the desired behavior but it can
// only be fixed by using our own parser. Here we only test the cases where the names are
// different but still referring to the same field.

@ -54,7 +54,7 @@ GPB_INLINE void CheckFieldSize(uint64_t size) {
// parse_context, delimited_message_util, message_lite, etc.).
// https://protobuf.dev/programming-guides/encoding/#cheat-sheet
if (size > 0x7fffffff) {
// TODO(thomasvl): Maybe a different error code for this, but adding one is a breaking
// TODO: Maybe a different error code for this, but adding one is a breaking
// change so reuse an existing one.
RaiseException(GPBCodedInputStreamErrorInvalidSize, nil);
}

@ -13,7 +13,7 @@
#import "GPBUnknownFieldSet_PackagePrivate.h"
#import "GPBUtilities_PackagePrivate.h"
// TODO(b/294836507): Consider using on other functions to reduce bloat when
// TODO: Consider using on other functions to reduce bloat when
// some compiler optimizations are enabled.
#define GPB_NOINLINE __attribute__((noinline))

@ -743,7 +743,7 @@
//
// BOOL test macros
//
//TODO(thomasvl): enum tests
//TODO: enum tests
//%PDDM-DEFINE BOOL_TESTS_FOR_POD_VALUE(VALUE_NAME, VALUE_TYPE, VAL1, VAL2)
//%BOOL_TESTS_COMMON(Bool, BOOL, , , YES, NO, VALUE_NAME, VALUE_TYPE, , value, POD, VAL1, VAL2)

@ -22,7 +22,7 @@
@implementation MessageMergeTests
// TODO(thomasvl): Pull tests over from GPBMessageTests that are merge specific.
// TODO: Pull tests over from GPBMessageTests that are merge specific.
- (void)testProto3MergingAndZeroValues {
// Proto2 covered in other tests.

@ -23,7 +23,7 @@
@implementation MessageRuntimeTests
// TODO(thomasvl): Pull tests over from GPBMessageTests that are runtime
// TODO: Pull tests over from GPBMessageTests that are runtime
// specific.
- (void)testStartupOrdering {

@ -23,7 +23,7 @@
@implementation MessageSerializationTests
// TODO(thomasvl): Pull tests over from GPBMessageTests that are serialization
// TODO: Pull tests over from GPBMessageTests that are serialization
// specific.
- (void)testProto3SerializationHandlingDefaults {

@ -66,7 +66,7 @@
@implementation MessageTests
// TODO(thomasvl): this should get split into a few files of logic junks, it is
// TODO: this should get split into a few files of logic junks, it is
// a jumble of things at the moment (and the testutils have a bunch of the real
// assertions).

@ -1103,7 +1103,7 @@ extend TestExtensionInsideTable {
optional int32 test_extension_inside_table_extension = 5;
}
// NOTE(b/202996544): Intentionally nested to mirror go/glep.
// NOTE: Intentionally nested to mirror go/glep.
message TestNestedGroupExtensionOuter {
optional group Layer1OptionalGroup = 1 {
repeated group Layer2RepeatedGroup = 2 {

@ -914,7 +914,7 @@ static void add_descriptor(upb_DefPool* symtab,
if (upb_DefPool_FindFileByNameWithSize(symtab, name.data, name.size)) {
// Already added.
// TODO(teboring): Re-enable this warning when aggregate metadata is
// TODO: Re-enable this warning when aggregate metadata is
// deprecated.
// zend_error(E_USER_WARNING,
// "proto descriptor was previously loaded (included in multiple

@ -667,7 +667,7 @@ PHP_METHOD(Message, mergeFrom) {
// zend_parse_parameters().
PBPHP_ASSERT(from->desc == intern->desc);
// TODO(haberman): use a temp arena for this.
// TODO: use a temp arena for this.
upb_EncodeStatus status = upb_Encode(from->msg, l, 0, arena, &pb, &size);
if (!Message_checkEncodeStatus(status)) return;
@ -695,7 +695,7 @@ PHP_METHOD(Message, mergeFromString) {
return;
}
// TODO(haberman): avoid this copy when we can make the decoder copy.
// TODO: avoid this copy when we can make the decoder copy.
data_copy = upb_Arena_Malloc(arena, data_len);
memcpy(data_copy, data, data_len);
@ -754,7 +754,7 @@ PHP_METHOD(Message, mergeFromJsonString) {
return;
}
// TODO(haberman): avoid this copy when we can make the decoder copy.
// TODO: avoid this copy when we can make the decoder copy.
data_copy = upb_Arena_Malloc(arena, data_len + 1);
memcpy(data_copy, data, data_len);
data_copy[data_len] = '\0';

@ -36,7 +36,7 @@ class EnumOptions extends \Google\Protobuf\Internal\Message
* and strips underscored from the fields before comparison in proto3 only.
* The new behavior takes `json_name` into account and applies to proto2 as
* well.
* TODO(b/261750190) Remove this legacy behavior once downstream teams have
* TODO Remove this legacy behavior once downstream teams have
* had time to migrate.
*
* Generated from protobuf field <code>optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];</code>
@ -69,7 +69,7 @@ class EnumOptions extends \Google\Protobuf\Internal\Message
* and strips underscored from the fields before comparison in proto3 only.
* The new behavior takes `json_name` into account and applies to proto2 as
* well.
* TODO(b/261750190) Remove this legacy behavior once downstream teams have
* TODO Remove this legacy behavior once downstream teams have
* had time to migrate.
* @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* The parser stores options it doesn't recognize here. See above.
@ -165,7 +165,7 @@ class EnumOptions extends \Google\Protobuf\Internal\Message
* and strips underscored from the fields before comparison in proto3 only.
* The new behavior takes `json_name` into account and applies to proto2 as
* well.
* TODO(b/261750190) Remove this legacy behavior once downstream teams have
* TODO Remove this legacy behavior once downstream teams have
* had time to migrate.
*
* Generated from protobuf field <code>optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];</code>
@ -195,7 +195,7 @@ class EnumOptions extends \Google\Protobuf\Internal\Message
* and strips underscored from the fields before comparison in proto3 only.
* The new behavior takes `json_name` into account and applies to proto2 as
* well.
* TODO(b/261750190) Remove this legacy behavior once downstream teams have
* TODO Remove this legacy behavior once downstream teams have
* had time to migrate.
*
* Generated from protobuf field <code>optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];</code>

@ -394,7 +394,7 @@ class Message
}
break;
case GPBType::STRING:
// TODO(teboring): Add utf-8 check.
// TODO: Add utf-8 check.
if (!GPBWire::readString($input, $value)) {
throw new GPBDecodeException(
"Unexpected EOF inside string field.");
@ -428,7 +428,7 @@ class Message
}
break;
case GPBType::ENUM:
// TODO(teboring): Check unknown enum value.
// TODO: Check unknown enum value.
if (!GPBWire::readInt32($input, $value)) {
throw new GPBDecodeException(
"Unexpected EOF inside enum field.");
@ -1648,7 +1648,7 @@ class Message
$size += GPBWire::varint32Size($size);
break;
case GPBType::GROUP:
// TODO(teboring): Add support.
// TODO: Add support.
user_error("Unsupported type.");
break;
default:
@ -1753,7 +1753,7 @@ class Message
$size += $value->jsonByteSize();
break;
# case GPBType::GROUP:
# // TODO(teboring): Add support.
# // TODO: Add support.
# user_error("Unsupported type.");
# break;
default:

@ -82,7 +82,7 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
* well.
* This should only be used as a temporary measure against broken builds due
* to the change in behavior for JSON field name conflicts.
* TODO(b/261750190) This is legacy behavior we plan to remove once downstream
* TODO This is legacy behavior we plan to remove once downstream
* teams have had time to migrate.
*
* Generated from protobuf field <code>optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];</code>
@ -153,7 +153,7 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
* well.
* This should only be used as a temporary measure against broken builds due
* to the change in behavior for JSON field name conflicts.
* TODO(b/261750190) This is legacy behavior we plan to remove once downstream
* TODO This is legacy behavior we plan to remove once downstream
* teams have had time to migrate.
* @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* The parser stores options it doesn't recognize here. See above.
@ -387,7 +387,7 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
* well.
* This should only be used as a temporary measure against broken builds due
* to the change in behavior for JSON field name conflicts.
* TODO(b/261750190) This is legacy behavior we plan to remove once downstream
* TODO This is legacy behavior we plan to remove once downstream
* teams have had time to migrate.
*
* Generated from protobuf field <code>optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];</code>
@ -419,7 +419,7 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
* well.
* This should only be used as a temporary measure against broken builds due
* to the change in behavior for JSON field name conflicts.
* TODO(b/261750190) This is legacy behavior we plan to remove once downstream
* TODO This is legacy behavior we plan to remove once downstream
* teams have had time to migrate.
*
* Generated from protobuf field <code>optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];</code>

@ -745,7 +745,7 @@ class EncodeDecodeTest extends TestBase
{
// Test preserve unknown for varint.
$m = new TestMessage();
$from = hex2bin('F80601'); // TODO(teboring): Add a util to encode
$from = hex2bin('F80601'); // TODO: Add a util to encode
// varint for better readability
$m->mergeFromString($from);
$to = $m->serializeToString();

@ -533,7 +533,7 @@ class MapFieldTest extends TestBase {
# Test memory leak
#########################################################
// TODO(teboring): Add it back.
// TODO: Add it back.
// public function testCycleLeak()
// {
// $arr = new MapField(GPBType::INT32,

@ -42,7 +42,7 @@ $data = $from->serializeToString();
$to->mergeFromString($data);
// TODO(teboring): This causes following tests fail in php7.
// TODO: This causes following tests fail in php7.
# $from->setRecursive($from);
$arr = new RepeatedField(GPBType::MESSAGE, TestMessage::class);

@ -23,7 +23,7 @@ if api_implementation.Type() != 'python':
import os
# pylint: disable=protected-access
_message = api_implementation._c_module
# TODO(jieluo): Remove this import after fix api_implementation
# TODO: Remove this import after fix api_implementation
if _message is None:
from google.protobuf.pyext import _message
_USE_C_DESCRIPTORS = True
@ -196,7 +196,7 @@ class _NestedDescriptorBase(DescriptorBase):
)
self.name = name
# TODO(falk): Add function to calculate full_name instead of having it in
# TODO: Add function to calculate full_name instead of having it in
# memory?
self.full_name = full_name
self.containing_type = containing_type
@ -296,7 +296,7 @@ class Descriptor(_NestedDescriptorBase):
_message.Message._CheckCalledFromGeneratedFile()
return _message.default_pool.FindMessageTypeByName(full_name)
# NOTE(tmarek): The file argument redefining a builtin is nothing we can
# NOTE: The file argument redefining a builtin is nothing we can
# fix right now since we don't know how many clients already rely on the
# name of the argument.
def __init__(self, name, full_name, filename, containing_type, fields,
@ -394,13 +394,13 @@ class Descriptor(_NestedDescriptorBase):
super(Descriptor, self).CopyToProto(proto)
# TODO(robinson): We should have aggressive checking here,
# TODO: We should have aggressive checking here,
# for example:
# * If you specify a repeated field, you should not be allowed
# to specify a default value.
# * [Other examples here as needed].
#
# TODO(robinson): for this and other *Descriptor classes, we
# TODO: for this and other *Descriptor classes, we
# might also want to lock things down aggressively (e.g.,
# prevent clients from setting the attributes). Having
# stronger invariants here in general will reduce the number
@ -459,7 +459,7 @@ class FieldDescriptor(DescriptorBase):
# Must be consistent with C++ FieldDescriptor::Type enum in
# descriptor.h.
#
# TODO(robinson): Find a way to eliminate this repetition.
# TODO: Find a way to eliminate this repetition.
TYPE_DOUBLE = 1
TYPE_FLOAT = 2
TYPE_INT64 = 3
@ -483,7 +483,7 @@ class FieldDescriptor(DescriptorBase):
# Must be consistent with C++ FieldDescriptor::CppType enum in
# descriptor.h.
#
# TODO(robinson): Find a way to eliminate this repetition.
# TODO: Find a way to eliminate this repetition.
CPPTYPE_INT32 = 1
CPPTYPE_INT64 = 2
CPPTYPE_UINT32 = 3
@ -520,7 +520,7 @@ class FieldDescriptor(DescriptorBase):
# Must be consistent with C++ FieldDescriptor::Label enum in
# descriptor.h.
#
# TODO(robinson): Find a way to eliminate this repetition.
# TODO: Find a way to eliminate this repetition.
LABEL_OPTIONAL = 1
LABEL_REQUIRED = 2
LABEL_REPEATED = 3
@ -620,7 +620,7 @@ class FieldDescriptor(DescriptorBase):
# self.containing_type is used here instead of self.file for legacy
# compatibility. FieldDescriptor.file was added in cl/153110619
# Some old/generated code didn't link file to FieldDescriptor.
# TODO(jieluo): remove syntax usage b/240619313
# TODO: remove syntax usage b/240619313
return self.containing_type.syntax == 'proto2'
@property

@ -118,11 +118,11 @@ class DescriptorDatabase(object):
raise KeyError(symbol)
def FindFileContainingExtension(self, extendee_name, extension_number):
# TODO(jieluo): implement this API.
# TODO: implement this API.
return None
def FindAllExtensionNumbers(self, extendee_name):
# TODO(jieluo): implement this API.
# TODO: implement this API.
return []
def _AddSymbol(self, name, file_desc_proto):

@ -1259,7 +1259,7 @@ def _PrefixWithDot(name):
if _USE_C_DESCRIPTORS:
# TODO(amauryfa): This pool could be constructed from Python code, when we
# TODO: This pool could be constructed from Python code, when we
# support a flag like 'use_cpp_generated_pool=True'.
# pylint: disable=protected-access
_DEFAULT = descriptor._message.default_pool

@ -83,7 +83,7 @@ if _implementation_type == 'cpp':
_c_module = _message
del _message
except ImportError:
# TODO(jieluo): fail back to python
# TODO: fail back to python
warnings.warn(
'Selected implementation cpp is not available.')
pass
@ -130,7 +130,7 @@ def Type():
# See comment on 'Type' above.
# TODO(jieluo): Remove the API, it returns a constant. b/228102101
# TODO: Remove the API, it returns a constant. b/228102101
def Version():
return 2

@ -92,7 +92,7 @@ def AddHelpersToExtensions(file_des):
Args:
file_des: FileDescriptor of the .proto file
"""
# TODO(b/279930766): Remove this on-op
# TODO: Remove this on-op
return

@ -95,7 +95,7 @@ class BaseContainer(Sequence[_T]):
self._values.reverse()
# TODO(slebedev): Remove this. BaseContainer does *not* conform to
# TODO: Remove this. BaseContainer does *not* conform to
# MutableSequence, only its subclasses do.
collections.abc.MutableSequence.register(BaseContainer)
@ -136,7 +136,7 @@ class RepeatedScalarFieldContainer(BaseContainer[_T], MutableSequence[_T]):
def extend(self, elem_seq: Iterable[_T]) -> None:
"""Extends by appending the given iterable. Similar to list.extend()."""
# TODO(b/286557203): Change OSS to raise error too
# TODO: Change OSS to raise error too
if elem_seq is None:
return
try:
@ -221,7 +221,7 @@ class RepeatedScalarFieldContainer(BaseContainer[_T], MutableSequence[_T]):
"Can't pickle repeated scalar fields, convert to list first")
# TODO(slebedev): Constrain T to be a subtype of Message.
# TODO: Constrain T to be a subtype of Message.
class RepeatedCompositeFieldContainer(BaseContainer[_T], MutableSequence[_T]):
"""Simple, list-like container for holding repeated composite fields."""

@ -122,7 +122,7 @@ class DescriptorPoolTestBase(object):
self.assertEqual('google/protobuf/unittest.proto',
file_desc8.name)
# TODO(jieluo): Add tests for no package when b/13860351 is fixed.
# TODO: Add tests for no package when b/13860351 is fixed.
self.assertRaises(KeyError, self.pool.FindFileContainingSymbol,
'google.protobuf.python.internal.Factory1Message.none_field')
@ -217,7 +217,7 @@ class DescriptorPoolTestBase(object):
self.assertRaises(TypeError, self.pool.FindExtensionByNumber, '')
self.assertRaises(KeyError, self.pool.FindMethodByName, '')
# TODO(jieluo): Fix python to raise correct errors.
# TODO: Fix python to raise correct errors.
if api_implementation.Type() == 'python':
error_type = AttributeError
else:
@ -373,7 +373,7 @@ class DescriptorPoolTestBase(object):
if api_implementation.Type() != 'python':
# Cpp extension cannot call Add on a DescriptorPool
# that uses a DescriptorDatabase.
# TODO(jieluo): Fix python and cpp extension diff.
# TODO: Fix python and cpp extension diff.
return
self.pool = descriptor_pool.DescriptorPool()
file1 = self.pool.AddSerializedFile(
@ -395,7 +395,7 @@ class DescriptorPoolTestBase(object):
if api_implementation.Type() != 'python':
# Cpp extension cannot call Add on a DescriptorPool
# that uses a DescriptorDatabase.
# TODO(jieluo): Fix python and cpp extension diff.
# TODO: Fix python and cpp extension diff.
return
self.pool = descriptor_pool.DescriptorPool()
file1_first = self.pool.AddSerializedFile(
@ -425,7 +425,7 @@ class DescriptorPoolTestBase(object):
if api_implementation.Type() != 'python':
# Cpp extension cannot call Add on a DescriptorPool
# that uses a DescriptorDatabase.
# TODO(jieluo): Fix python and cpp extension diff.
# TODO: Fix python and cpp extension diff.
return
# Then check the dynamic pool and its internal DescriptorDatabase.
descriptor_proto = descriptor_pb2.FileDescriptorProto.FromString(
@ -479,7 +479,7 @@ class DescriptorPoolTestBase(object):
if api_implementation.Type() != 'python':
# Cpp extension cannot call Add on a DescriptorPool
# that uses a DescriptorDatabase.
# TODO(jieluo): Fix python and cpp extension diff.
# TODO: Fix python and cpp extension diff.
return
file_desc = descriptor_pb2.FileDescriptorProto(name='some/file.proto')
self.pool.Add(file_desc)
@ -490,7 +490,7 @@ class DescriptorPoolTestBase(object):
if api_implementation.Type() != 'python':
# Cpp extension cannot call Add on a DescriptorPool
# that uses a DescriptorDatabase.
# TODO(jieluo): Fix python and cpp extension diff.
# TODO: Fix python and cpp extension diff.
return
more_messages_desc = descriptor_pb2.FileDescriptorProto.FromString(
more_messages_pb2.DESCRIPTOR.serialized_pb)
@ -509,7 +509,7 @@ class DescriptorPoolTestBase(object):
if api_implementation.Type() != 'python':
# Cpp extension cannot call Add on a DescriptorPool
# that uses a DescriptorDatabase.
# TODO(jieluo): Fix python and cpp extension diff.
# TODO: Fix python and cpp extension diff.
return
unittest_fd = descriptor_pb2.FileDescriptorProto.FromString(
unittest_pb2.DESCRIPTOR.serialized_pb)
@ -688,7 +688,7 @@ class SecondaryDescriptorFromDescriptorDB(DescriptorPoolTestBase,
# file can not build. So when FindMessageTypeByName('ErrorMessage') was
# called the first time, a KeyError will be raised but call the find
# method later will return a descriptor which is not build.
# TODO(jieluo): fix pure python to revert the load if file can not be build
# TODO: fix pure python to revert the load if file can not be build
if api_implementation.Type() != 'python':
error_msg = ('Invalid proto descriptor for file "error_file":\\n '
'collector.ErrorMessage.nested_message_field: "SubMessage" '

@ -668,7 +668,7 @@ class GeneratedDescriptorTest(unittest.TestCase):
self.assertRaises(StopIteration, next, reversed_iterator)
expected_list[0] = 'change value'
self.assertNotEqual(expected_list, sequence)
# TODO(jieluo): Change __repr__ support for DescriptorSequence.
# TODO: Change __repr__ support for DescriptorSequence.
if api_implementation.Type() == 'python':
self.assertEqual(str(list(sequence)), str(sequence))
else:
@ -698,7 +698,7 @@ class GeneratedDescriptorTest(unittest.TestCase):
self.assertEqual(mapping.get(key), item)
with self.assertRaises(TypeError):
mapping.get()
# TODO(jieluo): Fix python and cpp extension diff.
# TODO: Fix python and cpp extension diff.
if api_implementation.Type() == 'cpp':
self.assertEqual(None, mapping.get([]))
else:
@ -718,7 +718,7 @@ class GeneratedDescriptorTest(unittest.TestCase):
self.assertNotEqual(mapping, excepted_dict)
self.assertRaises(KeyError, mapping.__getitem__, 'key_error')
self.assertRaises(KeyError, mapping.__getitem__, len(mapping) + 1)
# TODO(jieluo): Add __repr__ support for DescriptorMapping.
# TODO: Add __repr__ support for DescriptorMapping.
if api_implementation.Type() == 'cpp':
self.assertEqual(str(mapping)[0], '<')
else:
@ -1066,7 +1066,7 @@ class DescriptorCopyToProtoTest(unittest.TestCase):
@unittest.skipIf(
api_implementation.Type() == 'python',
'Pure python does not raise error.')
# TODO(jieluo): Fix pure python to check with the proto type.
# TODO: Fix pure python to check with the proto type.
def testCopyToProto_TypeError(self):
file_proto = descriptor_pb2.FileDescriptorProto()
self.assertRaises(TypeError,

@ -34,8 +34,8 @@ def _VerifyExtensionHandle(message, extension_handle):
message.DESCRIPTOR.full_name))
# TODO(robinson): Unify error handling of "unknown extension" crap.
# TODO(robinson): Support iteritems()-style iteration over all
# TODO: Unify error handling of "unknown extension" crap.
# TODO: Support iteritems()-style iteration over all
# extensions with the "has" bits turned on?
class _ExtensionDict(object):

@ -5,7 +5,7 @@
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
# TODO(robinson): Flesh this out considerably. We focused on reflection_test.py
# TODO: Flesh this out considerably. We focused on reflection_test.py
# first, since it's testing the subtler code, and since it provides decent
# indirect testing of the protocol compiler output.
@ -44,7 +44,7 @@ class GeneratorTest(unittest.TestCase):
def testEnums(self):
# We test only module-level enums here.
# TODO(robinson): Examine descriptors directly to check
# TODO: Examine descriptors directly to check
# enum descriptor output.
self.assertEqual(4, unittest_pb2.FOREIGN_FOO)
self.assertEqual(5, unittest_pb2.FOREIGN_BAR)
@ -127,7 +127,7 @@ class GeneratorTest(unittest.TestCase):
proto = unittest_custom_options_pb2.TestMessageWithCustomOptions()
enum_options = proto.DESCRIPTOR.enum_types_by_name['AnEnum'].GetOptions()
self.assertTrue(enum_options is not None)
# TODO(gps): We really should test for the presence of the enum_opt1
# TODO: We really should test for the presence of the enum_opt1
# extension and for its value to be set to -789.
# Options that are explicitly marked RETENTION_SOURCE should not be present

@ -97,7 +97,7 @@ class MessageTest(unittest.TestCase):
msg = message_module.TestAllTypes()
self.assertRaises(TypeError, msg.FromString, 0)
self.assertRaises(Exception, msg.FromString, '0')
# TODO(jieluo): Fix cpp extension to raise error instead of warning.
# TODO: Fix cpp extension to raise error instead of warning.
# b/27494216
end_tag = encoder.TagBytes(1, 4)
if (api_implementation.Type() == 'python' or
@ -548,7 +548,7 @@ class MessageTest(unittest.TestCase):
"""Check some different types with the default comparator."""
message = message_module.TestAllTypes()
# TODO(mattp): would testing more scalar types strengthen test?
# TODO: would testing more scalar types strengthen test?
message.repeated_int32.append(1)
message.repeated_int32.append(3)
message.repeated_int32.append(2)
@ -1459,7 +1459,7 @@ class Proto2Test(unittest.TestCase):
# This is still an incomplete proto - so serializing should fail
self.assertRaises(message.EncodeError, unpickled_message.SerializeToString)
# TODO(haberman): this isn't really a proto2-specific test except that this
# TODO: this isn't really a proto2-specific test except that this
# message has a required field in it. Should probably be factored out so
# that we can test the other parts with proto3.
def testParsingMerge(self):
@ -1983,7 +1983,7 @@ class Proto3Test(unittest.TestCase):
self.assertIn(-456, msg2.map_int32_foreign_message)
self.assertEqual(2, len(msg2.map_int32_foreign_message))
msg2.map_int32_foreign_message[123].c = 1
# TODO(jieluo): Fix text format for message map.
# TODO: Fix text format for message map.
self.assertIn(
str(msg2.map_int32_foreign_message),
('{-456: , 123: c: 1\n}', '{123: c: 1\n, -456: }'))
@ -2304,7 +2304,7 @@ class Proto3Test(unittest.TestCase):
def testMapItems(self):
# Map items used to have strange behaviors when use c extension. Because
# [] may reorder the map and invalidate any existing iterators.
# TODO(jieluo): Check if [] reordering the map is a bug or intended
# TODO: Check if [] reordering the map is a bug or intended
# behavior.
msg = map_unittest_pb2.TestMap()
msg.map_string_string['local_init_op'] = ''
@ -2424,7 +2424,7 @@ class Proto3Test(unittest.TestCase):
if api_implementation.Type() == 'cpp':
# Need to keep the map reference because of b/27942626.
# TODO(jieluo): Remove it.
# TODO: Remove it.
unused_map = msg.map_int32_all_types # pylint: disable=unused-variable
msg_value = msg.map_int32_all_types[2]
msg.Clear()

@ -72,7 +72,7 @@ message TestFullKeyword {
optional google.protobuf.internal.class field2 = 2;
}
// TODO(jieluo): Add keyword support for service.
// TODO: Add keyword support for service.
// service False {
// rpc Bar(class) returns (class);
// }

@ -7,7 +7,7 @@
# This code is meant to work on Python 2.4 and above only.
#
# TODO(robinson): Helpers for verbose, common checks like seeing if a
# TODO: Helpers for verbose, common checks like seeing if a
# descriptor's cpp_type is CPPTYPE_MESSAGE.
"""Contains a metaclass and helper functions used to create
@ -208,7 +208,7 @@ def _PropertyName(proto_field_name):
proto_field_name: The protocol message field name, exactly
as it appears (or would appear) in a .proto file.
"""
# TODO(robinson): Escape Python keywords (e.g., yield), and test this support.
# TODO: Escape Python keywords (e.g., yield), and test this support.
# nnorwitz makes my day by writing:
# """
# FYI. See the keyword module in the stdlib. This could be as simple as:
@ -223,7 +223,7 @@ def _PropertyName(proto_field_name):
# the same transformation. Note that currently if you name a field "yield",
# you can still access it just fine using getattr/setattr -- it's not even
# that cumbersome to do so.
# TODO(kenton): Remove this method entirely if/when everyone agrees with my
# TODO: Remove this method entirely if/when everyone agrees with my
# position.
return proto_field_name
@ -457,7 +457,7 @@ def _DefaultValueConstructorForField(field):
return MakeSubMessageDefault
def MakeScalarDefault(message):
# TODO(protobuf-team): This may be broken since there may not be
# TODO: This may be broken since there may not be
# default_value. Combine with has_default_value somehow.
return field.default_value
return MakeScalarDefault
@ -682,7 +682,7 @@ def _AddPropertiesForNonRepeatedScalarField(field, cls):
default_value = field.default_value
def getter(self):
# TODO(protobuf-team): This may be broken since there may not be
# TODO: This may be broken since there may not be
# default_value. Combine with has_default_value somehow.
return self._fields.get(field, default_value)
getter.__module__ = None
@ -732,7 +732,7 @@ def _AddPropertiesForNonRepeatedCompositeField(field, cls):
field: A FieldDescriptor for this field.
cls: The class we're constructing.
"""
# TODO(robinson): Remove duplication with similar method
# TODO: Remove duplication with similar method
# for non-repeated scalars.
proto_field_name = field.name
property_name = _PropertyName(proto_field_name)
@ -772,17 +772,17 @@ def _AddPropertiesForExtensions(descriptor, cls):
constant_name = extension_name.upper() + '_FIELD_NUMBER'
setattr(cls, constant_name, extension_field.number)
# TODO(amauryfa): Migrate all users of these attributes to functions like
# TODO: Migrate all users of these attributes to functions like
# pool.FindExtensionByNumber(descriptor).
if descriptor.file is not None:
# TODO(amauryfa): Use cls.MESSAGE_FACTORY.pool when available.
# TODO: Use cls.MESSAGE_FACTORY.pool when available.
pool = descriptor.file.pool
def _AddStaticMethods(cls):
# TODO(robinson): This probably needs to be thread-safe(?)
# TODO: This probably needs to be thread-safe(?)
def RegisterExtension(field_descriptor):
field_descriptor.containing_type = cls.DESCRIPTOR
# TODO(amauryfa): Use cls.MESSAGE_FACTORY.pool when available.
# TODO: Use cls.MESSAGE_FACTORY.pool when available.
# pylint: disable=protected-access
cls.DESCRIPTOR.file.pool._AddExtensionDescriptor(field_descriptor)
_AttachFieldHelpers(cls, field_descriptor)
@ -934,7 +934,7 @@ def _InternalUnpackAny(msg):
Returns:
The unpacked message.
"""
# TODO(amauryfa): Don't use the factory of generated messages.
# TODO: Don't use the factory of generated messages.
# To make Any work with custom factories, use the message factory of the
# parent message.
# pylint: disable=g-import-not-at-top
@ -946,7 +946,7 @@ def _InternalUnpackAny(msg):
if not type_url:
return None
# TODO(haberman): For now we just strip the hostname. Better logic will be
# TODO: For now we just strip the hostname. Better logic will be
# required.
type_name = type_url.split('/')[-1]
descriptor = factory.pool.FindMessageTypeByName(type_name)
@ -980,7 +980,7 @@ def _AddEqualsMethod(message_descriptor, cls):
if not self.ListFields() == other.ListFields():
return False
# TODO(jieluo): Fix UnknownFieldSet to consider MessageSet extensions,
# TODO: Fix UnknownFieldSet to consider MessageSet extensions,
# then use it for the comparison.
unknown_fields = list(self._unknown_fields)
unknown_fields.sort()
@ -1177,7 +1177,7 @@ def _AddMergeFromStringMethod(message_descriptor, cls):
field_number, wire_type = wire_format.UnpackTag(tag)
if field_number == 0:
raise message_mod.DecodeError('Field number 0 is illegal.')
# TODO(jieluo): remove old_pos.
# TODO: remove old_pos.
old_pos = new_pos
(data, new_pos) = decoder._DecodeUnknownField(
buffer, new_pos, wire_type) # pylint: disable=protected-access
@ -1185,7 +1185,7 @@ def _AddMergeFromStringMethod(message_descriptor, cls):
return pos
# pylint: disable=protected-access
unknown_field_set._add(field_number, wire_type, data)
# TODO(jieluo): remove _unknown_fields.
# TODO: remove _unknown_fields.
new_pos = local_SkipField(buffer, old_pos, end, tag_bytes)
if new_pos == -1:
return pos

@ -190,7 +190,7 @@ class ReflectionTest(unittest.TestCase):
self.assertEqual(3, message.ByteSize())
message = message_module.TestAllTypes(repeated_int32=[12])
# TODO(jieluo): Add this test back for proto3
# TODO: Add this test back for proto3
if message_module is unittest_pb2:
self.assertEqual(3, message.ByteSize())
@ -353,7 +353,7 @@ class ReflectionTest(unittest.TestCase):
self.assertRaises(TypeError, setattr, proto, 'optional_bool', 'foo')
self.assertRaises(TypeError, setattr, proto, 'optional_float', 'foo')
self.assertRaises(TypeError, setattr, proto, 'optional_double', 'foo')
# TODO(jieluo): Fix type checking difference for python and c extension
# TODO: Fix type checking difference for python and c extension
if (api_implementation.Type() == 'python' or
(sys.version_info.major, sys.version_info.minor) >= (3, 10)):
self.assertRaises(TypeError, setattr, proto, 'optional_bool', 1.1)
@ -481,7 +481,7 @@ class ReflectionTest(unittest.TestCase):
self.assertEqual(0xffffffffffff, proto.optional_uint64)
proto.optional_uint64 = 0xffffffffffffffff
self.assertEqual(0xffffffffffffffff, proto.optional_uint64)
# TODO(robinson): Test all other scalar field types.
# TODO: Test all other scalar field types.
def testEnums(self, message_module):
proto = message_module.TestAllTypes()
@ -784,7 +784,7 @@ class ReflectionTest(unittest.TestCase):
messages.remove(messages[0])
self.assertEqual(len(messages), 0)
# TODO(anuraag): Implement deepcopy for extension dict
# TODO: Implement deepcopy for extension dict
def testDisconnectingBeforeClear(self, message_module):
proto = message_module.TestAllTypes()
@ -1157,7 +1157,7 @@ class Proto2ReflectionTest(unittest.TestCase):
proto.ClearField('optional_int32')
self.assertEqual(0, proto.optional_int32)
self.assertFalse(proto.HasField('optional_int32'))
# TODO(robinson): Test all other scalar field types.
# TODO: Test all other scalar field types.
def testRepeatedScalars(self):
proto = unittest_pb2.TestAllTypes()
@ -2456,11 +2456,11 @@ class ByteSizeTest(unittest.TestCase):
self.assertEqual(2, len(repeated_nested_message))
del repeated_nested_message[0:1]
# TODO(jieluo): Fix cpp extension bug when delete repeated message.
# TODO: Fix cpp extension bug when delete repeated message.
if api_implementation.Type() == 'python':
self.assertEqual(1, len(repeated_nested_message))
del repeated_nested_message[-1]
# TODO(jieluo): Fix cpp extension bug when delete repeated message.
# TODO: Fix cpp extension bug when delete repeated message.
if api_implementation.Type() == 'python':
self.assertEqual(0, len(repeated_nested_message))
@ -3339,7 +3339,7 @@ class ClassAPITest(unittest.TestCase):
# conflicting message descriptors.
def testParsingFlatClassWithExplicitClassDeclaration(self):
"""Test that the generated class can parse a flat message."""
# TODO(xiaofeng): This test fails with cpp implementation in the call
# TODO: This test fails with cpp implementation in the call
# of six.with_metaclass(). The other two callsites of with_metaclass
# in this file are both excluded from cpp test, so it might be expected
# to fail. Need someone more familiar with the python code to take a

@ -1262,7 +1262,7 @@ class OnlyWorksWithProto2RightNowTests(TextFormatBase):
% (letter,) for letter in string.ascii_uppercase))
self.CompareToGoldenText(text_format.MessageToString(message), golden)
# TODO(teboring): In c/137553523, not serializing default value for map entry
# TODO: In c/137553523, not serializing default value for map entry
# message has been fixed. This test needs to be disabled in order to submit
# that cl. Add this back when c/137553523 has been submitted.
# def testMapOrderSemantics(self):

@ -5,7 +5,7 @@
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
# TODO(robinson): We should just make these methods all "pure-virtual" and move
# TODO: We should just make these methods all "pure-virtual" and move
# all implementation out, into reflection.py for now.
@ -37,13 +37,13 @@ class Message(object):
shown below.
"""
# TODO(robinson): Link to an HTML document here.
# TODO: Link to an HTML document here.
# TODO(robinson): Document that instances of this class will also
# TODO: Document that instances of this class will also
# have an Extensions attribute with __getitem__ and __setitem__.
# Again, not sure how to best convey this.
# TODO(robinson): Document these fields and methods.
# TODO: Document these fields and methods.
__slots__ = []
@ -125,7 +125,7 @@ class Message(object):
"""
raise NotImplementedError
# TODO(robinson): MergeFromString() should probably return None and be
# TODO: MergeFromString() should probably return None and be
# implemented in terms of a helper that returns the # of bytes read. Our
# deserialization routines would use the helper when recursively
# deserializing, but the end user would almost always just want the no-return
@ -160,8 +160,8 @@ class Message(object):
Raises:
DecodeError: if the input cannot be parsed.
"""
# TODO(robinson): Document handling of unknown fields.
# TODO(robinson): When we switch to a helper, this will return None.
# TODO: Document handling of unknown fields.
# TODO: When we switch to a helper, this will return None.
raise NotImplementedError
def ParseFromString(self, serialized):
@ -206,13 +206,13 @@ class Message(object):
"""
raise NotImplementedError
# TODO(robinson): Decide whether we like these better
# TODO: Decide whether we like these better
# than auto-generated has_foo() and clear_foo() methods
# on the instances themselves. This way is less consistent
# with C++, but it makes reflection-type access easier and
# reduces the number of magically autogenerated things.
#
# TODO(robinson): Be sure to document (and test) exactly
# TODO: Be sure to document (and test) exactly
# which field names are accepted here. Are we case-sensitive?
# What do we do with fields that share names with Python keywords
# like 'lambda' and 'yield'?
@ -340,7 +340,7 @@ class Message(object):
def FromString(cls, s):
raise NotImplementedError
# TODO(b/286557203): Remove it in OSS
# TODO: Remove it in OSS
@staticmethod
def RegisterExtension(field_descriptor):
raise NotImplementedError

@ -82,7 +82,7 @@ def GetMessageClassesForFiles(files, pool):
for extension in file_desc.extensions_by_name.values():
extended_class = GetMessageClass(extension.containing_type)
if api_implementation.Type() != 'python':
# TODO(b/286443080): Remove this check here. Duplicate extension
# TODO: Remove this check here. Duplicate extension
# register check should be in descriptor_pool.
if extension is not pool.FindExtensionByNumber(
extension.containing_type, extension.number
@ -120,7 +120,7 @@ def _InternalCreateMessageClass(descriptor):
for extension in result_class.DESCRIPTOR.extensions:
extended_class = GetMessageClass(extension.containing_type)
if api_implementation.Type() != 'python':
# TODO(b/286443080): Remove this check here. Duplicate extension
# TODO: Remove this check here. Duplicate extension
# register check should be in descriptor_pool.
pool = extension.containing_type.file.pool
if extension is not pool.FindExtensionByNumber(

@ -18,7 +18,7 @@ from google.protobuf.internal import api_implementation
# pylint: disable=protected-access
_message = api_implementation._c_module
# TODO(jieluo): Remove this import after fix api_implementation
# TODO: Remove this import after fix api_implementation
if _message is None:
from google.protobuf.pyext import _message

@ -100,7 +100,7 @@ PyObject* PyString_FromCppString(const std::string& str) {
//
// From user code, descriptors still look immutable.
//
// TODO(amauryfa): Change the proto2 compiler to remove the assignments, and
// TODO: Change the proto2 compiler to remove the assignments, and
// remove this hack.
bool _CalledFromGeneratedFile(int stacklevel) {
#ifdef PYPY_VERSION
@ -1603,7 +1603,7 @@ PyObject* PyFileDescriptor_FromDescriptorWithSerializedPb(
Py_XINCREF(serialized_pb);
cfile_descriptor->serialized_pb = serialized_pb;
}
// TODO(amauryfa): In the case of a cached object, check that serialized_pb
// TODO: In the case of a cached object, check that serialized_pb
// is the same as before.
return py_descriptor;

@ -481,7 +481,7 @@ static PyObject* FindAllExtensions(PyObject* self, PyObject* arg) {
// However we do check that the existing descriptor already exists in the pool,
// which appears to always be true for existing calls -- but then why do people
// call a function that will just be a no-op?
// TODO(amauryfa): Need to investigate further.
// TODO: Need to investigate further.
static PyObject* AddFileDescriptor(PyObject* self, PyObject* descriptor) {
const FileDescriptor* file_descriptor =
@ -756,7 +756,7 @@ bool InitDescriptorPool() {
// The default DescriptorPool used everywhere in this module.
// Today it's the python_generated_pool.
// TODO(amauryfa): Remove all usages of this function: the pool should be
// TODO: Remove all usages of this function: the pool should be
// derived from the context.
PyDescriptorPool* GetDefaultDescriptorPool() {
return python_generated_pool;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save