aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFeng Xiao <xfxyjwf@gmail.com>2015-08-24 11:25:15 -0700
committerFeng Xiao <xfxyjwf@gmail.com>2015-08-24 11:25:15 -0700
commit839b180dbae98adf6caa54d0fb87b8d0a43081dc (patch)
treeda56323fb9674fbbff718489b8cd652f499003d5 /src
parentb17ec3ca11ed13cc0d984f6d8be112c246b1994d (diff)
downloadprotobuf-839b180dbae98adf6caa54d0fb87b8d0a43081dc.tar.gz
protobuf-839b180dbae98adf6caa54d0fb87b8d0a43081dc.tar.bz2
protobuf-839b180dbae98adf6caa54d0fb87b8d0a43081dc.zip
Cherry-pick Java utf8 change.
Diffstat (limited to 'src')
-rw-r--r--src/google/protobuf/compiler/java/java_helpers.h5
-rw-r--r--src/google/protobuf/compiler/java/java_string_field.cc4
-rw-r--r--src/google/protobuf/compiler/java/java_string_field_lite.cc4
3 files changed, 5 insertions, 8 deletions
diff --git a/src/google/protobuf/compiler/java/java_helpers.h b/src/google/protobuf/compiler/java/java_helpers.h
index 99ba6a18..7eef86a7 100644
--- a/src/google/protobuf/compiler/java/java_helpers.h
+++ b/src/google/protobuf/compiler/java/java_helpers.h
@@ -336,6 +336,11 @@ inline bool IsAnyMessage(const Descriptor* descriptor) {
return descriptor->full_name() == "google.protobuf.Any";
}
+inline bool CheckUtf8(const FieldDescriptor* descriptor) {
+ return descriptor->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ||
+ descriptor->file()->options().java_string_check_utf8();
+}
+
} // namespace java
} // namespace compiler
} // namespace protobuf
diff --git a/src/google/protobuf/compiler/java/java_string_field.cc b/src/google/protobuf/compiler/java/java_string_field.cc
index 47e04659..72ebaeca 100644
--- a/src/google/protobuf/compiler/java/java_string_field.cc
+++ b/src/google/protobuf/compiler/java/java_string_field.cc
@@ -131,10 +131,6 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor,
GenerateSetBitToLocal(messageBitIndex);
}
-bool CheckUtf8(const FieldDescriptor* descriptor) {
- return descriptor->file()->options().java_string_check_utf8();
-}
-
} // namespace
// ===================================================================
diff --git a/src/google/protobuf/compiler/java/java_string_field_lite.cc b/src/google/protobuf/compiler/java/java_string_field_lite.cc
index 032715b7..092e3c29 100644
--- a/src/google/protobuf/compiler/java/java_string_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_string_field_lite.cc
@@ -115,10 +115,6 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor,
GenerateSetBitToLocal(messageBitIndex);
}
-bool CheckUtf8(const FieldDescriptor* descriptor) {
- return descriptor->file()->options().java_string_check_utf8();
-}
-
} // namespace
// ===================================================================