It's parameter is FQ-name of class (currently only from builtins) that added as supertype to annotated Java class.
Parameters of annotated class used as non-flexible arguments of added supertype, that helps to propagate more precise types when using in Kotlin.
Some standard JDK collections loaded as they annotated with PurelyImplements.
See tests for clarification.
Before: ArrayList<Int>.add(x: Int!) // possible to add null
After: ArrayList<Int>.add(x: Int) // impossible to add null
#KT-7628 Fixed
#KT-7835 Fixed
In most cases order doesn't matter as in supertype tree built from real code
types with same type constructors should be completely equal.
The only case when order does matter is when we artificially add more specific supertype closer to the root.
For example specific annotation adding non-platform supertype MutableMap<K, V> to ConcurrentHashMap
ConcurrentHashMap<K, V> extends ConcurrentMap<K!, V!> that extends java.util.Map<K!, V!> (mapped to kotlin.MutableMap<K!, V!>)
So we want in that case to use refined (more specific) version when checking subtypes:
ConcurrentHashMap<String, Int> should not be a subtype Map<String!, Int!> (and respectively Map<String?, Int?>)
It should be pure non-platform Map<String, Int> that can be found only with BFS
These objects implement AbstractList that extending MutableCollection.
After type propagation `iterator` of AbstractList become MutableIterator, so it cannot be overriden with immutable Iterator
Some more FQ names appeared.
The reason is that earlier such types were Lazy and their `toString` method return short version.
But after type enhancement they are represented with JetTypeImpl
If lower bound of flexible is nullable treat it like Kotlin nullable type
Anyway appropriate errors are reported outside JavaNullabilityWarningsChecker
Before this commit old type parameters were inserted into new descriptor,
and that broke a simple contract: desc.child.getContainingDeclaration() == desc.
We use `doSubstitute` here because it does exactly what we need:
1. creates full copy of descriptor
2. copies method's type parameters (with new containing declaration) and properly substitute to them in value parameters, return type and etc.
But we had to customize `doSubstitute`: add some parameters like `newReturnType`
NOTE: Strange testData change.
(Mutable)List<in T!>! after substitution becomes MutableList<in T!>..List<*>?.
But it's not wrong because List<in T> behaves exactly as List<*>, and the same happens when substituing Java class scope:
public class A<E> {
<T> void foo(List<? super T> x) {}
}
Kotlin:
A.foo(), type of first value parameter --- (Mutable)List<in T!>
A<String>().foo(), type of first value parameter --- MutableList<in T!>..List<*>?
It's needed because new parameter owner is not created while enhacing types
(It was containing declaration of old value parameter that is wrong)
Also simplified SignatureParts' logic: `replaceType` is always an identity function
It's needed to enhace types when loading descriptors via reflection.
Also get rid of `enhanceSignatures` method in ExternalSignatureResolver as enhancement does not use external signature at all