Reflection: deprecate KClass.defaultType

Its semantics were unclear and its javaType was implemented incorrectly (it
should have returned ParameterizedType with star projections for generic type)
This commit is contained in:
Alexander Udalov
2016-07-26 18:41:41 +03:00
parent 6b79782951
commit f958483e56
3 changed files with 3 additions and 33 deletions
@@ -54,6 +54,9 @@ val KClass<*>.companionObjectInstance: Any?
* Returns a type corresponding to the given class with type parameters of that class substituted as the corresponding arguments.
* For example, for class `MyMap<K, V>` [defaultType] would return the type `MyMap<K, V>`.
*/
@Deprecated("This function creates a type which rarely makes sense for generic classes. " +
"For example, such type can only be used in signatures of members of that class. " +
"Use starProjectedType or createType() for clearer semantics.")
val KClass<*>.defaultType: KType
get() = KTypeImpl((this as KClassImpl<*>).descriptor.defaultType) { jClass }