Commit Graph

108 Commits

Author SHA1 Message Date
Abduqodiri Qurbonzoda 11f3c4b03f Clarify the error message when File.copyTo fails (KT-27545) 2019-09-13 21:29:13 +03:00
Ilya Gorbunov 3751a8a797 Common Array.fill for unsigned arrays, improve docs, native impl name
KT-32359
2019-08-01 19:02:39 +03:00
Jake Wharton 1a6069382e Provide Array.fill in common stdlib
KT-32359
2019-08-01 19:02:38 +03:00
Ilya Gorbunov 4fc942c5e9 KT-16602: Improve mutable sorting samples, fix sample references 2019-07-12 21:34:54 +03:00
Dat Trieu 38d26b1d92 KT-16602: Provide samples for sorting API usage 2019-07-12 21:32:03 +03:00
Ilya Gorbunov 7573fcde53 Demote new experimental capitalize overloads in overload resolution
Revert "Fix method reference ambiguity in test after introducing 'capitalize' overload"
This reverts commit fe9bd9ee
2019-07-09 03:39:25 +03:00
Ilya Gorbunov 39bdf34b9f Use common implementation of fastLog2 based on countLeadingZeroBits 2019-07-08 19:09:32 +03:00
Ilya Gorbunov f8724654a1 Bit query and bit rotation functions for Int, Long, Short, Byte
#KT-12749
2019-07-08 19:09:32 +03:00
Ilya Gorbunov 32fc131d62 Rename jvm actuals from Numbers to NumbersJVM
Rename multifile facade to from MathKt to NumbersKt to avoid confusion
with kotlin.math.MathKt
2019-07-08 19:09:32 +03:00
AJ Alt ed96197d6b Always use LF line endings in generated stdlib code
The code generation uses a mixture of literal `\n` characters and `appendln`. The latter insert `\r\n` on Windows by default, causing generated files to contain a mixture of line endings.

This commit sets the `line.separator` system property for the generator to `\n` so that `appendln` will never insert `\r` characters. As an additional measure, `.gitattributes` files were added to checkout generated stdlib files always with LF line endings.
2019-06-27 03:02:10 +03:00
Ilya Gorbunov a2b1c537af Change Duration.toString scientific exponent formatting
- use 'e+' for positive exponents in scientific format
2019-06-18 19:49:35 +03:00
Ilya Gorbunov a5b7c270ae Change Duration.toString(unit, decimals) formatting
- switch to scientific notation when value is too big (greater than 1e14)
- allow at most 12 decimals, larger values are coerced to 12
- use scientific format with exactly two decimals in mantissa in JVM
2019-06-18 19:49:35 +03:00
Ilya Gorbunov c66740a7ed Explicit public visibility, SinceKotlin and ExperimentalTime status
Use file level ExperimentalTime opt-in in tests.
2019-06-18 04:02:35 +03:00
Ilya Gorbunov 04ec90164e Use ThreadLocals to cache DecimalFormat instances 2019-06-18 04:02:34 +03:00
Ilya Gorbunov 368452748b Move convertDurationUnit into Duration companion 2019-06-18 04:02:33 +03:00
Ilya Gorbunov b5d16f1a9b Simplify Clock/ClockMark design
- Do not require initialElapsed parameter
- Introduce instead ClockMark +- Duration operators
- Do not require ClockMark to expose its originating Clock back
- Turn elapsedFrom property into elapsed() function
- Rename abstract clock classes
- Fix unit of abstract clocks when constructing them

Add top-level docs for Clocks
2019-06-18 04:02:32 +03:00
Ilya Gorbunov b816f50d4d Implement and test default string formatting in JVM and JS
Relax Duration.toString tests for JS and Native rounding specifics
2019-06-18 04:01:55 +03:00
Ilya Gorbunov 7977b6cdb8 Implement DurationUnit in JS, add doc summary and conversion test 2019-06-18 03:59:51 +03:00
Ilya Gorbunov 37c5f2c54f Initial prototype of Duration and Clocks API 2019-06-18 03:59:51 +03:00
Ilya Gorbunov 8badfca459 Fix titlecase lowering in decapitalize
Replace isUpperCase() with !isLowerCase check to lower both
upper- and titlecased first chars.
2019-05-29 03:54:46 +03:00
Ilya Gorbunov a921bd04e0 capitalize/decapitalize: improve docs, add one test 2019-05-29 03:54:46 +03:00
Jake Wharton af31794f60 Add Locale-accepting overloads for (de)capitalize in JDK stdlib
#KT-28933 fixed
2019-05-29 03:35:33 +03:00
Ilya Gorbunov 2c26dc3af6 Add simplified overloads of String<->ByteArray/CharArray conversions
These overloads cover the most common cases of conversion of the entire
String or Byte/CharArray, avoiding extra index check and branching.

