deprecate some legacy code in the standard library

This commit is contained in:
Dmitry Jemerov
2015-03-02 18:17:17 +01:00
parent c63b9b9433
commit afafdb31ee
6 changed files with 18 additions and 45 deletions
@@ -16,7 +16,7 @@ private enum class State {
* A base class to simplify implementing iterators so that implementations only have to implement [computeNext]
* to implement the iterator, calling [done] when the iteration is complete.
*/
public abstract class AbstractIterator<T>: Iterator<T> {
deprecated public abstract class AbstractIterator<T>: Iterator<T> {
private var state = State.NotReady
private var nextValue: T? = null
@@ -1,5 +1,5 @@
package kotlin
public class EmptyIterableException(private val it: Iterable<*>) : RuntimeException("$it is empty")
deprecated public class EmptyIterableException(private val it: Iterable<*>) : RuntimeException("$it is empty")
public class DuplicateKeyException(message : String = "Duplicate keys detected") : RuntimeException(message)
deprecated public class DuplicateKeyException(message : String = "Duplicate keys detected") : RuntimeException(message)
@@ -1,6 +1,6 @@
package kotlin.concurrent
public abstract class FunctionalList<T>(public val size: Int) {
deprecated public abstract class FunctionalList<T>(public val size: Int) {
public abstract val head: T
public abstract val tail: FunctionalList<T>
@@ -2,7 +2,7 @@ package kotlin.concurrent
import java.util.concurrent.Executor
public class FunctionalQueue<T> (
deprecated public class FunctionalQueue<T> (
private val input: FunctionalList<T> = FunctionalList.emptyList<T>(),
private val output: FunctionalList<T> = FunctionalList.emptyList<T>()
) {
@@ -3,7 +3,7 @@ package kotlin.properties
import java.util.HashMap
import java.util.ArrayList
public class ChangeEvent(
deprecated public class ChangeEvent(
public val source: Any,
public val name: String,
public val oldValue: Any?,
@@ -12,7 +12,7 @@ public class ChangeEvent(
override fun toString(): String = "ChangeEvent($name, $oldValue, $newValue)"
}
public trait ChangeListener {
deprecated public trait ChangeListener {
public fun onPropertyChange(event: ChangeEvent): Unit
}
@@ -21,7 +21,7 @@ public trait ChangeListener {
* updates for easier binding to user interfaces, undo/redo command stacks and
* change tracking mechanisms for persistence or distributed change notifications.
*/
public abstract class ChangeSupport {
deprecated public abstract class ChangeSupport {
private var allListeners: MutableList<ChangeListener>? = null
private var nameListeners: MutableMap<String, MutableList<ChangeListener>>? = null
@@ -81,30 +81,3 @@ public abstract class ChangeSupport {
//addChangeListener(name, DelegateChangeListener(fn))
}
}
/*
TODO this seems to generate a compiler barf!
see http://youtrack.jetbrains.com/issue/KT-1362
protected fun createChangeListener(fn: (ChangeEvent) -> Unit): ChangeListener {
return DelegateChangeListener(fn)
}
protected fun createChangeListener(fn: (ChangeEvent) -> Unit): ChangeListener {
return ChangeListener {
public override fun onPropertyChange(event: ChangeEvent): Unit {
fn(event)
}
}
}
}
class DelegateChangeListener(val f: (ChangeEvent) -> Unit) : ChangeListener {
public override fun onPropertyChange(event: ChangeEvent): Unit {
f(event)
}
}
@@ -10,7 +10,7 @@ import java.util.Date
// TODO this class should move into the runtime
// in kotlin.StringTemplate
public class StringTemplate(private val values: Array<Any?>) {
deprecated public class StringTemplate(private val values: Array<Any?>) {
/**
* Converts the template into a String
@@ -38,7 +38,7 @@ public class StringTemplate(private val values: Array<Any?>) {
*
* See [[HtmlFormatter] and [[LocaleFormatter] respectively.
*/
public fun StringTemplate.toString(formatter: Formatter): String {
deprecated public fun StringTemplate.toString(formatter: Formatter): String {
val buffer = StringBuilder()
append(buffer, formatter)
return buffer.toString()
@@ -48,7 +48,7 @@ public fun StringTemplate.toString(formatter: Formatter): String {
* Appends the text representation of this string template to the given output
* using the supplied formatter
*/
public fun StringTemplate.append(out: Appendable, formatter: Formatter): Unit {
deprecated public fun StringTemplate.append(out: Appendable, formatter: Formatter): Unit {
var constantText = true
this.forEach {
if (constantText) {
@@ -69,19 +69,19 @@ public fun StringTemplate.append(out: Appendable, formatter: Formatter): Unit {
* Converts this string template to internationalised text using the supplied
* [[LocaleFormatter]]
*/
public fun StringTemplate.toLocale(formatter: LocaleFormatter = LocaleFormatter()): String = toString(formatter)
deprecated public fun StringTemplate.toLocale(formatter: LocaleFormatter = LocaleFormatter()): String = toString(formatter)
/**
* Converts this string template to HTML text
*/
public fun StringTemplate.toHtml(formatter: HtmlFormatter = HtmlFormatter()): String = toString(formatter)
deprecated public fun StringTemplate.toHtml(formatter: HtmlFormatter = HtmlFormatter()): String = toString(formatter)
/**
* Represents a formatter and encoder of values in a [[StringTemplate]] which understands
* how to format values for a particular [[Locale]] such as with the [[LocaleFormatter]] or
* to escape particular characters in different output formats such as [[HtmlFormatter]
*/
public trait Formatter {
deprecated public trait Formatter {
public fun format(buffer: Appendable, value: Any?): Unit
}
@@ -89,7 +89,7 @@ public trait Formatter {
* Formats strings with no special encoding other than allowing the null text to be
* configured
*/
public open class ToStringFormatter : Formatter {
deprecated public open class ToStringFormatter : Formatter {
private val nullString: String = "null"
@@ -114,12 +114,12 @@ public open class ToStringFormatter : Formatter {
}
}
public val defaultLocale: Locale = Locale.getDefault()
deprecated public val defaultLocale: Locale = Locale.getDefault()
/**
* Formats values using a given [[Locale]] for internationalisation
*/
public open class LocaleFormatter(protected val locale: Locale = defaultLocale) : ToStringFormatter() {
deprecated public open class LocaleFormatter(protected val locale: Locale = defaultLocale) : ToStringFormatter() {
override fun toString(): String = "LocaleFormatter{$locale}"
@@ -149,7 +149,7 @@ public open class LocaleFormatter(protected val locale: Locale = defaultLocale)
/**
* Formats values for HTML encoding, escaping special characters in HTML.
*/
public class HtmlFormatter(locale: Locale = defaultLocale) : LocaleFormatter(locale) {
deprecated public class HtmlFormatter(locale: Locale = defaultLocale) : LocaleFormatter(locale) {
override fun toString(): String = "HtmlFormatter{$locale}"