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()
}
+1 -1
View File
@@ -406,7 +406,7 @@ class CollectionTest {
class IterableWrapper<T>(collection : java.lang.Iterable<T>) : java.lang.Iterable<T> {
private val collection = collection
override fun iterator(): java.util.Iterator<T> {
public override fun iterator(): java.util.Iterator<T> {
return collection.iterator().sure()
}
}
+2 -2
View File
@@ -43,10 +43,10 @@ class CompareTest {
Test fun sortUsingCustomComparator() {
val c = object : Comparator<Item>{
override fun compare(o1: Item?, o2: Item?): Int {
public override fun compare(o1: Item?, o2: Item?): Int {
return compareBy(o1, o2, {(it: Item) -> it.name}, {(it: Item) -> it.rating})
}
override fun equals(obj: Any?): Boolean {
public override fun equals(obj: Any?): Boolean {
return this == obj
}
}
+4 -4
View File
@@ -17,13 +17,13 @@ class TestBuilt<T>(name: String, val builder: TestBuilder<T>, val test: TestBuil
get() = myState.sure()
set(newState: T) { myState = newState }
override fun countTestCases(): Int = 1
public override fun countTestCases(): Int = 1
override fun setUp() = this.(builder.setUp)()
protected override fun setUp() = this.(builder.setUp)()
override fun tearDown() = this.(builder.tearDown)()
protected override fun tearDown() = this.(builder.tearDown)()
override fun runTest() = this.(test)()
protected override fun runTest() = this.(test)()
}
open class TestBuilder<T>(name: String) {
@@ -10,7 +10,7 @@ import junit.framework.TestCase
import junit.framework.Assert
class Serial(val a : String) : java.lang.Object(), Serializable {
override fun toString() = a
public override fun toString() = a
}
class SerialTest() : TestCase() {
@@ -28,7 +28,7 @@ class Customer() : ChangeSupport() {
class MyChangeListener() : ChangeListener {
val events = ArrayList<ChangeEvent>()
override fun onPropertyChange(event: ChangeEvent): Unit {
public override fun onPropertyChange(event: ChangeEvent): Unit {
println("Property changed: $event")
events.add(event)
}