[Tests] KQA-1763 add tests for default rule for annotation
add tests for records
fix tests
diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLBlackBoxModernJdkTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLBlackBoxModernJdkTestGenerated.java
index cccc48c..fed1063 100644
--- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLBlackBoxModernJdkTestGenerated.java
+++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLBlackBoxModernJdkTestGenerated.java
@@ -412,6 +412,12 @@
}
@Test
+ @TestMetadata("recordAnnotationWithoutDefaultTarget.kt")
+ public void testRecordAnnotationWithoutDefaultTarget() {
+ runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordAnnotationWithoutDefaultTarget.kt");
+ }
+
+ @Test
@TestMetadata("recordDifferentPropertyOverride.kt")
public void testRecordDifferentPropertyOverride() {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordDifferentPropertyOverride.kt");
diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLDiagnosticsFirTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLDiagnosticsFirTestGenerated.java
index 9d09e50..f1d638c 100644
--- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLDiagnosticsFirTestGenerated.java
+++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLDiagnosticsFirTestGenerated.java
@@ -6738,10 +6738,22 @@
}
@Test
+ @TestMetadata("combinationOfAllNotAllAndDefaultTarget.kt")
+ public void testCombinationOfAllNotAllAndDefaultTarget() {
+ runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/combinationOfAllNotAllAndDefaultTarget.kt");
+ }
+
+ @Test
@TestMetadata("multipleAnnotationsWithAllUseSiteTarget.kt")
public void testMultipleAnnotationsWithAllUseSiteTarget() {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithAllUseSiteTarget.kt");
}
+
+ @Test
+ @TestMetadata("multipleAnnotationsWithDefaultTarget.kt")
+ public void testMultipleAnnotationsWithDefaultTarget() {
+ runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithDefaultTarget.kt");
+ }
}
@Nested
diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedBlackBoxModernJdkTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedBlackBoxModernJdkTestGenerated.java
index f006954..33c4e08 100644
--- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedBlackBoxModernJdkTestGenerated.java
+++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedBlackBoxModernJdkTestGenerated.java
@@ -412,6 +412,12 @@
}
@Test
+ @TestMetadata("recordAnnotationWithoutDefaultTarget.kt")
+ public void testRecordAnnotationWithoutDefaultTarget() {
+ runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordAnnotationWithoutDefaultTarget.kt");
+ }
+
+ @Test
@TestMetadata("recordDifferentPropertyOverride.kt")
public void testRecordDifferentPropertyOverride() {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordDifferentPropertyOverride.kt");
diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedDiagnosticsFirTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedDiagnosticsFirTestGenerated.java
index 90c097c..1d6130d 100644
--- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedDiagnosticsFirTestGenerated.java
+++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedDiagnosticsFirTestGenerated.java
@@ -6738,10 +6738,22 @@
}
@Test
+ @TestMetadata("combinationOfAllNotAllAndDefaultTarget.kt")
+ public void testCombinationOfAllNotAllAndDefaultTarget() {
+ runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/combinationOfAllNotAllAndDefaultTarget.kt");
+ }
+
+ @Test
@TestMetadata("multipleAnnotationsWithAllUseSiteTarget.kt")
public void testMultipleAnnotationsWithAllUseSiteTarget() {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithAllUseSiteTarget.kt");
}
+
+ @Test
+ @TestMetadata("multipleAnnotationsWithDefaultTarget.kt")
+ public void testMultipleAnnotationsWithDefaultTarget() {
+ runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithDefaultTarget.kt");
+ }
}
@Nested
diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationAllUseSiteTarget.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationAllUseSiteTarget.fir.txt
index 6c3fcec..3e4c66f 100644
--- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationAllUseSiteTarget.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationAllUseSiteTarget.fir.txt
@@ -1,4 +1,4 @@
-FILE: annotationAllUseSiteTarget.kt
+FILE: test.kt
@ALL:R|p/Default|() package p
@R|kotlin/annotation/Target|(allowedTargets = vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.VALUE_PARAMETER|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.PROPERTY|)) public final annotation class ParamProperty : R|kotlin/Annotation| {
@@ -56,64 +56,74 @@
}
@ALL:R|p/Default|() public final class My : R|kotlin/Any| {
- public constructor(@ALL:R|p/ParamProperty|() @ALL:R|p/ParamField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/ParamGetter|() @ALL:R|p/ParamGetterSetter|() @ALL:R|p/Default|() valFromConstructor: R|kotlin/Int|, @ALL:R|p/ParamProperty|() @ALL:R|p/ParamField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/ParamGetter|() @ALL:R|p/ParamGetterSetter|() @ALL:R|p/Default|() varFromConstructor: R|kotlin/Int|, @ALL:R|p/Default|() param: R|kotlin/Int|): R|p/My| {
+ public constructor(@ALL:R|p/ParamProperty|() @ALL:R|p/ParamField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/ParamGetter|() @ALL:R|p/ParamGetterSetter|() @ALL:R|p/Default|() @ALL:R|JavaAnn|() valFromConstructor: R|kotlin/Int|, @ALL:R|p/ParamProperty|() @ALL:R|p/ParamField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/ParamGetter|() @ALL:R|p/ParamGetterSetter|() @ALL:R|p/Default|() @ALL:R|JavaAnn|() varFromConstructor: R|kotlin/Int|, @ALL:R|p/Default|() param: R|kotlin/Int|): R|p/My| {
super<R|kotlin/Any|>()
}
- @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() public final val valFromConstructor: R|kotlin/Int| = R|<local>/valFromConstructor|
- @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() public get(): R|kotlin/Int|
+ @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() @R|JavaAnn|() public final val valFromConstructor: R|kotlin/Int| = R|<local>/valFromConstructor|
+ @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() public get(): R|kotlin/Int|
- @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() public final var varFromConstructor: R|kotlin/Int| = R|<local>/varFromConstructor|
- @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() public get(): R|kotlin/Int|
- public set(@R|p/ParamProperty|() @R|p/ParamField|() @R|p/ParamPropertyField|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() value: R|kotlin/Int|): R|kotlin/Unit|
+ @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() @R|JavaAnn|() public final var varFromConstructor: R|kotlin/Int| = R|<local>/varFromConstructor|
+ @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() public get(): R|kotlin/Int|
+ public set(@R|p/ParamProperty|() @R|p/ParamField|() @R|p/ParamPropertyField|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() value: R|kotlin/Int|): R|kotlin/Unit|
- @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() public final val valInside: R|kotlin/Int| = Int(0)
- @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() public get(): R|kotlin/Int|
+ @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() @R|JavaAnn|() public final val valInside: R|kotlin/Int| = Int(0)
+ @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() public get(): R|kotlin/Int|
- @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() public final var varInside: R|kotlin/Int| = Int(1)
- @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() public get(): R|kotlin/Int|
- public set(@R|p/ParamProperty|() @R|p/ParamField|() @R|p/ParamPropertyField|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() value: R|kotlin/Int|): R|kotlin/Unit|
+ @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() @R|JavaAnn|() public final var varInside: R|kotlin/Int| = Int(1)
+ @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() public get(): R|kotlin/Int|
+ public set(@R|p/ParamProperty|() @R|p/ParamField|() @R|p/ParamPropertyField|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() value: R|kotlin/Int|): R|kotlin/Unit|
- @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() public final val valWithGetter: R|kotlin/Int| = Int(2)
- @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() public get(): R|kotlin/Int| {
+ @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() @R|JavaAnn|() public final val valWithGetter: R|kotlin/Int| = Int(2)
+ @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() public get(): R|kotlin/Int| {
^ this@R|p/My|.F|p/My.valWithGetter|
}
- @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() public final val valWithoutField: R|kotlin/Int|
- @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() public get(): R|kotlin/Int| {
+ @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() @R|JavaAnn|() public final val valWithoutField: R|kotlin/Int|
+ @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() public get(): R|kotlin/Int| {
^ Int(3)
}
- @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() public final var varWithSetter: R|kotlin/Int| = Int(4)
- @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() public get(): R|kotlin/Int|
- public set(@R|p/ParamProperty|() @R|p/ParamField|() @R|p/ParamPropertyField|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() param: R|kotlin/Int|): R|kotlin/Unit| {
+ @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() @R|JavaAnn|() public final var varWithSetter: R|kotlin/Int| = Int(4)
+ @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() public get(): R|kotlin/Int|
+ public set(@R|p/ParamProperty|() @R|p/ParamField|() @R|p/ParamPropertyField|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() param: R|kotlin/Int|): R|kotlin/Unit| {
}
- @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() public final var varWithSetterAndGetter: R|kotlin/Int| = Int(5)
- @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() public get(): R|kotlin/Int| {
+ @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() @R|JavaAnn|() public final var varWithSetterAndGetter: R|kotlin/Int| = Int(5)
+ @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() public get(): R|kotlin/Int| {
^ this@R|p/My|.F|p/My.varWithSetterAndGetter|
}
- public set(@R|p/ParamProperty|() @R|p/ParamField|() @R|p/ParamPropertyField|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() param: R|kotlin/Int|): R|kotlin/Unit| {
+ public set(@R|p/ParamProperty|() @R|p/ParamField|() @R|p/ParamPropertyField|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() param: R|kotlin/Int|): R|kotlin/Unit| {
}
- @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() public final var varWithoutField: R|kotlin/Int|
- @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() public get(): R|kotlin/Int| {
+ @ALL:R|p/ParamProperty|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() field:@R|p/ParamField|() @R|p/PropertyField|() @R|p/ParamPropertyField|() @R|p/Default|() @R|JavaAnn|() public final var varWithoutField: R|kotlin/Int|
+ @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() public get(): R|kotlin/Int| {
^ Int(6)
}
- public set(@R|p/ParamProperty|() @R|p/ParamField|() @R|p/ParamPropertyField|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() param: R|kotlin/Int|): R|kotlin/Unit| {
+ public set(@R|p/ParamProperty|() @R|p/ParamField|() @R|p/ParamPropertyField|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() param: R|kotlin/Int|): R|kotlin/Unit| {
}
@ALL:R|p/ParamProperty|() @ALL:R|p/ParamField|() @ALL:R|p/PropertyField|() @ALL:R|p/ParamPropertyField|() @ALL:R|p/Default|() @ALL:R|p/Inapplicable|() public final val delegatedVal: R|kotlin/Int|by R|kotlin/lazy|<R|kotlin/Int|>(<L> = lazy@fun <anonymous>(): R|kotlin/Int| <inline=NoInline> {
^ Int(7)
}
)
- @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() public get(): R|kotlin/Int| {
+ @R|p/GetterSetter|() @R|p/ParamGetter|() @R|p/ParamGetterSetter|() @R|p/Default|() @R|JavaAnn|() public get(): R|kotlin/Int| {
^ this@R|p/My|.D|p/My.delegatedVal|.R|kotlin/getValue|<R|kotlin/Int|>(this@R|p/My|, ::R|p/My.delegatedVal|)
}
@ALL:R|p/Default|() public final fun foo(@ALL:R|p/Default|() param: R|kotlin/Int|): R|@ALL:R|p/Default|() kotlin/Int| {
@ALL:R|p/Default|() lval x: R|kotlin/Int| = Int(8)
lval y: R|kotlin/Int| = @ALL:R|p/Default|() R|<local>/x|
+ lval z: R|p/<anonymous>| = object : R|kotlin/Any| {
+ private constructor(): R|p/<anonymous>| {
+ super<R|kotlin/Any|>()
+ }
+
+ @ALL:R|p/Default|() field:@R|p/Default|() public final val bar: R|kotlin/Int| = Int(0)
+ @R|p/Default|() public get(): R|kotlin/Int|
+
+ }
+
^foo R|<local>/y|
}
@@ -128,4 +138,4 @@
@ALL:R|p/Default|() public set(@ALL:R|p/Default|() param: R|kotlin/Int|): R|kotlin/Unit| {
}
- }
+ }
\ No newline at end of file
diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationAllUseSiteTarget.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationAllUseSiteTarget.kt
index c8b3b1c..64f2f33 100644
--- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationAllUseSiteTarget.kt
+++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationAllUseSiteTarget.kt
@@ -2,10 +2,22 @@
// ISSUE: KT-73256
// LANGUAGE: +AnnotationAllUseSiteTarget
// FIR_DUMP
+// FILE: JavaAnn.java
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
+public @interface JavaAnn {
+ String value() default "OK";
+}
+
+// FILE: test.kt
@<!INAPPLICABLE_ALL_TARGET!>all<!>:Default
package p
+import JavaAnn
+
+
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class ParamProperty
@@ -43,6 +55,7 @@
@all:ParamGetterSetter
@all:Default
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@all:Inapplicable<!>
+ @all:JavaAnn
val valFromConstructor: Int,
@all:ParamProperty
@@ -54,6 +67,7 @@
@all:ParamGetterSetter
@all:Default
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@all:Inapplicable<!>
+ @all:JavaAnn
var varFromConstructor: Int,
@<!INAPPLICABLE_ALL_TARGET!>all<!>:Default
@@ -68,6 +82,7 @@
@all:ParamGetterSetter
@all:Default
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@all:Inapplicable<!>
+ @all:JavaAnn
val valInside: Int = 0
@all:ParamProperty
@@ -79,6 +94,7 @@
@all:ParamGetterSetter
@all:Default
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@all:Inapplicable<!>
+ @all:JavaAnn
var varInside: Int = 1
@all:ParamProperty
@@ -90,6 +106,7 @@
@all:ParamGetterSetter
@all:Default
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@all:Inapplicable<!>
+ @all:JavaAnn
val valWithGetter: Int = 2
get() = field
@@ -102,6 +119,7 @@
@all:ParamGetterSetter
@all:Default
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@all:Inapplicable<!>
+ <!WRONG_ANNOTATION_TARGET!>@all:JavaAnn<!>
val valWithoutField: Int
get() = 3
@@ -114,6 +132,7 @@
@all:ParamGetterSetter
@all:Default
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@all:Inapplicable<!>
+ @all:JavaAnn
var varWithSetter: Int = 4
set(param) {}
@@ -126,6 +145,7 @@
@all:ParamGetterSetter
@all:Default
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@all:Inapplicable<!>
+ @all:JavaAnn
var varWithSetterAndGetter: Int = 5
get() = field
set(param) {}
@@ -139,6 +159,7 @@
@all:ParamGetterSetter
@all:Default
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@all:Inapplicable<!>
+ <!WRONG_ANNOTATION_TARGET!>@all:JavaAnn<!>
var varWithoutField: Int
get() = 6
set(param) {}
@@ -152,12 +173,16 @@
@all:ParamGetterSetter
@all:Default
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@all:Inapplicable<!>
+ @all:JavaAnn
val delegatedVal: Int by lazy { 7 }
@<!INAPPLICABLE_ALL_TARGET!>all<!>:Default
fun foo(@<!INAPPLICABLE_ALL_TARGET!>all<!>:Default param: Int): <!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@all:Default<!> Int {
@<!INAPPLICABLE_ALL_TARGET!>all<!>:Default val x = 8
val y = <!WRONG_ANNOTATION_TARGET!>@all:Default<!> x
+ val z = object {
+ @all:Default val bar: Int = 0
+ }
return y
}
diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnly.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnly.fir.txt
index 12581b9..706ab09 100644
--- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnly.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnly.fir.txt
@@ -1,4 +1,4 @@
-FILE: annotationDefaultTargetFirstOnly.kt
+FILE: test.kt
@R|kotlin/annotation/Target|(allowedTargets = vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.VALUE_PARAMETER|)) public final annotation class ParamOnly : R|kotlin/Annotation| {
public constructor(): R|ParamOnly| {
super<R|kotlin/Any|>()
@@ -48,24 +48,27 @@
}
public final class My : R|kotlin/Any| {
- public constructor(@R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() x: R|kotlin/Int|): R|My| {
+ public constructor(@R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() @R|JavaAnn|() x: R|kotlin/Int|, @R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() @R|JavaAnn|() vararg a: R|kotlin/Array<out kotlin/String>|): R|My| {
super<R|kotlin/Any|>()
}
@R|PropertyOnly|() @R|PropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() public final val x: R|kotlin/Int| = R|<local>/x|
public get(): R|kotlin/Int|
- @R|ParamOnly|() @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() public final val y: R|kotlin/Int| = Int(0)
+ @R|PropertyOnly|() @R|PropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() public final val a: R|kotlin/Array<out kotlin/String>| = R|<local>/a|
+ public get(): R|kotlin/Array<out kotlin/String>|
+
+ @R|ParamOnly|() @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() @R|JavaAnn|() public final val y: R|kotlin/Int| = Int(0)
public get(): R|kotlin/Int|
- @R|ParamOnly|() @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() public final val z: R|kotlin/Int|
+ @R|ParamOnly|() @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() @R|JavaAnn|() public final val z: R|kotlin/Int|
public get(): R|kotlin/Int| {
^ Int(0)
}
}
public final annotation class Your : R|kotlin/Annotation| {
- public constructor(@R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() s: R|kotlin/String|): R|Your| {
+ public constructor(@R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() @R|JavaAnn|() s: R|kotlin/String|): R|Your| {
super<R|kotlin/Any|>()
}
@@ -73,3 +76,4 @@
public get(): R|kotlin/String|
}
+
diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnly.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnly.kt
index ff13189..8c4f5a4 100644
--- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnly.kt
+++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnly.kt
@@ -1,6 +1,17 @@
// RUN_PIPELINE_TILL: FRONTEND
// LANGUAGE: -AnnotationDefaultTargetMigrationWarning -PropertyParamAnnotationDefaultTargetMode -ForbidFieldAnnotationsOnAnnotationParameters
// ISSUE: KT-73255 KT-73831
+// FILE: JavaAnn.java
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
+public @interface JavaAnn {
+ String value() default "OK";
+}
+
+// FILE: test.kt
+import JavaAnn
@Target(AnnotationTarget.VALUE_PARAMETER)
annotation class ParamOnly
@@ -35,7 +46,18 @@
@PropertyField
@ParamPropertyField
<!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
- val x: Int
+ @JavaAnn
+ val x: Int,
+ @ParamOnly
+ @PropertyOnly
+ @FieldOnly
+ @ParamProperty
+ @ParamField
+ @PropertyField
+ @ParamPropertyField
+ <!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
+ @JavaAnn
+ vararg val a: String
) {
<!WRONG_ANNOTATION_TARGET!>@ParamOnly<!>
@PropertyOnly
@@ -45,6 +67,7 @@
@PropertyField
@ParamPropertyField
<!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
+ @JavaAnn
val y: Int = 0
<!WRONG_ANNOTATION_TARGET!>@ParamOnly<!>
@@ -55,6 +78,7 @@
@PropertyField
@ParamPropertyField
<!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
+ <!WRONG_ANNOTATION_TARGET!>@JavaAnn<!>
val z: Int get() = 0
}
@@ -67,5 +91,6 @@
@PropertyField
@ParamPropertyField
<!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
+ @JavaAnn
val s: String
)
diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnlyWarn.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnlyWarn.fir.txt
index af03950..15375a5 100644
--- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnlyWarn.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnlyWarn.fir.txt
@@ -1,4 +1,4 @@
-FILE: annotationDefaultTargetFirstOnlyWarn.kt
+FILE: test.kt
@R|kotlin/annotation/Target|(allowedTargets = vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.VALUE_PARAMETER|)) public final annotation class ParamOnly : R|kotlin/Annotation| {
public constructor(): R|ParamOnly| {
super<R|kotlin/Any|>()
@@ -48,24 +48,27 @@
}
public final class My : R|kotlin/Any| {
- public constructor(@R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() x: R|kotlin/Int|): R|My| {
+ public constructor(@R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() @R|JavaAnn|() x: R|kotlin/Int|, @R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() @R|JavaAnn|() vararg a: R|kotlin/Array<out kotlin/String>|): R|My| {
super<R|kotlin/Any|>()
}
@R|PropertyOnly|() @R|PropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() public final val x: R|kotlin/Int| = R|<local>/x|
public get(): R|kotlin/Int|
- @R|ParamOnly|() @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() public final val y: R|kotlin/Int| = Int(0)
+ @R|PropertyOnly|() @R|PropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() public final val a: R|kotlin/Array<out kotlin/String>| = R|<local>/a|
+ public get(): R|kotlin/Array<out kotlin/String>|
+
+ @R|ParamOnly|() @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() @R|JavaAnn|() public final val y: R|kotlin/Int| = Int(0)
public get(): R|kotlin/Int|
- @R|ParamOnly|() @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() public final val z: R|kotlin/Int|
+ @R|ParamOnly|() @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() @R|JavaAnn|() public final val z: R|kotlin/Int|
public get(): R|kotlin/Int| {
^ Int(0)
}
}
public final annotation class Your : R|kotlin/Annotation| {
- public constructor(@R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() s: R|kotlin/String|): R|Your| {
+ public constructor(@R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() @R|JavaAnn|() s: R|kotlin/String|): R|Your| {
super<R|kotlin/Any|>()
}
diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnlyWarn.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnlyWarn.kt
index 8a4e676..3cefc67 100644
--- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnlyWarn.kt
+++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetFirstOnlyWarn.kt
@@ -1,6 +1,17 @@
// RUN_PIPELINE_TILL: FRONTEND
// LANGUAGE: +AnnotationDefaultTargetMigrationWarning -PropertyParamAnnotationDefaultTargetMode -ForbidFieldAnnotationsOnAnnotationParameters
// ISSUE: KT-73255 KT-73831
+// FILE: JavaAnn.java
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
+public @interface JavaAnn {
+ String value() default "OK";
+}
+
+// FILE: test.kt
+import JavaAnn
@Target(AnnotationTarget.VALUE_PARAMETER)
annotation class ParamOnly
@@ -35,7 +46,18 @@
@PropertyField
<!ANNOTATION_WILL_BE_APPLIED_ALSO_TO_PROPERTY_OR_FIELD("property")!>@ParamPropertyField<!>
<!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
- val x: Int
+ <!ANNOTATION_WILL_BE_APPLIED_ALSO_TO_PROPERTY_OR_FIELD!>@JavaAnn<!>
+ val x: Int,
+ @ParamOnly
+ @PropertyOnly
+ @FieldOnly
+ <!ANNOTATION_WILL_BE_APPLIED_ALSO_TO_PROPERTY_OR_FIELD!>@ParamProperty<!>
+ <!ANNOTATION_WILL_BE_APPLIED_ALSO_TO_PROPERTY_OR_FIELD!>@ParamField<!>
+ @PropertyField
+ <!ANNOTATION_WILL_BE_APPLIED_ALSO_TO_PROPERTY_OR_FIELD!>@ParamPropertyField<!>
+ <!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
+ <!ANNOTATION_WILL_BE_APPLIED_ALSO_TO_PROPERTY_OR_FIELD!>@JavaAnn<!>
+ vararg val a: String
) {
<!WRONG_ANNOTATION_TARGET!>@ParamOnly<!>
@PropertyOnly
@@ -45,6 +67,7 @@
@PropertyField
@ParamPropertyField
<!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
+ @JavaAnn
val y: Int = 0
<!WRONG_ANNOTATION_TARGET!>@ParamOnly<!>
@@ -55,6 +78,7 @@
@PropertyField
@ParamPropertyField
<!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
+ <!WRONG_ANNOTATION_TARGET!>@JavaAnn<!>
val z: Int get() = 0
}
@@ -67,5 +91,6 @@
@PropertyField
<!ANNOTATION_WILL_BE_APPLIED_ALSO_TO_PROPERTY_OR_FIELD!>@ParamPropertyField<!>
<!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
+ @JavaAnn
val s: String
)
diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetParamProperty.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetParamProperty.fir.txt
index 9c8c486..f2a3ec7 100644
--- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetParamProperty.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetParamProperty.fir.txt
@@ -1,4 +1,4 @@
-FILE: annotationDefaultTargetParamProperty.kt
+FILE: test.kt
@R|kotlin/annotation/Target|(allowedTargets = vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.VALUE_PARAMETER|)) public final annotation class ParamOnly : R|kotlin/Annotation| {
public constructor(): R|ParamOnly| {
super<R|kotlin/Any|>()
@@ -48,24 +48,27 @@
}
public final class My : R|kotlin/Any| {
- public constructor(@R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() x: R|kotlin/Int|): R|My| {
+ public constructor(@R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() @R|JavaAnn|() x: R|kotlin/Int|, @R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() @R|JavaAnn|() vararg a: R|kotlin/Array<out kotlin/String>|): R|My| {
super<R|kotlin/Any|>()
}
- @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() public final val x: R|kotlin/Int| = R|<local>/x|
+ @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() @R|JavaAnn|() public final val x: R|kotlin/Int| = R|<local>/x|
public get(): R|kotlin/Int|
- @R|ParamOnly|() @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() public final val y: R|kotlin/Int| = Int(0)
+ @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() @R|JavaAnn|() public final val a: R|kotlin/Array<out kotlin/String>| = R|<local>/a|
+ public get(): R|kotlin/Array<out kotlin/String>|
+
+ @R|ParamOnly|() @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() @R|JavaAnn|() public final val y: R|kotlin/Int| = Int(0)
public get(): R|kotlin/Int|
- @R|ParamOnly|() @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() public final val z: R|kotlin/Int|
+ @R|ParamOnly|() @R|PropertyOnly|() @R|ParamProperty|() @R|PropertyField|() @R|ParamPropertyField|() @R|Inapplicable|() field:@R|FieldOnly|() @R|ParamField|() @R|JavaAnn|() public final val z: R|kotlin/Int|
public get(): R|kotlin/Int| {
^ Int(0)
}
}
public final annotation class Your : R|kotlin/Annotation| {
- public constructor(@R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() s: R|kotlin/String|): R|Your| {
+ public constructor(@R|ParamOnly|() @R|ParamProperty|() @R|ParamField|() @R|ParamPropertyField|() @R|JavaAnn|() s: R|kotlin/String|): R|Your| {
super<R|kotlin/Any|>()
}
@@ -73,3 +76,4 @@
public get(): R|kotlin/String|
}
+
diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetParamProperty.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetParamProperty.kt
index 661f808..1223372 100644
--- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetParamProperty.kt
+++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/annotationDefaultTargetParamProperty.kt
@@ -1,6 +1,17 @@
// RUN_PIPELINE_TILL: FRONTEND
// LANGUAGE: +PropertyParamAnnotationDefaultTargetMode
// ISSUE: KT-73255 KT-73831
+// FILE: JavaAnn.java
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
+public @interface JavaAnn {
+ String value() default "OK";
+}
+
+// FILE: test.kt
+import JavaAnn
@Target(AnnotationTarget.VALUE_PARAMETER)
annotation class ParamOnly
@@ -35,7 +46,18 @@
@PropertyField
@ParamPropertyField
<!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
- val x: Int
+ @JavaAnn
+ val x: Int,
+ @ParamOnly
+ @PropertyOnly
+ @FieldOnly
+ @ParamProperty
+ @ParamField
+ @PropertyField
+ @ParamPropertyField
+ <!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
+ @JavaAnn
+ vararg val a: String
) {
<!WRONG_ANNOTATION_TARGET!>@ParamOnly<!>
@PropertyOnly
@@ -45,6 +67,7 @@
@PropertyField
@ParamPropertyField
<!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
+ @JavaAnn
val y: Int = 0
<!WRONG_ANNOTATION_TARGET!>@ParamOnly<!>
@@ -55,6 +78,7 @@
@PropertyField
@ParamPropertyField
<!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
+ <!WRONG_ANNOTATION_TARGET!>@JavaAnn<!>
val z: Int get() = 0
}
@@ -67,5 +91,6 @@
@PropertyField
@ParamPropertyField
<!WRONG_ANNOTATION_TARGET!>@Inapplicable<!>
+ @JavaAnn
val s: String
)
diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/combinationOfAllNotAllAndDefaultTarget.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/combinationOfAllNotAllAndDefaultTarget.fir.txt
new file mode 100644
index 0000000..77520c5
--- /dev/null
+++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/combinationOfAllNotAllAndDefaultTarget.fir.txt
@@ -0,0 +1,37 @@
+FILE: combinationOfAllNotAllAndDefaultTarget.kt
+ @R|kotlin/annotation/Repeatable|() public final annotation class WithoutExplicitTarget : R|kotlin/Annotation| {
+ public constructor(): R|WithoutExplicitTarget| {
+ super<R|kotlin/Any|>()
+ }
+
+ }
+ @R|kotlin/annotation/Repeatable|() @R|kotlin/annotation/Target|(allowedTargets = vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.VALUE_PARAMETER|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.PROPERTY|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.FIELD|)) public final annotation class ParamPropertyField : R|kotlin/Annotation| {
+ public constructor(): R|ParamPropertyField| {
+ super<R|kotlin/Any|>()
+ }
+
+ }
+ public final class Test : R|kotlin/Any| {
+ public constructor(@ALL:R|WithoutExplicitTarget|() @R|WithoutExplicitTarget|() a: R|kotlin/String|, @CONSTRUCTOR_PARAMETER:R|WithoutExplicitTarget|() @ALL:R|WithoutExplicitTarget|() b: R|kotlin/String|, @CONSTRUCTOR_PARAMETER:R|WithoutExplicitTarget|() @R|WithoutExplicitTarget|() c: R|kotlin/String|, @ALL:R|ParamPropertyField|() @R|ParamPropertyField|() d: R|kotlin/String|, @ALL:R|ParamPropertyField|() @CONSTRUCTOR_PARAMETER:R|ParamPropertyField|() e: R|kotlin/String|, @R|ParamPropertyField|() @CONSTRUCTOR_PARAMETER:R|ParamPropertyField|() f: R|kotlin/String|): R|Test| {
+ super<R|kotlin/Any|>()
+ }
+
+ @ALL:R|WithoutExplicitTarget|() @R|WithoutExplicitTarget|() field:@R|WithoutExplicitTarget|() public final val a: R|kotlin/String| = R|<local>/a|
+ @R|WithoutExplicitTarget|() public get(): R|kotlin/String|
+
+ @ALL:R|WithoutExplicitTarget|() field:@R|WithoutExplicitTarget|() public final val b: R|kotlin/String| = R|<local>/b|
+ @R|WithoutExplicitTarget|() public get(): R|kotlin/String|
+
+ @R|WithoutExplicitTarget|() public final val c: R|kotlin/String| = R|<local>/c|
+ public get(): R|kotlin/String|
+
+ @ALL:R|ParamPropertyField|() @R|ParamPropertyField|() field:@R|ParamPropertyField|() public final val d: R|kotlin/String| = R|<local>/d|
+ public get(): R|kotlin/String|
+
+ @ALL:R|ParamPropertyField|() field:@R|ParamPropertyField|() public final val e: R|kotlin/String| = R|<local>/e|
+ public get(): R|kotlin/String|
+
+ @R|ParamPropertyField|() public final val f: R|kotlin/String| = R|<local>/f|
+ public get(): R|kotlin/String|
+
+ }
diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/combinationOfAllNotAllAndDefaultTarget.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/combinationOfAllNotAllAndDefaultTarget.kt
new file mode 100644
index 0000000..d9e67b5
--- /dev/null
+++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/combinationOfAllNotAllAndDefaultTarget.kt
@@ -0,0 +1,16 @@
+// RUN_PIPELINE_TILL: BACKEND
+// LANGUAGE: +PropertyParamAnnotationDefaultTargetMode, +AnnotationAllUseSiteTarget
+
+@Repeatable
+annotation class WithoutExplicitTarget
+
+@Repeatable
+@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD)
+annotation class ParamPropertyField
+
+class Test(@all:WithoutExplicitTarget @WithoutExplicitTarget val a: String,
+ @param:WithoutExplicitTarget @all:WithoutExplicitTarget val b: String,
+ @param:WithoutExplicitTarget @WithoutExplicitTarget val c: String,
+ @all:ParamPropertyField @ParamPropertyField val d: String,
+ @all:ParamPropertyField @param:ParamPropertyField val e: String,
+ @ParamPropertyField @param:ParamPropertyField val f: String)
\ No newline at end of file
diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithDefaultTarget.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithDefaultTarget.fir.txt
new file mode 100644
index 0000000..5f9197e
--- /dev/null
+++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithDefaultTarget.fir.txt
@@ -0,0 +1,22 @@
+FILE: multipleAnnotationsWithDefaultTarget.kt
+ @R|kotlin/annotation/Target|(allowedTargets = vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.VALUE_PARAMETER|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.PROPERTY|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.FIELD|)) public final annotation class ParamPropertyField : R|kotlin/Annotation| {
+ public constructor(): R|ParamPropertyField| {
+ super<R|kotlin/Any|>()
+ }
+
+ }
+ public final annotation class WithoutExplicitTarget : R|kotlin/Annotation| {
+ public constructor(): R|WithoutExplicitTarget| {
+ super<R|kotlin/Any|>()
+ }
+
+ }
+ public final class MultipleTargets : R|kotlin/Any| {
+ public constructor(@R|ParamPropertyField|() @R|WithoutExplicitTarget|() value: R|kotlin/String|): R|MultipleTargets| {
+ super<R|kotlin/Any|>()
+ }
+
+ @R|ParamPropertyField|() @R|WithoutExplicitTarget|() public final val value: R|kotlin/String| = R|<local>/value|
+ public get(): R|kotlin/String|
+
+ }
diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithDefaultTarget.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithDefaultTarget.kt
new file mode 100644
index 0000000..d4b1371
--- /dev/null
+++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithDefaultTarget.kt
@@ -0,0 +1,9 @@
+// RUN_PIPELINE_TILL: BACKEND
+// LANGUAGE: +PropertyParamAnnotationDefaultTargetMode
+
+@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD)
+annotation class ParamPropertyField
+
+annotation class WithoutExplicitTarget
+
+class MultipleTargets (@[ParamPropertyField WithoutExplicitTarget] val value: String)
\ No newline at end of file
diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeDiagnosticsWithLatestLanguageVersionTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeDiagnosticsWithLatestLanguageVersionTestGenerated.java
index 3eed866..8c7a67f 100644
--- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeDiagnosticsWithLatestLanguageVersionTestGenerated.java
+++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeDiagnosticsWithLatestLanguageVersionTestGenerated.java
@@ -6738,10 +6738,22 @@
}
@Test
+ @TestMetadata("combinationOfAllNotAllAndDefaultTarget.kt")
+ public void testCombinationOfAllNotAllAndDefaultTarget() {
+ runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/combinationOfAllNotAllAndDefaultTarget.kt");
+ }
+
+ @Test
@TestMetadata("multipleAnnotationsWithAllUseSiteTarget.kt")
public void testMultipleAnnotationsWithAllUseSiteTarget() {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithAllUseSiteTarget.kt");
}
+
+ @Test
+ @TestMetadata("multipleAnnotationsWithDefaultTarget.kt")
+ public void testMultipleAnnotationsWithDefaultTarget() {
+ runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithDefaultTarget.kt");
+ }
}
@Nested
diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/PhasedJvmDiagnosticLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/PhasedJvmDiagnosticLightTreeTestGenerated.java
index aaab7c6..a7ec38b 100644
--- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/PhasedJvmDiagnosticLightTreeTestGenerated.java
+++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/PhasedJvmDiagnosticLightTreeTestGenerated.java
@@ -56111,10 +56111,22 @@
}
@Test
+ @TestMetadata("combinationOfAllNotAllAndDefaultTarget.kt")
+ public void testCombinationOfAllNotAllAndDefaultTarget() {
+ runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/combinationOfAllNotAllAndDefaultTarget.kt");
+ }
+
+ @Test
@TestMetadata("multipleAnnotationsWithAllUseSiteTarget.kt")
public void testMultipleAnnotationsWithAllUseSiteTarget() {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithAllUseSiteTarget.kt");
}
+
+ @Test
+ @TestMetadata("multipleAnnotationsWithDefaultTarget.kt")
+ public void testMultipleAnnotationsWithDefaultTarget() {
+ runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithDefaultTarget.kt");
+ }
}
@Nested
diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/PhasedJvmDiagnosticPsiTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/PhasedJvmDiagnosticPsiTestGenerated.java
index a392ee1..3e7eb4f 100644
--- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/PhasedJvmDiagnosticPsiTestGenerated.java
+++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/PhasedJvmDiagnosticPsiTestGenerated.java
@@ -56283,10 +56283,22 @@
}
@Test
+ @TestMetadata("combinationOfAllNotAllAndDefaultTarget.kt")
+ public void testCombinationOfAllNotAllAndDefaultTarget() {
+ runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/combinationOfAllNotAllAndDefaultTarget.kt");
+ }
+
+ @Test
@TestMetadata("multipleAnnotationsWithAllUseSiteTarget.kt")
public void testMultipleAnnotationsWithAllUseSiteTarget() {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithAllUseSiteTarget.kt");
}
+
+ @Test
+ @TestMetadata("multipleAnnotationsWithDefaultTarget.kt")
+ public void testMultipleAnnotationsWithDefaultTarget() {
+ runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/annotations/multipleAnnotationsWithDefaultTarget.kt");
+ }
}
@Nested
diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxModernJdkCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxModernJdkCodegenTestGenerated.java
index 6aff19f..2ea108a 100644
--- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxModernJdkCodegenTestGenerated.java
+++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxModernJdkCodegenTestGenerated.java
@@ -413,6 +413,12 @@
}
@Test
+ @TestMetadata("recordAnnotationWithoutDefaultTarget.kt")
+ public void testRecordAnnotationWithoutDefaultTarget() {
+ runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordAnnotationWithoutDefaultTarget.kt");
+ }
+
+ @Test
@TestMetadata("recordDifferentPropertyOverride.kt")
public void testRecordDifferentPropertyOverride() {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordDifferentPropertyOverride.kt");
diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxModernJdkCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxModernJdkCodegenTestGenerated.java
index 14ca195..6a92b9b 100644
--- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxModernJdkCodegenTestGenerated.java
+++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxModernJdkCodegenTestGenerated.java
@@ -413,6 +413,12 @@
}
@Test
+ @TestMetadata("recordAnnotationWithoutDefaultTarget.kt")
+ public void testRecordAnnotationWithoutDefaultTarget() {
+ runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordAnnotationWithoutDefaultTarget.kt");
+ }
+
+ @Test
@TestMetadata("recordDifferentPropertyOverride.kt")
public void testRecordDifferentPropertyOverride() {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordDifferentPropertyOverride.kt");
diff --git a/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordAnnotation.kt b/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordAnnotation.kt
index 72a3c6f..f356df2 100644
--- a/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordAnnotation.kt
+++ b/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordAnnotation.kt
@@ -38,6 +38,17 @@
public @interface JavaDefault {
}
+// FILE: JavaWithKotlinTarget.java
+
+import java.lang.annotation.*;
+import kotlin.annotation.AnnotationTarget;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.RECORD_COMPONENT})
+@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FIELD, AnnotationTarget.VALUE_PARAMETER})
+public @interface JavaWithKotlinTarget {
+}
+
// FILE: main.kt
@java.lang.annotation.Target(java.lang.annotation.ElementType.RECORD_COMPONENT)
@@ -77,6 +88,7 @@
@JavaParamFieldComponent val c: Int,
@JavaDefault val d: Int,
@field:JavaDefault val e: Int,
+ @JavaWithKotlinTarget val f: Int
)
@JvmRecord
@@ -90,6 +102,7 @@
@all:JavaFieldComponent val a: Int,
@all:JavaParamFieldComponent val c: Int,
@all:JavaDefault val d: Int,
+ @all:JavaWithKotlinTarget val e: Int
)
fun box(): String {
@@ -132,6 +145,10 @@
return "FAIL: no record component annotation for '@field:JavaDefault val e' found"
}
+ if (someComponents[12].annotations.isEmpty()) {
+ return "FAIL: no record component annotation for '@JavaWithKotlinTarget val f' found"
+ }
+
val elseComponents = Else::class.java.recordComponents
if (elseComponents[0].annotations.isEmpty()) {
@@ -162,5 +179,9 @@
return "FAIL: no record component annotation for '@all:JavaDefault val d' found"
}
+ if (elseComponents[9].annotations.isEmpty()) {
+ return "FAIL: no record component annotation for '@JavaWithKotlinTarget val e' found"
+ }
+
return "OK"
}
\ No newline at end of file
diff --git a/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordAnnotationWithoutDefaultTarget.kt b/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordAnnotationWithoutDefaultTarget.kt
new file mode 100644
index 0000000..c72b0ca
--- /dev/null
+++ b/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordAnnotationWithoutDefaultTarget.kt
@@ -0,0 +1,187 @@
+// IGNORE_BACKEND_K1: JVM_IR
+// ISSUE: KT-73256, KT-74382 (not supported in K1)
+// LANGUAGE: +AnnotationAllUseSiteTarget -PropertyParamAnnotationDefaultTargetMode
+
+// FILE: JavaFieldComponent.java
+
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.RECORD_COMPONENT, ElementType.FIELD })
+public @interface JavaFieldComponent {
+}
+
+// FILE: JavaParamComponent.java
+
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.RECORD_COMPONENT, ElementType.PARAMETER })
+public @interface JavaParamComponent {
+}
+
+// FILE: JavaParamFieldComponent.java
+
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.RECORD_COMPONENT, ElementType.PARAMETER, ElementType.FIELD })
+public @interface JavaParamFieldComponent {
+}
+
+// FILE: JavaDefault.java
+
+import java.lang.annotation.*;
+
+// requires explicit @field target to be applied
+@Retention(RetentionPolicy.RUNTIME)
+public @interface JavaDefault {
+}
+
+// FILE: JavaWithKotlinTarget.java
+
+import java.lang.annotation.*;
+import kotlin.annotation.AnnotationTarget;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.RECORD_COMPONENT})
+@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FIELD, AnnotationTarget.VALUE_PARAMETER})
+public @interface JavaWithKotlinTarget {
+}
+
+// FILE: main.kt
+
+@java.lang.annotation.Target(java.lang.annotation.ElementType.RECORD_COMPONENT)
+@Target(AnnotationTarget.FIELD)
+annotation class FieldComponent
+
+@Target(AnnotationTarget.FIELD)
+annotation class Field
+
+// actually not applicable to records, since FIELD is not a valid target
+@java.lang.annotation.Target(java.lang.annotation.ElementType.RECORD_COMPONENT)
+@Target(AnnotationTarget.PROPERTY)
+annotation class PropertyComponent
+
+// no @Target means "every target"
+annotation class Default
+
+@java.lang.annotation.Target(java.lang.annotation.ElementType.RECORD_COMPONENT)
+@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FIELD)
+annotation class PropertyFieldComponent
+
+@java.lang.annotation.Target(value = [])
+@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FIELD)
+annotation class NoneInJava
+
+@JvmRecord
+data class Some(
+ @FieldComponent val x: Int,
+ @Field val y: Int,
+ @PropertyComponent val z: Int,
+ @Default val u: Int,
+ @field:Default val v: Int,
+ @PropertyFieldComponent val w: Int,
+ @NoneInJava val n: Int,
+ @JavaFieldComponent val a: Int,
+ @JavaParamComponent val b: Int,
+ @JavaParamFieldComponent val c: Int,
+ @JavaDefault val d: Int,
+ @field:JavaDefault val e: Int,
+ @JavaWithKotlinTarget val f: Int
+)
+
+@JvmRecord
+data class Else(
+ @all:FieldComponent val x: Int,
+ @all:Field val y: Int,
+ @all:PropertyComponent val z: Int,
+ @all:Default val u: Int,
+ @all:PropertyFieldComponent val w: Int,
+ @all:NoneInJava val n: Int,
+ @all:JavaFieldComponent val a: Int,
+ @all:JavaParamFieldComponent val c: Int,
+ @all:JavaDefault val d: Int,
+ @all:JavaWithKotlinTarget val e: Int
+)
+
+fun box(): String {
+ val someComponents = Some::class.java.recordComponents
+
+ if (someComponents[0].annotations.isEmpty()) {
+ return "FAIL: no record component annotation for '@FieldComponent val x' found"
+ }
+ if (someComponents[1].annotations.isNotEmpty()) {
+ return "FAIL: record component annotation for '@Field val y' found, but it should not be so"
+ }
+ if (someComponents[2].annotations.isNotEmpty()) {
+ return "FAIL: record component annotation for '@PropertyComponent val z' found, but it should not be so"
+ }
+ if (someComponents[3].annotations.isNotEmpty()) {
+ return "FAIL: record component annotation for '@Default val u' found, but it should not be so"
+ }
+ if (someComponents[4].annotations.isEmpty()) {
+ return "FAIL: no record component annotation for '@field:Default val v' found"
+ }
+ if (someComponents[5].annotations.isNotEmpty()) {
+ return "FAIL: record component annotation for '@PropertyFieldComponent val w' found, but it should not be so"
+ }
+ if (someComponents[6].annotations.isNotEmpty()) {
+ return "FAIL: record component annotation for '@NoneInJava val n' found, but it should not be so"
+ }
+ if (someComponents[7].annotations.isEmpty()) {
+ return "FAIL: no record component annotation for '@JavaFieldComponent val a' found"
+ }
+ if (someComponents[8].annotations.isNotEmpty()) {
+ return "FAIL: record component annotation for '@JavaParamComponent val b' found, but it should not be so"
+ }
+ if (someComponents[9].annotations.isNotEmpty()) {
+ return "FAIL: record component annotation for '@JavaParamFieldComponent val c' found, but it should not be so"
+ }
+ if (someComponents[10].annotations.isNotEmpty()) {
+ return "FAIL: record component annotation for '@JavaDefault val d' found, but it should not be so"
+ }
+ if (someComponents[11].annotations.isEmpty()) {
+ return "FAIL: no record component annotation for '@field:JavaDefault val e' found"
+ }
+
+ if (someComponents[12].annotations.isNotEmpty()) {
+ return "FAIL: record component annotation for '@JavaWithKotlinTarget val f' found"
+ }
+
+ val elseComponents = Else::class.java.recordComponents
+
+ if (elseComponents[0].annotations.isEmpty()) {
+ return "FAIL: no record component annotation for '@all:FieldComponent val x' found"
+ }
+ if (elseComponents[1].annotations.isNotEmpty()) {
+ return "FAIL: record component annotation for '@all:Field val y' found, but it should not be so"
+ }
+ if (elseComponents[2].annotations.isNotEmpty()) {
+ return "FAIL: record component annotation for '@all:PropertyComponent val z' found, but it should not be so"
+ }
+ if (elseComponents[3].annotations.isEmpty()) {
+ return "FAIL: no record component annotation for '@all:Default val u' found"
+ }
+ if (elseComponents[4].annotations.isEmpty()) {
+ return "FAIL: no record component annotation for '@all:PropertyFieldComponent val w' found"
+ }
+ if (elseComponents[5].annotations.isNotEmpty()) {
+ return "FAIL: record component annotation for '@all:NoneInJava val n' found, but it should not be so"
+ }
+ if (elseComponents[6].annotations.isEmpty()) {
+ return "FAIL: no record component annotation for '@all:JavaFieldComponent val a' found"
+ }
+ if (elseComponents[7].annotations.isEmpty()) {
+ return "FAIL: no record component annotation for '@all:JavaParamFieldComponent val c' found"
+ }
+ if (elseComponents[8].annotations.isEmpty()) {
+ return "FAIL: no record component annotation for '@all:JavaDefault val d' found"
+ }
+
+ if (elseComponents[9].annotations.isEmpty()) {
+ return "FAIL: no record component annotation for '@JavaWithKotlinTarget val e' found"
+ }
+
+ return "OK"
+}
\ No newline at end of file
diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestRestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestRestGenerated.java
index 41d7a8c..20b0646 100644
--- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestRestGenerated.java
+++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestRestGenerated.java
@@ -6515,6 +6515,12 @@
}
@Test
+ @TestMetadata("recordAnnotationWithoutDefaultTarget.kt")
+ public void testRecordAnnotationWithoutDefaultTarget() {
+ runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordAnnotationWithoutDefaultTarget.kt");
+ }
+
+ @Test
@TestMetadata("recordDifferentPropertyOverride.kt")
public void testRecordDifferentPropertyOverride() {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordDifferentPropertyOverride.kt");
diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxModernJdkCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxModernJdkCodegenTestGenerated.java
index 86b9a3f..4f505bb 100644
--- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxModernJdkCodegenTestGenerated.java
+++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxModernJdkCodegenTestGenerated.java
@@ -413,6 +413,12 @@
}
@Test
+ @TestMetadata("recordAnnotationWithoutDefaultTarget.kt")
+ public void testRecordAnnotationWithoutDefaultTarget() {
+ runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordAnnotationWithoutDefaultTarget.kt");
+ }
+
+ @Test
@TestMetadata("recordDifferentPropertyOverride.kt")
public void testRecordDifferentPropertyOverride() {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordDifferentPropertyOverride.kt");
diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxModernJdkCodegenTestGeneratedWithInlineScopes.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxModernJdkCodegenTestGeneratedWithInlineScopes.java
index 09e6fc2..75f6606 100644
--- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxModernJdkCodegenTestGeneratedWithInlineScopes.java
+++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxModernJdkCodegenTestGeneratedWithInlineScopes.java
@@ -413,6 +413,12 @@
}
@Test
+ @TestMetadata("recordAnnotationWithoutDefaultTarget.kt")
+ public void testRecordAnnotationWithoutDefaultTarget() {
+ runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordAnnotationWithoutDefaultTarget.kt");
+ }
+
+ @Test
@TestMetadata("recordDifferentPropertyOverride.kt")
public void testRecordDifferentPropertyOverride() {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordDifferentPropertyOverride.kt");