#KT-24810, KT-29265
2019-05-08 02:58:57 +03:00
Abduqodiri Qurbonzoda c8a4fa58cd Implement String to/from ByteArray conversion (KT-24810) 2019-05-06 15:54:28 +03:00
Abduqodiri Qurbonzoda 81d2d3cb6a Implement String to/from CharArray conversion (KT-29265) 2019-05-06 15:54:28 +03:00
Ilya Gorbunov 5f2762ed20 Follow up: fix typos in coroutine docs 2019-05-01 05:40:35 +03:00
Yanis Batura a51b7fb8d0 Fix typos 2019-04-30 18:42:07 +03:00
nikita.movshin abb7d3ab46 Update copyright.
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
Update 2 lines comment
2019-04-23 20:09:27 +03:00
nikita.movshin 65244b4bea Update copyright.
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
Update only 2 lines copyright.
2019-04-23 20:09:22 +03:00
Ilya Gorbunov 04bbf23936 Add explicit imports of kotlin.ranges more specific functions
The extensions 'contains' and 'reversed' from kotlin.ranges can be more
specific for IntRange, LongRange, etc than the same functions from
kotlin.collections, yet they lose in overload resolution to the latter
ones when invoked from kotlin.collections package
because of same package package extensions are preferred (KT-30633).
2019-04-02 21:28:33 +03:00
Ilya Gorbunov 91c7233ed8 Make Throwable.addSuppressed extension work without kotlin-stdlib-jdk7*
*given that it runs on JDK7 and higher. The addSuppressed member
is called with reflection when it's available.
kotlin-stdlib-jdk7 extension still overrides that and calls
addSuppressed member statically as before.

#KT-30560 Fixed
2019-03-28 22:42:20 +03:00
Ilya Gorbunov 8021f9c4af Clarify toSortedMap and sortedMapOf docs (KT-30100)
Remove the note about iteration order so that toSortedMap is not misused
for sorting map entires with the comparator inconsistent with key equality.
2019-03-20 22:08:03 +03:00
Ilya Gorbunov b74fe7c1c3 Clarify floor and ceil docs (KT-30418) 2019-03-19 03:12:12 +03:00
Ilya Gorbunov 6bc7c06038 Add samples for is(|Not|NullOr)Empty and is(|Not|NullOr)Blank functions 2019-03-13 17:58:05 +03:00
Abduqodiri Qurbonzoda ba61695a45 Check for index-out-of-bound in elementAt function (KT-30051) 2019-03-12 21:39:09 +03:00
Ilya Gorbunov 6ae5e91930 Move UArraysKt into kotlin.collections.unsigned package
Provide UArraysKt class in kotlin.collections for binary compatibility
instead of removed multipart facade class. It contains only non-inline
functions of the latter.
2019-03-08 23:35:40 +03:00
Abduqodiri Qurbonzoda fc85781bfc Implement asList, slice & sliceArray extension functions for UArrays 2019-03-08 23:34:34 +03:00
Abduqodiri Qurbonzoda 92cd84682c Implement first, last & single extension functions for UArrays 2019-03-08 23:34:34 +03:00
Abduqodiri Qurbonzoda 876dff6d22 Implement fill extension function for UArrays (KT-28339) 2019-03-08 23:34:33 +03:00
Abduqodiri Qurbonzoda 550c74bb6b Implement binarySearch method for UArrays (KT-27262) 2019-03-08 23:34:33 +03:00
Roman Elizarov 4f532a7c05 Invoke probeCoroutineResumed on each unroll of the frame from heap
Fixes KT-29997
2019-03-07 17:04:11 +03:00
Wil d3ac50f694 Minor: typo fix in Writer.buffered docs 2019-03-01 17:09:27 +03:00
Kevin Peek 565727e302 KT-20357 - Add sample for Regex.findAll() 2019-02-18 21:05:46 +03:00
Ilya Gorbunov f50820045a Allow setting seed only once, as it is set from superclass constructor
Add tests for Java<->Kotlin Random wrappers.

#KT-29520 Fixed
2019-02-13 00:21:22 +03:00
Ilya Gorbunov 0ac85ad715 Document that sorting is stable in each platform
#KT-12473 Fixed
2019-01-17 18:38:37 +03:00
Ilya Gorbunov 23950042f6 Clarify how elements of arrays are compared by contentEquals function
Add clarification only for the particular group of overloads including
 arrays of object and floating point numbers.

#KT-22942 Fixed
2019-01-11 21:04:03 +03:00
Ilya Gorbunov fcef876c7e Update copyright in generated stdlib sources 2019-01-11 19:23:12 +03:00
Ilya Gorbunov 30c769c19a Avoid hitting max argument limit in String(chars)
Rewrite CharArray to String conversions to appending chars one by one.

Refine parameter checking in String(chars, offset, length) to adhere to
the common exception contract and document it.

#KT-29003
2019-01-10 23:35:52 +03:00
Ilya Gorbunov 7b08f6f8f1 readLine: extend buffer to decode surrogate pairs from utf-8 correctly
CharBuffer had capacity to hold 2 chars, which was not enough to append
a surrogate pair when the buffer was not empty.

The buffer was extended and the decoding algorithm rewritten to deal with
a buffer of any length.

#KT-28572 Fixed
2018-12-07 17:42:09 +03:00
Ilmir Usmanov 1336e8f3e3 Take java 9 modules into account in coroutines debug metadata
reading
 #KT-28237
2018-12-06 16:59:15 +03:00