diff options
author | Vadim Mishenev <vad-mishenev@yandex.ru> | 2022-08-18 18:43:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-18 18:43:20 +0300 |
commit | df8d9879b818799c83ff731b3a78e7d2b96fd8e5 (patch) | |
tree | a935c4fcd42750cf7727d9970c2c575db0f9400e /plugins/base/src/test | |
parent | e9e95f6bdefa2ea4bd2cc1a79ed642ff57b25e48 (diff) | |
download | dokka-df8d9879b818799c83ff731b3a78e7d2b96fd8e5.tar.gz dokka-df8d9879b818799c83ff731b3a78e7d2b96fd8e5.tar.bz2 dokka-df8d9879b818799c83ff731b3a78e7d2b96fd8e5.zip |
Fix generic types caching (#2619)
Diffstat (limited to 'plugins/base/src/test')
-rw-r--r-- | plugins/base/src/test/kotlin/model/JavaTest.kt | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt index 0abaf1b1..47a25943 100644 --- a/plugins/base/src/test/kotlin/model/JavaTest.kt +++ b/plugins/base/src/test/kotlin/model/JavaTest.kt @@ -143,6 +143,43 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { ) { with((this / "java" / "Foo").cast<DClass>()) { generics counts 1 + generics[0].dri.classNames equals "Foo" + (functions[0].type as? TypeParameter)?.dri?.run { + packageName equals "java" + name equals "Foo" + callable?.name equals "foo" + } + } + } + } + + @Test + fun typeParameterIntoDifferentClasses2596() { + inlineModelTest( + """ + |class GenericDocument { } + |public interface DocumentClassFactory<T> { + | String getSchemaName(); + | GenericDocument toGenericDocument(T document); + | T fromGenericDocument(GenericDocument genericDoc); + |} + | + |public final class DocumentClassFactoryRegistry { + | public <T> DocumentClassFactory<T> getOrCreateFactory(T documentClass) { + | return null; + | } + |} + """, configuration = configuration + ) { + with((this / "java" / "DocumentClassFactory").cast<DInterface>()) { + generics counts 1 + generics[0].dri.classNames equals "DocumentClassFactory" + } + with((this / "java" / "DocumentClassFactoryRegistry").cast<DClass>()) { + functions.forEach { + (it.type as GenericTypeConstructor).dri.classNames equals "DocumentClassFactory" + ((it.type as GenericTypeConstructor).projections[0] as TypeParameter).dri.classNames equals "DocumentClassFactoryRegistry" + } } } } |