From 4798c029dea6fe1438ba5442e1073e6a5e6270e0 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Sat, 6 May 2017 06:10:10 +0300 Subject: [PATCH] Limit visibility of sublists, make them implement RandomAccess --- js/js.libraries/src/core/collections/AbstractMutableList.kt | 4 ++-- libraries/stdlib/src/kotlin/collections/AbstractList.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/js.libraries/src/core/collections/AbstractMutableList.kt b/js/js.libraries/src/core/collections/AbstractMutableList.kt index 82520388df6..af34d7e9185 100644 --- a/js/js.libraries/src/core/collections/AbstractMutableList.kt +++ b/js/js.libraries/src/core/collections/AbstractMutableList.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2016 JetBrains s.r.o. + * Copyright 2010-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -174,7 +174,7 @@ public abstract class AbstractMutableList protected constructor() : AbstractM } } - private class SubList(private val list: AbstractMutableList, private val fromIndex: Int, toIndex: Int) : AbstractMutableList() { + private class SubList(private val list: AbstractMutableList, private val fromIndex: Int, toIndex: Int) : AbstractMutableList(), RandomAccess { private var _size: Int = 0 init { diff --git a/libraries/stdlib/src/kotlin/collections/AbstractList.kt b/libraries/stdlib/src/kotlin/collections/AbstractList.kt index 71ff76c4ae4..b64f2d073d6 100644 --- a/libraries/stdlib/src/kotlin/collections/AbstractList.kt +++ b/libraries/stdlib/src/kotlin/collections/AbstractList.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2016 JetBrains s.r.o. + * Copyright 2010-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ public abstract class AbstractList protected constructor() : AbstractColl override fun subList(fromIndex: Int, toIndex: Int): List = SubList(this, fromIndex, toIndex) - internal open class SubList(private val list: AbstractList, private val fromIndex: Int, toIndex: Int) : AbstractList() { + private class SubList(private val list: AbstractList, private val fromIndex: Int, toIndex: Int) : AbstractList(), RandomAccess { private var _size: Int = 0 init {