revert incorrect deprecations

This commit is contained in:
Dmitry Jemerov
2015-03-02 22:16:52 +01:00
parent f41a0a328f
commit 2e208c4294
5 changed files with 44 additions and 17 deletions
@@ -1,5 +1,5 @@
package kotlin
deprecated public class EmptyIterableException(private val it: Iterable<*>) : RuntimeException("$it is empty")
public class EmptyIterableException(private val it: Iterable<*>) : RuntimeException("$it is empty")
deprecated public class DuplicateKeyException(message : String = "Duplicate keys detected") : RuntimeException(message)
public class DuplicateKeyException(message : String = "Duplicate keys detected") : RuntimeException(message)
@@ -1,6 +1,6 @@
package kotlin.concurrent
deprecated public abstract class FunctionalList<T>(public val size: Int) {
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
deprecated public class FunctionalQueue<T> (
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
deprecated public class ChangeEvent(
public class ChangeEvent(
public val source: Any,
public val name: String,
public val oldValue: Any?,
@@ -12,7 +12,7 @@ deprecated public class ChangeEvent(
override fun toString(): String = "ChangeEvent($name, $oldValue, $newValue)"
}
deprecated public trait ChangeListener {
public trait ChangeListener {
public fun onPropertyChange(event: ChangeEvent): Unit
}
@@ -21,7 +21,7 @@ deprecated 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 public abstract class ChangeSupport {
public abstract class ChangeSupport {
private var allListeners: MutableList<ChangeListener>? = null
private var nameListeners: MutableMap<String, MutableList<ChangeListener>>? = null
@@ -81,3 +81,30 @@ deprecated 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
deprecated public class StringTemplate(private val values: Array<Any?>) {
public class StringTemplate(private val values: Array<Any?>) {
/**
* Converts the template into a String
@@ -38,7 +38,7 @@ deprecated public class StringTemplate(private val values: Array<Any?>) {
*
* See [[HtmlFormatter] and [[LocaleFormatter] respectively.
*/
deprecated public fun StringTemplate.toString(formatter: Formatter): String {
public fun StringTemplate.toString(formatter: Formatter): String {
val buffer = StringBuilder()
append(buffer, formatter)
return buffer.toString()
@@ -48,7 +48,7 @@ deprecated public fun StringTemplate.toString(formatter: Formatter): String {
* Appends the text representation of this string template to the given output
* using the supplied formatter
*/
deprecated public fun StringTemplate.append(out: Appendable, formatter: Formatter): Unit {
public fun StringTemplate.append(out: Appendable, formatter: Formatter): Unit {
var constantText = true
this.forEach {
if (constantText) {
@@ -69,19 +69,19 @@ deprecated public fun StringTemplate.append(out: Appendable, formatter: Formatte
* Converts this string template to internationalised text using the supplied
* [[LocaleFormatter]]
*/
deprecated public fun StringTemplate.toLocale(formatter: LocaleFormatter = LocaleFormatter()): String = toString(formatter)
public fun StringTemplate.toLocale(formatter: LocaleFormatter = LocaleFormatter()): String = toString(formatter)
/**
* Converts this string template to HTML text
*/
deprecated public fun StringTemplate.toHtml(formatter: HtmlFormatter = HtmlFormatter()): String = toString(formatter)
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]
*/
deprecated public trait Formatter {
public trait Formatter {
public fun format(buffer: Appendable, value: Any?): Unit
}
@@ -89,7 +89,7 @@ deprecated public trait Formatter {
* Formats strings with no special encoding other than allowing the null text to be
* configured
*/
deprecated public open class ToStringFormatter : Formatter {
public open class ToStringFormatter : Formatter {
private val nullString: String = "null"
@@ -114,12 +114,12 @@ deprecated public open class ToStringFormatter : Formatter {
}
}
deprecated public val defaultLocale: Locale = Locale.getDefault()
public val defaultLocale: Locale = Locale.getDefault()
/**
* Formats values using a given [[Locale]] for internationalisation
*/
deprecated public open class LocaleFormatter(protected val locale: Locale = defaultLocale) : ToStringFormatter() {
public open class LocaleFormatter(protected val locale: Locale = defaultLocale) : ToStringFormatter() {
override fun toString(): String = "LocaleFormatter{$locale}"
@@ -149,7 +149,7 @@ deprecated public open class LocaleFormatter(protected val locale: Locale = defa
/**
* Formats values for HTML encoding, escaping special characters in HTML.
*/
deprecated public class HtmlFormatter(locale: Locale = defaultLocale) : LocaleFormatter(locale) {
public class HtmlFormatter(locale: Locale = defaultLocale) : LocaleFormatter(locale) {
override fun toString(): String = "HtmlFormatter{$locale}"