Merge pull request #3176 from acozzette/fix-3114
Ensure that for Java, imports of .proto files with empty packages works
This commit is contained in:
commit
96095f3a85
1 changed files with 10 additions and 4 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Reference in a new issue