Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
661f87ce
Commit
661f87ce
authored
Jun 07, 2013
by
Wink Saville
Committed by
Gerrit Code Review
Jun 07, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Fix enum field references with java_multiple_files."
parents
63d4b5fd
a220fe61
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
javanano_helpers.cc
src/google/protobuf/compiler/javanano/javanano_helpers.cc
+14
-4
unittest_enum_multiplejava_nano.proto
src/google/protobuf/unittest_enum_multiplejava_nano.proto
+4
-0
No files found.
src/google/protobuf/compiler/javanano/javanano_helpers.cc
View file @
661f87ce
...
@@ -208,7 +208,8 @@ string ClassName(const Params& params, const EnumDescriptor* descriptor) {
...
@@ -208,7 +208,8 @@ string ClassName(const Params& params, const EnumDescriptor* descriptor) {
const
string
full_name
=
descriptor
->
full_name
();
const
string
full_name
=
descriptor
->
full_name
();
// Remove enum class name as we use int's for enums
// Remove enum class name as we use int's for enums
string
base_name
=
full_name
.
substr
(
0
,
full_name
.
find_last_of
(
'.'
));
int
last_dot_in_name
=
full_name
.
find_last_of
(
'.'
);
string
base_name
=
full_name
.
substr
(
0
,
last_dot_in_name
);
if
(
!
file
->
package
().
empty
())
{
if
(
!
file
->
package
().
empty
())
{
if
(
file
->
package
()
==
base_name
.
substr
(
0
,
file
->
package
().
size
()))
{
if
(
file
->
package
()
==
base_name
.
substr
(
0
,
file
->
package
().
size
()))
{
...
@@ -226,13 +227,22 @@ string ClassName(const Params& params, const EnumDescriptor* descriptor) {
...
@@ -226,13 +227,22 @@ string ClassName(const Params& params, const EnumDescriptor* descriptor) {
// Construct the path name from the package and outer class
// Construct the path name from the package and outer class
// Add the java package name if it ex
si
ts
// Add the java package name if it ex
is
ts
if
(
params
.
has_java_package
(
file_name
))
{
if
(
params
.
has_java_package
(
file_name
))
{
result
+=
params
.
java_package
(
file_name
);
result
+=
params
.
java_package
(
file_name
);
}
}
// Add the outer classname if it exists
// If the java_multiple_files option is present, we will generate enums into separate
if
(
params
.
has_java_outer_classname
(
file_name
))
{
// classes, each named after the original enum type. This takes precedence over
// any outer_classname.
if
(
params
.
java_multiple_files
()
&&
last_dot_in_name
!=
string
::
npos
)
{
string
enum_simple_name
=
full_name
.
substr
(
last_dot_in_name
+
1
);
if
(
!
result
.
empty
())
{
result
+=
"."
;
}
result
+=
enum_simple_name
;
}
else
if
(
params
.
has_java_outer_classname
(
file_name
))
{
// Add the outer classname if it exists
if
(
!
result
.
empty
())
{
if
(
!
result
.
empty
())
{
result
+=
"."
;
result
+=
"."
;
}
}
...
...
src/google/protobuf/unittest_enum_multiplejava_nano.proto
View file @
661f87ce
...
@@ -47,3 +47,7 @@ enum SecondTopLevelEnum {
...
@@ -47,3 +47,7 @@ enum SecondTopLevelEnum {
SECOND_TOP_LEVEL_SECOND
=
2
;
SECOND_TOP_LEVEL_SECOND
=
2
;
}
}
message
SomeMessage
{
optional
FirstTopLevelEnum
first
=
1
;
optional
SecondTopLevelEnum
second
=
2
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment