| Index: third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.cc
|
| diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.cc b/third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.cc
|
| index e24894b1b95b18a019a5429f6467113597cc11fe..c31df2651fee478263a0a43d981b3b44d36b1f82 100644
|
| --- a/third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.cc
|
| +++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.cc
|
| @@ -101,6 +101,20 @@ string FieldName(const FieldDescriptor* field) {
|
|
|
| } // namespace
|
|
|
| +void PrintGeneratedAnnotation(io::Printer* printer, char delimiter,
|
| + const string& annotation_file) {
|
| + if (annotation_file.empty()) {
|
| + return;
|
| + }
|
| + string ptemplate =
|
| + "@javax.annotation.Generated(value=\"protoc\", comments=\"annotations:";
|
| + ptemplate.push_back(delimiter);
|
| + ptemplate.append("annotation_file");
|
| + ptemplate.push_back(delimiter);
|
| + ptemplate.append("\")\n");
|
| + printer->Print(ptemplate.c_str(), "annotation_file", annotation_file);
|
| +}
|
| +
|
| string UnderscoresToCamelCase(const string& input, bool cap_next_letter) {
|
| string result;
|
| // Note: I distrust ctype.h due to locales.
|
| @@ -481,9 +495,9 @@ bool IsDefaultValueJavaDefault(const FieldDescriptor* field) {
|
| return field->default_value_float() == 0.0;
|
| case FieldDescriptor::CPPTYPE_BOOL:
|
| return field->default_value_bool() == false;
|
| -
|
| - case FieldDescriptor::CPPTYPE_STRING:
|
| case FieldDescriptor::CPPTYPE_ENUM:
|
| + return field->default_value_enum()->number() == 0;
|
| + case FieldDescriptor::CPPTYPE_STRING:
|
| case FieldDescriptor::CPPTYPE_MESSAGE:
|
| return false;
|
|
|
| @@ -495,6 +509,11 @@ bool IsDefaultValueJavaDefault(const FieldDescriptor* field) {
|
| return false;
|
| }
|
|
|
| +bool IsByteStringWithCustomDefaultValue(const FieldDescriptor* field) {
|
| + return GetJavaType(field) == JAVATYPE_BYTES &&
|
| + field->default_value_string() != "";
|
| +}
|
| +
|
| const char* bit_masks[] = {
|
| "0x00000001",
|
| "0x00000002",
|
|
|