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()
This commit is contained in:
@@ -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).
|
||||
|
||||
+3
-1
@@ -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<KotlinAnnota
|
||||
public KotlinAnnotationEntryStub createStub(@NotNull KtAnnotationEntry psi, StubElement parentStub) {
|
||||
Name shortName = KtPsiUtil.getShortName(psi);
|
||||
String resultName = shortName != null ? shortName.asString() : psi.getText();
|
||||
boolean hasValueArguments = psi.getValueArgumentList() != null;
|
||||
KtValueArgumentList valueArgumentList = psi.getValueArgumentList();
|
||||
boolean hasValueArguments = valueArgumentList != null && !valueArgumentList.getArguments().isEmpty();
|
||||
return new KotlinAnnotationEntryStubImpl(parentStub, StringRef.fromString(resultName), hasValueArguments);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user