Commit 96095f3a authored by Adam Cozzette's avatar Adam Cozzette Committed by GitHub

Merge pull request #3176 from acozzette/fix-3114

Ensure that for Java, imports of .proto files with empty packages works
parents c202b06d e9c15d60
......@@ -182,10 +182,16 @@ void SharedCodeGenerator::GenerateDescriptors(io::Printer* printer) {
std::vector<std::pair<string, string> > dependencies;
for (int i = 0; i < file_->dependency_count(); i++) {
string filename = file_->dependency(i)->name();
string classname = FileJavaPackage(file_->dependency(i)) + "." +
name_resolver_->GetDescriptorClassName(
file_->dependency(i));
dependencies.push_back(std::make_pair(filename, classname));
string package = FileJavaPackage(file_->dependency(i));
string classname = name_resolver_->GetDescriptorClassName(
file_->dependency(i));
string full_name;
if (package.empty()) {
full_name = classname;
} else {
full_name = package + "." + classname;
}
dependencies.push_back(std::make_pair(filename, full_name));
}
// -----------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment