Skip to content

Commit 9dc5aaa

Browse files
cho-mcopybara-github
authored andcommitted
PROTOC_EXPORT in java/names.h to expose symbols (#19363)
Otherwise libprotoc built by CMake hides symbols needed by grpc-java (grpc/grpc-java#11475) --- I wasn't sure if other functions should be exposed, but just added them based on objectivec/names.h where everything is PROTOC_EXPORT. Can restrict to only minimum if preferred (for grpc-java, this would be `ClassName`) Closes #19363 COPYBARA_INTEGRATE_REVIEW=#19363 from cho-m:java-names-protoc-export 1bf84d4 PiperOrigin-RevId: 700381234
1 parent da1c7c0 commit 9dc5aaa

File tree

1 file changed

+17
-15
lines changed
  • src/google/protobuf/compiler/java

1 file changed

+17
-15
lines changed

src/google/protobuf/compiler/java/names.h

+17-15
Original file line numberDiff line numberDiff line change
@@ -41,87 +41,89 @@ namespace java {
4141
//
4242
// Returns:
4343
// The fully-qualified Java class name.
44-
std::string ClassName(const Descriptor* descriptor);
44+
PROTOC_EXPORT std::string ClassName(const Descriptor* descriptor);
4545

4646
// Requires:
4747
// descriptor != NULL
4848
//
4949
// Returns:
5050
// The fully-qualified Java class name.
51-
std::string ClassName(const EnumDescriptor* descriptor);
51+
PROTOC_EXPORT std::string ClassName(const EnumDescriptor* descriptor);
5252

5353
// Requires:
5454
// descriptor != NULL
5555
//
5656
// Returns:
5757
// The fully-qualified Java class name.
58-
std::string ClassName(const FileDescriptor* descriptor);
58+
PROTOC_EXPORT std::string ClassName(const FileDescriptor* descriptor);
5959

6060
// Requires:
6161
// descriptor != NULL
6262
//
6363
// Returns:
6464
// The fully-qualified Java class name.
65-
std::string ClassName(const ServiceDescriptor* descriptor);
65+
PROTOC_EXPORT std::string ClassName(const ServiceDescriptor* descriptor);
6666

6767
// Requires:
6868
// descriptor != NULL
6969
//
7070
// Returns:
7171
// Java package name.
72-
std::string FileJavaPackage(const FileDescriptor* descriptor,
73-
Options options = {});
72+
PROTOC_EXPORT std::string FileJavaPackage(const FileDescriptor* descriptor,
73+
Options options = {});
7474

7575
// Requires:
7676
// descriptor != NULL
7777
//
7878
// Returns:
7979
// Java package directory.
80-
std::string JavaPackageDirectory(const FileDescriptor* file);
80+
PROTOC_EXPORT std::string JavaPackageDirectory(const FileDescriptor* file);
8181

8282
// Requires:
8383
// descriptor != NULL
8484
//
8585
// Returns:
8686
// The unqualified Java class name.
87-
std::string FileClassName(const FileDescriptor* file);
87+
PROTOC_EXPORT std::string FileClassName(const FileDescriptor* file);
8888

8989
// Requires:
9090
// descriptor != NULL
9191
// Returns:
9292
// Capitalized camel case field name.
93-
std::string CapitalizedFieldName(const FieldDescriptor* field);
93+
PROTOC_EXPORT std::string CapitalizedFieldName(const FieldDescriptor* field);
9494

9595
// Requires:
9696
// descriptor != NULL
9797
// Returns:
9898
// Capitalized camel case oneof name.
99-
std::string CapitalizedOneofName(const OneofDescriptor* oneof);
99+
PROTOC_EXPORT std::string CapitalizedOneofName(const OneofDescriptor* oneof);
100100

101101
// Returns:
102102
// Converts a name to camel-case. If cap_first_letter is true, capitalize the
103103
// first letter.
104-
std::string UnderscoresToCamelCase(absl::string_view input,
105-
bool cap_next_letter);
104+
PROTOC_EXPORT std::string UnderscoresToCamelCase(absl::string_view input,
105+
bool cap_next_letter);
106106
// Requires:
107107
// field != NULL
108108
// Returns:
109109
// Converts the field's name to camel-case, e.g. "foo_bar_baz" becomes
110110
// "fooBarBaz" or "FooBarBaz", respectively.
111-
std::string UnderscoresToCamelCase(const FieldDescriptor* field);
111+
PROTOC_EXPORT std::string UnderscoresToCamelCase(const FieldDescriptor* field);
112112

113113
// Requires:
114114
// method != NULL
115115
// Returns:
116116
// Similar, but for method names. (Typically, this merely has the effect
117117
// of lower-casing the first letter of the name.)
118-
std::string UnderscoresToCamelCase(const MethodDescriptor* method);
118+
PROTOC_EXPORT std::string UnderscoresToCamelCase(
119+
const MethodDescriptor* method);
119120

120121
// Requires:
121122
// field != NULL
122123
// Returns:
123124
// Same as UnderscoresToCamelCase, but checks for reserved keywords
124-
std::string UnderscoresToCamelCaseCheckReserved(const FieldDescriptor* field);
125+
PROTOC_EXPORT std::string UnderscoresToCamelCaseCheckReserved(
126+
const FieldDescriptor* field);
125127

126128

127129
} // namespace java

0 commit comments

Comments
 (0)