diff --git a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportNormalizer.java b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportNormalizer.java index d1b0fdcd5..63dd2c176 100644 --- a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportNormalizer.java +++ b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportNormalizer.java @@ -23,7 +23,7 @@ public class ImportNormalizer { public ImportNormalizer(QualifiedName importedNamespace, boolean wildCard, boolean ignoreCase) { this.ignoreCase = ignoreCase; - if (importedNamespace == null || importedNamespace.getSegmentCount() < 1) { + if (importedNamespace == null || importedNamespace.isEmpty()) { throw new IllegalArgumentException("Imported namespace must not be null / empty"); } hasWildCard = wildCard; diff --git a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportedNamespaceAwareLocalScopeProvider.java b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportedNamespaceAwareLocalScopeProvider.java index b989486c7..2e2881d95 100644 --- a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportedNamespaceAwareLocalScopeProvider.java +++ b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportedNamespaceAwareLocalScopeProvider.java @@ -161,7 +161,7 @@ public class ImportedNamespaceAwareLocalScopeProvider extends AbstractGlobalScop if (Strings.isEmpty(namespace)) return null; QualifiedName importedNamespace = qualifiedNameConverter.toQualifiedName(namespace); - if (importedNamespace == null || importedNamespace.getSegmentCount() < 1) { + if (importedNamespace == null || importedNamespace.isEmpty()) { return null; } boolean hasWildCard = ignoreCase ? @@ -191,7 +191,7 @@ public class ImportedNamespaceAwareLocalScopeProvider extends AbstractGlobalScop boolean ignoreCase = isIgnoreCase(reference); final List namespaceResolvers = getImportedNamespaceResolvers(context, ignoreCase); if (!namespaceResolvers.isEmpty()) { - if (isRelativeImport() && name!=null) { + if (isRelativeImport() && name!=null && !name.isEmpty()) { ImportNormalizer localNormalizer = doCreateImportNormalizer(name, true, ignoreCase); result = createImportScope(result, singletonList(localNormalizer), allDescriptions, reference.getEReferenceType(), isIgnoreCase(reference)); }