diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetNamespaceHeader.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetNamespaceHeader.java index edc7be8d912..4c10f5c2f8c 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetNamespaceHeader.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetNamespaceHeader.java @@ -79,10 +79,10 @@ public class JetNamespaceHeader extends JetReferenceExpression { return nameIdentifier == null ? "" : nameIdentifier.getText(); } - @Nullable + @NotNull public Name getNameAsName() { PsiElement nameIdentifier = getNameIdentifier(); - return nameIdentifier == null ? null : Name.identifier(nameIdentifier.getText()); + return nameIdentifier == null ? JetPsiUtil.ROOT_NAMESPACE_NAME : Name.identifier(nameIdentifier.getText()); } public boolean isRoot() { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java index acf1b1a32d2..be6f5a329ad 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java @@ -40,6 +40,7 @@ import java.util.Set; public class JetPsiUtil { public static final Name NO_NAME_PROVIDED = Name.special(""); + public static final Name ROOT_NAMESPACE_NAME = Name.special(""); private JetPsiUtil() { } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/JetModuleUtil.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/JetModuleUtil.java index 18bf30820b0..112628c8126 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/JetModuleUtil.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/JetModuleUtil.java @@ -17,7 +17,7 @@ package org.jetbrains.jet.lang.resolve; import org.jetbrains.jet.lang.psi.JetElement; -import org.jetbrains.jet.lang.resolve.name.Name; +import org.jetbrains.jet.lang.psi.JetPsiUtil; import org.jetbrains.jet.lang.resolve.scopes.JetScope; import org.jetbrains.jet.lang.types.NamespaceType; @@ -27,6 +27,6 @@ import org.jetbrains.jet.lang.types.NamespaceType; public class JetModuleUtil { public static NamespaceType getRootNamespaceType(JetElement expression) { // TODO: this is a stub: at least the modules' root namespaces must be indexed here - return new NamespaceType(Name.special(""), JetScope.EMPTY); + return new NamespaceType(JetPsiUtil.ROOT_NAMESPACE_NAME, JetScope.EMPTY); } }