Fixed: [Issue 96] Importing files with syntax errors breaks scoping of
imported types from syntactically correct files
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java
index 6c50689..9467c56 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java
@@ -125,10 +125,12 @@
}
Resource importedResource = importedResourceFrom(anImport);
Protobuf importedRoot = rootElementOf(importedResource);
- descriptions.addAll(publicImportedTypes(importedRoot, targetType));
- if (importedRoot != null && arePackagesRelated(aPackage, importedRoot)) {
- descriptions.addAll(typesIn(importedRoot));
- continue;
+ if (importedRoot != null) {
+ descriptions.addAll(publicImportedTypes(importedRoot, targetType));
+ if (arePackagesRelated(aPackage, importedRoot)) {
+ descriptions.addAll(typesIn(importedRoot));
+ continue;
+ }
}
descriptions.addAll(children(importedResource, targetType));
}
@@ -136,7 +138,8 @@
}
private boolean isImportingDescriptor(Import anImport) {
- return descriptorProvider.descriptorLocation().toString().equals(anImport.getImportURI());
+ String descriptorLocation = descriptorProvider.descriptorLocation().toString();
+ return descriptorLocation.equals(anImport.getImportURI());
}
private <T extends Type> Collection<IEObjectDescription> allBuiltInTypes(Class<T> targetType) {