How can java.util.ArrayList inherit from MutableList


hi i try to understand some Konzepts about Kotlin.
when i was looking at the collections at

that ArrayList or HashMap have The JS Tag for the Javascript Plattform on it. Which I understand means its only used when targetting Javascript. In Intelij when I am doing a Java Project and add Kotlin support for JVM, I can still freely use kotlin.ArrayList. I saw that in TypeAlias.kt since Kotlin 1.1 their are stored follow Informations:


package kotlin.collections

@SinceKotlin("1.1") public typealias RandomAccess = java.util.RandomAccess

@SinceKotlin("1.1") public typealias ArrayList<E> = java.util.ArrayList<E>
@SinceKotlin("1.1") public typealias LinkedHashMap<K, V> = java.util.LinkedHashMap<K, V>
@SinceKotlin("1.1") public typealias HashMap<K, V> = java.util.HashMap<K, V>
@SinceKotlin("1.1") public typealias LinkedHashSet<E> = java.util.LinkedHashSet<E>
@SinceKotlin("1.1") public typealias HashSet<E> = java.util.HashSet<E>

// also @SinceKotlin("1.1")
internal typealias SortedSet<E> = java.util.SortedSet<E>
internal typealias TreeSet<E> = java.util.TreeSet<E>

so kotlin.ArrayList is just an alias for the Java Version java.util.ArrayList.
java.utilArrayList extends AbstractList and implements List, RandomAccess, Cloneable,

so its not implements MutableList. So how is it possible that the code:

var myList:MutableList<String>=ArrayList<String>()

works when ArrayList not implementing MutableList? A Soloution would be a Class extension, but as i Understand know you can only extends Funktions or Propertys.


java.util.List is mapped to MutableList (or List depending on the type of the variable the list is assigned to):