diff options
author | Brian Duff <bduff@google.com> | 2015-01-09 13:32:38 -0800 |
---|---|---|
committer | Brian Duff <bduff@google.com> | 2015-04-28 12:28:05 -0700 |
commit | fb96026b8deb79aa023c9f5c460582e8fea8f331 (patch) | |
tree | 45d106b89a44546c57846c0174764c0c367a0ab0 /src/google/protobuf/compiler/javanano/javanano_message.h | |
parent | 9ffaa50d55bf377f4693eae45483e26ca136f878 (diff) |
When no clear() is generated, still initialize fields.
https://android-review.googlesource.com/#/c/67890/ removed field
initialization from the ctor, making it just call clear() instead.
When I added the generate_clear option back (as part of the reftypes
compat mode) in https://android-review.googlesource.com/#/c/109530/,
I forgot to ensure that what clear() used to do was inlined in the
constructor.
This change fixes NPEs that are happening for users of
reftypes_compat_mode who rely on unset repeated fields being empty
arrays rather than null.
Change-Id: Idb58746c60f4a4054b7ebb5c3b0e76b16ff88184
Diffstat (limited to 'src/google/protobuf/compiler/javanano/javanano_message.h')
-rw-r--r-- | src/google/protobuf/compiler/javanano/javanano_message.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/javanano/javanano_message.h b/src/google/protobuf/compiler/javanano/javanano_message.h index 6f25a3a0..8504aa83 100644 --- a/src/google/protobuf/compiler/javanano/javanano_message.h +++ b/src/google/protobuf/compiler/javanano/javanano_message.h @@ -77,6 +77,7 @@ class MessageGenerator { const FieldDescriptor* field); void GenerateClear(io::Printer* printer); + void GenerateFieldInitializers(io::Printer* printer); void GenerateEquals(io::Printer* printer); void GenerateHashCode(io::Printer* printer); |