Drop deprecations: text and system
Fix import in testData Fix testData: replace removed method.
This commit is contained in:
@@ -3,12 +3,6 @@
|
||||
|
||||
package kotlin.text
|
||||
|
||||
/**
|
||||
* Builds newly created StringBuilder using provided body.
|
||||
*/
|
||||
@Deprecated("Use StringBuilder().apply { body } or use buildString { body } if you need String as a result.", ReplaceWith("StringBuilder().apply(body)"))
|
||||
public inline fun StringBuilder(body: StringBuilder.() -> Unit): StringBuilder = StringBuilder().apply(body)
|
||||
|
||||
/**
|
||||
* Builds new string by populating newly created [StringBuilder] using provided [builderAction] and then converting it to [String].
|
||||
*/
|
||||
|
||||
@@ -290,17 +290,6 @@ public fun String.contentEquals(charSequence: CharSequence): Boolean = (this as
|
||||
*/
|
||||
public fun String.contentEquals(stringBuilder: StringBuffer): Boolean = (this as java.lang.String).contentEquals(stringBuilder)
|
||||
|
||||
/**
|
||||
* Copies the characters from a substring of this string into the specified character array.
|
||||
* @param srcBegin the start offset (inclusive) of the substring to copy.
|
||||
* @param srcEnd the end offset (exclusive) of the substring to copy.
|
||||
* @param dst the array to copy to.
|
||||
* @param dstBegin the position in the array to copy to.
|
||||
*/
|
||||
@Deprecated("Use toCharArray() instead.", ReplaceWith("toCharArray(dst, dstBegin, srcBegin, srcEnd)"))
|
||||
public fun String.getChars(srcBegin: Int, srcEnd: Int, dst: CharArray, dstBegin: Int): Unit = (this as java.lang.String).getChars(srcBegin, srcEnd, dst, dstBegin)
|
||||
|
||||
|
||||
/**
|
||||
* Returns a canonical representation for this string object.
|
||||
*/
|
||||
@@ -394,21 +383,6 @@ public fun String.toFloat(): Float = java.lang.Float.parseFloat(this)
|
||||
*/
|
||||
public fun String.toDouble(): Double = java.lang.Double.parseDouble(this)
|
||||
|
||||
/**
|
||||
* Returns the list of all characters in this string.
|
||||
*/
|
||||
@Deprecated("Use toList() instead.", ReplaceWith("toList()"))
|
||||
public fun String.toCharList(): List<Char> = toCharArray().toList()
|
||||
|
||||
/**
|
||||
* Returns a subsequence of this char sequence.
|
||||
*
|
||||
* @param start the start index (inclusive).
|
||||
* @param end the end index (exclusive).
|
||||
*/
|
||||
@Deprecated("Use subSequence(start, end) instead.", ReplaceWith("subSequence(start, end)"))
|
||||
public operator fun CharSequence.get(start: Int, end: Int): CharSequence = subSequence(start, end)
|
||||
|
||||
/**
|
||||
* Encodes the contents of this string using the specified character set and returns the resulting byte array.
|
||||
*/
|
||||
|
||||
@@ -111,18 +111,12 @@ public class Regex internal constructor(private val nativePattern: Pattern) {
|
||||
/** The set of options that were used to create this regular expression. */
|
||||
public val options: Set<RegexOption> = fromInt(nativePattern.flags())
|
||||
|
||||
@Deprecated("To get the Matcher from java.util.regex.Pattern use toPattern to convert string to Pattern, or migrate to Regex API", ReplaceWith("toPattern().matcher(input)"), DeprecationLevel.ERROR)
|
||||
public fun matcher(input: CharSequence): Matcher = nativePattern.matcher(input)
|
||||
|
||||
/** Indicates whether the regular expression matches the entire [input]. */
|
||||
public fun matches(input: CharSequence): Boolean = nativePattern.matcher(input).matches()
|
||||
|
||||
/** Indicates whether the regular expression can find at least one match in the specified [input]. */
|
||||
public fun containsMatchIn(input: CharSequence): Boolean = nativePattern.matcher(input).find()
|
||||
|
||||
@Deprecated("Use containsMatchIn() or 'in' operator instead.", ReplaceWith("this in input"), DeprecationLevel.ERROR)
|
||||
public fun hasMatch(input: CharSequence): Boolean = containsMatchIn(input)
|
||||
|
||||
/**
|
||||
* Returns the first match of a regular expression in the [input], beginning at the specified [startIndex].
|
||||
*
|
||||
@@ -131,17 +125,11 @@ public class Regex internal constructor(private val nativePattern: Pattern) {
|
||||
*/
|
||||
public fun find(input: CharSequence, startIndex: Int = 0): MatchResult? = nativePattern.matcher(input).findNext(startIndex, input)
|
||||
|
||||
@Deprecated("Use find() instead.", ReplaceWith("find(input, startIndex)"), DeprecationLevel.ERROR)
|
||||
public fun match(input: CharSequence, startIndex: Int = 0): MatchResult? = find(input, startIndex)
|
||||
|
||||
/**
|
||||
* Returns a sequence of all occurrences of a regular expression within the [input] string, beginning at the specified [startIndex].
|
||||
*/
|
||||
public fun findAll(input: CharSequence, startIndex: Int = 0): Sequence<MatchResult> = generateSequence({ find(input, startIndex) }, { match -> match.next() })
|
||||
|
||||
@Deprecated("Use findAll() instead.", ReplaceWith("findAll(input, startIndex)"), DeprecationLevel.ERROR)
|
||||
public fun matchAll(input: CharSequence, startIndex: Int = 0): Sequence<MatchResult> = findAll(input, startIndex)
|
||||
|
||||
/**
|
||||
* Attempts to match the entire [input] CharSequence against the pattern.
|
||||
*
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
@file:kotlin.jvm.JvmName("TimingUtilsKt")
|
||||
package kotlin.util
|
||||
|
||||
/**
|
||||
* Executes the given block and returns elapsed time in milliseconds.
|
||||
*/
|
||||
@Deprecated("Use measureTimeMillis from kotlin.system instead.", ReplaceWith("kotlin.system.measureTimeMillis(block)", "kotlin.system"))
|
||||
public fun measureTimeMillis(block: () -> Unit) : Long {
|
||||
val start = System.currentTimeMillis()
|
||||
block()
|
||||
return System.currentTimeMillis() - start
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the given block and returns elapsed time in nanoseconds.
|
||||
*/
|
||||
@Deprecated("Use measureTimeNano from kotlin.system instead.", ReplaceWith("kotlin.system.measureTimeNano(block)", "kotlin.system"))
|
||||
public fun measureTimeNano(block: () -> Unit) : Long {
|
||||
val start = System.nanoTime()
|
||||
block()
|
||||
return System.nanoTime() - start
|
||||
}
|
||||
Reference in New Issue
Block a user