diff options
author | Julia McClellan <juliamcclellan37@gmail.com> | 2023-08-04 06:22:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-04 12:22:54 +0200 |
commit | e7af2fd28ed46f02046ea329a8e6707a2e217bd6 (patch) | |
tree | f64ea2bb7ce0345f40cbcb032a49d2ad32e14c75 /subprojects/analysis-java-psi | |
parent | 8fd4ed32275a7e2df38f5f62964093441c77065c (diff) | |
download | dokka-e7af2fd28ed46f02046ea329a8e6707a2e217bd6.tar.gz dokka-e7af2fd28ed46f02046ea329a8e6707a2e217bd6.tar.bz2 dokka-e7af2fd28ed46f02046ea329a8e6707a2e217bd6.zip |
Fix handling of Java contravariance (#3092)
Diffstat (limited to 'subprojects/analysis-java-psi')
-rw-r--r-- | subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/DokkaPsiParser.kt | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/DokkaPsiParser.kt b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/DokkaPsiParser.kt index 45f44338..a1f9cef0 100644 --- a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/DokkaPsiParser.kt +++ b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/DokkaPsiParser.kt @@ -567,8 +567,10 @@ internal class DokkaPsiParser( private fun getVariance(type: PsiWildcardType): Projection = when { + type.isExtends -> Covariance(getBound(type.extendsBound)) + type.isSuper -> Contravariance(getBound(type.superBound)) + // If the type isn't explicitly bounded, it still has an implicit `extends Object` bound type.extendsBound != PsiType.NULL -> Covariance(getBound(type.extendsBound)) - type.superBound != PsiType.NULL -> Contravariance(getBound(type.superBound)) else -> throw IllegalStateException("${type.presentableText} has incorrect bounds") } |