You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The following are Java and Kotlin definitions of a function with a parameter with a contravariant type:
public void bar(java.util.List<? super String> param) {}
fun bar(param: List<in String>) {}
The Kotlin definition is correctly parsed as Contravariant with a bound of String, but the Java definition becomes Covariant with a bound of Object.
It seems like in the PSI model, a PsiWildcardType will always have an extendsBound of java.lang.Object, even if that is not explicitly written in the source. In DokkaPsiParser.getVariance, because the extendsBound is checked first, wildcard types will always turn into Covariants, even when they have a contravariant super bound.
Are you willing to provide a PR?
I think #3092 fixes the issue
The text was updated successfully, but these errors were encountered:
Describe the bug
The following are Java and Kotlin definitions of a function with a parameter with a contravariant type:
The Kotlin definition is correctly parsed as
Contravariant
with a bound ofString
, but the Java definition becomesCovariant
with a bound ofObject
.It seems like in the PSI model, a
PsiWildcardType
will always have anextendsBound
ofjava.lang.Object
, even if that is not explicitly written in the source. InDokkaPsiParser.getVariance
, because theextendsBound
is checked first, wildcard types will always turn intoCovariant
s, even when they have a contravariantsuper
bound.Are you willing to provide a PR?
I think #3092 fixes the issue
The text was updated successfully, but these errors were encountered: