KT-2640 Provide jet.MutableIterator and jet.MutableIterable

#KT-2640 fixed
This commit is contained in:
Svetlana Isakova
2012-08-24 15:07:00 +04:00
parent 422b938728
commit 0dcdaccad1
21 changed files with 175 additions and 9 deletions
+8
View File
@@ -832,6 +832,14 @@ public final class jet.LongRange : jet.Range<jet.Long>, jet.LongIterable {
public final val EMPTY: jet.LongRange
}
}
public abstract trait jet.MutableIterable</*0*/ out T : jet.Any?> : jet.Iterable<T> {
public abstract override /*1*/ fun iterator(): jet.MutableIterator<T>
}
public abstract trait jet.MutableIterator</*0*/ out T : jet.Any?> : jet.Iterator<T> {
public abstract override /*1*/ fun hasNext(): jet.Boolean
public abstract override /*1*/ fun next(): T
public abstract fun remove(): jet.Tuple0
}
public final class jet.Nothing {
private final /*constructor*/ fun <init>(): jet.Nothing
}
@@ -0,0 +1,29 @@
//FILE:a/JC.java
package a;
import java.util.Iterator;
public interface JC<T> {
public Iterator<T> getIterator();
public void setIterator(Iterator<T> iterator);
public Iterable<T> getIterable();
public void setIterable(Iterable<T> iterable);
}
//FILE:n.kt
package n
import a.JC
fun foo(c: JC<Int>, iterator: Iterator<Int>, iterable: Iterable<Int>) {
val mutableIterator: MutableIterator<Int>? = c.getIterator()
c.setIterator(mutableIterator)
c.setIterator(iterator)
val mutableIterable: MutableIterable<Int>? = c.getIterable()
c.setIterable(mutableIterable)
c.setIterable(iterable)
}
@@ -5,7 +5,7 @@ public open class InnerClassesInGeneric<P, Q>() : java.lang.Object() {
}
public open class Inner2() : Inner() {
public open fun iterator() : jet.Iterator<P>? {
public open fun iterator() : jet.MutableIterator<P>? {
throw UnsupportedOperationException()
}
}
@@ -7,6 +7,6 @@ public open class test.InnerClassesInGeneric</*0*/ P : jet.Any?, /*1*/ Q : jet.A
}
public open class test.InnerClassesInGeneric.Inner2 : test.InnerClassesInGeneric.Inner {
public final /*constructor*/ fun <init>(): test.InnerClassesInGeneric.Inner2
public open fun iterator(): jet.Iterator<P>?
public open fun iterator(): jet.MutableIterator<P>?
}
}
@@ -0,0 +1,22 @@
/*
* Copyright 2010-2012 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test;
public interface LoadIterable<T> {
public Iterable<T> getIterable();
public void setIterable(Iterable<T> Iterable);
}
@@ -0,0 +1,6 @@
package test
public trait LoadIterable<T> : java.lang.Object {
public fun getIterable(): MutableIterable<T>?
public fun setIterable(p0: Iterable<T>?)
}
@@ -0,0 +1,6 @@
namespace test
public abstract trait test.LoadIterable</*0*/ T : jet.Any?> : java.lang.Object {
public abstract fun getIterable(): jet.MutableIterable<T>?
public abstract fun setIterable(/*0*/ p0: jet.Iterable<T>?): jet.Tuple0
}
@@ -0,0 +1,8 @@
package test;
import java.util.Iterator;
public interface LoadIterator<T> {
public Iterator<T> getIterator();
public void setIterator(Iterator<T> iterator);
}
@@ -0,0 +1,6 @@
package test
public trait LoadIterator<T> : java.lang.Object {
public fun getIterator(): MutableIterator<T>?
public fun setIterator(p0: Iterator<T>?)
}
@@ -0,0 +1,6 @@
namespace test
public abstract trait test.LoadIterator</*0*/ T : jet.Any?> : java.lang.Object {
public abstract fun getIterator(): jet.MutableIterator<T>?
public abstract fun setIterator(/*0*/ p0: jet.Iterator<T>?): jet.Tuple0
}
@@ -12,7 +12,7 @@ public open class test.ModalityOfFakeOverrides : java.util.AbstractList<jet.Stri
public open override /*1*/ fun get(/*0*/ p0: jet.Int): jet.String?
public open override /*1*/ fun indexOf(/*0*/ p0: jet.Any?): jet.Int
public open override /*1*/ fun isEmpty(): jet.Boolean
public open override /*1*/ fun iterator(): jet.Iterator<jet.String>?
public open override /*1*/ fun iterator(): jet.MutableIterator<jet.String>?
public open override /*1*/ fun lastIndexOf(/*0*/ p0: jet.Any?): jet.Int
public open override /*1*/ fun listIterator(): java.util.ListIterator<jet.String>?
public open override /*1*/ fun listIterator(/*0*/ p0: jet.Int): java.util.ListIterator<jet.String>?