Commit Graph

3122 Commits

Author SHA1 Message Date
Mikhail Bogdanov 95654bb9bc Deprecate @JvmDefault
#KT-40392 Fixed

(cherry picked from commit c11f38688e)
2021-03-13 08:24:17 +00:00
Abduqodiri Qurbonzoda ff5b2404af Introduce firstNotNullOf and firstNotNullOfOrNull #KT-12109 2021-03-12 09:27:14 +03:00
Abduqodiri Qurbonzoda 09ad5ca602 Strict version of String.toBoolean() #KT-42071 2021-03-12 09:26:55 +03:00
Michael Hoisie 83383ab9e5 Make kotlin.jvm.internal.DefaultConstructorMarker public
DefaultConstructorMarker is used as a marker to ensure that a
constructor is unique for companion objects. Prior to this change,
DefaultConstructorMarker was package private.

Being package private worked when calling the
DefaultConstructorMarker-marked constsructor using `invokespecial`,
likely because the JVM may not perform strict access checks in this
situation.

However, when access checks are performed, trying to call a
DefaultConstructorMarker-marked constructor will fail. This could happen
if the constructor was called using reflection or the MethodHandle API.
These APIs may be used by tools that perform bytecode instrumentation
on Kotlin JVM bytecode, such as Robolectric. It also caused problems
when using ByteBuddy validation.

