diff --git a/libraries/stdlib/src/kotlin/collections/Exceptions.kt b/libraries/stdlib/src/kotlin/collections/Exceptions.kt index 0b096c8f6c5..eac02e90037 100644 --- a/libraries/stdlib/src/kotlin/collections/Exceptions.kt +++ b/libraries/stdlib/src/kotlin/collections/Exceptions.kt @@ -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) \ No newline at end of file diff --git a/libraries/stdlib/src/kotlin/concurrent/FunctionalList.kt b/libraries/stdlib/src/kotlin/concurrent/FunctionalList.kt index 462c1a30502..19797e8ad52 100644 --- a/libraries/stdlib/src/kotlin/concurrent/FunctionalList.kt +++ b/libraries/stdlib/src/kotlin/concurrent/FunctionalList.kt @@ -1,6 +1,6 @@ package kotlin.concurrent -deprecated public abstract class FunctionalList(public val size: Int) { +public abstract class FunctionalList(public val size: Int) { public abstract val head: T public abstract val tail: FunctionalList diff --git a/libraries/stdlib/src/kotlin/concurrent/FunctionalQueue.kt b/libraries/stdlib/src/kotlin/concurrent/FunctionalQueue.kt index 859104bb733..33d3c18a822 100644 --- a/libraries/stdlib/src/kotlin/concurrent/FunctionalQueue.kt +++ b/libraries/stdlib/src/kotlin/concurrent/FunctionalQueue.kt @@ -2,7 +2,7 @@ package kotlin.concurrent import java.util.concurrent.Executor -deprecated public class FunctionalQueue ( +public class FunctionalQueue ( private val input: FunctionalList = FunctionalList.emptyList(), private val output: FunctionalList = FunctionalList.emptyList() ) { diff --git a/libraries/stdlib/src/kotlin/properties/Properties.kt b/libraries/stdlib/src/kotlin/properties/Properties.kt index a8e000a09ae..1b5e288039e 100644 --- a/libraries/stdlib/src/kotlin/properties/Properties.kt +++ b/libraries/stdlib/src/kotlin/properties/Properties.kt @@ -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? = null private var nameListeners: MutableMap>? = 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) + } +} + + diff --git a/libraries/stdlib/src/kotlin/template/Templates.kt b/libraries/stdlib/src/kotlin/template/Templates.kt index 1d41bf64b6a..f0890bf0c7f 100644 --- a/libraries/stdlib/src/kotlin/template/Templates.kt +++ b/libraries/stdlib/src/kotlin/template/Templates.kt @@ -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) { +public class StringTemplate(private val values: Array) { /** * Converts the template into a String @@ -38,7 +38,7 @@ deprecated public class StringTemplate(private val values: Array) { * * 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}"