KT-1717 Don't make member visibility inherit when it is not declared explicitly

#KT-1717 Fixed
This commit is contained in:
Svetlana Isakova
2012-04-03 19:12:29 +04:00
parent 5df7258708
commit 9b2eeb076e
45 changed files with 115 additions and 159 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ public inline fun <T> java.util.Iterator<T>.iterator() : java.util.Iterator<T> =
Helper to make java.util.Enumeration usable in for
*/
public fun <erased T> java.util.Enumeration<T>.iterator(): Iterator<T> = object: Iterator<T> {
override val hasNext: Boolean
public override val hasNext: Boolean
get() = hasMoreElements()
public override fun next() : T = nextElement().sure()
@@ -35,15 +35,15 @@ abstract class FunctionalList<T>(public val size: Int) {
return head
}
override val hasNext: Boolean
public override val hasNext: Boolean
get() = !cur.empty
}
class object {
class Empty<T>() : FunctionalList<T>(0) {
override val head: T
public override val head: T
get() = throw java.util.NoSuchElementException()
override val tail: FunctionalList<T>
public override val tail: FunctionalList<T>
get() = throw java.util.NoSuchElementException()
}
+6 -6
View File
@@ -201,7 +201,7 @@ fun Node.nextSiblings() : Iterator<Node> = NextSiblingIterator(this)
class NextSiblingIterator(var node: Node) : AbstractIterator<Node>() {
override fun computeNext(): Unit {
protected override fun computeNext(): Unit {
val next = node.getNextSibling()
if (next != null) {
setNext(next)
@@ -215,7 +215,7 @@ fun Node.previousSiblings() : Iterator<Node> = PreviousSiblingIterator(this)
class PreviousSiblingIterator(var node: Node) : AbstractIterator<Node>() {
override fun computeNext(): Unit {
protected override fun computeNext(): Unit {
val next = node.getPreviousSibling()
if (next != null) {
setNext(next)
@@ -323,7 +323,7 @@ fun NodeList?.toXmlString(xmlDeclaration: Boolean = false): String {
}
class NodeListAsList(val nodeList: NodeList): AbstractList<Node>() {
override fun get(index: Int): Node {
public override fun get(index: Int): Node {
val node = nodeList.item(index)
if (node == null) {
throw IndexOutOfBoundsException("NodeList does not contain a node at index: " + index)
@@ -332,11 +332,11 @@ class NodeListAsList(val nodeList: NodeList): AbstractList<Node>() {
}
}
override fun size(): Int = nodeList.getLength()
public override fun size(): Int = nodeList.getLength()
}
class ElementListAsList(val nodeList: NodeList): AbstractList<Element>() {
override fun get(index: Int): Element {
public override fun get(index: Int): Element {
val node = nodeList.item(index)
if (node is Element) {
return node
@@ -349,7 +349,7 @@ class ElementListAsList(val nodeList: NodeList): AbstractList<Element>() {
}
}
override fun size(): Int = nodeList.getLength()
public override fun size(): Int = nodeList.getLength()
}
+2 -2
View File
@@ -172,7 +172,7 @@ public inline fun <T: Closeable, R> T.use(block: (T)-> R) : R {
/** Returns an [Iterator] of bytes over an input stream */
public fun InputStream.iterator() : ByteIterator =
object: ByteIterator() {
override val hasNext : Boolean
public override val hasNext : Boolean
get() = available() > 0
public override fun nextByte() : Byte = read().toByte()
@@ -236,7 +236,7 @@ class LineIterator(val reader: BufferedReader) : Iterator<String> {
private var nextValue: String? = null
private var done = false
override val hasNext: Boolean
public override val hasNext: Boolean
get() {
if (nextValue == null && !done) {
nextValue = reader.readLine()
@@ -17,7 +17,7 @@ public abstract class AbstractIterator<T>: java.util.Iterator<T> {
private var state: State = State.NotReady
private var next: T? = null
override fun hasNext(): Boolean {
public override fun hasNext(): Boolean {
require(state != State.Failed)
return when (state) {
State.Done -> false
@@ -26,13 +26,13 @@ public abstract class AbstractIterator<T>: java.util.Iterator<T> {
}
}
override fun next(): T {
public override fun next(): T {
if (!hasNext()) throw NoSuchElementException()
state = State.NotReady
return next.sure()
}
override fun remove() {
public override fun remove() {
throw UnsupportedOperationException()
}