From 22999fe67dd27a1b03e2fc6c3c33e4d3cd9a00d9 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Mon, 24 Oct 2016 15:51:33 +0300 Subject: [PATCH] Set hasValueArguments in KotlinAnnotationEntryStub to 'true' only if some arguments exist Currently '()' is used for resolving ambiguity in parsing when annotating function types. This way a decompiled code will need brackets, but compile code will have annotation without parameters. This commit will allow to make both stub-trees consistent. Tested in ClsStubBuilderTestGenerated.testAnnotationsOnNullableTypes() --- .../jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt | 2 +- .../stubs/elements/KtAnnotationEntryElementType.java | 4 +++- .../stubBuilder/Annotations/Annotations.kt | 1 + .../stubBuilder/Annotations/Annotations.txt | 12 ++++++++++++ .../AnnotationsOnNullableTypes.txt | 5 +++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt index 799db9ca2d6..ba059505352 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt @@ -23,7 +23,7 @@ object KotlinStubVersions { // Though only kotlin declarations (no code in the bodies) are stubbed, please do increase this version // if you are not 100% sure it can be avoided. // Increasing this version will lead to reindexing of all kotlin source files on the first IDE startup with the new version. - const val SOURCE_STUB_VERSION = 118 + const val SOURCE_STUB_VERSION = 119 // Binary stub version should be increased if stub format (org.jetbrains.kotlin.psi.stubs.impl) is changed // or changes are made to the core stub building code (org.jetbrains.kotlin.idea.decompiler.stubBuilder). 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 dc17dd24546..ce05f8264a3 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 @@ -25,6 +25,7 @@ import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.kotlin.psi.KtAnnotationEntry; import org.jetbrains.kotlin.psi.KtPsiUtil; +import org.jetbrains.kotlin.psi.KtValueArgumentList; import org.jetbrains.kotlin.psi.stubs.KotlinAnnotationEntryStub; import org.jetbrains.kotlin.psi.stubs.impl.KotlinAnnotationEntryStubImpl; import org.jetbrains.kotlin.name.Name; @@ -41,7 +42,8 @@ public class KtAnnotationEntryElementType extends KtStubElementType