Fixes https://youtrack.jetbrains.com/issue/KT-20869
2021-03-11 14:17:33 +01:00
Steven Schäfer 057ead358c JVM: Add FILE target to the JvmSynthetic annotation (#4149) 2021-03-11 13:33:07 +01:00
Alexander Likhachev 6bd44df861 [Build] Fix configuration cache issues (part 6)
Make DexMethodCountStats task class, tasks :examples:kotlin-jsr223-daemon-local-eval-example:test,:idea:idea-fir:test, :idea:idea-fir-performance-tests:test, :idea:idea-frontend-fir:test, :idea:idea-frontend-fir:idea-fir-low-level-api:test, :kotlin-compiler-client-embeddable:test, :kotlin-compiler-embeddable:test, :kotlin-stdlib-js-ir:compileTestKotlinJs, :plugins:android-extensions-compiler:test, :plugins:parcelize:parcelize-compiler:test, :compiler:test compatible with configuration cache
Relates to #KT-44611
2021-03-11 14:12:36 +03:00
Alexander Likhachev 74ab5c21a8 [Build] Fix configuration cache issues (part 4)
Make :kotlin-stdlib-js:prepareComparableSource, :kotlin-stdlib-js:prepareBuiltinsSources, :kotlin-stdlib-js:compileJs, :kotlin-stdlib-js:compileJs, :prepare:build.version:writeBuildNumber, :kotlin-compiler:distKotlinc compatible with configuration cache

Relates to #KT-44611
2021-03-11 14:12:34 +03:00
Alexander Likhachev 5f10c98a38 [Build] Fix configuration cache issues (part 3)
* Make IntelliJInstrumentCodeTask compatible with configuration cache
* Make CoreXmlShadingTransformer compatible with configuration cache
* Make :kotlin-reflect:relocateCoreSources compatible with configuration cache
* Copy some properties to not capture it's owning object into lambda to support configuration cache
Relates to #KT-44611
2021-03-11 14:12:34 +03:00
Alexander Likhachev 0e4e90dc13 [Build] Bump gradle-node-plugin version to 3.0.1 to support conf cache
:kotlin-test:kotlin-test-js:kotlin-test-js-it will still have old version as integration test run logic cannot be fully refactored to the new version (approximately till 3.1)
Relates to #KT-44611
2021-03-11 14:12:34 +03:00
Ilya Gorbunov a7fda66fa1 Suggest duration static factories instead of number extension properties
Introduce Duration companion functions to convert numbers to Duration.
Deprecate number extension properties and propose to use these
new functions instead.
2021-03-10 13:23:32 +03:00
Alexander Udalov 6ddca4a592 Add KClass.isValue to kotlin-reflect
#KT-44782 Fixed
2021-03-08 21:22:40 +01:00
Abduqodiri Qurbonzoda e7a45bba91 Fix @SinceKotlin in Common titlecase and titlecaseChar functions 2021-03-07 07:38:04 +03:00
Abduqodiri Qurbonzoda 10b0d147af Mark with @SinceKotlin("1.5") the Common char category API 2021-03-07 07:37:46 +03:00
Abduqodiri Qurbonzoda 421cb6971d Optimized toArray method for ArrayDeque and ListBuilder #KT-42720 2021-03-06 11:14:50 +03:00
Abduqodiri Qurbonzoda ed57bcb3b1 Commonize and generalize JVM-only String.contentEquals #KT-42840 2021-03-06 11:14:30 +03:00
Ilya Gorbunov 7e2c365b79 Generate docs for floorDiv and mod and improve docs for div and rem
Refactor operator documentation generation for primitives and unsigned
types so that it is easier to specialize it.

Manually sync docs of numeric types in js-ir stdlib.

 KT-26234
2021-03-05 07:32:16 +03:00
Ilya Gorbunov 50d4979531 Floor division and remainder for numeric types KT-26234
- floorDiv/mod for unsigned types
- floorDiv/mod for signed types
- mod for floating point types

- mod return type: same as divisor for integer types

- Update JS API dump
- Avoid triggering division overflow in tests due to K/N
- Workaround failing test in JS-legacy
2021-03-05 07:32:16 +03:00
KotlinIsland 5e173c9f83 Minor: remove redundant suppression (#3812)
The suppression is not needed after KT-12448 has been fixed.
2021-03-04 08:18:35 +03:00
Abduqodiri Qurbonzoda 2266cd4631 Commonize Char.titlecaseChar() and Char.titlecase() #KT-44369 2021-03-02 01:11:45 +03:00
Abduqodiri Qurbonzoda 0c9205423f Add String case conversion tests 2021-03-02 01:11:42 +03:00
Abduqodiri Qurbonzoda 49ce776bf4 Add Char case conversion tests 2021-03-02 01:11:39 +03:00
Alexander Udalov 17ee10a0d8 Minor, fix compilation warning in DurationUnit.kt 2021-02-25 21:00:09 +01:00
Ilmir Usmanov d67e4f0c48 Rename inline class -> @JvmInline value class in stdlib and compiler 2021-02-25 16:06:51 +01:00
Dmitriy Novozhilov 99c47a0487 Fix non-exhaustive when in common stdlib 2021-02-25 14:56:08 +03:00
Ilya Gorbunov ca6ce151a2 Unify test package names in kotlin-stdlib tests
This makes 'test.' an implicit package prefix, thus fixing the inspection
"Package directive doesn't match file location" positive in almost all
test files.
2021-02-25 09:58:14 +03:00
Alexander Udalov aeb0906f2d Build: suppress warnings for kotlin-stdlib-wasm 2021-02-24 20:48:26 +01:00
Alexander Udalov 48fb085bf6 Deprecate kotlin.Metadata.bytecodeVersion
#KT-41758 Fixed
2021-02-23 12:45:41 +01:00
Ilya Goncharov bd2601f289 [JS IR] Extract adding of function call to another function
[JS IR] Add option for dce mode

[JS IR] Add logging to non useful declarations if appropriate dce mode

[JS IR] Add mode with throwing exception

[JS IR] unreachableDeclaration method is in rootDeclarations

[JS IR] Add js extra help arg with dce mode and include debug.kt to compile unreachableMethod

[JS IR] unreachableDeclaration as internal to not reproduce stdlib api

[JS IR] Fix description of dce mode argument

- Use console.error instead of console.log
- Use JsError instead Kotlin exception for lightweight

[JS IR] Remove body for throwing exception

[JS IR] Remove default parameter in unreachableDeclaration

[JS IR] Process without removing fields and declaration containers

[JS IR] Rename dce mode on dce runtime diagnostic

[JS IR] Use console.trace instead of console.error

[JS IR] Extract JsError

- Fix naming in prependFunctionCall
- Fix description on runtime diagnostic argument
- Using message collector instead of throwing exception

[JS IR] Distinguish unreachableMethods for log and exception

[JS IR] Extract checking of Kotlin packages of IrField

^KT-45059 fixed
2021-02-20 12:05:06 +03:00
Alexander Udalov 1d6b198915 Build: suppress version and JVM target warnings
To further reduce the output on each build.
2021-02-18 12:17:17 +01:00
Dmitriy Novozhilov 8521d844e2 Advance bootstrap to 1.5.20-dev-814 2021-02-17 12:01:06 +03:00
Svyatoslav Kuzmich 218c246111 [JS] Fix extra js function capturing 2021-02-04 15:41:21 +03:00
Svyatoslav Kuzmich 53204661e3 [JS] Update stdlib API test data after dukat update 2021-02-03 20:36:24 +03:00
Svyatoslav Kuzmich d3b4df7da8 [JS] Revert paramter names changed by dukat 2021-02-03 20:36:24 +03:00
Victor Turansky f1682cba13 KT-40235 Dukat 0.5.8-rc.4 2021-02-03 20:36:24 +03:00
Victor Turansky ba0d60853d KT-40235 null companion for stdlib external union types 2021-02-03 20:36:24 +03:00
Ilya Gorbunov 87e130e77a Remove obsolete diagnostics suppression
The diagnostic NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS is now
obsolete because internal constructors of inline classes became allowed.
2021-02-03 18:23:53 +03:00
Alexander Udalov e0b6d4d917 Add -Xsuppress-deprecated-jvm-target-warning to modules compiled with 1.6
Currently this leads to an unknown argument warning, but it'll be
removed automatically on the next bootstrap.
2021-02-03 12:51:39 +01:00
Dmitriy Novozhilov bc3b791cd8 [TMP] Remove :kotlin-coroutines-experimental-compat module 2021-01-28 13:19:34 +03:00
Abduqodiri Qurbonzoda 46b7a774b5 Commonize CharCategory and related functions #KT-39177 #KT-43216 #KT-39906 #KT-30652 2021-01-28 01:41:24 +03:00
Svyatoslav Kuzmich cb3b1f8ae2 [JS IR] Fix referencing Kotin variables in inline JS code
Fixed by outlining JS code that uses Kotlin variables making usages of
these locals explicit and preventing bugs due to one-sided variable renaming.

This prevents using Kotlin variables as lvalue in JS code.
2021-01-25 19:18:44 +03:00
Alexander Udalov a6b51da308 Fix compilation in the case of JDK_16 pointing to JDK 1.8 2021-01-13 21:47:23 +01:00
Alexander Udalov 221f44da5f Fix warnings in stdlib/compiler/plugins/test code 2021-01-13 19:18:20 +01:00
Kris Hall ee952db1a2 Added samples for String.replace() function 2021-01-12 14:59:43 +03:00
Alexander Udalov 22d0e5eb65 Rename -Xno-use-ir -> -Xuse-old-backend, add Gradle option
As soon as JVM IR is enabled by default (in language version 1.5), use
the CLI argument `-Xuse-old-backend` or Gradle option `useOldBackend` to
switch to the old JVM backend.
2021-01-11 12:47:54 +01:00
Alexander Udalov acd29481bd Regenerate sources of builtins and stdlib 2021-01-03 22:31:06 +01:00
Ilya Gorbunov 3c37bbaf64 Duration: normalize to avoid negative zeroes (KT-44168)
The current comparison method of inline classes makes
durations of positive and negative zeroes non-equal.
To avoid that, normalize the duration value upon construction
preventing negative zero being stored.
2020-12-31 19:44:39 +03:00
Ilya Gorbunov ae6f10df3b Duration: reject NaN duration values (KT-44168) 2020-12-31 19:44:10 +03:00
Ilya Gorbunov 1d40ed39d0 KotlinVersion: Advance snapshot version 1.4.255 -> 1.5.255
KTI-421
2020-12-31 19:20:29 +03:00
Abduqodiri Qurbonzoda 662787b12b Straighten Char-to-code and Char-to-digit conversions out #KT-23451 2020-12-31 12:07:41 +03:00
Ilya Gorbunov 79e426270c Rename Random.Default serialization surrogate object (KT-25571) 2020-12-31 06:57:17 +03:00