From 5e1b44eac8ec921bb8667c65b82c75b81e4788ca Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 5 Aug 2015 19:41:29 +0200 Subject: [PATCH] fix tests: imported FQ name of an import directive is nullable --- .../src/org/jetbrains/kotlin/psi/stubs/StubInterfaces.kt | 2 +- .../stubs/elements/JetImportDirectiveElementType.java | 7 +++++-- .../psi/stubs/impl/KotlinImportDirectiveStubImpl.kt | 9 +++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/StubInterfaces.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/StubInterfaces.kt index 45eee7c8c89..2e6e65c9894 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/StubInterfaces.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/StubInterfaces.kt @@ -66,7 +66,7 @@ public interface KotlinFunctionStub : KotlinCallableStubBase { public interface KotlinImportDirectiveStub : StubElement { public fun isAbsoluteInRootPackage(): Boolean public fun isAllUnder(): Boolean - public fun getImportedFqName(): FqName + public fun getImportedFqName(): FqName? public fun getAliasName(): String? public fun isValid(): Boolean } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetImportDirectiveElementType.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetImportDirectiveElementType.java index b43306cd146..53898d168e6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetImportDirectiveElementType.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetImportDirectiveElementType.java @@ -22,6 +22,7 @@ import com.intellij.psi.stubs.StubOutputStream; import com.intellij.util.io.StringRef; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import org.jetbrains.kotlin.name.FqName; import org.jetbrains.kotlin.psi.JetImportDirective; import org.jetbrains.kotlin.psi.stubs.KotlinImportDirectiveStub; import org.jetbrains.kotlin.psi.stubs.impl.KotlinImportDirectiveStubImpl; @@ -35,7 +36,8 @@ public class JetImportDirectiveElementType extends JetStubElementType, private val isAbsoluteInRootPackage: Boolean, private val isAllUnder: Boolean, - private val importedFqName: StringRef, + private val importedFqName: StringRef?, private val aliasName: StringRef?, private val isValid: Boolean) : KotlinStubBaseImpl(parent, JetStubElementTypes.IMPORT_DIRECTIVE), KotlinImportDirectiveStub { override fun isAbsoluteInRootPackage(): Boolean = isAbsoluteInRootPackage override fun isAllUnder(): Boolean = isAllUnder - override fun getImportedFqName(): FqName = FqName(StringRef.toString(importedFqName)!!) + + override fun getImportedFqName(): FqName? { + val fqNameString = StringRef.toString(importedFqName) + return if (fqNameString != null) FqName(fqNameString) else null + } + override fun getAliasName(): String? = StringRef.toString(aliasName) override fun isValid(): Boolean = isValid }