deprecate some legacy code in the standard library
This commit is contained in:
@@ -16,7 +16,7 @@ private enum class State {
|
|||||||
* A base class to simplify implementing iterators so that implementations only have to implement [computeNext]
|
* 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.
|
* 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 state = State.NotReady
|
||||||
private var nextValue: T? = null
|
private var nextValue: T? = null
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package kotlin
|
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
|
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 head: T
|
||||||
public abstract val tail: FunctionalList<T>
|
public abstract val tail: FunctionalList<T>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package kotlin.concurrent
|
|||||||
|
|
||||||
import java.util.concurrent.Executor
|
import java.util.concurrent.Executor
|
||||||
|
|
||||||
public class FunctionalQueue<T> (
|
deprecated public class FunctionalQueue<T> (
|
||||||
private val input: FunctionalList<T> = FunctionalList.emptyList<T>(),
|
private val input: FunctionalList<T> = FunctionalList.emptyList<T>(),
|
||||||
private val output: 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.HashMap
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
|
|
||||||
public class ChangeEvent(
|
deprecated public class ChangeEvent(
|
||||||
public val source: Any,
|
public val source: Any,
|
||||||
public val name: String,
|
public val name: String,
|
||||||
public val oldValue: Any?,
|
public val oldValue: Any?,
|
||||||
@@ -12,7 +12,7 @@ public class ChangeEvent(
|
|||||||
override fun toString(): String = "ChangeEvent($name, $oldValue, $newValue)"
|
override fun toString(): String = "ChangeEvent($name, $oldValue, $newValue)"
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait ChangeListener {
|
deprecated public trait ChangeListener {
|
||||||
public fun onPropertyChange(event: ChangeEvent): Unit
|
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
|
* updates for easier binding to user interfaces, undo/redo command stacks and
|
||||||
* change tracking mechanisms for persistence or distributed change notifications.
|
* 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 allListeners: MutableList<ChangeListener>? = null
|
||||||
private var nameListeners: MutableMap<String, MutableList<ChangeListener>>? = null
|
private var nameListeners: MutableMap<String, MutableList<ChangeListener>>? = null
|
||||||
|
|
||||||
@@ -81,30 +81,3 @@ public abstract class ChangeSupport {
|
|||||||
//addChangeListener(name, DelegateChangeListener(fn))
|
//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
|
// TODO this class should move into the runtime
|
||||||
// in kotlin.StringTemplate
|
// 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
|
* Converts the template into a String
|
||||||
@@ -38,7 +38,7 @@ public class StringTemplate(private val values: Array<Any?>) {
|
|||||||
*
|
*
|
||||||
* See [[HtmlFormatter] and [[LocaleFormatter] respectively.
|
* See [[HtmlFormatter] and [[LocaleFormatter] respectively.
|
||||||
*/
|
*/
|
||||||
public fun StringTemplate.toString(formatter: Formatter): String {
|
deprecated public fun StringTemplate.toString(formatter: Formatter): String {
|
||||||
val buffer = StringBuilder()
|
val buffer = StringBuilder()
|
||||||
append(buffer, formatter)
|
append(buffer, formatter)
|
||||||
return buffer.toString()
|
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
|
* Appends the text representation of this string template to the given output
|
||||||
* using the supplied formatter
|
* 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
|
var constantText = true
|
||||||
this.forEach {
|
this.forEach {
|
||||||
if (constantText) {
|
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
|
* Converts this string template to internationalised text using the supplied
|
||||||
* [[LocaleFormatter]]
|
* [[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
|
* 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
|
* 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
|
* 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]
|
* 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
|
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
|
* Formats strings with no special encoding other than allowing the null text to be
|
||||||
* configured
|
* configured
|
||||||
*/
|
*/
|
||||||
public open class ToStringFormatter : Formatter {
|
deprecated public open class ToStringFormatter : Formatter {
|
||||||
|
|
||||||
private val nullString: String = "null"
|
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
|
* 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}"
|
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.
|
* 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}"
|
override fun toString(): String = "HtmlFormatter{$locale}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user