From 2d240d2925c40b59c07171705531fac29fb123d7 Mon Sep 17 00:00:00 2001 From: Dmitrii Gridin Date: Fri, 7 Oct 2022 17:21:09 +0200 Subject: [PATCH] [AA] add test on property annotations ^KT-54311 --- ...sSourceModuleSymbolByPsiTestGenerated.java | 6 + ...sSourceModuleSymbolByPsiTestGenerated.java | 6 + ...sSourceModuleSymbolByPsiTestGenerated.java | 6 + ...ertyWithAnnotations.descriptors.pretty.txt | 20 ++ .../propertyWithAnnotations.descriptors.txt | 221 +++++++++++++++++ .../symbolByPsi/propertyWithAnnotations.kt | 19 ++ .../propertyWithAnnotations.pretty.txt | 22 ++ .../symbolByPsi/propertyWithAnnotations.txt | 226 ++++++++++++++++++ 8 files changed, 526 insertions(+) create mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.descriptors.pretty.txt create mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.descriptors.txt create mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.kt create mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.pretty.txt create mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.txt diff --git a/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/symbols/Fe10IdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java b/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/symbols/Fe10IdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java index d7c783da0df..ed9c79792b1 100644 --- a/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/symbols/Fe10IdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java +++ b/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/symbols/Fe10IdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java @@ -220,6 +220,12 @@ public class Fe10IdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated extends A runTest("analysis/analysis-api/testData/symbols/symbolByPsi/outerAndInnerClasses.kt"); } + @Test + @TestMetadata("propertyWithAnnotations.kt") + public void testPropertyWithAnnotations() throws Exception { + runTest("analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.kt"); + } + @Test @TestMetadata("topLevelFunctions.kt") public void testTopLevelFunctions() throws Exception { diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/symbols/FirIdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/symbols/FirIdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java index 456cd3ebdee..3b78170e156 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/symbols/FirIdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/symbols/FirIdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java @@ -220,6 +220,12 @@ public class FirIdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated extends Ab runTest("analysis/analysis-api/testData/symbols/symbolByPsi/outerAndInnerClasses.kt"); } + @Test + @TestMetadata("propertyWithAnnotations.kt") + public void testPropertyWithAnnotations() throws Exception { + runTest("analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.kt"); + } + @Test @TestMetadata("topLevelFunctions.kt") public void testTopLevelFunctions() throws Exception { diff --git a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/symbols/FirStandaloneNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/symbols/FirStandaloneNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java index 70090824228..509cec16f59 100644 --- a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/symbols/FirStandaloneNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java +++ b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/symbols/FirStandaloneNormalAnalysisSourceModuleSymbolByPsiTestGenerated.java @@ -220,6 +220,12 @@ public class FirStandaloneNormalAnalysisSourceModuleSymbolByPsiTestGenerated ext runTest("analysis/analysis-api/testData/symbols/symbolByPsi/outerAndInnerClasses.kt"); } + @Test + @TestMetadata("propertyWithAnnotations.kt") + public void testPropertyWithAnnotations() throws Exception { + runTest("analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.kt"); + } + @Test @TestMetadata("topLevelFunctions.kt") public void testTopLevelFunctions() throws Exception { diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.descriptors.pretty.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.descriptors.pretty.txt new file mode 100644 index 00000000000..73fdb95564a --- /dev/null +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.descriptors.pretty.txt @@ -0,0 +1,20 @@ +@PropertyAnnotation +var prop: kotlin.Int + @GetAnnotation + get() + @SetAnnotation + set(@SetparamAnnotation value: kotlin.Int) + +val lazyProperty: kotlin.Int + +annotation class PropertyAnnotation + +annotation class FieldAnnotation + +annotation class GetAnnotation + +annotation class SetAnnotation + +annotation class SetparamAnnotation + +annotation class DelegateAnnotation \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.descriptors.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.descriptors.txt new file mode 100644 index 00000000000..c6c81d4acd1 --- /dev/null +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.descriptors.txt @@ -0,0 +1,221 @@ +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: PropertyAnnotation + classKind: ANNOTATION_CLASS + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: PropertyAnnotation + origin: SOURCE + superTypes: [ + kotlin/Annotation + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: FieldAnnotation + classKind: ANNOTATION_CLASS + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: FieldAnnotation + origin: SOURCE + superTypes: [ + kotlin/Annotation + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: GetAnnotation + classKind: ANNOTATION_CLASS + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: GetAnnotation + origin: SOURCE + superTypes: [ + kotlin/Annotation + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: SetAnnotation + classKind: ANNOTATION_CLASS + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: SetAnnotation + origin: SOURCE + superTypes: [ + kotlin/Annotation + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: SetparamAnnotation + classKind: ANNOTATION_CLASS + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: SetparamAnnotation + origin: SOURCE + superTypes: [ + kotlin/Annotation + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [ + PropertyAnnotation() + psi: KtAnnotationEntry + ] + callableIdIfNonLocal: /prop + contextReceivers: [] + getter: KtPropertyGetterSymbol() + hasBackingField: true + hasGetter: true + hasSetter: true + initializer: KtConstantInitializerValue(1) + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: false + modality: FINAL + name: prop + origin: SOURCE + receiverType: null + returnType: kotlin/Int + setter: KtPropertySetterSymbol() + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getProp + javaSetterName: setProp + setterDeprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: DelegateAnnotation + classKind: ANNOTATION_CLASS + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: DelegateAnnotation + origin: SOURCE + superTypes: [ + kotlin/Annotation + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtAnonymousFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + hasStableParameterNames: true + isExtension: false + origin: SOURCE + receiverType: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + valueParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [] + callableIdIfNonLocal: /lazyProperty + contextReceivers: [] + getter: KtPropertyGetterSymbol() + hasBackingField: false + hasGetter: true + hasSetter: false + initializer: null + isConst: false + isDelegatedProperty: true + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: lazyProperty + origin: SOURCE + receiverType: null + returnType: kotlin/Int + setter: null + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getLazyProperty + javaSetterName: null + setterDeprecationStatus: null \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.kt b/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.kt new file mode 100644 index 00000000000..5ae5e6c2da1 --- /dev/null +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.kt @@ -0,0 +1,19 @@ +// WITH_STDLIB + +annotation class PropertyAnnotation +annotation class FieldAnnotation +annotation class GetAnnotation +annotation class SetAnnotation +annotation class SetparamAnnotation + +@property:PropertyAnnotation +@field:FieldAnnotation +@get:GetAnnotation +@set:SetAnnotation +@setparam:SetparamAnnotation +var prop: Int = 1 + +annotation class DelegateAnnotation + +@delegate:DelegateAnnotation +val lazyProperty by lazy { 1 } diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.pretty.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.pretty.txt new file mode 100644 index 00000000000..3ccff3fbe57 --- /dev/null +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.pretty.txt @@ -0,0 +1,22 @@ +@PropertyAnnotation +@FieldAnnotation +var prop: kotlin.Int + @GetAnnotation + get() + @SetAnnotation + set(value: kotlin.Int) + +@DelegateAnnotation +val lazyProperty: kotlin.Int + +annotation class PropertyAnnotation + +annotation class FieldAnnotation + +annotation class GetAnnotation + +annotation class SetAnnotation + +annotation class SetparamAnnotation + +annotation class DelegateAnnotation \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.txt new file mode 100644 index 00000000000..cc428d729fd --- /dev/null +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/propertyWithAnnotations.txt @@ -0,0 +1,226 @@ +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: PropertyAnnotation + classKind: ANNOTATION_CLASS + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: PropertyAnnotation + origin: SOURCE + superTypes: [ + kotlin/Annotation + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: FieldAnnotation + classKind: ANNOTATION_CLASS + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: FieldAnnotation + origin: SOURCE + superTypes: [ + kotlin/Annotation + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: GetAnnotation + classKind: ANNOTATION_CLASS + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: GetAnnotation + origin: SOURCE + superTypes: [ + kotlin/Annotation + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: SetAnnotation + classKind: ANNOTATION_CLASS + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: SetAnnotation + origin: SOURCE + superTypes: [ + kotlin/Annotation + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: SetparamAnnotation + classKind: ANNOTATION_CLASS + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: SetparamAnnotation + origin: SOURCE + superTypes: [ + kotlin/Annotation + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [ + PropertyAnnotation() + psi: KtAnnotationEntry + FieldAnnotation() + psi: KtAnnotationEntry + ] + callableIdIfNonLocal: /prop + contextReceivers: [] + getter: KtPropertyGetterSymbol() + hasBackingField: true + hasGetter: true + hasSetter: true + initializer: KtConstantInitializerValue(1) + isConst: false + isDelegatedProperty: false + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: false + modality: FINAL + name: prop + origin: SOURCE + receiverType: null + returnType: kotlin/Int + setter: KtPropertySetterSymbol() + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getProp + javaSetterName: setProp + setterDeprecationStatus: null + +KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: DelegateAnnotation + classKind: ANNOTATION_CLASS + companionObject: null + contextReceivers: [] + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: DelegateAnnotation + origin: SOURCE + superTypes: [ + kotlin/Annotation + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtAnonymousFunctionSymbol: + annotationsList: [] + callableIdIfNonLocal: null + contextReceivers: [] + hasStableParameterNames: true + isExtension: false + origin: SOURCE + receiverType: null + returnType: kotlin/Int + symbolKind: LOCAL + typeParameters: [] + valueParameters: [] + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + +KtKotlinPropertySymbol: + annotationsList: [ + DelegateAnnotation() + psi: KtAnnotationEntry + ] + callableIdIfNonLocal: /lazyProperty + contextReceivers: [] + getter: KtPropertyGetterSymbol() + hasBackingField: false + hasGetter: true + hasSetter: false + initializer: null + isConst: false + isDelegatedProperty: true + isExtension: false + isFromPrimaryConstructor: false + isLateInit: false + isOverride: false + isStatic: false + isVal: true + modality: FINAL + name: lazyProperty + origin: SOURCE + receiverType: null + returnType: kotlin/Int + setter: null + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + getContainingModule: KtSourceModule "Sources of main" + deprecationStatus: null + getterDeprecationStatus: null + javaGetterName: getLazyProperty + javaSetterName: null + setterDeprecationStatus: null \ No newline at end of file