Skip to content

Commit

Permalink
Test fqn of nested annotations
Browse files Browse the repository at this point in the history
(cherry picked from commit dfe706d)
  • Loading branch information
kuanyingchou authored and KSP Auto Pick committed Oct 6, 2024
1 parent 8bdc388 commit a42aae2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
// MyClass: MyAnnotation: stringParam = 2
// MyClass: MyAnnotation: stringParam2 = 1
// MyClass: MyAnnotation: stringArrayParam = [3, 5, 7]
// MyClass: MyAnnotation: Containing.Nested
// MyClassInLib: MyAnnotation: stringParam = 2
// MyClassInLib: MyAnnotation: stringParam2 = 1
// MyClassInLib: MyAnnotation: stringArrayParam = [3, 5, 7]
// MyClassInLib: MyAnnotation: Containing.Nested
// Str
// 42
// Foo
Expand Down Expand Up @@ -60,8 +62,12 @@ import java.lang.annotation.Target;
int value1();
}

@interface Containing {
@interface Nested {}
}

interface MyInterface {}
@MyAnnotation(stringParam = "2") class MyClassInLib implements MyInterface {}
@MyAnnotation(stringParam = "2") @Containing.Nested class MyClassInLib implements MyInterface {}

// FILE: OtherAnnotation.java
import java.lang.annotation.Retention;
Expand All @@ -80,7 +86,7 @@ annotation class KotlinAnnotationWithDefaults(val otherAnnotation: OtherAnnotati

// MODULE: main(module1)
// FILE: Test.java
@MyAnnotation(stringParam = "2") class MyClass implements MyInterface {}
@MyAnnotation(stringParam = "2") @Containing.Nested class MyClass implements MyInterface {}

// FILE: a.kt
enum class RGB {
Expand Down
11 changes: 9 additions & 2 deletions test-utils/testData/api/annotationValue_java.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
// MyClass: MyAnnotation: stringParam = 2
// MyClass: MyAnnotation: stringParam2 = 1
// MyClass: MyAnnotation: stringArrayParam = [3, 5, 7]
// MyClass: MyAnnotation: Containing.Nested
// MyClassInLib: MyAnnotation: stringParam = 2
// MyClassInLib: MyAnnotation: stringParam2 = 1
// MyClassInLib: MyAnnotation: stringArrayParam = [3, 5, 7]
// MyClassInLib: MyAnnotation: Containing.Nested
// Str
// 42
// Foo
Expand All @@ -50,8 +52,13 @@ import java.lang.annotation.Target;
String stringParam2() default "1";
String[] stringArrayParam() default {"3", "5", "7"};
}

@interface Containing {
@interface Nested {}
}

interface MyInterface {}
@MyAnnotation(stringParam = "2") class MyClassInLib implements MyInterface {}
@MyAnnotation(stringParam = "2") @Containing.Nested class MyClassInLib implements MyInterface {}

// FILE: OtherAnnotation.java
import java.lang.annotation.Retention;
Expand All @@ -67,7 +74,7 @@ public @interface JavaAnnotationWithDefaults {

// MODULE: main(module1)
// FILE: Test.java
@MyAnnotation(stringParam = "2") class MyClass implements MyInterface {}
@MyAnnotation(stringParam = "2") @Containing.Nested class MyClass implements MyInterface {}
// FILE: a.kt

enum class RGB {
Expand Down

0 comments on commit a42aae2

Please sign in to comment.