diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2021-02-05 14:55:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-05 14:55:45 +0100 |
commit | 70000c87a37caa2a6b518a555f53c98514434403 (patch) | |
tree | 3a0e7a2b797b6edfffc0396bb5f9d35708120e9d /plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt | |
parent | b44e41ec8e3e26c73affaaa98bbd170fde352d96 (diff) | |
download | dokka-70000c87a37caa2a6b518a555f53c98514434403.tar.gz dokka-70000c87a37caa2a6b518a555f53c98514434403.tar.bz2 dokka-70000c87a37caa2a6b518a555f53c98514434403.zip |
Annotations for parameters (#1710)
* Annotations for parameters
* Annotations for parameters
Diffstat (limited to 'plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt')
-rw-r--r-- | plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt b/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt index 5679010d..9e00fafd 100644 --- a/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt +++ b/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt @@ -1,11 +1,10 @@ package model.annotations import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.Annotations -import org.jetbrains.dokka.model.DClass -import org.jetbrains.dokka.model.DFunction +import org.jetbrains.dokka.model.* import org.junit.jupiter.api.Test import utils.AbstractModelTest +import kotlin.test.Ignore import kotlin.test.assertEquals class JavaAnnotationsForParametersTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { @@ -85,4 +84,34 @@ class JavaAnnotationsForParametersTest : AbstractModelTest("/src/main/kotlin/jav } } } + + @Test + fun `function with generic parameter that has annotated bounds`() { + inlineModelTest( + """ + |@Retention(RetentionPolicy.RUNTIME) + |@Target({ElementType.TYPE_USE}) + |@interface Hello { + | public String bar() default ""; + |} + |class Test { + | public <T extends @Hello(bar = "baz") String> List<T> foo() { + | return null; + | } + |} + """.trimIndent() + ) { + with((this / "java" / "Test").cast<DClass>()) { + with((this / "foo").cast<DFunction>()) { + val annotations = ((generics.first().bounds.first() as Nullable).inner as GenericTypeConstructor) + .extra[Annotations]?.directAnnotations?.flatMap { it.value } + val driOfHello = DRI("java", "Hello") + val annotationsValues = annotations?.flatMap { it.params.values }?.map { it.toString() }?.toList() + + assertEquals(listOf(driOfHello), annotations?.map { it.dri }) + assertEquals(listOf("baz"), annotationsValues) + } + } + } + } }
\ No newline at end of file |