From 8f8cbfcfa5b701f29d4859c07ff4b97b65d09c6c Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Thu, 8 Feb 2018 18:51:12 +0100 Subject: [PATCH] KtAnnotationEntry#name is stubbed and is nullable --- .../kotlin/psi/KtAnnotationEntry.java | 25 +++++++++++++++++++ .../org/jetbrains/kotlin/psi/KtPsiUtil.java | 17 +------------ .../kotlin/psi/stubs/StubInterfaces.kt | 2 +- .../KtAnnotationEntryElementType.java | 4 +-- .../impl/KotlinAnnotationEntryStubImpl.kt | 4 +-- 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtAnnotationEntry.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtAnnotationEntry.java index adece1135d1..fff03721fa1 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtAnnotationEntry.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtAnnotationEntry.java @@ -22,6 +22,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.KtNodeTypes; import org.jetbrains.kotlin.lexer.KtTokens; +import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.psi.stubs.KotlinAnnotationEntryStub; import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes; @@ -121,4 +122,28 @@ public class KtAnnotationEntry extends KtElementImplStub annotationEntries = modifierList.getAnnotationEntries(); for (KtAnnotationEntry annotation : annotationEntries) { - Name shortName = getShortName(annotation); + Name shortName = annotation.getShortName(); if (KotlinBuiltIns.FQ_NAMES.deprecated.shortName().equals(shortName)) { return true; } 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 3b9d9bfa8ee..7a247022d47 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/StubInterfaces.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/StubInterfaces.kt @@ -57,7 +57,7 @@ interface KotlinObjectStub : KotlinClassOrObjectStub { } interface KotlinAnnotationEntryStub : StubElement { - fun getShortName(): String + fun getShortName(): String? fun hasValueArguments(): Boolean } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/KtAnnotationEntryElementType.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/KtAnnotationEntryElementType.java index ce05f8264a3..6330eb1a019 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/KtAnnotationEntryElementType.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/KtAnnotationEntryElementType.java @@ -40,8 +40,8 @@ public class KtAnnotationEntryElementType extends KtStubElementType?, - private val shortName: StringRef, + private val shortName: StringRef?, private val hasValueArguments: Boolean ) : KotlinStubBaseImpl(parent, KtStubElementTypes.ANNOTATION_ENTRY), KotlinAnnotationEntryStub { - override fun getShortName() = shortName.string + override fun getShortName() = shortName?.string override fun hasValueArguments() = hasValueArguments }