standard library deprecations, now with proper messages
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package kotlin
|
||||
|
||||
deprecated("This exception is no longer thrown by any standard library classes and is going to be removed")
|
||||
public class EmptyIterableException(private val it: Iterable<*>) : RuntimeException("$it is empty")
|
||||
|
||||
deprecated("This exception is no longer thrown by any standard library classes and is going to be removed")
|
||||
public class DuplicateKeyException(message : String = "Duplicate keys detected") : RuntimeException(message)
|
||||
@@ -1,5 +1,6 @@
|
||||
package kotlin.concurrent
|
||||
|
||||
deprecated("This class is unfinished work. It will be removed from the standard library and replaced by a separate persistent collections library")
|
||||
public abstract class FunctionalList<T>(public val size: Int) {
|
||||
public abstract val head: T
|
||||
public abstract val tail: FunctionalList<T>
|
||||
|
||||
@@ -2,6 +2,7 @@ package kotlin.concurrent
|
||||
|
||||
import java.util.concurrent.Executor
|
||||
|
||||
deprecated("This class is unfinished work. It will be removed from the standard library and replaced by a separate persistent collections library")
|
||||
public class FunctionalQueue<T> (
|
||||
private val input: FunctionalList<T> = FunctionalList.emptyList<T>(),
|
||||
private val output: FunctionalList<T> = FunctionalList.emptyList<T>()
|
||||
|
||||
@@ -3,6 +3,7 @@ package kotlin.properties
|
||||
import java.util.HashMap
|
||||
import java.util.ArrayList
|
||||
|
||||
deprecated("This class is part of an old, incomplete and suboptimal design of change notifications and is going to be removed")
|
||||
public class ChangeEvent(
|
||||
public val source: Any,
|
||||
public val name: String,
|
||||
@@ -12,6 +13,7 @@ public class ChangeEvent(
|
||||
override fun toString(): String = "ChangeEvent($name, $oldValue, $newValue)"
|
||||
}
|
||||
|
||||
deprecated("This class is part of an old, incomplete and suboptimal design of change notifications and is going to be removed")
|
||||
public trait ChangeListener {
|
||||
public fun onPropertyChange(event: ChangeEvent): Unit
|
||||
}
|
||||
@@ -21,6 +23,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.
|
||||
*/
|
||||
deprecated("This class is part of an old, incomplete and suboptimal design of change notifications and is going to be removed")
|
||||
public abstract class ChangeSupport {
|
||||
private var allListeners: MutableList<ChangeListener>? = null
|
||||
private var nameListeners: MutableMap<String, MutableList<ChangeListener>>? = null
|
||||
@@ -81,30 +84,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,6 +10,7 @@ import java.util.Date
|
||||
|
||||
// TODO this class should move into the runtime
|
||||
// in kotlin.StringTemplate
|
||||
deprecated("This class is part of an experimental implementation of string templates and is going to be removed")
|
||||
public class StringTemplate(private val values: Array<Any?>) {
|
||||
|
||||
/**
|
||||
@@ -38,6 +39,7 @@ public class StringTemplate(private val values: Array<Any?>) {
|
||||
*
|
||||
* See [[HtmlFormatter] and [[LocaleFormatter] respectively.
|
||||
*/
|
||||
deprecated("This function is part of an experimental implementation of string templates and is going to be removed")
|
||||
public fun StringTemplate.toString(formatter: Formatter): String {
|
||||
val buffer = StringBuilder()
|
||||
append(buffer, formatter)
|
||||
@@ -48,6 +50,7 @@ public fun StringTemplate.toString(formatter: Formatter): String {
|
||||
* Appends the text representation of this string template to the given output
|
||||
* using the supplied formatter
|
||||
*/
|
||||
deprecated("This function is part of an experimental implementation of string templates and is going to be removed")
|
||||
public fun StringTemplate.append(out: Appendable, formatter: Formatter): Unit {
|
||||
var constantText = true
|
||||
this.forEach {
|
||||
@@ -69,11 +72,13 @@ public fun StringTemplate.append(out: Appendable, formatter: Formatter): Unit {
|
||||
* Converts this string template to internationalised text using the supplied
|
||||
* [[LocaleFormatter]]
|
||||
*/
|
||||
deprecated("This function is part of an experimental implementation of string templates and is going to be removed")
|
||||
public fun StringTemplate.toLocale(formatter: LocaleFormatter = LocaleFormatter()): String = toString(formatter)
|
||||
|
||||
/**
|
||||
* Converts this string template to HTML text
|
||||
*/
|
||||
deprecated("This function is part of an experimental implementation of string templates and is going to be removed")
|
||||
public fun StringTemplate.toHtml(formatter: HtmlFormatter = HtmlFormatter()): String = toString(formatter)
|
||||
|
||||
/**
|
||||
@@ -81,6 +86,7 @@ public fun StringTemplate.toHtml(formatter: HtmlFormatter = HtmlFormatter()): St
|
||||
* 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]
|
||||
*/
|
||||
deprecated("This trait is part of an experimental implementation of string templates and is going to be removed")
|
||||
public trait Formatter {
|
||||
public fun format(buffer: Appendable, value: Any?): Unit
|
||||
}
|
||||
@@ -89,6 +95,7 @@ public trait Formatter {
|
||||
* Formats strings with no special encoding other than allowing the null text to be
|
||||
* configured
|
||||
*/
|
||||
deprecated("This class is part of an experimental implementation of string templates and is going to be removed")
|
||||
public open class ToStringFormatter : Formatter {
|
||||
|
||||
private val nullString: String = "null"
|
||||
@@ -114,11 +121,13 @@ public open class ToStringFormatter : Formatter {
|
||||
}
|
||||
}
|
||||
|
||||
deprecated("This property is part of an experimental implementation of string templates and is going to be removed")
|
||||
public val defaultLocale: Locale = Locale.getDefault()
|
||||
|
||||
/**
|
||||
* Formats values using a given [[Locale]] for internationalisation
|
||||
*/
|
||||
deprecated("This class is part of an experimental implementation of string templates and is going to be removed")
|
||||
public open class LocaleFormatter(protected val locale: Locale = defaultLocale) : ToStringFormatter() {
|
||||
|
||||
override fun toString(): String = "LocaleFormatter{$locale}"
|
||||
@@ -149,6 +158,7 @@ public open class LocaleFormatter(protected val locale: Locale = defaultLocale)
|
||||
/**
|
||||
* Formats values for HTML encoding, escaping special characters in HTML.
|
||||
*/
|
||||
deprecated("This class is part of an experimental implementation of string templates and is going to be removed")
|
||||
public class HtmlFormatter(locale: Locale = defaultLocale) : LocaleFormatter(locale) {
|
||||
|
||||
override fun toString(): String = "HtmlFormatter{$locale}"
|
||||
|
||||
Reference in New Issue
Block a user