aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/javanano/javanano_enum.cc
diff options
context:
space:
mode:
authorGravatar Max Cai <maxtroy@google.com>2013-07-24 14:16:38 +0100
committerGravatar Max Cai <maxtroy@google.com>2013-07-25 19:49:23 +0100
commit4c4d639025f35aa10030b02b165f489168f4d293 (patch)
treea1735652fcea7573f36c9f0a40713ef36ae17181 /src/google/protobuf/compiler/javanano/javanano_enum.cc
parent09400156818ec809cfc37a950d8b599b52cef88f (diff)
Per-file java_multiple_files flag.
Imported source files may have different values for the 'java_multiple_files' option to the main source file's. Whether the fully qualified Java name of an entity should include the outer class name depends on the flag value in the file defining the referenced entity, not the main file. This CL loads the flag values from the main and all transitively imported files into the params, and generates the fully qualified Java names accordingly. If the generator option 'java_multiple_files' is set, its value overrides any in-file values in all source/imported files. This is because this generator option is typically used on either none or all source files. Change-Id: Id6a4a42426d68961dc669487d38f35530deb7d8e
Diffstat (limited to 'src/google/protobuf/compiler/javanano/javanano_enum.cc')
-rw-r--r--src/google/protobuf/compiler/javanano/javanano_enum.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/google/protobuf/compiler/javanano/javanano_enum.cc b/src/google/protobuf/compiler/javanano/javanano_enum.cc
index 66b671b1..973ef681 100644
--- a/src/google/protobuf/compiler/javanano/javanano_enum.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_enum.cc
@@ -69,9 +69,10 @@ EnumGenerator::~EnumGenerator() {}
void EnumGenerator::Generate(io::Printer* printer) {
printer->Print("// enum $classname$\n", "classname", descriptor_->name());
- bool is_own_file = params_.java_multiple_files() ||
+ const string& file_name = descriptor_->file()->name();
+ bool is_own_file = params_.java_multiple_files(file_name) ||
((descriptor_->containing_type() == NULL) &&
- !params_.has_java_outer_classname(descriptor_->file()->name()));
+ !params_.has_java_outer_classname(file_name));
if (is_own_file) {
printer->Print("public final class $classname$ {\n", "classname",