aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/model/JavaTest.kt
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2021-04-14 15:16:45 +0200
committerGitHub <noreply@github.com>2021-04-14 15:16:45 +0200
commit38270a3b8783857bd0bba4b9422b19b4de507e4c (patch)
tree71273a5c15db755ac264c6bddb164de40bbca2c1 /plugins/base/src/test/kotlin/model/JavaTest.kt
parentacd9234be6909a69f89600e9c8ddde642d36b1cf (diff)
downloaddokka-38270a3b8783857bd0bba4b9422b19b4de507e4c.tar.gz
dokka-38270a3b8783857bd0bba4b9422b19b4de507e4c.tar.bz2
dokka-38270a3b8783857bd0bba4b9422b19b4de507e4c.zip
Fix missing annotations in GFM and unresolved static imports (#1845)
* Fix missing unresolved links in GFM * Fix missing links to elements imported as static
Diffstat (limited to 'plugins/base/src/test/kotlin/model/JavaTest.kt')
-rw-r--r--plugins/base/src/test/kotlin/model/JavaTest.kt38
1 files changed, 38 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt
index 72342962..da45a920 100644
--- a/plugins/base/src/test/kotlin/model/JavaTest.kt
+++ b/plugins/base/src/test/kotlin/model/JavaTest.kt
@@ -14,6 +14,7 @@ import org.junit.jupiter.api.Test
import utils.AbstractModelTest
import utils.assertNotNull
import utils.name
+import kotlin.test.assertEquals
import org.jetbrains.dokka.links.Callable as DRICallable
class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
@@ -342,4 +343,41 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
}
}
}
+
+ @Test
+ fun `retention should work with static import`() {
+ inlineModelTest(
+ """
+ |import java.lang.annotation.Retention;
+ |import java.lang.annotation.RetentionPolicy;
+ |import static java.lang.annotation.RetentionPolicy.RUNTIME;
+ |
+ |@Retention(RUNTIME)
+ |public @interface JsonClass {
+ |};
+ """, configuration = configuration
+ ) {
+ with((this / "java" / "JsonClass").cast<DAnnotation>()) {
+ val annotation = extra[Annotations]?.directAnnotations?.entries
+ ?.firstOrNull()?.value //First sourceset
+ ?.firstOrNull()
+
+ val expectedDri = DRI("java.lang.annotation", "Retention", null, PointingToDeclaration)
+ val expectedParams = "value" to EnumValue(
+ "RUNTIME",
+ DRI(
+ "java.lang.annotation",
+ "RetentionPolicy",
+ DRICallable("RUNTIME", null, emptyList()),
+ PointingToDeclaration
+ )
+ )
+
+ assertEquals(expectedDri, annotation?.dri)
+ assertEquals(expectedParams.first, annotation?.params?.entries?.first()?.key)
+ assertEquals(expectedParams.second, annotation?.params?.entries?.first()?.value)
+ }
+ }
+ }
+
}