mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-18 00:21:29 +00:00
Compare commits
519 Commits
1.5.0-gith
...
rr/FIR/sem
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42d681b8d6 | ||
|
|
dcad9c84fc | ||
|
|
440fc8c4e4 | ||
|
|
069941cdaf | ||
|
|
0eaea655d0 | ||
|
|
3c6eb8f8f4 | ||
|
|
0af31abb04 | ||
|
|
90cdb9203f | ||
|
|
8a17de38d0 | ||
|
|
7f8f1dc4f8 | ||
|
|
6ff5704ef9 | ||
|
|
f493766563 | ||
|
|
c0759f96e9 | ||
|
|
8acf3b1d76 | ||
|
|
c158c64ee0 | ||
|
|
0d40022d6d | ||
|
|
d783d99443 | ||
|
|
edb8007d52 | ||
|
|
befe8599c4 | ||
|
|
cf4e61bebb | ||
|
|
5711a8d610 | ||
|
|
0e46a961a3 | ||
|
|
67ad4249c8 | ||
|
|
a94086224d | ||
|
|
6f64fd2fec | ||
|
|
dae1f4c05d | ||
|
|
b463a0fa58 | ||
|
|
683bd0ed38 | ||
|
|
ef458b20e1 | ||
|
|
c7427a751a | ||
|
|
383b9834a1 | ||
|
|
cbeb031099 | ||
|
|
a6cdfeafed | ||
|
|
604dda839a | ||
|
|
d844296629 | ||
|
|
cbdcd8f2bc | ||
|
|
ba969410c2 | ||
|
|
1cceec3642 | ||
|
|
240fdfa7a8 | ||
|
|
2b0ad70242 | ||
|
|
a6bf9bf51b | ||
|
|
432c6486d5 | ||
|
|
c7421e2bea | ||
|
|
0e29a9df6c | ||
|
|
6eac5e1907 | ||
|
|
15f6bb9506 | ||
|
|
daa9c81bcb | ||
|
|
da80d53796 | ||
|
|
65faf20472 | ||
|
|
521b722c09 | ||
|
|
4566b7c6e5 | ||
|
|
8c79baa998 | ||
|
|
a41d3e5b04 | ||
|
|
e6bfe9a702 | ||
|
|
b9aa577f84 | ||
|
|
cd0dfd6fa9 | ||
|
|
60da9281a2 | ||
|
|
19e59fe770 | ||
|
|
cc51869a2a | ||
|
|
4a0437a507 | ||
|
|
bf9fa4c9da | ||
|
|
6882cf820e | ||
|
|
75f6780b90 | ||
|
|
d42cc219bf | ||
|
|
6ba57abb8f | ||
|
|
5013344bc4 | ||
|
|
4ab242ed51 | ||
|
|
afeb7e18cd | ||
|
|
43b1711010 | ||
|
|
3438d19c22 | ||
|
|
7564c9bb8c | ||
|
|
052f6929c9 | ||
|
|
3ebeca5852 | ||
|
|
6c6d43c29a | ||
|
|
a719656118 | ||
|
|
54636f1af7 | ||
|
|
0c4bca4bde | ||
|
|
0e31551797 | ||
|
|
d696a488b5 | ||
|
|
7a4625b70b | ||
|
|
d615b6b682 | ||
|
|
bc26230392 | ||
|
|
c3831baba2 | ||
|
|
dee4f4345b | ||
|
|
d202b0feb2 | ||
|
|
09ba927680 | ||
|
|
c89380fc36 | ||
|
|
9a464ae9c4 | ||
|
|
7478b8d189 | ||
|
|
798c4d2485 | ||
|
|
c0a4301179 | ||
|
|
8020424b93 | ||
|
|
ee98a76600 | ||
|
|
88e7d1e5ee | ||
|
|
51c59e5634 | ||
|
|
d88fd5bd73 | ||
|
|
e265a78a33 | ||
|
|
0e271b72c7 | ||
|
|
534f4a66ad | ||
|
|
f03ca5ea57 | ||
|
|
0b48416a1e | ||
|
|
08e271411f | ||
|
|
e34370554d | ||
|
|
0609aa1e2e | ||
|
|
8575ce32d4 | ||
|
|
e744084c15 | ||
|
|
b9d074051f | ||
|
|
c1130f2010 | ||
|
|
108395fcfe | ||
|
|
1479388bd5 | ||
|
|
68b5f2736e | ||
|
|
0de251e50d | ||
|
|
2d5b685535 | ||
|
|
7c61ddc72b | ||
|
|
f3a8fcaea6 | ||
|
|
e795c2c407 | ||
|
|
f33cad54c5 | ||
|
|
7eb5fc7778 | ||
|
|
abc44fa658 | ||
|
|
20f9787c70 | ||
|
|
3d635b6a94 | ||
|
|
70f462781a | ||
|
|
510b9e6f2a | ||
|
|
2d60fa787d | ||
|
|
401f0ac583 | ||
|
|
f797ee7803 | ||
|
|
80daf120e6 | ||
|
|
4b62b2de0c | ||
|
|
c3c8991ab6 | ||
|
|
a9f19c4a45 | ||
|
|
7962224804 | ||
|
|
57e06992c9 | ||
|
|
cd483ad231 | ||
|
|
5f3102bf2f | ||
|
|
791f589127 | ||
|
|
4bc630d82c | ||
|
|
346ffb3acf | ||
|
|
7050af9b79 | ||
|
|
67671afab4 | ||
|
|
2c4a6fdb98 | ||
|
|
73aa465ee9 | ||
|
|
17fc10a8af | ||
|
|
6eaf0a95ca | ||
|
|
af8061a4dd | ||
|
|
2cd1aefd5e | ||
|
|
9b1f01ab04 | ||
|
|
1729eff31b | ||
|
|
5e150d62ea | ||
|
|
0c0c53cc2e | ||
|
|
903defdf30 | ||
|
|
154a768a3a | ||
|
|
ac966ad1d2 | ||
|
|
4bab505c3a | ||
|
|
f8c5244a39 | ||
|
|
25df25ccc6 | ||
|
|
97000b1285 | ||
|
|
054b59198b | ||
|
|
5d19ac16d5 | ||
|
|
c6756762e5 | ||
|
|
671ebc6819 | ||
|
|
e6588ee8a4 | ||
|
|
3dfd2a95fa | ||
|
|
1216b33593 | ||
|
|
606ae45f5f | ||
|
|
3ee5665746 | ||
|
|
a0007bf244 | ||
|
|
7e59e083d3 | ||
|
|
24d6853ead | ||
|
|
a932f69b8a | ||
|
|
bd37badf29 | ||
|
|
a88b82d8ff | ||
|
|
7a9315e6b6 | ||
|
|
48ec227aaf | ||
|
|
d64f7dd8c7 | ||
|
|
79b4b18e25 | ||
|
|
d0f26abd18 | ||
|
|
9afe8a0a39 | ||
|
|
09ea4116e4 | ||
|
|
2673261b10 | ||
|
|
c54354f348 | ||
|
|
ede5fef39c | ||
|
|
cf3defbc9c | ||
|
|
2554065ae9 | ||
|
|
7ab9583102 | ||
|
|
91e135888d | ||
|
|
a6f76399e2 | ||
|
|
5cefad1ab3 | ||
|
|
4cf863e054 | ||
|
|
21ac83aba0 | ||
|
|
cf56c59ca2 | ||
|
|
8fc6e50dd1 | ||
|
|
b2d51dc455 | ||
|
|
fe9c0e584f | ||
|
|
e269b1d19d | ||
|
|
d72a2d39da | ||
|
|
6c81d9848d | ||
|
|
9304056901 | ||
|
|
5d32cb0daf | ||
|
|
c87e6c6a87 | ||
|
|
f7aec31abf | ||
|
|
aed728c4d8 | ||
|
|
0fbb5c60c9 | ||
|
|
99a6f24771 | ||
|
|
b114a45f23 | ||
|
|
a10f54befa | ||
|
|
0551834164 | ||
|
|
79baffb69d | ||
|
|
e008ad03a2 | ||
|
|
aaba5742dc | ||
|
|
f5ec37db95 | ||
|
|
e9a5749cf4 | ||
|
|
05fb88d2d9 | ||
|
|
794558ab68 | ||
|
|
6dd2037f85 | ||
|
|
15ff79830f | ||
|
|
e41ad2ea06 | ||
|
|
c87684a6ef | ||
|
|
b92dce9be4 | ||
|
|
5ff816127a | ||
|
|
ef4fa3381d | ||
|
|
6dd331d7e8 | ||
|
|
e54f31cc2f | ||
|
|
8f0e1035fa | ||
|
|
e7fdc18ced | ||
|
|
d7e3e83251 | ||
|
|
18bde2c542 | ||
|
|
2a1c9283a4 | ||
|
|
ad677046a8 | ||
|
|
96038e4b32 | ||
|
|
abd1c8fb30 | ||
|
|
8dd9d98129 | ||
|
|
3f715e671d | ||
|
|
76f9830b47 | ||
|
|
6469900b5e | ||
|
|
11ab37160e | ||
|
|
490ef210ac | ||
|
|
c8f9cc33ef | ||
|
|
38437fb036 | ||
|
|
e3c1aa599d | ||
|
|
6f9bcf249b | ||
|
|
9724d81a49 | ||
|
|
2b088f1147 | ||
|
|
30b5bfe767 | ||
|
|
3dff225b98 | ||
|
|
21e9f67322 | ||
|
|
5c5fb0ae39 | ||
|
|
8af9ce1e0b | ||
|
|
275fef94fe | ||
|
|
10cc86c975 | ||
|
|
58d903c638 | ||
|
|
d97a2b13c0 | ||
|
|
ca6e1b8f1b | ||
|
|
79f986bb75 | ||
|
|
4ed93d3dee | ||
|
|
9b6f95faa2 | ||
|
|
1664eec7e4 | ||
|
|
75954dd1a4 | ||
|
|
2a46da906c | ||
|
|
4a381d4b83 | ||
|
|
d96921e287 | ||
|
|
872effc21e | ||
|
|
3e17317f31 | ||
|
|
d4b0688690 | ||
|
|
2cbdad0bb1 | ||
|
|
1c210c2386 | ||
|
|
694d69fbfa | ||
|
|
19bffc694b | ||
|
|
76b124a9c0 | ||
|
|
7b4624aac4 | ||
|
|
6c051b2be4 | ||
|
|
a9322a01ce | ||
|
|
37a702b962 | ||
|
|
83e3201677 | ||
|
|
266432a482 | ||
|
|
065d0c66ab | ||
|
|
64c5608f31 | ||
|
|
0e8f4294f0 | ||
|
|
04017b00a1 | ||
|
|
f9e5584a3e | ||
|
|
c75d2c05f0 | ||
|
|
dcb47d9934 | ||
|
|
391f53154a | ||
|
|
250040bab7 | ||
|
|
94e66acd54 | ||
|
|
9f7d7e55da | ||
|
|
27dcd07a5e | ||
|
|
4d5ec6e52a | ||
|
|
955f86ef9f | ||
|
|
33c1ca01f4 | ||
|
|
6c92ea518b | ||
|
|
cb226e74a5 | ||
|
|
08111031ec | ||
|
|
a68837451a | ||
|
|
0d1f493b6c | ||
|
|
f1ab5d1fbd | ||
|
|
bbd1da7b71 | ||
|
|
a564f92eef | ||
|
|
cd189c0812 | ||
|
|
fb296b5b95 | ||
|
|
35ec6b4f5c | ||
|
|
d5deccd2e9 | ||
|
|
dacf012a78 | ||
|
|
cdb488149f | ||
|
|
c9cb7bc0fd | ||
|
|
ae738e9c59 | ||
|
|
c6242ad167 | ||
|
|
8be7e6064e | ||
|
|
2a424ad2af | ||
|
|
924a7b009b | ||
|
|
218c246111 | ||
|
|
95140f35f8 | ||
|
|
ca02573d1e | ||
|
|
771b1acbc1 | ||
|
|
29b96aa15d | ||
|
|
21c493a854 | ||
|
|
acd8c4503b | ||
|
|
5f71cd5476 | ||
|
|
02f845636e | ||
|
|
a30a961cf5 | ||
|
|
52e22796e1 | ||
|
|
73113c1041 | ||
|
|
53204661e3 | ||
|
|
d3b4df7da8 | ||
|
|
f1682cba13 | ||
|
|
ba0d60853d | ||
|
|
7523a5e97f | ||
|
|
cc55580300 | ||
|
|
b32db1ac02 | ||
|
|
b2017a9c9c | ||
|
|
87e130e77a | ||
|
|
ebced14db2 | ||
|
|
459a2886a0 | ||
|
|
923a4427c5 | ||
|
|
60a05dded0 | ||
|
|
7942bd0b3b | ||
|
|
2535e5d5c9 | ||
|
|
bd45a6c11d | ||
|
|
d901ceb734 | ||
|
|
5a55d56320 | ||
|
|
8712772a5f | ||
|
|
c51798d46f | ||
|
|
e7669ef9d6 | ||
|
|
29ac4cb9cc | ||
|
|
173a852273 | ||
|
|
8b2279072f | ||
|
|
e0b6d4d917 | ||
|
|
99b5e5a373 | ||
|
|
ab20a8ffff | ||
|
|
088448043a | ||
|
|
d94912ed62 | ||
|
|
0bc386cb08 | ||
|
|
bb8bf28b8b | ||
|
|
690fb47cbb | ||
|
|
de3678a805 | ||
|
|
d6e74b9620 | ||
|
|
ca314c5bb9 | ||
|
|
3a07ca4c64 | ||
|
|
80d5a1a1db | ||
|
|
4ef1e1119f | ||
|
|
0dd5b94556 | ||
|
|
b48835f3ce | ||
|
|
571c4ce398 | ||
|
|
8277c96933 | ||
|
|
bd205317aa | ||
|
|
496d857db1 | ||
|
|
6a959fefd0 | ||
|
|
62897a194b | ||
|
|
ff45e58543 | ||
|
|
c8a938275c | ||
|
|
318dd22bd1 | ||
|
|
6fe5f85da7 | ||
|
|
2438265ba8 | ||
|
|
9c4af5070b | ||
|
|
a4438ad64f | ||
|
|
55c37183d9 | ||
|
|
dfd1a53624 | ||
|
|
1c8cd242bf | ||
|
|
9d6c0e56ed | ||
|
|
b39a205671 | ||
|
|
80b95a22a4 | ||
|
|
3b91d1c5e5 | ||
|
|
585cd64b9a | ||
|
|
5ff6b5ef42 | ||
|
|
f67a9615b8 | ||
|
|
e5aa772639 | ||
|
|
4c640e3f81 | ||
|
|
d610837caf | ||
|
|
2bcaf1fa63 | ||
|
|
e28c1fd310 | ||
|
|
9551e0fff2 | ||
|
|
701374a646 | ||
|
|
08cc904a71 | ||
|
|
85f79695b9 | ||
|
|
4bf6e58f2b | ||
|
|
3f10914f05 | ||
|
|
165533fdb7 | ||
|
|
f42f2fa743 | ||
|
|
26ce6b5131 | ||
|
|
bbc6d2b993 | ||
|
|
3c0b226344 | ||
|
|
0ebb39a26e | ||
|
|
17d59e0daa | ||
|
|
81ba7aa833 | ||
|
|
e9cb30b4f3 | ||
|
|
c432efc364 | ||
|
|
dea3c954f1 | ||
|
|
2ae35b0b08 | ||
|
|
e79d02f482 | ||
|
|
a4e9ab90a0 | ||
|
|
c969a34644 | ||
|
|
53e5aa4364 | ||
|
|
09ec3f6eaf | ||
|
|
93741ced5c | ||
|
|
a3ad626f99 | ||
|
|
b351ca6bd4 | ||
|
|
3199ce03a6 | ||
|
|
e62b118351 | ||
|
|
99cb85ab00 | ||
|
|
6f3713af5f | ||
|
|
49c2bfe637 | ||
|
|
64a300bfcd | ||
|
|
3a0eee64b8 | ||
|
|
8973e3f362 | ||
|
|
92e21e76ba | ||
|
|
e3ab3d6be3 | ||
|
|
60e0831c11 | ||
|
|
13a778fd9c | ||
|
|
fc83dc17fe | ||
|
|
3f758a3fa2 | ||
|
|
0768a7089c | ||
|
|
5075484c8e | ||
|
|
9ba41c5b88 | ||
|
|
5c8d555808 | ||
|
|
1ea4fa4464 | ||
|
|
c13f38f6df | ||
|
|
1a044e5af4 | ||
|
|
5b64ceceb3 | ||
|
|
16928d6e3f | ||
|
|
0b0ba7d987 | ||
|
|
d953a03807 | ||
|
|
21000f4174 | ||
|
|
465261e611 | ||
|
|
b9c33a0c6e | ||
|
|
2fce6a4af9 | ||
|
|
5de34b052f | ||
|
|
e2b7aba086 | ||
|
|
59551eb037 | ||
|
|
9fa5feeeea | ||
|
|
daa65a2fff | ||
|
|
bf67308cc2 | ||
|
|
6891ad0dfc | ||
|
|
bb66b2fd04 | ||
|
|
c5068b7d45 | ||
|
|
484b884d04 | ||
|
|
d6bb1f2d4e | ||
|
|
24d82c63e0 | ||
|
|
ba5193870e | ||
|
|
06498c0efd | ||
|
|
f255f93ad9 | ||
|
|
eff13d24dc | ||
|
|
e47dfcbe64 | ||
|
|
18cebe5131 | ||
|
|
e529a7bf9b | ||
|
|
56db4bd1ac | ||
|
|
5d4606daaa | ||
|
|
2812034896 | ||
|
|
c1cdf273a6 | ||
|
|
9f282e0ddc | ||
|
|
659d2c13b4 | ||
|
|
019635189a | ||
|
|
65b6a95f64 | ||
|
|
5480faf5c5 | ||
|
|
3e59adc7f3 | ||
|
|
90f9dd5b33 | ||
|
|
206b38f0ab | ||
|
|
78c6e0733c | ||
|
|
1f62fee4f9 | ||
|
|
593fb8770b | ||
|
|
4ec369ac5b | ||
|
|
8172ae5d89 | ||
|
|
bd3bc13e75 | ||
|
|
ad53fc931e | ||
|
|
0f2ca5d84c | ||
|
|
4a17228621 | ||
|
|
cbeadba15d | ||
|
|
573aac7252 | ||
|
|
a16aaa3824 | ||
|
|
913c298be8 | ||
|
|
558338f997 | ||
|
|
8f675fe757 | ||
|
|
9ad88a5a0d | ||
|
|
5c0231b727 | ||
|
|
d8549d6292 | ||
|
|
e9436da858 | ||
|
|
adfa8c788c | ||
|
|
64e97225b8 | ||
|
|
d022bb0248 | ||
|
|
509ed64917 | ||
|
|
771600077c | ||
|
|
297288e984 | ||
|
|
772ca2715c | ||
|
|
6265ac8c19 | ||
|
|
16b3fedcd4 | ||
|
|
e7cf34a2a9 | ||
|
|
f08733eb75 | ||
|
|
2ef4ca4e6e | ||
|
|
2bbe3db041 | ||
|
|
9f9c8e3d77 | ||
|
|
21f022dec2 | ||
|
|
021a63827d | ||
|
|
6a29097a8c | ||
|
|
be9ef8f3c8 | ||
|
|
482e217b5e | ||
|
|
6747084fe2 | ||
|
|
338aad98eb | ||
|
|
7d4eaefd36 | ||
|
|
0ee4f1f393 | ||
|
|
e72ddbcbfe | ||
|
|
4b823eca21 |
2913
ChangeLog.md
2913
ChangeLog.md
File diff suppressed because it is too large
Load Diff
34
ReadMe.md
34
ReadMe.md
@@ -4,7 +4,7 @@
|
||||
[](https://www.apache.org/licenses/LICENSE-2.0)
|
||||
[](https://ge.jetbrains.com/scans?search.rootProjectNames=Kotlin)
|
||||
|
||||
# Kotlin Programming Language!!!
|
||||
# Kotlin Programming Language
|
||||
|
||||
Welcome to [Kotlin](https://kotlinlang.org/)!
|
||||
It is an open-source, statically typed programming language supported and developed by [JetBrains](https://www.jetbrains.com/) and open-source contributors.
|
||||
@@ -59,8 +59,8 @@ You also can use [Gradle properties](https://docs.gradle.org/current/userguide/b
|
||||
Note: The JDK 6 for MacOS is not available on Oracle's site. You can install it by
|
||||
|
||||
```bash
|
||||
$ brew tap caskroom/versions
|
||||
$ brew cask install java6
|
||||
$ brew tap homebrew/cask-versions
|
||||
$ brew install --cask java6
|
||||
```
|
||||
|
||||
On Windows you might need to add long paths setting to the repo:
|
||||
@@ -109,13 +109,13 @@ Refer to [libraries/ReadMe.md](libraries/ReadMe.md) for details.
|
||||
|
||||
### Building for different versions of IntelliJ IDEA and Android Studio
|
||||
|
||||
Kotlin plugin is intended to work with several recent versions of IntelliJ IDEA and Android Studio. Each platform is allowed to have a different set of features and might provide a slightly different API. Instead of using several parallel Git branches, project stores everything in a single branch, but files may have counterparts with version extensions (\*.as32, \*.172, \*.181). The primary file is expected to be replaced with its counterpart when targeting non-default platform.
|
||||
Kotlin plugin is intended to work with several recent versions of IntelliJ IDEA and Android Studio. Each platform is allowed to have a different set of features and might provide a slightly different API. Instead of using several parallel Git branches, the project stores everything in a single branch, but files may have counterparts with version extensions (\*.as32, \*.172, \*.181). The primary file is expected to be replaced with its counterpart when targeting a non-default platform.
|
||||
|
||||
More detailed description of this scheme can be found at https://github.com/JetBrains/bunches/blob/master/ReadMe.md.
|
||||
A More detailed description of this scheme can be found at https://github.com/JetBrains/bunches/blob/master/ReadMe.md.
|
||||
|
||||
Usually, there's no need to care about multiple platforms as all features are enabled everywhere by default. Additional counterparts should be created if there's an expected difference in behavior or an incompatible API usage is required **and** there's no reasonable workaround to save source compatibility. Kotlin plugin contains a pre-commit check that shows a warning if a file has been updated without its counterparts.
|
||||
|
||||
Development for some particular platform is possible after 'switching' that can be done with [Bunch Tool](https://github.com/JetBrains/bunches/releases) from the command line.
|
||||
Development for some particular platform is possible after 'switching' that can be done with the [Bunch Tool](https://github.com/JetBrains/bunches/releases) from the command line.
|
||||
|
||||
```sh
|
||||
cd kotlin-project-dir
|
||||
@@ -168,28 +168,6 @@ includeBuild('/path/to/kotlin') {
|
||||
}
|
||||
```
|
||||
|
||||
### Dependency verification
|
||||
|
||||
We have a [dependencies verification](https://docs.gradle.org/current/userguide/dependency_verification.html) feature enabled in the
|
||||
repository for all Gradle builds. Gradle will check hashes (md5 and sha256) of used dependencies and will fail builds with
|
||||
`Dependency verification failed` errors when local artifacts are absent or have different hashes listed in the
|
||||
[verification-metadata.xml](https://github.com/JetBrains/kotlin/blob/master/gradle/verification-metadata.xml) file.
|
||||
|
||||
It's expected that `verification-metadata.xml` should only be updated with the commits that modify the build. There are some tips how
|
||||
to perform such updates:
|
||||
|
||||
- Use auto-generation for getting an initial list of new hashes (verify updates relate to you changes).
|
||||
|
||||
`./gradlew -M sha256,md5 help`
|
||||
|
||||
*(any other task may be used instead of `help`)*
|
||||
|
||||
- Consider removing old versions from the file if you are updating dependencies.
|
||||
- Leave meaningful `origin` attribute (instead of `Generated by Gradle`) if you did some manual verification of the artifact.
|
||||
- Always do manual verification if several hashes are needed and a new `also-trust` tag has to be added.
|
||||
- If you’re adding a dependency with OS mentioning in an artifact name (`darwin`, `mac`, `osx`, `linux`, `windows`), remember to add
|
||||
counterparts for other platforms.
|
||||
|
||||
# License
|
||||
Kotlin is distributed under the terms of the Apache License (Version 2.0). See [license folder](license/README.md) for details.
|
||||
|
||||
|
||||
@@ -1,11 +1,36 @@
|
||||
import kotlinx.benchmark.gradle.benchmark
|
||||
|
||||
val benchmarks_version = "0.3.0"
|
||||
val benchmarks_version = "0.2.0-dev-7"
|
||||
buildscript {
|
||||
val benchmarks_version = "0.2.0-dev-7"
|
||||
|
||||
repositories {
|
||||
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
||||
if (cacheRedirectorEnabled) {
|
||||
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
|
||||
} else {
|
||||
maven("https://dl.bintray.com/kotlin/kotlinx")
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlinx:kotlinx.benchmark.gradle:$benchmarks_version")
|
||||
}
|
||||
}
|
||||
|
||||
apply(plugin = "kotlinx.benchmark")
|
||||
|
||||
plugins {
|
||||
java
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.kotlinx.benchmark") version "0.3.0"
|
||||
}
|
||||
|
||||
repositories {
|
||||
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
||||
if (cacheRedirectorEnabled) {
|
||||
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
|
||||
} else {
|
||||
maven("https://dl.bintray.com/kotlin/kotlinx")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -17,7 +42,7 @@ dependencies {
|
||||
compile(jpsStandalone()) { includeJars("jps-model") }
|
||||
compile(intellijPluginDep("java"))
|
||||
compile(intellijDep()) { includeIntellijCoreJarDependencies(project) }
|
||||
compile("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:$benchmarks_version")
|
||||
compile("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:$benchmarks_version")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.build
|
||||
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,43 +29,21 @@ import org.jetbrains.kotlin.cli.common.arguments.Argument;
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments;
|
||||
import org.jetbrains.kotlin.cli.common.arguments.InternalArgument;
|
||||
import org.jetbrains.kotlin.cli.common.arguments.ParseCommandLineArgumentsKt;
|
||||
import org.jetbrains.kotlin.idea.ExplicitDefaultSubstitutor;
|
||||
import org.jetbrains.kotlin.idea.ExplicitDefaultSubstitutorsKt;
|
||||
import org.jetbrains.kotlin.utils.StringsKt;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ArgumentUtils {
|
||||
private ArgumentUtils() {
|
||||
}
|
||||
private ArgumentUtils() {}
|
||||
|
||||
@NotNull
|
||||
public static List<String> convertArgumentsToStringList(@NotNull CommonToolArguments arguments)
|
||||
throws InstantiationException, IllegalAccessException, InvocationTargetException {
|
||||
List<String> convertedArguments = convertArgumentsToStringListInternal(arguments);
|
||||
|
||||
Map<KClass<? extends CommonToolArguments>, Collection<ExplicitDefaultSubstitutor>> defaultSubstitutorsMap =
|
||||
ExplicitDefaultSubstitutorsKt.getDefaultSubstitutors();
|
||||
KClass<? extends CommonToolArguments> argumentsKClass = JvmClassMappingKt.getKotlinClass(arguments.getClass());
|
||||
Collection<ExplicitDefaultSubstitutor> defaultSubstitutors = defaultSubstitutorsMap.get(argumentsKClass);
|
||||
if (defaultSubstitutors != null) {
|
||||
for (ExplicitDefaultSubstitutor substitutor : defaultSubstitutors) {
|
||||
if (substitutor.isSubstitutable(convertedArguments)) convertedArguments.addAll(substitutor.getNewSubstitution());
|
||||
}
|
||||
}
|
||||
return convertedArguments;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<String> convertArgumentsToStringListNoDefaults(@NotNull CommonToolArguments arguments)
|
||||
throws InstantiationException, IllegalAccessException, InvocationTargetException {
|
||||
return convertArgumentsToStringListInternal(arguments);
|
||||
}
|
||||
|
||||
private static List<String> convertArgumentsToStringListInternal(@NotNull CommonToolArguments arguments)
|
||||
throws InstantiationException, IllegalAccessException, InvocationTargetException {
|
||||
List<String> result = new ArrayList<>();
|
||||
Class<? extends CommonToolArguments> argumentsClass = arguments.getClass();
|
||||
convertArgumentsToStringList(arguments, argumentsClass.newInstance(), JvmClassMappingKt.getKotlinClass(argumentsClass), result);
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.arguments.Argument
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.config.JvmTarget
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KProperty1
|
||||
import kotlin.reflect.full.findAnnotation
|
||||
|
||||
val defaultSubstitutors: Map<KClass<out CommonToolArguments>, Collection<ExplicitDefaultSubstitutor>> =
|
||||
mapOf(K2JVMCompilerArguments::class to listOf(JvmTargetDefaultSubstitutor))
|
||||
|
||||
sealed class ExplicitDefaultSubstitutor {
|
||||
abstract val substitutedProperty: KProperty1<out CommonToolArguments, String?>
|
||||
abstract val oldSubstitution: List<String>
|
||||
abstract val newSubstitution: List<String>
|
||||
abstract fun isSubstitutable(args: List<String>): Boolean
|
||||
|
||||
protected val argument: Argument by lazy {
|
||||
substitutedProperty.findAnnotation() ?: error("Property \"${substitutedProperty.name}\" has no Argument annotation")
|
||||
}
|
||||
}
|
||||
|
||||
object JvmTargetDefaultSubstitutor : ExplicitDefaultSubstitutor() {
|
||||
override val substitutedProperty
|
||||
get() = K2JVMCompilerArguments::jvmTarget
|
||||
private val oldDefault: String
|
||||
get() = JvmTarget.JVM_1_6.description
|
||||
private val newDefault: String
|
||||
get() = JvmTarget.JVM_1_8.description
|
||||
|
||||
private fun prepareSubstitution(default: String): List<String> = listOf(argument.value, default)
|
||||
|
||||
override val oldSubstitution: List<String>
|
||||
get() = prepareSubstitution(oldDefault)
|
||||
override val newSubstitution: List<String>
|
||||
get() = prepareSubstitution(newDefault)
|
||||
|
||||
override fun isSubstitutable(args: List<String>): Boolean = argument.value !in args
|
||||
}
|
||||
@@ -94,10 +94,6 @@ open class IncrementalJvmCache(
|
||||
fun sourcesByInternalName(internalName: String): Collection<File> =
|
||||
internalNameToSource[internalName]
|
||||
|
||||
fun getAllPartsOfMultifileFacade(facade: JvmClassName): Collection<String>? {
|
||||
return multifileFacadeToParts[facade]
|
||||
}
|
||||
|
||||
fun isMultifileFacade(className: JvmClassName): Boolean =
|
||||
className in multifileFacadeToParts
|
||||
|
||||
@@ -429,8 +425,6 @@ open class IncrementalJvmCache(
|
||||
|
||||
private inner class MultifileClassFacadeMap(storageFile: File) :
|
||||
BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
|
||||
|
||||
@Synchronized
|
||||
operator fun set(className: JvmClassName, partNames: Collection<String>) {
|
||||
storage[className.internalName] = partNames
|
||||
}
|
||||
@@ -441,7 +435,6 @@ open class IncrementalJvmCache(
|
||||
operator fun contains(className: JvmClassName): Boolean =
|
||||
className.internalName in storage
|
||||
|
||||
@Synchronized
|
||||
fun remove(className: JvmClassName) {
|
||||
storage.remove(className.internalName)
|
||||
}
|
||||
@@ -451,8 +444,6 @@ open class IncrementalJvmCache(
|
||||
|
||||
private inner class MultifileClassPartMap(storageFile: File) :
|
||||
BasicStringMap<String>(storageFile, EnumeratorStringDescriptor.INSTANCE) {
|
||||
|
||||
@Synchronized
|
||||
fun set(partName: String, facadeName: String) {
|
||||
storage[partName] = facadeName
|
||||
}
|
||||
@@ -460,7 +451,6 @@ open class IncrementalJvmCache(
|
||||
fun get(partName: JvmClassName): String? =
|
||||
storage[partName.internalName]
|
||||
|
||||
@Synchronized
|
||||
fun remove(className: JvmClassName) {
|
||||
storage.remove(className.internalName)
|
||||
}
|
||||
|
||||
@@ -182,21 +182,6 @@ open class ProtoCompareGenerated(
|
||||
|
||||
if (!checkEqualsClassSealedSubclassFqName(old, new)) return false
|
||||
|
||||
if (old.hasInlineClassUnderlyingPropertyName() != new.hasInlineClassUnderlyingPropertyName()) return false
|
||||
if (old.hasInlineClassUnderlyingPropertyName()) {
|
||||
if (!checkStringEquals(old.inlineClassUnderlyingPropertyName, new.inlineClassUnderlyingPropertyName)) return false
|
||||
}
|
||||
|
||||
if (old.hasInlineClassUnderlyingType() != new.hasInlineClassUnderlyingType()) return false
|
||||
if (old.hasInlineClassUnderlyingType()) {
|
||||
if (!checkEquals(old.inlineClassUnderlyingType, new.inlineClassUnderlyingType)) return false
|
||||
}
|
||||
|
||||
if (old.hasInlineClassUnderlyingTypeId() != new.hasInlineClassUnderlyingTypeId()) return false
|
||||
if (old.hasInlineClassUnderlyingTypeId()) {
|
||||
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) return false
|
||||
}
|
||||
|
||||
if (!checkEqualsClassVersionRequirement(old, new)) return false
|
||||
|
||||
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) return false
|
||||
@@ -281,9 +266,6 @@ open class ProtoCompareGenerated(
|
||||
TYPE_ALIAS_LIST,
|
||||
ENUM_ENTRY_LIST,
|
||||
SEALED_SUBCLASS_FQ_NAME_LIST,
|
||||
INLINE_CLASS_UNDERLYING_PROPERTY_NAME,
|
||||
INLINE_CLASS_UNDERLYING_TYPE,
|
||||
INLINE_CLASS_UNDERLYING_TYPE_ID,
|
||||
VERSION_REQUIREMENT_LIST,
|
||||
VERSION_REQUIREMENT_TABLE,
|
||||
JVM_EXT_CLASS_MODULE_NAME,
|
||||
@@ -332,21 +314,6 @@ open class ProtoCompareGenerated(
|
||||
|
||||
if (!checkEqualsClassSealedSubclassFqName(old, new)) result.add(ProtoBufClassKind.SEALED_SUBCLASS_FQ_NAME_LIST)
|
||||
|
||||
if (old.hasInlineClassUnderlyingPropertyName() != new.hasInlineClassUnderlyingPropertyName()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME)
|
||||
if (old.hasInlineClassUnderlyingPropertyName()) {
|
||||
if (!checkStringEquals(old.inlineClassUnderlyingPropertyName, new.inlineClassUnderlyingPropertyName)) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME)
|
||||
}
|
||||
|
||||
if (old.hasInlineClassUnderlyingType() != new.hasInlineClassUnderlyingType()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE)
|
||||
if (old.hasInlineClassUnderlyingType()) {
|
||||
if (!checkEquals(old.inlineClassUnderlyingType, new.inlineClassUnderlyingType)) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE)
|
||||
}
|
||||
|
||||
if (old.hasInlineClassUnderlyingTypeId() != new.hasInlineClassUnderlyingTypeId()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
|
||||
if (old.hasInlineClassUnderlyingTypeId()) {
|
||||
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
|
||||
}
|
||||
|
||||
if (!checkEqualsClassVersionRequirement(old, new)) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_LIST)
|
||||
|
||||
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_TABLE)
|
||||
@@ -1761,18 +1728,6 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
|
||||
hashCode = 31 * hashCode + fqNameIndexes(getSealedSubclassFqName(i))
|
||||
}
|
||||
|
||||
if (hasInlineClassUnderlyingPropertyName()) {
|
||||
hashCode = 31 * hashCode + stringIndexes(inlineClassUnderlyingPropertyName)
|
||||
}
|
||||
|
||||
if (hasInlineClassUnderlyingType()) {
|
||||
hashCode = 31 * hashCode + inlineClassUnderlyingType.hashCode(stringIndexes, fqNameIndexes, typeById)
|
||||
}
|
||||
|
||||
if (hasInlineClassUnderlyingTypeId()) {
|
||||
hashCode = 31 * hashCode + typeById(inlineClassUnderlyingTypeId).hashCode(stringIndexes, fqNameIndexes, typeById)
|
||||
}
|
||||
|
||||
for(i in 0..versionRequirementCount - 1) {
|
||||
hashCode = 31 * hashCode + getVersionRequirement(i)
|
||||
}
|
||||
|
||||
@@ -290,11 +290,6 @@ class DifferenceCalculatorForClass(
|
||||
isClassAffected = true
|
||||
areSubclassesAffected = true
|
||||
}
|
||||
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME,
|
||||
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE,
|
||||
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID -> {
|
||||
isClassAffected = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10347,37 +10347,6 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
int getSealedSubclassFqName(int index);
|
||||
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
boolean hasInlineClassUnderlyingPropertyName();
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
int getInlineClassUnderlyingPropertyName();
|
||||
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
boolean hasInlineClassUnderlyingType();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder();
|
||||
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
boolean hasInlineClassUnderlyingTypeId();
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
int getInlineClassUnderlyingTypeId();
|
||||
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
*/
|
||||
@@ -10616,32 +10585,9 @@ public final class DebugProtoBuf {
|
||||
input.popLimit(limit);
|
||||
break;
|
||||
}
|
||||
case 136: {
|
||||
bitField0_ |= 0x00000008;
|
||||
inlineClassUnderlyingPropertyName_ = input.readInt32();
|
||||
break;
|
||||
}
|
||||
case 146: {
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
subBuilder = inlineClassUnderlyingType_.toBuilder();
|
||||
}
|
||||
inlineClassUnderlyingType_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.PARSER, extensionRegistry);
|
||||
if (subBuilder != null) {
|
||||
subBuilder.mergeFrom(inlineClassUnderlyingType_);
|
||||
inlineClassUnderlyingType_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000010;
|
||||
break;
|
||||
}
|
||||
case 152: {
|
||||
bitField0_ |= 0x00000020;
|
||||
inlineClassUnderlyingTypeId_ = input.readInt32();
|
||||
break;
|
||||
}
|
||||
case 242: {
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
subBuilder = typeTable_.toBuilder();
|
||||
}
|
||||
typeTable_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.PARSER, extensionRegistry);
|
||||
@@ -10649,13 +10595,13 @@ public final class DebugProtoBuf {
|
||||
subBuilder.mergeFrom(typeTable_);
|
||||
typeTable_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000040;
|
||||
bitField0_ |= 0x00000008;
|
||||
break;
|
||||
}
|
||||
case 248: {
|
||||
if (!((mutable_bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
if (!((mutable_bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>();
|
||||
mutable_bitField0_ |= 0x00020000;
|
||||
mutable_bitField0_ |= 0x00004000;
|
||||
}
|
||||
versionRequirement_.add(input.readInt32());
|
||||
break;
|
||||
@@ -10663,9 +10609,9 @@ public final class DebugProtoBuf {
|
||||
case 250: {
|
||||
int length = input.readRawVarint32();
|
||||
int limit = input.pushLimit(length);
|
||||
if (!((mutable_bitField0_ & 0x00020000) == 0x00020000) && input.getBytesUntilLimit() > 0) {
|
||||
if (!((mutable_bitField0_ & 0x00004000) == 0x00004000) && input.getBytesUntilLimit() > 0) {
|
||||
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>();
|
||||
mutable_bitField0_ |= 0x00020000;
|
||||
mutable_bitField0_ |= 0x00004000;
|
||||
}
|
||||
while (input.getBytesUntilLimit() > 0) {
|
||||
versionRequirement_.add(input.readInt32());
|
||||
@@ -10675,7 +10621,7 @@ public final class DebugProtoBuf {
|
||||
}
|
||||
case 258: {
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
subBuilder = versionRequirementTable_.toBuilder();
|
||||
}
|
||||
versionRequirementTable_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.PARSER, extensionRegistry);
|
||||
@@ -10683,7 +10629,7 @@ public final class DebugProtoBuf {
|
||||
subBuilder.mergeFrom(versionRequirementTable_);
|
||||
versionRequirementTable_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000080;
|
||||
bitField0_ |= 0x00000010;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -10724,7 +10670,7 @@ public final class DebugProtoBuf {
|
||||
if (((mutable_bitField0_ & 0x00001000) == 0x00001000)) {
|
||||
sealedSubclassFqName_ = java.util.Collections.unmodifiableList(sealedSubclassFqName_);
|
||||
}
|
||||
if (((mutable_bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
if (((mutable_bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
versionRequirement_ = java.util.Collections.unmodifiableList(versionRequirement_);
|
||||
}
|
||||
this.unknownFields = unknownFields.build();
|
||||
@@ -11279,64 +11225,13 @@ public final class DebugProtoBuf {
|
||||
}
|
||||
private int sealedSubclassFqNameMemoizedSerializedSize = -1;
|
||||
|
||||
public static final int INLINE_CLASS_UNDERLYING_PROPERTY_NAME_FIELD_NUMBER = 17;
|
||||
private int inlineClassUnderlyingPropertyName_;
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingPropertyName() {
|
||||
return ((bitField0_ & 0x00000008) == 0x00000008);
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public int getInlineClassUnderlyingPropertyName() {
|
||||
return inlineClassUnderlyingPropertyName_;
|
||||
}
|
||||
|
||||
public static final int INLINE_CLASS_UNDERLYING_TYPE_FIELD_NUMBER = 18;
|
||||
private org.jetbrains.kotlin.metadata.DebugProtoBuf.Type inlineClassUnderlyingType_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingType() {
|
||||
return ((bitField0_ & 0x00000010) == 0x00000010);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType() {
|
||||
return inlineClassUnderlyingType_;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder() {
|
||||
return inlineClassUnderlyingType_;
|
||||
}
|
||||
|
||||
public static final int INLINE_CLASS_UNDERLYING_TYPE_ID_FIELD_NUMBER = 19;
|
||||
private int inlineClassUnderlyingTypeId_;
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingTypeId() {
|
||||
return ((bitField0_ & 0x00000020) == 0x00000020);
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public int getInlineClassUnderlyingTypeId() {
|
||||
return inlineClassUnderlyingTypeId_;
|
||||
}
|
||||
|
||||
public static final int TYPE_TABLE_FIELD_NUMBER = 30;
|
||||
private org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable typeTable_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
*/
|
||||
public boolean hasTypeTable() {
|
||||
return ((bitField0_ & 0x00000040) == 0x00000040);
|
||||
return ((bitField0_ & 0x00000008) == 0x00000008);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
@@ -11391,7 +11286,7 @@ public final class DebugProtoBuf {
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
*/
|
||||
public boolean hasVersionRequirementTable() {
|
||||
return ((bitField0_ & 0x00000080) == 0x00000080);
|
||||
return ((bitField0_ & 0x00000010) == 0x00000010);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
@@ -11420,9 +11315,6 @@ public final class DebugProtoBuf {
|
||||
typeAlias_ = java.util.Collections.emptyList();
|
||||
enumEntry_ = java.util.Collections.emptyList();
|
||||
sealedSubclassFqName_ = java.util.Collections.emptyList();
|
||||
inlineClassUnderlyingPropertyName_ = 0;
|
||||
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
|
||||
inlineClassUnderlyingTypeId_ = 0;
|
||||
typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
|
||||
versionRequirement_ = java.util.Collections.emptyList();
|
||||
versionRequirementTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance();
|
||||
@@ -11479,12 +11371,6 @@ public final class DebugProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasInlineClassUnderlyingType()) {
|
||||
if (!getInlineClassUnderlyingType().isInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasTypeTable()) {
|
||||
if (!getTypeTable().isInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
@@ -11557,21 +11443,12 @@ public final class DebugProtoBuf {
|
||||
output.writeInt32NoTag(sealedSubclassFqName_.get(i));
|
||||
}
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
output.writeInt32(17, inlineClassUnderlyingPropertyName_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
output.writeMessage(18, inlineClassUnderlyingType_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
output.writeInt32(19, inlineClassUnderlyingTypeId_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
output.writeMessage(30, typeTable_);
|
||||
}
|
||||
for (int i = 0; i < versionRequirement_.size(); i++) {
|
||||
output.writeInt32(31, versionRequirement_.get(i));
|
||||
}
|
||||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
output.writeMessage(32, versionRequirementTable_);
|
||||
}
|
||||
extensionWriter.writeUntil(19000, output);
|
||||
@@ -11667,18 +11544,6 @@ public final class DebugProtoBuf {
|
||||
sealedSubclassFqNameMemoizedSerializedSize = dataSize;
|
||||
}
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeInt32Size(17, inlineClassUnderlyingPropertyName_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(18, inlineClassUnderlyingType_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeInt32Size(19, inlineClassUnderlyingTypeId_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(30, typeTable_);
|
||||
}
|
||||
@@ -11691,7 +11556,7 @@ public final class DebugProtoBuf {
|
||||
size += dataSize;
|
||||
size += 2 * getVersionRequirementList().size();
|
||||
}
|
||||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(32, versionRequirementTable_);
|
||||
}
|
||||
@@ -11813,7 +11678,6 @@ public final class DebugProtoBuf {
|
||||
getPropertyFieldBuilder();
|
||||
getTypeAliasFieldBuilder();
|
||||
getEnumEntryFieldBuilder();
|
||||
getInlineClassUnderlyingTypeFieldBuilder();
|
||||
getTypeTableFieldBuilder();
|
||||
getVersionRequirementTableFieldBuilder();
|
||||
}
|
||||
@@ -11878,30 +11742,20 @@ public final class DebugProtoBuf {
|
||||
}
|
||||
sealedSubclassFqName_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00001000);
|
||||
inlineClassUnderlyingPropertyName_ = 0;
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
inlineClassUnderlyingTypeId_ = 0;
|
||||
bitField0_ = (bitField0_ & ~0x00008000);
|
||||
if (typeTableBuilder_ == null) {
|
||||
typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
|
||||
} else {
|
||||
typeTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00010000);
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
versionRequirement_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
if (versionRequirementTableBuilder_ == null) {
|
||||
versionRequirementTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance();
|
||||
} else {
|
||||
versionRequirementTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00040000);
|
||||
bitField0_ = (bitField0_ & ~0x00008000);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -12023,34 +11877,18 @@ public final class DebugProtoBuf {
|
||||
if (((from_bitField0_ & 0x00002000) == 0x00002000)) {
|
||||
to_bitField0_ |= 0x00000008;
|
||||
}
|
||||
result.inlineClassUnderlyingPropertyName_ = inlineClassUnderlyingPropertyName_;
|
||||
if (((from_bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
to_bitField0_ |= 0x00000010;
|
||||
}
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
result.inlineClassUnderlyingType_ = inlineClassUnderlyingType_;
|
||||
} else {
|
||||
result.inlineClassUnderlyingType_ = inlineClassUnderlyingTypeBuilder_.build();
|
||||
}
|
||||
if (((from_bitField0_ & 0x00008000) == 0x00008000)) {
|
||||
to_bitField0_ |= 0x00000020;
|
||||
}
|
||||
result.inlineClassUnderlyingTypeId_ = inlineClassUnderlyingTypeId_;
|
||||
if (((from_bitField0_ & 0x00010000) == 0x00010000)) {
|
||||
to_bitField0_ |= 0x00000040;
|
||||
}
|
||||
if (typeTableBuilder_ == null) {
|
||||
result.typeTable_ = typeTable_;
|
||||
} else {
|
||||
result.typeTable_ = typeTableBuilder_.build();
|
||||
}
|
||||
if (((bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
if (((bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
versionRequirement_ = java.util.Collections.unmodifiableList(versionRequirement_);
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
}
|
||||
result.versionRequirement_ = versionRequirement_;
|
||||
if (((from_bitField0_ & 0x00040000) == 0x00040000)) {
|
||||
to_bitField0_ |= 0x00000080;
|
||||
if (((from_bitField0_ & 0x00008000) == 0x00008000)) {
|
||||
to_bitField0_ |= 0x00000010;
|
||||
}
|
||||
if (versionRequirementTableBuilder_ == null) {
|
||||
result.versionRequirementTable_ = versionRequirementTable_;
|
||||
@@ -12294,22 +12132,13 @@ public final class DebugProtoBuf {
|
||||
}
|
||||
onChanged();
|
||||
}
|
||||
if (other.hasInlineClassUnderlyingPropertyName()) {
|
||||
setInlineClassUnderlyingPropertyName(other.getInlineClassUnderlyingPropertyName());
|
||||
}
|
||||
if (other.hasInlineClassUnderlyingType()) {
|
||||
mergeInlineClassUnderlyingType(other.getInlineClassUnderlyingType());
|
||||
}
|
||||
if (other.hasInlineClassUnderlyingTypeId()) {
|
||||
setInlineClassUnderlyingTypeId(other.getInlineClassUnderlyingTypeId());
|
||||
}
|
||||
if (other.hasTypeTable()) {
|
||||
mergeTypeTable(other.getTypeTable());
|
||||
}
|
||||
if (!other.versionRequirement_.isEmpty()) {
|
||||
if (versionRequirement_.isEmpty()) {
|
||||
versionRequirement_ = other.versionRequirement_;
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
} else {
|
||||
ensureVersionRequirementIsMutable();
|
||||
versionRequirement_.addAll(other.versionRequirement_);
|
||||
@@ -12371,12 +12200,6 @@ public final class DebugProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasInlineClassUnderlyingType()) {
|
||||
if (!getInlineClassUnderlyingType().isInitialized()) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasTypeTable()) {
|
||||
if (!getTypeTable().isInitialized()) {
|
||||
|
||||
@@ -14435,186 +14258,6 @@ public final class DebugProtoBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
private int inlineClassUnderlyingPropertyName_ ;
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingPropertyName() {
|
||||
return ((bitField0_ & 0x00002000) == 0x00002000);
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public int getInlineClassUnderlyingPropertyName() {
|
||||
return inlineClassUnderlyingPropertyName_;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public Builder setInlineClassUnderlyingPropertyName(int value) {
|
||||
bitField0_ |= 0x00002000;
|
||||
inlineClassUnderlyingPropertyName_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public Builder clearInlineClassUnderlyingPropertyName() {
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
inlineClassUnderlyingPropertyName_ = 0;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private org.jetbrains.kotlin.metadata.DebugProtoBuf.Type inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
|
||||
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder> inlineClassUnderlyingTypeBuilder_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingType() {
|
||||
return ((bitField0_ & 0x00004000) == 0x00004000);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType() {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
return inlineClassUnderlyingType_;
|
||||
} else {
|
||||
return inlineClassUnderlyingTypeBuilder_.getMessage();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public Builder setInlineClassUnderlyingType(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type value) {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
inlineClassUnderlyingType_ = value;
|
||||
onChanged();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00004000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public Builder setInlineClassUnderlyingType(
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder builderForValue) {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
inlineClassUnderlyingType_ = builderForValue.build();
|
||||
onChanged();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00004000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public Builder mergeInlineClassUnderlyingType(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type value) {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00004000) == 0x00004000) &&
|
||||
inlineClassUnderlyingType_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance()) {
|
||||
inlineClassUnderlyingType_ =
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.newBuilder(inlineClassUnderlyingType_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
inlineClassUnderlyingType_ = value;
|
||||
}
|
||||
onChanged();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00004000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public Builder clearInlineClassUnderlyingType() {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
|
||||
onChanged();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder getInlineClassUnderlyingTypeBuilder() {
|
||||
bitField0_ |= 0x00004000;
|
||||
onChanged();
|
||||
return getInlineClassUnderlyingTypeFieldBuilder().getBuilder();
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder() {
|
||||
if (inlineClassUnderlyingTypeBuilder_ != null) {
|
||||
return inlineClassUnderlyingTypeBuilder_.getMessageOrBuilder();
|
||||
} else {
|
||||
return inlineClassUnderlyingType_;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder>
|
||||
getInlineClassUnderlyingTypeFieldBuilder() {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
inlineClassUnderlyingTypeBuilder_ = new org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder>(
|
||||
getInlineClassUnderlyingType(),
|
||||
getParentForChildren(),
|
||||
isClean());
|
||||
inlineClassUnderlyingType_ = null;
|
||||
}
|
||||
return inlineClassUnderlyingTypeBuilder_;
|
||||
}
|
||||
|
||||
private int inlineClassUnderlyingTypeId_ ;
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingTypeId() {
|
||||
return ((bitField0_ & 0x00008000) == 0x00008000);
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public int getInlineClassUnderlyingTypeId() {
|
||||
return inlineClassUnderlyingTypeId_;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public Builder setInlineClassUnderlyingTypeId(int value) {
|
||||
bitField0_ |= 0x00008000;
|
||||
inlineClassUnderlyingTypeId_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public Builder clearInlineClassUnderlyingTypeId() {
|
||||
bitField0_ = (bitField0_ & ~0x00008000);
|
||||
inlineClassUnderlyingTypeId_ = 0;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
|
||||
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTableOrBuilder> typeTableBuilder_;
|
||||
@@ -14622,7 +14265,7 @@ public final class DebugProtoBuf {
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
*/
|
||||
public boolean hasTypeTable() {
|
||||
return ((bitField0_ & 0x00010000) == 0x00010000);
|
||||
return ((bitField0_ & 0x00002000) == 0x00002000);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
@@ -14647,7 +14290,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00010000;
|
||||
bitField0_ |= 0x00002000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14661,7 +14304,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00010000;
|
||||
bitField0_ |= 0x00002000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14669,7 +14312,7 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
public Builder mergeTypeTable(org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable value) {
|
||||
if (typeTableBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00010000) == 0x00010000) &&
|
||||
if (((bitField0_ & 0x00002000) == 0x00002000) &&
|
||||
typeTable_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance()) {
|
||||
typeTable_ =
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.newBuilder(typeTable_).mergeFrom(value).buildPartial();
|
||||
@@ -14680,7 +14323,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00010000;
|
||||
bitField0_ |= 0x00002000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14693,14 +14336,14 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00010000);
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder getTypeTableBuilder() {
|
||||
bitField0_ |= 0x00010000;
|
||||
bitField0_ |= 0x00002000;
|
||||
onChanged();
|
||||
return getTypeTableFieldBuilder().getBuilder();
|
||||
}
|
||||
@@ -14733,9 +14376,9 @@ public final class DebugProtoBuf {
|
||||
|
||||
private java.util.List<java.lang.Integer> versionRequirement_ = java.util.Collections.emptyList();
|
||||
private void ensureVersionRequirementIsMutable() {
|
||||
if (!((bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
if (!((bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>(versionRequirement_);
|
||||
bitField0_ |= 0x00020000;
|
||||
bitField0_ |= 0x00004000;
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -14820,7 +14463,7 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
public Builder clearVersionRequirement() {
|
||||
versionRequirement_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
@@ -14832,7 +14475,7 @@ public final class DebugProtoBuf {
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
*/
|
||||
public boolean hasVersionRequirementTable() {
|
||||
return ((bitField0_ & 0x00040000) == 0x00040000);
|
||||
return ((bitField0_ & 0x00008000) == 0x00008000);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
@@ -14857,7 +14500,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00040000;
|
||||
bitField0_ |= 0x00008000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14871,7 +14514,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00040000;
|
||||
bitField0_ |= 0x00008000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14879,7 +14522,7 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
public Builder mergeVersionRequirementTable(org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable value) {
|
||||
if (versionRequirementTableBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00040000) == 0x00040000) &&
|
||||
if (((bitField0_ & 0x00008000) == 0x00008000) &&
|
||||
versionRequirementTable_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance()) {
|
||||
versionRequirementTable_ =
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.newBuilder(versionRequirementTable_).mergeFrom(value).buildPartial();
|
||||
@@ -14890,7 +14533,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00040000;
|
||||
bitField0_ |= 0x00008000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14903,14 +14546,14 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00040000);
|
||||
bitField0_ = (bitField0_ & ~0x00008000);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.Builder getVersionRequirementTableBuilder() {
|
||||
bitField0_ |= 0x00040000;
|
||||
bitField0_ |= 0x00008000;
|
||||
onChanged();
|
||||
return getVersionRequirementTableFieldBuilder().getBuilder();
|
||||
}
|
||||
@@ -34739,7 +34382,7 @@ public final class DebugProtoBuf {
|
||||
"Variance:\003INV\0228\n\013upper_bound\030\005 \003(\0132#.org" +
|
||||
".jetbrains.kotlin.metadata.Type\022\036\n\016upper" +
|
||||
"_bound_id\030\006 \003(\005B\006\020\001\240\265\030\001\"$\n\010Variance\022\006\n\002I" +
|
||||
"N\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*\005\010d\020\350\007\"\327\010\n\005Class\022\020" +
|
||||
"N\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*\005\010d\020\350\007\"\250\007\n\005Class\022\020" +
|
||||
"\n\005flags\030\001 \001(\005:\0016\022\025\n\007fq_name\030\003 \002(\005B\004\220\265\030\001\022",
|
||||
"#\n\025companion_object_name\030\004 \001(\005B\004\210\265\030\001\022D\n\016" +
|
||||
"type_parameter\030\005 \003(\0132,.org.jetbrains.kot" +
|
||||
@@ -34755,127 +34398,122 @@ public final class DebugProtoBuf {
|
||||
"brains.kotlin.metadata.TypeAlias\022<\n\nenum" +
|
||||
"_entry\030\r \003(\0132(.org.jetbrains.kotlin.meta" +
|
||||
"data.EnumEntry\022\'\n\027sealed_subclass_fq_nam" +
|
||||
"e\030\020 \003(\005B\006\020\001\220\265\030\001\0223\n%inline_class_underlyi" +
|
||||
"ng_property_name\030\021 \001(\005B\004\210\265\030\001\022I\n\034inline_c" +
|
||||
"lass_underlying_type\030\022 \001(\0132#.org.jetbrai" +
|
||||
"ns.kotlin.metadata.Type\022-\n\037inline_class_" +
|
||||
"underlying_type_id\030\023 \001(\005B\004\240\265\030\001\022<\n\ntype_t" +
|
||||
"able\030\036 \001(\0132(.org.jetbrains.kotlin.metada",
|
||||
"ta.TypeTable\022\033\n\023version_requirement\030\037 \003(" +
|
||||
"\005\022Y\n\031version_requirement_table\030 \001(\01326.o" +
|
||||
"rg.jetbrains.kotlin.metadata.VersionRequ" +
|
||||
"irementTable\"x\n\004Kind\022\t\n\005CLASS\020\000\022\r\n\tINTER" +
|
||||
"FACE\020\001\022\016\n\nENUM_CLASS\020\002\022\016\n\nENUM_ENTRY\020\003\022\024" +
|
||||
"\n\020ANNOTATION_CLASS\020\004\022\n\n\006OBJECT\020\005\022\024\n\020COMP" +
|
||||
"ANION_OBJECT\020\006*\006\010d\020\270\224\001\"\335\002\n\007Package\0229\n\010fu" +
|
||||
"nction\030\003 \003(\0132\'.org.jetbrains.kotlin.meta" +
|
||||
"data.Function\0229\n\010property\030\004 \003(\0132\'.org.je" +
|
||||
"tbrains.kotlin.metadata.Property\022<\n\ntype",
|
||||
"_alias\030\005 \003(\0132(.org.jetbrains.kotlin.meta" +
|
||||
"data.TypeAlias\022<\n\ntype_table\030\036 \001(\0132(.org" +
|
||||
".jetbrains.kotlin.metadata.TypeTable\022Y\n\031" +
|
||||
"version_requirement_table\030 \001(\01326.org.je" +
|
||||
"tbrains.kotlin.metadata.VersionRequireme" +
|
||||
"ntTable*\005\010d\020\310\001\"`\n\tTypeTable\0221\n\004type\030\001 \003(" +
|
||||
"\0132#.org.jetbrains.kotlin.metadata.Type\022\032" +
|
||||
"\n\016first_nullable\030\002 \001(\005:\002-1:\004\240\273\030\001\"\214\001\n\013Con" +
|
||||
"structor\022\020\n\005flags\030\001 \001(\005:\0016\022F\n\017value_para" +
|
||||
"meter\030\002 \003(\0132-.org.jetbrains.kotlin.metad",
|
||||
"ata.ValueParameter\022\033\n\023version_requiremen" +
|
||||
"t\030\037 \003(\005*\006\010d\020\270\224\001\"\246\004\n\010Function\022\020\n\005flags\030\t " +
|
||||
"\001(\005:\0016\022\024\n\told_flags\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002" +
|
||||
"(\005B\004\210\265\030\001\0228\n\013return_type\030\003 \001(\0132#.org.jetb" +
|
||||
"rains.kotlin.metadata.Type\022\034\n\016return_typ" +
|
||||
"e_id\030\007 \001(\005B\004\240\265\030\001\022D\n\016type_parameter\030\004 \003(\013" +
|
||||
"2,.org.jetbrains.kotlin.metadata.TypePar" +
|
||||
"ameter\022:\n\rreceiver_type\030\005 \001(\0132#.org.jetb" +
|
||||
"rains.kotlin.metadata.Type\022\036\n\020receiver_t" +
|
||||
"ype_id\030\010 \001(\005B\004\240\265\030\001\022F\n\017value_parameter\030\006 ",
|
||||
"\003(\0132-.org.jetbrains.kotlin.metadata.Valu" +
|
||||
"eParameter\022<\n\ntype_table\030\036 \001(\0132(.org.jet" +
|
||||
"brains.kotlin.metadata.TypeTable\022\033\n\023vers" +
|
||||
"ion_requirement\030\037 \003(\005\0229\n\010contract\030 \001(\0132" +
|
||||
"\'.org.jetbrains.kotlin.metadata.Contract" +
|
||||
"*\006\010d\020\270\224\001\"\345\003\n\010Property\022\022\n\005flags\030\013 \001(\005:\00351" +
|
||||
"8\022\027\n\told_flags\030\001 \001(\005:\0042054\022\022\n\004name\030\002 \002(\005" +
|
||||
"B\004\210\265\030\001\0228\n\013return_type\030\003 \001(\0132#.org.jetbra" +
|
||||
"ins.kotlin.metadata.Type\022\034\n\016return_type_" +
|
||||
"id\030\t \001(\005B\004\240\265\030\001\022D\n\016type_parameter\030\004 \003(\0132,",
|
||||
".org.jetbrains.kotlin.metadata.TypeParam" +
|
||||
"eter\022:\n\rreceiver_type\030\005 \001(\0132#.org.jetbra" +
|
||||
"ins.kotlin.metadata.Type\022\036\n\020receiver_typ" +
|
||||
"e_id\030\n \001(\005B\004\240\265\030\001\022M\n\026setter_value_paramet" +
|
||||
"er\030\006 \001(\0132-.org.jetbrains.kotlin.metadata" +
|
||||
".ValueParameter\022\024\n\014getter_flags\030\007 \001(\005\022\024\n" +
|
||||
"\014setter_flags\030\010 \001(\005\022\033\n\023version_requireme" +
|
||||
"nt\030\037 \003(\005*\006\010d\020\270\224\001\"\357\001\n\016ValueParameter\022\020\n\005f" +
|
||||
"lags\030\001 \001(\005:\0010\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0221\n\004typ" +
|
||||
"e\030\003 \001(\0132#.org.jetbrains.kotlin.metadata.",
|
||||
"Type\022\025\n\007type_id\030\005 \001(\005B\004\240\265\030\001\022@\n\023vararg_el" +
|
||||
"ement_type\030\004 \001(\0132#.org.jetbrains.kotlin." +
|
||||
"metadata.Type\022$\n\026vararg_element_type_id\030" +
|
||||
"\006 \001(\005B\004\240\265\030\001*\005\010d\020\310\001\"\226\003\n\tTypeAlias\022\020\n\005flag" +
|
||||
"s\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022D\n\016type_p" +
|
||||
"arameter\030\003 \003(\0132,.org.jetbrains.kotlin.me" +
|
||||
"tadata.TypeParameter\022<\n\017underlying_type\030" +
|
||||
"\004 \001(\0132#.org.jetbrains.kotlin.metadata.Ty" +
|
||||
"pe\022 \n\022underlying_type_id\030\005 \001(\005B\004\240\265\030\001\022:\n\r" +
|
||||
"expanded_type\030\006 \001(\0132#.org.jetbrains.kotl",
|
||||
"in.metadata.Type\022\036\n\020expanded_type_id\030\007 \001" +
|
||||
"(\005B\004\240\265\030\001\022=\n\nannotation\030\010 \003(\0132).org.jetbr" +
|
||||
"ains.kotlin.metadata.Annotation\022\033\n\023versi" +
|
||||
"on_requirement\030\037 \003(\005*\005\010d\020\310\001\"&\n\tEnumEntry" +
|
||||
"\022\022\n\004name\030\001 \001(\005B\004\210\265\030\001*\005\010d\020\310\001\"\225\003\n\022VersionR" +
|
||||
"equirement\022\017\n\007version\030\001 \001(\005\022\024\n\014version_f" +
|
||||
"ull\030\002 \001(\005\022M\n\005level\030\003 \001(\01627.org.jetbrains" +
|
||||
".kotlin.metadata.VersionRequirement.Leve" +
|
||||
"l:\005ERROR\022\022\n\nerror_code\030\004 \001(\005\022\025\n\007message\030" +
|
||||
"\005 \001(\005B\004\230\265\030\001\022e\n\014version_kind\030\006 \001(\0162=.org.",
|
||||
"jetbrains.kotlin.metadata.VersionRequire" +
|
||||
"ment.VersionKind:\020LANGUAGE_VERSION\"+\n\005Le" +
|
||||
"vel\022\013\n\007WARNING\020\000\022\t\n\005ERROR\020\001\022\n\n\006HIDDEN\020\002\"" +
|
||||
"J\n\013VersionKind\022\024\n\020LANGUAGE_VERSION\020\000\022\024\n\020" +
|
||||
"COMPILER_VERSION\020\001\022\017\n\013API_VERSION\020\002\"a\n\027V" +
|
||||
"ersionRequirementTable\022F\n\013requirement\030\001 " +
|
||||
"\003(\01321.org.jetbrains.kotlin.metadata.Vers" +
|
||||
"ionRequirement\"\217\002\n\017PackageFragment\022;\n\007st" +
|
||||
"rings\030\001 \001(\0132*.org.jetbrains.kotlin.metad" +
|
||||
"ata.StringTable\022J\n\017qualified_names\030\002 \001(\013",
|
||||
"21.org.jetbrains.kotlin.metadata.Qualifi" +
|
||||
"edNameTable\0227\n\007package\030\003 \001(\0132&.org.jetbr" +
|
||||
"ains.kotlin.metadata.Package\0223\n\005class\030\004 " +
|
||||
"\003(\0132$.org.jetbrains.kotlin.metadata.Clas" +
|
||||
"s*\005\010d\020\310\001\"A\n\010Contract\0225\n\006effect\030\001 \003(\0132%.o" +
|
||||
"rg.jetbrains.kotlin.metadata.Effect\"\306\003\n\006" +
|
||||
"Effect\022E\n\013effect_type\030\001 \001(\01620.org.jetbra" +
|
||||
"ins.kotlin.metadata.Effect.EffectType\022N\n" +
|
||||
"\033effect_constructor_argument\030\002 \003(\0132).org" +
|
||||
".jetbrains.kotlin.metadata.Expression\022S\n",
|
||||
" conclusion_of_conditional_effect\030\003 \001(\0132" +
|
||||
").org.jetbrains.kotlin.metadata.Expressi" +
|
||||
"on\022B\n\004kind\030\004 \001(\01624.org.jetbrains.kotlin." +
|
||||
"metadata.Effect.InvocationKind\"C\n\nEffect" +
|
||||
"Type\022\024\n\020RETURNS_CONSTANT\020\000\022\t\n\005CALLS\020\001\022\024\n" +
|
||||
"\020RETURNS_NOT_NULL\020\002\"G\n\016InvocationKind\022\020\n" +
|
||||
"\014AT_MOST_ONCE\020\000\022\020\n\014EXACTLY_ONCE\020\001\022\021\n\rAT_" +
|
||||
"LEAST_ONCE\020\002\"\245\003\n\nExpression\022\020\n\005flags\030\001 \001" +
|
||||
"(\005:\0010\022!\n\031value_parameter_reference\030\002 \001(\005" +
|
||||
"\022O\n\016constant_value\030\003 \001(\01627.org.jetbrains",
|
||||
".kotlin.metadata.Expression.ConstantValu" +
|
||||
"e\022=\n\020is_instance_type\030\004 \001(\0132#.org.jetbra" +
|
||||
"ins.kotlin.metadata.Type\022!\n\023is_instance_" +
|
||||
"type_id\030\005 \001(\005B\004\240\265\030\001\022?\n\014and_argument\030\006 \003(" +
|
||||
"\0132).org.jetbrains.kotlin.metadata.Expres" +
|
||||
"sion\022>\n\013or_argument\030\007 \003(\0132).org.jetbrain" +
|
||||
"s.kotlin.metadata.Expression\".\n\rConstant" +
|
||||
"Value\022\010\n\004TRUE\020\000\022\t\n\005FALSE\020\001\022\010\n\004NULL\020\002*9\n\010" +
|
||||
"Modality\022\t\n\005FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRAC" +
|
||||
"T\020\002\022\n\n\006SEALED\020\003*b\n\nVisibility\022\014\n\010INTERNA",
|
||||
"L\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLI" +
|
||||
"C\020\003\022\023\n\017PRIVATE_TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nM" +
|
||||
"emberKind\022\017\n\013DECLARATION\020\000\022\021\n\rFAKE_OVERR" +
|
||||
"IDE\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED\020\003B\017" +
|
||||
"B\rDebugProtoBuf"
|
||||
"e\030\020 \003(\005B\006\020\001\220\265\030\001\022<\n\ntype_table\030\036 \001(\0132(.or" +
|
||||
"g.jetbrains.kotlin.metadata.TypeTable\022\033\n" +
|
||||
"\023version_requirement\030\037 \003(\005\022Y\n\031version_re" +
|
||||
"quirement_table\030 \001(\01326.org.jetbrains.ko" +
|
||||
"tlin.metadata.VersionRequirementTable\"x\n" +
|
||||
"\004Kind\022\t\n\005CLASS\020\000\022\r\n\tINTERFACE\020\001\022\016\n\nENUM_",
|
||||
"CLASS\020\002\022\016\n\nENUM_ENTRY\020\003\022\024\n\020ANNOTATION_CL" +
|
||||
"ASS\020\004\022\n\n\006OBJECT\020\005\022\024\n\020COMPANION_OBJECT\020\006*" +
|
||||
"\006\010d\020\270\224\001\"\335\002\n\007Package\0229\n\010function\030\003 \003(\0132\'." +
|
||||
"org.jetbrains.kotlin.metadata.Function\0229" +
|
||||
"\n\010property\030\004 \003(\0132\'.org.jetbrains.kotlin." +
|
||||
"metadata.Property\022<\n\ntype_alias\030\005 \003(\0132(." +
|
||||
"org.jetbrains.kotlin.metadata.TypeAlias\022" +
|
||||
"<\n\ntype_table\030\036 \001(\0132(.org.jetbrains.kotl" +
|
||||
"in.metadata.TypeTable\022Y\n\031version_require" +
|
||||
"ment_table\030 \001(\01326.org.jetbrains.kotlin.",
|
||||
"metadata.VersionRequirementTable*\005\010d\020\310\001\"" +
|
||||
"`\n\tTypeTable\0221\n\004type\030\001 \003(\0132#.org.jetbrai" +
|
||||
"ns.kotlin.metadata.Type\022\032\n\016first_nullabl" +
|
||||
"e\030\002 \001(\005:\002-1:\004\240\273\030\001\"\214\001\n\013Constructor\022\020\n\005fla" +
|
||||
"gs\030\001 \001(\005:\0016\022F\n\017value_parameter\030\002 \003(\0132-.o" +
|
||||
"rg.jetbrains.kotlin.metadata.ValueParame" +
|
||||
"ter\022\033\n\023version_requirement\030\037 \003(\005*\006\010d\020\270\224\001" +
|
||||
"\"\246\004\n\010Function\022\020\n\005flags\030\t \001(\005:\0016\022\024\n\told_f" +
|
||||
"lags\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0228\n\013ret" +
|
||||
"urn_type\030\003 \001(\0132#.org.jetbrains.kotlin.me",
|
||||
"tadata.Type\022\034\n\016return_type_id\030\007 \001(\005B\004\240\265\030" +
|
||||
"\001\022D\n\016type_parameter\030\004 \003(\0132,.org.jetbrain" +
|
||||
"s.kotlin.metadata.TypeParameter\022:\n\rrecei" +
|
||||
"ver_type\030\005 \001(\0132#.org.jetbrains.kotlin.me" +
|
||||
"tadata.Type\022\036\n\020receiver_type_id\030\010 \001(\005B\004\240" +
|
||||
"\265\030\001\022F\n\017value_parameter\030\006 \003(\0132-.org.jetbr" +
|
||||
"ains.kotlin.metadata.ValueParameter\022<\n\nt" +
|
||||
"ype_table\030\036 \001(\0132(.org.jetbrains.kotlin.m" +
|
||||
"etadata.TypeTable\022\033\n\023version_requirement" +
|
||||
"\030\037 \003(\005\0229\n\010contract\030 \001(\0132\'.org.jetbrains",
|
||||
".kotlin.metadata.Contract*\006\010d\020\270\224\001\"\345\003\n\010Pr" +
|
||||
"operty\022\022\n\005flags\030\013 \001(\005:\003518\022\027\n\told_flags\030" +
|
||||
"\001 \001(\005:\0042054\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0228\n\013retur" +
|
||||
"n_type\030\003 \001(\0132#.org.jetbrains.kotlin.meta" +
|
||||
"data.Type\022\034\n\016return_type_id\030\t \001(\005B\004\240\265\030\001\022" +
|
||||
"D\n\016type_parameter\030\004 \003(\0132,.org.jetbrains." +
|
||||
"kotlin.metadata.TypeParameter\022:\n\rreceive" +
|
||||
"r_type\030\005 \001(\0132#.org.jetbrains.kotlin.meta" +
|
||||
"data.Type\022\036\n\020receiver_type_id\030\n \001(\005B\004\240\265\030" +
|
||||
"\001\022M\n\026setter_value_parameter\030\006 \001(\0132-.org.",
|
||||
"jetbrains.kotlin.metadata.ValueParameter" +
|
||||
"\022\024\n\014getter_flags\030\007 \001(\005\022\024\n\014setter_flags\030\010" +
|
||||
" \001(\005\022\033\n\023version_requirement\030\037 \003(\005*\006\010d\020\270\224" +
|
||||
"\001\"\357\001\n\016ValueParameter\022\020\n\005flags\030\001 \001(\005:\0010\022\022" +
|
||||
"\n\004name\030\002 \002(\005B\004\210\265\030\001\0221\n\004type\030\003 \001(\0132#.org.j" +
|
||||
"etbrains.kotlin.metadata.Type\022\025\n\007type_id" +
|
||||
"\030\005 \001(\005B\004\240\265\030\001\022@\n\023vararg_element_type\030\004 \001(" +
|
||||
"\0132#.org.jetbrains.kotlin.metadata.Type\022$" +
|
||||
"\n\026vararg_element_type_id\030\006 \001(\005B\004\240\265\030\001*\005\010d" +
|
||||
"\020\310\001\"\226\003\n\tTypeAlias\022\020\n\005flags\030\001 \001(\005:\0016\022\022\n\004n",
|
||||
"ame\030\002 \002(\005B\004\210\265\030\001\022D\n\016type_parameter\030\003 \003(\0132" +
|
||||
",.org.jetbrains.kotlin.metadata.TypePara" +
|
||||
"meter\022<\n\017underlying_type\030\004 \001(\0132#.org.jet" +
|
||||
"brains.kotlin.metadata.Type\022 \n\022underlyin" +
|
||||
"g_type_id\030\005 \001(\005B\004\240\265\030\001\022:\n\rexpanded_type\030\006" +
|
||||
" \001(\0132#.org.jetbrains.kotlin.metadata.Typ" +
|
||||
"e\022\036\n\020expanded_type_id\030\007 \001(\005B\004\240\265\030\001\022=\n\nann" +
|
||||
"otation\030\010 \003(\0132).org.jetbrains.kotlin.met" +
|
||||
"adata.Annotation\022\033\n\023version_requirement\030" +
|
||||
"\037 \003(\005*\005\010d\020\310\001\"&\n\tEnumEntry\022\022\n\004name\030\001 \001(\005B",
|
||||
"\004\210\265\030\001*\005\010d\020\310\001\"\225\003\n\022VersionRequirement\022\017\n\007v" +
|
||||
"ersion\030\001 \001(\005\022\024\n\014version_full\030\002 \001(\005\022M\n\005le" +
|
||||
"vel\030\003 \001(\01627.org.jetbrains.kotlin.metadat" +
|
||||
"a.VersionRequirement.Level:\005ERROR\022\022\n\nerr" +
|
||||
"or_code\030\004 \001(\005\022\025\n\007message\030\005 \001(\005B\004\230\265\030\001\022e\n\014" +
|
||||
"version_kind\030\006 \001(\0162=.org.jetbrains.kotli" +
|
||||
"n.metadata.VersionRequirement.VersionKin" +
|
||||
"d:\020LANGUAGE_VERSION\"+\n\005Level\022\013\n\007WARNING\020" +
|
||||
"\000\022\t\n\005ERROR\020\001\022\n\n\006HIDDEN\020\002\"J\n\013VersionKind\022" +
|
||||
"\024\n\020LANGUAGE_VERSION\020\000\022\024\n\020COMPILER_VERSIO",
|
||||
"N\020\001\022\017\n\013API_VERSION\020\002\"a\n\027VersionRequireme" +
|
||||
"ntTable\022F\n\013requirement\030\001 \003(\01321.org.jetbr" +
|
||||
"ains.kotlin.metadata.VersionRequirement\"" +
|
||||
"\217\002\n\017PackageFragment\022;\n\007strings\030\001 \001(\0132*.o" +
|
||||
"rg.jetbrains.kotlin.metadata.StringTable" +
|
||||
"\022J\n\017qualified_names\030\002 \001(\01321.org.jetbrain" +
|
||||
"s.kotlin.metadata.QualifiedNameTable\0227\n\007" +
|
||||
"package\030\003 \001(\0132&.org.jetbrains.kotlin.met" +
|
||||
"adata.Package\0223\n\005class\030\004 \003(\0132$.org.jetbr" +
|
||||
"ains.kotlin.metadata.Class*\005\010d\020\310\001\"A\n\010Con",
|
||||
"tract\0225\n\006effect\030\001 \003(\0132%.org.jetbrains.ko" +
|
||||
"tlin.metadata.Effect\"\306\003\n\006Effect\022E\n\013effec" +
|
||||
"t_type\030\001 \001(\01620.org.jetbrains.kotlin.meta" +
|
||||
"data.Effect.EffectType\022N\n\033effect_constru" +
|
||||
"ctor_argument\030\002 \003(\0132).org.jetbrains.kotl" +
|
||||
"in.metadata.Expression\022S\n conclusion_of_" +
|
||||
"conditional_effect\030\003 \001(\0132).org.jetbrains" +
|
||||
".kotlin.metadata.Expression\022B\n\004kind\030\004 \001(" +
|
||||
"\01624.org.jetbrains.kotlin.metadata.Effect" +
|
||||
".InvocationKind\"C\n\nEffectType\022\024\n\020RETURNS",
|
||||
"_CONSTANT\020\000\022\t\n\005CALLS\020\001\022\024\n\020RETURNS_NOT_NU" +
|
||||
"LL\020\002\"G\n\016InvocationKind\022\020\n\014AT_MOST_ONCE\020\000" +
|
||||
"\022\020\n\014EXACTLY_ONCE\020\001\022\021\n\rAT_LEAST_ONCE\020\002\"\245\003" +
|
||||
"\n\nExpression\022\020\n\005flags\030\001 \001(\005:\0010\022!\n\031value_" +
|
||||
"parameter_reference\030\002 \001(\005\022O\n\016constant_va" +
|
||||
"lue\030\003 \001(\01627.org.jetbrains.kotlin.metadat" +
|
||||
"a.Expression.ConstantValue\022=\n\020is_instanc" +
|
||||
"e_type\030\004 \001(\0132#.org.jetbrains.kotlin.meta" +
|
||||
"data.Type\022!\n\023is_instance_type_id\030\005 \001(\005B\004" +
|
||||
"\240\265\030\001\022?\n\014and_argument\030\006 \003(\0132).org.jetbrai",
|
||||
"ns.kotlin.metadata.Expression\022>\n\013or_argu" +
|
||||
"ment\030\007 \003(\0132).org.jetbrains.kotlin.metada" +
|
||||
"ta.Expression\".\n\rConstantValue\022\010\n\004TRUE\020\000" +
|
||||
"\022\t\n\005FALSE\020\001\022\010\n\004NULL\020\002*9\n\010Modality\022\t\n\005FIN" +
|
||||
"AL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRACT\020\002\022\n\n\006SEALED\020\003" +
|
||||
"*b\n\nVisibility\022\014\n\010INTERNAL\020\000\022\013\n\007PRIVATE\020" +
|
||||
"\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLIC\020\003\022\023\n\017PRIVATE_" +
|
||||
"TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nMemberKind\022\017\n\013DE" +
|
||||
"CLARATION\020\000\022\021\n\rFAKE_OVERRIDE\020\001\022\016\n\nDELEGA" +
|
||||
"TION\020\002\022\017\n\013SYNTHESIZED\020\003B\017B\rDebugProtoBuf"
|
||||
};
|
||||
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
|
||||
@@ -34949,7 +34587,7 @@ public final class DebugProtoBuf {
|
||||
internal_static_org_jetbrains_kotlin_metadata_Class_fieldAccessorTable = new
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_org_jetbrains_kotlin_metadata_Class_descriptor,
|
||||
new java.lang.String[] { "Flags", "FqName", "CompanionObjectName", "TypeParameter", "Supertype", "SupertypeId", "NestedClassName", "Constructor", "Function", "Property", "TypeAlias", "EnumEntry", "SealedSubclassFqName", "InlineClassUnderlyingPropertyName", "InlineClassUnderlyingType", "InlineClassUnderlyingTypeId", "TypeTable", "VersionRequirement", "VersionRequirementTable", });
|
||||
new java.lang.String[] { "Flags", "FqName", "CompanionObjectName", "TypeParameter", "Supertype", "SupertypeId", "NestedClassName", "Constructor", "Function", "Property", "TypeAlias", "EnumEntry", "SealedSubclassFqName", "TypeTable", "VersionRequirement", "VersionRequirementTable", });
|
||||
internal_static_org_jetbrains_kotlin_metadata_Package_descriptor =
|
||||
getDescriptor().getMessageTypes().get(6);
|
||||
internal_static_org_jetbrains_kotlin_metadata_Package_fieldAccessorTable = new
|
||||
@@ -35058,8 +34696,6 @@ public final class DebugProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipMessageInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);
|
||||
|
||||
@@ -52,7 +52,6 @@ pill {
|
||||
excludedDirs(
|
||||
"out",
|
||||
"buildSrc/build",
|
||||
"buildSrc/prepare-deps/android-dx/build",
|
||||
"buildSrc/prepare-deps/intellij-sdk/build"
|
||||
)
|
||||
}
|
||||
@@ -131,6 +130,7 @@ extra["JDK_18"] = jdkPath("1.8")
|
||||
extra["JDK_9"] = jdkPath("9")
|
||||
extra["JDK_10"] = jdkPath("10")
|
||||
extra["JDK_11"] = jdkPath("11")
|
||||
extra["JDK_15"] = jdkPath("15")
|
||||
|
||||
// allow opening the project without setting up all env variables (see KT-26413)
|
||||
if (!kotlinBuildProperties.isInIdeaSync) {
|
||||
@@ -178,7 +178,7 @@ extra["versions.jflex"] = "1.7.0"
|
||||
extra["versions.markdown"] = "0.1.25"
|
||||
extra["versions.trove4j"] = "1.0.20181211"
|
||||
extra["versions.completion-ranking-kotlin"] = "0.1.3"
|
||||
extra["versions.r8"] = "2.1.75"
|
||||
extra["versions.r8"] = "2.0.88"
|
||||
val immutablesVersion = "0.3.1"
|
||||
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
|
||||
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
|
||||
@@ -187,7 +187,7 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
|
||||
extra["versions.ktor-network"] = "1.0.1"
|
||||
|
||||
if (!project.hasProperty("versions.kotlin-native")) {
|
||||
extra["versions.kotlin-native"] = "1.5-rc1-41"
|
||||
extra["versions.kotlin-native"] = "1.5-dev-17775"
|
||||
}
|
||||
|
||||
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
|
||||
@@ -326,11 +326,6 @@ extra["tasksWithWarnings"] = listOf(
|
||||
":kotlin-stdlib-jdk7:compileTestKotlin",
|
||||
":kotlin-stdlib-jdk8:compileTestKotlin",
|
||||
":compiler:cli:compileKotlin",
|
||||
":compiler:frontend:compileKotlin",
|
||||
":compiler:fir:tree:compileKotlin",
|
||||
":compiler:fir:resolve:compileKotlin",
|
||||
":compiler:fir:checkers:compileKotlin",
|
||||
":compiler:fir:java:compileKotlin",
|
||||
":kotlin-scripting-compiler:compileKotlin",
|
||||
":plugins:uast-kotlin:compileKotlin",
|
||||
":plugins:uast-kotlin:compileTestKotlin",
|
||||
@@ -424,19 +419,14 @@ allprojects {
|
||||
repositories {
|
||||
kotlinBuildLocalRepo(project)
|
||||
mirrorRepo?.let(::maven)
|
||||
|
||||
internalBootstrapRepo?.let(::maven)
|
||||
bootstrapKotlinRepo?.let(::maven)
|
||||
maven(protobufRepo)
|
||||
|
||||
maven(intellijRepo)
|
||||
|
||||
mavenCentral()
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
maven("https://dl.google.com/dl/android/maven2")
|
||||
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
|
||||
|
||||
jcenter()
|
||||
maven(protobufRepo)
|
||||
maven(intellijRepo)
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies")
|
||||
maven("https://dl.google.com/dl/android/maven2")
|
||||
bootstrapKotlinRepo?.let(::maven)
|
||||
internalBootstrapRepo?.let(::maven)
|
||||
}
|
||||
|
||||
configureJvmProject(javaHome!!, jvmTarget!!)
|
||||
@@ -737,12 +727,10 @@ tasks {
|
||||
register("scriptingTest") {
|
||||
dependsOn("dist")
|
||||
dependsOn(":kotlin-script-util:test")
|
||||
dependsOn(":kotlin-scripting-compiler:test")
|
||||
dependsOn(":kotlin-scripting-compiler:testWithIr")
|
||||
dependsOn(":kotlin-scripting-compiler-embeddable:test")
|
||||
dependsOn(":kotlin-scripting-common:test")
|
||||
dependsOn(":kotlin-scripting-jvm:test")
|
||||
dependsOn(":kotlin-scripting-jvm-host-test:test")
|
||||
dependsOn(":kotlin-scripting-jvm-host-test:testWithIr")
|
||||
dependsOn(":kotlin-scripting-dependencies:test")
|
||||
dependsOn(":kotlin-scripting-dependencies-maven:test")
|
||||
dependsOn(":kotlin-scripting-jsr223-test:test")
|
||||
@@ -750,7 +738,6 @@ tasks {
|
||||
// dependsOn(":kotlin-scripting-jvm-host-test:embeddableTest")
|
||||
dependsOn(":kotlin-scripting-jsr223-test:embeddableTest")
|
||||
dependsOn(":kotlin-main-kts-test:test")
|
||||
dependsOn(":kotlin-main-kts-test:testWithIr")
|
||||
dependsOn(":kotlin-scripting-ide-services-test:test")
|
||||
dependsOn(":kotlin-scripting-ide-services-test:embeddableTest")
|
||||
dependsOn(":kotlin-scripting-js-test:test")
|
||||
@@ -764,6 +751,7 @@ tasks {
|
||||
|
||||
register("miscCompilerTest") {
|
||||
dependsOn("nativeCompilerTest")
|
||||
dependsOn("firCompilerTest")
|
||||
|
||||
dependsOn(":kotlin-daemon-tests:test")
|
||||
dependsOn("scriptingTest")
|
||||
|
||||
@@ -81,13 +81,11 @@ extra["intellijReleaseType"] = when {
|
||||
else -> "releases"
|
||||
}
|
||||
|
||||
extra["versions.androidDxSources"] = "5.0.0_r2"
|
||||
|
||||
extra["customDepsOrg"] = "kotlin.build"
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
|
||||
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
gradlePluginPortal()
|
||||
|
||||
|
||||
@@ -65,11 +65,28 @@ repositories {
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
|
||||
ivy {
|
||||
url = URI("https://dl.bintray.com/kotlin/as/")
|
||||
|
||||
patternLayout {
|
||||
artifact("[artifact]-[revision]-$androidStudioOs.[ext]")
|
||||
}
|
||||
|
||||
credentials {
|
||||
username = System.getenv("AS_BINTRAY_USER_NAME") ?: findProperty("bintray.user") as String?
|
||||
password = System.getenv("AS_BINTRAY_API_KEY") ?: findProperty("bintray.apikey") as String?
|
||||
}
|
||||
|
||||
metadataSources {
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
maven("https://www.jetbrains.com/intellij-repository/$intellijReleaseType")
|
||||
maven("https://plugins.jetbrains.com/maven")
|
||||
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
|
||||
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
|
||||
}
|
||||
|
||||
val intellij by configurations.creating
|
||||
|
||||
@@ -19,4 +19,4 @@ val KotlinBuildProperties.jarCompression: Boolean get() = getBoolean("kotlin.bui
|
||||
|
||||
val KotlinBuildProperties.ignoreTestFailures: Boolean get() = getBoolean("ignoreTestFailures", isTeamcityBuild)
|
||||
|
||||
val KotlinBuildProperties.disableWerror: Boolean get() = getBoolean("kotlin.build.disable.werror", isTeamcityBuild)
|
||||
val KotlinBuildProperties.disableWerror: Boolean get() = getBoolean("kotlin.build.disable.werror", false)
|
||||
|
||||
@@ -25,7 +25,6 @@ val packagesToRelocate =
|
||||
"org.fusesource",
|
||||
"net.jpountz",
|
||||
"one.util.streamex",
|
||||
"it.unimi.dsi.fastutil",
|
||||
"kotlinx.collections.immutable"
|
||||
)
|
||||
|
||||
|
||||
@@ -10,12 +10,12 @@ import net.rubygrapefruit.platform.WindowsRegistry.Key.HKEY_LOCAL_MACHINE
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
enum class JdkMajorVersion(private val mandatory: Boolean = true) {
|
||||
JDK_16, JDK_17, JDK_18, JDK_9, JDK_10(false), JDK_11(false);
|
||||
JDK_16, JDK_17, JDK_18, JDK_9, JDK_10(false), JDK_11(false), /*15.0*/JDK_15(false);
|
||||
|
||||
fun isMandatory(): Boolean = mandatory
|
||||
}
|
||||
|
||||
val jdkAlternativeVarNames = mapOf(JdkMajorVersion.JDK_9 to listOf("JDK_19"))
|
||||
val jdkAlternativeVarNames = mapOf(JdkMajorVersion.JDK_9 to listOf("JDK_19"), JdkMajorVersion.JDK_15 to listOf("JDK_15_0"))
|
||||
|
||||
data class JdkId(val explicit: Boolean, val majorVersion: JdkMajorVersion, var version: String, var homeDir: File)
|
||||
|
||||
|
||||
@@ -76,8 +76,6 @@ fun Project.jpsStandalone() = "kotlin.build:jps-standalone:${rootProject.extra["
|
||||
|
||||
fun Project.nodeJSPlugin() = "kotlin.build:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}"
|
||||
|
||||
fun Project.androidDxJar() = "org.jetbrains.kotlin:android-dx:${rootProject.extra["versions.androidBuildTools"]}"
|
||||
|
||||
fun Project.jpsBuildTest() = "com.jetbrains.intellij.idea:jps-build-test:${rootProject.extra["versions.intellijSdk"]}"
|
||||
|
||||
fun Project.kotlinxCollectionsImmutable() = "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:${rootProject.extra["versions.kotlinx-collections-immutable"]}"
|
||||
|
||||
@@ -41,7 +41,7 @@ open class DexMethodCount : DefaultTask() {
|
||||
dependsOn(jar)
|
||||
}
|
||||
|
||||
@Internal // plain output properties are not supported, mark as internal to suppress warning from validatePlugins
|
||||
@Internal // plain output properties are not supported, mark as internal to suppress warning from validateTaskProperties
|
||||
lateinit var counts: Counts
|
||||
|
||||
@get:OutputFile
|
||||
|
||||
@@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.1'
|
||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
||||
}
|
||||
}
|
||||
apply plugin: 'com.android.application'
|
||||
@@ -37,14 +37,6 @@ android {
|
||||
|
||||
packagingOptions { exclude 'META-INF/build.txt' }
|
||||
|
||||
//TODO run under java 6, cause there is error on implicit 'stream' import in 'asWithMutable' test
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
incremental = false
|
||||
}
|
||||
|
||||
dexOptions {
|
||||
dexInProcess false
|
||||
@@ -81,11 +73,19 @@ android {
|
||||
dimension "box"
|
||||
}
|
||||
|
||||
jvm80 {
|
||||
common_ir0 {
|
||||
dimension "box"
|
||||
}
|
||||
|
||||
reflectjvm80 {
|
||||
common_ir1 {
|
||||
dimension "box"
|
||||
}
|
||||
|
||||
common_ir2 {
|
||||
dimension "box"
|
||||
}
|
||||
|
||||
reflect_ir0 {
|
||||
dimension "box"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.android.tests;
|
||||
|
||||
import org.jetbrains.kotlin.jps.build.BaseKotlinJpsBuildTestCase;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@Ignore
|
||||
public class AndroidJpsBuildTestCase extends BaseKotlinJpsBuildTestCase {
|
||||
private static final String PROJECT_NAME = "android-module";
|
||||
private static final String SDK_NAME = "Android_SDK";
|
||||
|
||||
private final File workDir = new File(AndroidRunner.getPathManager().getTmpFolder());
|
||||
|
||||
public void doTest() {
|
||||
initProject();
|
||||
rebuildAllModules();
|
||||
buildAllModules().assertSuccessful();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getProjectName() {
|
||||
return "android-module";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runTest() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AndroidJpsTest";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File doGetProjectDir() throws IOException {
|
||||
return workDir;
|
||||
}
|
||||
|
||||
private void initProject() {
|
||||
addJdk(SDK_NAME, AndroidRunner.getPathManager().getPlatformFolderInAndroidSdk() + "/android.jar");
|
||||
loadProject(workDir.getAbsolutePath() + File.separator + PROJECT_NAME + ".ipr");
|
||||
}
|
||||
}
|
||||
@@ -46,12 +46,8 @@ public class AndroidRunner {
|
||||
|
||||
CodegenTestsOnAndroidGenerator.generate(pathManager);
|
||||
|
||||
System.out.println("Run tests on android...");
|
||||
TestSuite suite = CodegenTestsOnAndroidRunner.runTestsInEmulator(pathManager);
|
||||
//AndroidJpsBuildTestCase indirectly depends on UsefulTestCase which compiled against java 8
|
||||
//TODO: Need add separate run configuration for AndroidJpsBuildTestCase
|
||||
//suite.addTest(new AndroidJpsBuildTestCase());
|
||||
return suite;
|
||||
System.out.println("Run tests on Android...");
|
||||
return CodegenTestsOnAndroidRunner.runTestsInEmulator(pathManager);
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.intellij.openapi.util.io.FileUtilRt
|
||||
import org.jetbrains.kotlin.cli.common.output.writeAllTo
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.codegen.CodegenTestCase
|
||||
import org.jetbrains.kotlin.codegen.CodegenTestFiles
|
||||
import org.jetbrains.kotlin.codegen.GenerationUtils
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
@@ -22,8 +21,6 @@ import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.*
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives
|
||||
import org.jetbrains.kotlin.test.directives.model.singleOrZeroValue
|
||||
import org.jetbrains.kotlin.test.model.DependencyKind
|
||||
import org.jetbrains.kotlin.test.model.FrontendKinds
|
||||
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest
|
||||
@@ -57,17 +54,18 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
//keep it globally to avoid test grouping on TC
|
||||
private val generatedTestNames = hashSetOf<String>()
|
||||
|
||||
private val COMMON = FlavorConfig("common", 3);
|
||||
private val REFLECT = FlavorConfig("reflect", 1);
|
||||
private val JVM8 = FlavorConfig("jvm8", 1);
|
||||
private val JVM8REFLECT = FlavorConfig("reflectjvm8", 1);
|
||||
private val COMMON = FlavorConfig(TargetBackend.ANDROID,"common", 3)
|
||||
private val REFLECT = FlavorConfig(TargetBackend.ANDROID, "reflect", 1)
|
||||
|
||||
class FlavorConfig(private val prefix: String, val limit: Int) {
|
||||
private val COMMON_IR = FlavorConfig(TargetBackend.ANDROID_IR, "common_ir", 3)
|
||||
private val REFLECT_IR = FlavorConfig(TargetBackend.ANDROID_IR,"reflect_ir", 1)
|
||||
|
||||
class FlavorConfig(private val backend: TargetBackend, private val prefix: String, val limit: Int) {
|
||||
|
||||
private var writtenFilesCount = 0
|
||||
|
||||
fun printStatistics() {
|
||||
println("FlavorTestCompiler: $prefix, generated file count: $writtenFilesCount")
|
||||
println("FlavorTestCompiler for $backend: $prefix, generated file count: $writtenFilesCount")
|
||||
}
|
||||
|
||||
fun getFlavorForNewFiles(newFilesCount: Int): String {
|
||||
@@ -113,7 +111,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
it.setExecutable(true)
|
||||
}
|
||||
}
|
||||
File("./gradlew.bat").copyTo(File(projectRoot, "gradlew.bat"));
|
||||
File("./gradlew.bat").copyTo(File(projectRoot, "gradlew.bat"))
|
||||
val file = File(target, "gradle-wrapper.properties")
|
||||
file.readLines().map {
|
||||
when {
|
||||
@@ -150,27 +148,47 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
private fun generateTestsAndFlavourSuites() {
|
||||
println("Generating test files...")
|
||||
|
||||
generateTestMethodsForDirectories(File("compiler/testData/codegen/box"), File("compiler/testData/codegen/boxInline"))
|
||||
val folders = arrayOf(
|
||||
File("compiler/testData/codegen/box"),
|
||||
File("compiler/testData/codegen/boxInline")
|
||||
)
|
||||
|
||||
generateTestMethodsForDirectories(
|
||||
TargetBackend.ANDROID,
|
||||
COMMON,
|
||||
REFLECT,
|
||||
*folders
|
||||
)
|
||||
|
||||
generateTestMethodsForDirectories(
|
||||
TargetBackend.ANDROID_IR,
|
||||
COMMON_IR,
|
||||
REFLECT_IR,
|
||||
*folders
|
||||
)
|
||||
|
||||
pendingUnitTestGenerators.values.forEach { it.generate() }
|
||||
}
|
||||
|
||||
private fun generateTestMethodsForDirectories(vararg dirs: File) {
|
||||
private fun generateTestMethodsForDirectories(
|
||||
backend: TargetBackend,
|
||||
commonFlavor: FlavorConfig,
|
||||
reflectionFlavor: FlavorConfig,
|
||||
vararg dirs: File
|
||||
) {
|
||||
val holders = mutableMapOf<ConfigurationKey, FilesWriter>()
|
||||
|
||||
for (dir in dirs) {
|
||||
val files = dir.listFiles() ?: error("Folder with testData is empty: ${dir.absolutePath}")
|
||||
processFiles(files, holders)
|
||||
processFiles(files, holders, backend, commonFlavor, reflectionFlavor)
|
||||
}
|
||||
|
||||
holders.values.forEach {
|
||||
it.writeFilesOnDisk()
|
||||
}
|
||||
|
||||
COMMON.printStatistics()
|
||||
REFLECT.printStatistics()
|
||||
JVM8.printStatistics()
|
||||
JVM8REFLECT.printStatistics()
|
||||
commonFlavor.printStatistics()
|
||||
reflectionFlavor.printStatistics()
|
||||
}
|
||||
|
||||
internal inner class FilesWriter(
|
||||
@@ -258,7 +276,10 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
@Throws(IOException::class)
|
||||
private fun processFiles(
|
||||
files: Array<File>,
|
||||
holders: MutableMap<ConfigurationKey, FilesWriter>
|
||||
holders: MutableMap<ConfigurationKey, FilesWriter>,
|
||||
backend: TargetBackend,
|
||||
commmonFlavor: FlavorConfig,
|
||||
reflectionFlavor: FlavorConfig
|
||||
) {
|
||||
holders.values.forEach {
|
||||
it.writeFilesOnDiskIfNeeded()
|
||||
@@ -268,7 +289,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
if (file.isDirectory) {
|
||||
val listFiles = file.listFiles()
|
||||
if (listFiles != null) {
|
||||
processFiles(listFiles, holders)
|
||||
processFiles(listFiles, holders, backend, commmonFlavor, reflectionFlavor)
|
||||
}
|
||||
} else if (FileUtilRt.getExtension(file.name) != KotlinFileType.EXTENSION) {
|
||||
// skip non kotlin files
|
||||
@@ -277,7 +298,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
continue
|
||||
}
|
||||
|
||||
if (!InTextDirectivesUtils.isPassingTarget(TargetBackend.JVM, file) ||
|
||||
if (!InTextDirectivesUtils.isPassingTarget(backend.compatibleWith, file) ||
|
||||
InTextDirectivesUtils.isIgnoredTarget(TargetBackend.ANDROID, file)
|
||||
) {
|
||||
continue
|
||||
@@ -296,18 +317,19 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
if (fullFileText.contains("// ASSERTIONS_MODE: jvm")) continue
|
||||
if (fullFileText.contains("// MODULE: ")) continue
|
||||
val targets = InTextDirectivesUtils.findLinesWithPrefixesRemoved(fullFileText, "// JVM_TARGET:")
|
||||
.also { it.remove(JvmTarget.JVM_1_6.description) }
|
||||
|
||||
val isJvm8Target =
|
||||
if (targets.isEmpty()) false
|
||||
else if (targets.contains(JvmTarget.JVM_1_8.description) && targets.size == 1) true
|
||||
else continue //TODO: support other targets on Android
|
||||
val isAtLeastJvm8Target = !targets.contains(JvmTarget.JVM_1_6.description)
|
||||
|
||||
if (isAtLeastJvm8Target && fullFileText.contains("@Target(AnnotationTarget.TYPE)")) {
|
||||
//TODO: type annotations supported on sdk 26 emulator
|
||||
continue
|
||||
}
|
||||
|
||||
// TODO: support SKIP_JDK6 on new platforms
|
||||
if (fullFileText.contains("// SKIP_JDK6")) continue
|
||||
|
||||
if (hasBoxMethod(fullFileText)) {
|
||||
val testConfiguration = createTestConfiguration(file)
|
||||
val testConfiguration = createTestConfiguration(file, backend)
|
||||
val services = testConfiguration.testServices
|
||||
|
||||
val moduleStructure = try {
|
||||
@@ -338,9 +360,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
keyConfiguration.languageVersionSettings = module.languageVersionSettings
|
||||
|
||||
val key = ConfigurationKey(kind, jdkKind, keyConfiguration.toString())
|
||||
val compiler = if (isJvm8Target) {
|
||||
if (kind.withReflection) JVM8REFLECT else JVM8
|
||||
} else if (kind.withReflection) REFLECT else COMMON
|
||||
val compiler = if (kind.withReflection) reflectionFlavor else commmonFlavor
|
||||
val compilerConfigurationProvider = services.compilerConfigurationProvider as CompilerConfigurationProviderImpl
|
||||
val filesHolder = holders.getOrPut(key) {
|
||||
FilesWriter(compiler, compilerConfigurationProvider.createCompilerConfiguration(module)).also {
|
||||
@@ -354,9 +374,9 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
}
|
||||
}
|
||||
|
||||
private fun createTestConfiguration(testDataFile: File): TestConfiguration {
|
||||
private fun createTestConfiguration(testDataFile: File, backend: TargetBackend): TestConfiguration {
|
||||
return TestConfigurationBuilder().apply {
|
||||
testConfiguration()
|
||||
configure(backend)
|
||||
testInfo = KotlinTestInfo(
|
||||
"org.jetbrains.kotlin.android.tests.AndroidRunner",
|
||||
"test${testDataFile.nameWithoutExtension.capitalize()}",
|
||||
@@ -365,10 +385,10 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
}.build(testDataFile.path)
|
||||
}
|
||||
|
||||
private val testConfiguration: TestConfigurationBuilder.() -> Unit = {
|
||||
private fun TestConfigurationBuilder.configure(backend: TargetBackend) {
|
||||
globalDefaults {
|
||||
frontend = FrontendKinds.ClassicFrontend
|
||||
targetBackend = TargetBackend.ANDROID
|
||||
targetBackend = backend
|
||||
targetPlatform = JvmPlatforms.defaultJvmPlatform
|
||||
dependencyKind = DependencyKind.Binary
|
||||
}
|
||||
@@ -391,9 +411,6 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
useDirectives(*AbstractKotlinCompilerTest.defaultDirectiveContainers.toTypedArray())
|
||||
}
|
||||
|
||||
private fun createTestFiles(file: File, expectedText: String): List<KotlinBaseTest.TestFile> =
|
||||
CodegenTestCase.createTestFilesFromFile(file, expectedText, false, TargetBackend.JVM)
|
||||
|
||||
companion object {
|
||||
const val GRADLE_VERSION = "6.8.1" // update GRADLE_SHA_256 on change
|
||||
const val GRADLE_SHA_256 = "fd591a34af7385730970399f473afabdb8b28d57fd97d6625c388d090039d6fd"
|
||||
|
||||
@@ -71,15 +71,20 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
|
||||
return rootSuite
|
||||
}
|
||||
|
||||
private fun processReport(suite: TestSuite, resultOutput: String) {
|
||||
private fun processReport(rootSuite: TestSuite, resultOutput: String) {
|
||||
val reportFolder = File(flavorFolder())
|
||||
try {
|
||||
val folders = reportFolder.listFiles()
|
||||
assertTrue(folders != null && folders.isNotEmpty(), "No folders in ${reportFolder.path}")
|
||||
|
||||
folders.forEach {
|
||||
assertTrue("${it.path} is not directory") { it.isDirectory }
|
||||
val isIr = it.name.contains("_ir")
|
||||
val testCases = parseSingleReportInFolder(it)
|
||||
testCases.forEach { aCase -> suite.addTest(aCase) }
|
||||
testCases.forEach { aCase ->
|
||||
if (isIr) aCase.name += "_ir"
|
||||
rootSuite.addTest(aCase)
|
||||
}
|
||||
Assert.assertNotEquals("There is no test results in report", 0, testCases.size.toLong())
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
@@ -87,10 +92,6 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
|
||||
}
|
||||
}
|
||||
|
||||
private fun renameFlavorFolder() {
|
||||
val reportFolder = File(flavorFolder())
|
||||
reportFolder.renameTo(File(reportFolder.parentFile, reportFolder.name + "_d8"))
|
||||
}
|
||||
|
||||
private fun flavorFolder() = pathManager.tmpFolder + "/build/test/results/connected/flavors"
|
||||
|
||||
@@ -119,7 +120,7 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
|
||||
|
||||
private fun cleanAndBuildProject(gradleRunner: GradleRunner) {
|
||||
gradleRunner.clean()
|
||||
gradleRunner.build()
|
||||
gradleRunner.assembleAndroidTest()
|
||||
}
|
||||
|
||||
@Throws(IOException::class, SAXException::class, ParserConfigurationException::class)
|
||||
@@ -138,21 +139,14 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
|
||||
|
||||
return (0 until testCases.length).map { i ->
|
||||
val item = testCases.item(i) as Element
|
||||
val failure = item.getElementsByTagName("failure")
|
||||
val failure = item.getElementsByTagName("failure").takeIf { it.length != 0 }?.item(0)
|
||||
val name = item.getAttribute("name")
|
||||
|
||||
if (failure.length == 0) {
|
||||
object : TestCase(name) {
|
||||
@Throws(Throwable::class)
|
||||
override fun runTest() {
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
object : TestCase(name) {
|
||||
@Throws(Throwable::class)
|
||||
override fun runTest() {
|
||||
Assert.fail(failure.item(0).textContent)
|
||||
object : TestCase(name) {
|
||||
@Throws(Throwable::class)
|
||||
override fun runTest() {
|
||||
if (failure != null) {
|
||||
Assert.fail(failure.textContent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ public class GradleRunner {
|
||||
OutputUtils.checkResult(result);
|
||||
}
|
||||
|
||||
public void build() {
|
||||
public void assembleAndroidTest() {
|
||||
System.out.println("Building gradle project...");
|
||||
GeneralCommandLine build = generateCommandLine("build");
|
||||
GeneralCommandLine build = generateCommandLine("assembleAndroidTest");
|
||||
build.addParameter("--stacktrace");
|
||||
build.addParameter("--warn");
|
||||
RunResult result = RunUtils.execute(build);
|
||||
|
||||
@@ -116,12 +116,6 @@ object AbstractTypeMapper {
|
||||
return asmType
|
||||
}
|
||||
|
||||
typeConstructor.isScript() -> {
|
||||
val asmType = AsmTypes.JAVA_CLASS_TYPE
|
||||
with(context) { sw?.writeGenericType(type, asmType, mode) }
|
||||
return asmType
|
||||
}
|
||||
|
||||
typeConstructor.isTypeParameter() -> {
|
||||
val typeParameter = typeConstructor as TypeParameterMarker
|
||||
return mapType(context, typeParameter.representativeUpperBound(), mode, null).also { asmType ->
|
||||
|
||||
@@ -50,7 +50,7 @@ class AccessorForFunctionDescriptor(
|
||||
if (calleeDescriptor.getUserData(INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION) != null) {
|
||||
userDataMap = LinkedHashMap<CallableDescriptor.UserDataKey<*>, Any>()
|
||||
userDataMap[INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION] =
|
||||
calleeDescriptor.getUserData(INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION)
|
||||
calleeDescriptor.getUserData(INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,11 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.resolve.calls.components.hasDefaultValue
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.overriddenTreeUniqueAsSequence
|
||||
import org.jetbrains.kotlin.utils.DFS
|
||||
import org.jetbrains.kotlin.utils.mapToIndex
|
||||
|
||||
class ArgumentAndDeclIndex(val arg: ResolvedValueArgument, val declIndex: Int)
|
||||
@@ -68,8 +70,12 @@ abstract class ArgumentGenerator {
|
||||
generateExpression(declIndex, argument)
|
||||
}
|
||||
is DefaultValueArgument -> {
|
||||
defaultArgs.mark(declIndex)
|
||||
generateDefault(declIndex, argument)
|
||||
if (calleeDescriptor?.defaultValueFromJava(declIndex) == true) {
|
||||
generateDefaultJava(declIndex, argument)
|
||||
} else {
|
||||
defaultArgs.mark(declIndex)
|
||||
generateDefault(declIndex, argument)
|
||||
}
|
||||
}
|
||||
is VarargValueArgument -> {
|
||||
generateVararg(declIndex, argument)
|
||||
@@ -97,6 +103,10 @@ abstract class ArgumentGenerator {
|
||||
throw UnsupportedOperationException("Unsupported vararg value argument #$i: $argument")
|
||||
}
|
||||
|
||||
protected open fun generateDefaultJava(i: Int, argument: DefaultValueArgument) {
|
||||
throw UnsupportedOperationException("Unsupported default java argument #$i: $argument")
|
||||
}
|
||||
|
||||
protected open fun generateOther(i: Int, argument: ResolvedValueArgument) {
|
||||
throw UnsupportedOperationException("Unsupported value argument #$i: $argument")
|
||||
}
|
||||
@@ -106,6 +116,28 @@ abstract class ArgumentGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
private fun CallableDescriptor.defaultValueFromJava(index: Int): Boolean = DFS.ifAny(
|
||||
listOf(this),
|
||||
{ current -> current.original.overriddenDescriptors.map { it.original } },
|
||||
{ descriptor ->
|
||||
descriptor.original.overriddenDescriptors.isEmpty() &&
|
||||
descriptor is JavaCallableMemberDescriptor &&
|
||||
descriptor.valueParameters[index].declaresDefaultValue()
|
||||
}
|
||||
)
|
||||
|
||||
fun shouldInvokeDefaultArgumentsStub(resolvedCall: ResolvedCall<*>): Boolean {
|
||||
val descriptor = resolvedCall.resultingDescriptor
|
||||
val valueArgumentsByIndex = resolvedCall.valueArgumentsByIndex ?: return false
|
||||
for (index in valueArgumentsByIndex.indices) {
|
||||
val resolvedValueArgument = valueArgumentsByIndex[index]
|
||||
if (resolvedValueArgument is DefaultValueArgument && !descriptor.defaultValueFromJava(index)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun getFunctionWithDefaultArguments(functionDescriptor: FunctionDescriptor): FunctionDescriptor {
|
||||
if (functionDescriptor.containingDeclaration !is ClassDescriptor) return functionDescriptor
|
||||
if (functionDescriptor.overriddenDescriptors.isEmpty()) return functionDescriptor
|
||||
@@ -123,4 +155,4 @@ fun getFunctionWithDefaultArguments(functionDescriptor: FunctionDescriptor): Fun
|
||||
function.valueParameters.any { valueParameter -> valueParameter.hasDefaultValue() }
|
||||
}
|
||||
?: functionDescriptor
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,7 @@ interface BaseExpressionCodegen {
|
||||
|
||||
fun consumeReifiedOperationMarker(typeParameter: TypeParameterMarker)
|
||||
|
||||
@JvmDefault
|
||||
fun putReifiedOperationMarkerIfTypeIsReifiedParameter(type: KotlinTypeMarker, operationKind: OperationKind) {
|
||||
with(typeSystem) {
|
||||
val (typeParameter, second) = extractReificationArgument(type) ?: return
|
||||
|
||||
@@ -72,6 +72,12 @@ class CallBasedArgumentGenerator(
|
||||
callGenerator.putValueIfNeeded(getJvmKotlinType(i), lazyVararg, ValueKind.GENERAL_VARARG, i)
|
||||
}
|
||||
|
||||
override fun generateDefaultJava(i: Int, argument: DefaultValueArgument) {
|
||||
val argumentValue = valueParameters[i].findJavaDefaultArgumentValue(valueParameterTypes[i], codegen.typeMapper)
|
||||
|
||||
callGenerator.putValueIfNeeded(getJvmKotlinType(i), argumentValue)
|
||||
}
|
||||
|
||||
override fun reorderArgumentsIfNeeded(args: List<ArgumentAndDeclIndex>) {
|
||||
callGenerator.reorderArgumentsIfNeeded(args, valueParameterTypes)
|
||||
}
|
||||
|
||||
@@ -232,7 +232,9 @@ public class DescriptorAsmUtil {
|
||||
int flags = getVisibilityAccessFlag(functionDescriptor, kind);
|
||||
flags |= getVarargsFlag(functionDescriptor);
|
||||
flags |= getDeprecatedAccessFlag(functionDescriptor);
|
||||
if (deprecationResolver.isDeprecatedHidden(functionDescriptor) || isInlineWithReified(functionDescriptor)) {
|
||||
if (deprecationResolver.isDeprecatedHidden(functionDescriptor) ||
|
||||
isInlineWithReified(functionDescriptor) ||
|
||||
functionDescriptor.isSuspend() && functionDescriptor.getVisibility().equals(DescriptorVisibilities.PRIVATE)) {
|
||||
flags |= ACC_SYNTHETIC;
|
||||
}
|
||||
return flags;
|
||||
@@ -425,6 +427,10 @@ public class DescriptorAsmUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (memberDescriptor instanceof FunctionDescriptor && ((FunctionDescriptor) memberDescriptor).isSuspend()) {
|
||||
return NO_FLAG_PACKAGE_PRIVATE;
|
||||
}
|
||||
|
||||
if (memberDescriptor instanceof AccessorForCompanionObjectInstanceFieldDescriptor) {
|
||||
return NO_FLAG_PACKAGE_PRIVATE;
|
||||
}
|
||||
|
||||
@@ -74,10 +74,7 @@ import org.jetbrains.kotlin.resolve.constants.*;
|
||||
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluatorKt;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmBindingContextSlices;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmConstantsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.RuntimeAssertionInfo;
|
||||
import org.jetbrains.kotlin.resolve.jvm.*;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
|
||||
@@ -88,7 +85,6 @@ import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
import org.jetbrains.kotlin.types.checker.ClassicTypeSystemContextImpl;
|
||||
import org.jetbrains.kotlin.types.expressions.DoubleColonLHS;
|
||||
import org.jetbrains.kotlin.types.model.KotlinTypeMarker;
|
||||
import org.jetbrains.kotlin.types.model.TypeParameterMarker;
|
||||
import org.jetbrains.kotlin.types.typesApproximation.CapturedTypeApproximationKt;
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||
@@ -2694,7 +2690,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
}
|
||||
|
||||
@NotNull
|
||||
Callable resolveToCallable(@NotNull FunctionDescriptor fd, boolean superCall, @NotNull ResolvedCall<?> resolvedCall) {
|
||||
Callable resolveToCallable(@NotNull FunctionDescriptor fd, boolean superCall, @NotNull ResolvedCall resolvedCall) {
|
||||
IntrinsicMethod intrinsic = state.getIntrinsics().getIntrinsic(fd);
|
||||
if (intrinsic != null) {
|
||||
return intrinsic.toCallable(fd, superCall, resolvedCall, this);
|
||||
@@ -2702,8 +2698,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
|
||||
fd = SamCodegenUtil.resolveSamAdapter(fd);
|
||||
|
||||
List<ResolvedValueArgument> valueArguments = resolvedCall.getValueArgumentsByIndex();
|
||||
if (valueArguments != null && valueArguments.stream().anyMatch(it -> it instanceof DefaultValueArgument)) {
|
||||
if (ArgumentGeneratorKt.shouldInvokeDefaultArgumentsStub(resolvedCall)) {
|
||||
// When we invoke a function with some arguments mapped as defaults,
|
||||
// we later reroute this call to an overridden function in a base class that processes the default arguments.
|
||||
// If the base class is generic, this overridden function can have a different Kotlin signature
|
||||
@@ -5533,11 +5528,4 @@ The "returned" value of try expression with no finally is either the last expres
|
||||
parentCodegen.getReifiedTypeParametersUsages().addUsedReifiedParameter(typeParameterDescriptor.getName().asString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putReifiedOperationMarkerIfTypeIsReifiedParameter(
|
||||
@NotNull KotlinTypeMarker type, @NotNull ReifiedTypeInliner.OperationKind operationKind
|
||||
) {
|
||||
BaseExpressionCodegen.DefaultImpls.putReifiedOperationMarkerIfTypeIsReifiedParameter(this, type, operationKind);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1152,10 +1152,8 @@ public class FunctionCodegen {
|
||||
|
||||
// $default methods are never private to be accessible from other class files (e.g. inner) without the need of synthetic accessors
|
||||
// $default methods are never protected to be accessible from subclass nested classes
|
||||
// TODO: maybe best to generate private default in interface as private
|
||||
int visibilityFlag =
|
||||
(!isInterface(functionDescriptor.getContainingDeclaration()) || kind == OwnerKind.DEFAULT_IMPLS) &&
|
||||
(DescriptorVisibilities.isPrivate(functionDescriptor.getVisibility()) || isInlineOnlyPrivateInBytecode(functionDescriptor))
|
||||
DescriptorVisibilities.isPrivate(functionDescriptor.getVisibility()) || isInlineOnlyPrivateInBytecode(functionDescriptor)
|
||||
? AsmUtil.NO_FLAG_PACKAGE_PRIVATE : Opcodes.ACC_PUBLIC;
|
||||
int flags = visibilityFlag | getDeprecatedAccessFlag(functionDescriptor) | ACC_SYNTHETIC;
|
||||
if (!(functionDescriptor instanceof ConstructorDescriptor &&
|
||||
@@ -1687,11 +1685,10 @@ public class FunctionCodegen {
|
||||
|
||||
// Fake overrides in interfaces should be expanded to implementation to make proper default check
|
||||
if (JvmAnnotationUtilKt.checkIsImplementationCompiledToJvmDefault(memberDescriptor, mode)) {
|
||||
boolean isSyntheticInCompatibilityOrJvmDefault = isSynthetic && (mode.isCompatibility() || mode == JvmDefaultMode.ENABLE);
|
||||
return (kind != OwnerKind.DEFAULT_IMPLS && !isSyntheticInCompatibilityOrJvmDefault) ||
|
||||
return (kind != OwnerKind.DEFAULT_IMPLS && !isSynthetic) ||
|
||||
(kind == OwnerKind.DEFAULT_IMPLS &&
|
||||
(isSyntheticInCompatibilityOrJvmDefault ||
|
||||
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))) && !DescriptorVisibilities.isPrivate(memberDescriptor.getVisibility()));
|
||||
(isSynthetic || //TODO: move synthetic method generation into interface
|
||||
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))));
|
||||
} else {
|
||||
switch (kind) {
|
||||
case DEFAULT_IMPLS: return true;
|
||||
|
||||
@@ -660,8 +660,7 @@ public abstract class MemberCodegen<T extends KtPureElement/* TODO: & KtDeclarat
|
||||
List<VariableDescriptorWithAccessors> delegatedProperties = bindingContext.get(CodegenBinding.DELEGATED_PROPERTIES_WITH_METADATA, thisAsmType);
|
||||
if (delegatedProperties == null || delegatedProperties.isEmpty()) return;
|
||||
|
||||
int additionalFlags = context.getContextKind() != OwnerKind.DEFAULT_IMPLS && isInterface(context.getContextDescriptor()) ? ACC_PUBLIC : 0;
|
||||
v.newField(NO_ORIGIN, ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC | additionalFlags, JvmAbi.DELEGATED_PROPERTIES_ARRAY_NAME,
|
||||
v.newField(NO_ORIGIN, ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, JvmAbi.DELEGATED_PROPERTIES_ARRAY_NAME,
|
||||
"[" + K_PROPERTY_TYPE, null, null);
|
||||
|
||||
if (!state.getClassBuilderMode().generateBodies) return;
|
||||
|
||||
@@ -34,13 +34,9 @@ import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtTypeAlias
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.MemberComparator
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_SYNTHETIC_ANNOTATION_FQ_NAME
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClass
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClassPart
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin
|
||||
@@ -129,19 +125,8 @@ class MultifileClassCodegenImpl(
|
||||
val superClassForFacade = if (shouldGeneratePartHierarchy) partInternalNamesSorted.last() else J_L_OBJECT
|
||||
|
||||
state.factory.newVisitor(MultifileClass(files.firstOrNull(), actualPackageFragment), facadeClassType, files).apply {
|
||||
var attributes = FACADE_CLASS_ATTRIBUTES
|
||||
|
||||
val nonJvmSyntheticParts = files.filterNot { it.isJvmSynthetic() }
|
||||
if (nonJvmSyntheticParts.isEmpty()) {
|
||||
attributes = attributes or Opcodes.ACC_SYNTHETIC
|
||||
} else if (nonJvmSyntheticParts.size < files.size) {
|
||||
for (part in nonJvmSyntheticParts) {
|
||||
state.diagnostics.report(ErrorsJvm.NOT_ALL_MULTIFILE_CLASS_PARTS_ARE_JVM_SYNTHETIC.on(part.packageDirective ?: part))
|
||||
}
|
||||
}
|
||||
|
||||
defineClass(
|
||||
singleSourceFile, state.classFileVersion, attributes,
|
||||
singleSourceFile, state.classFileVersion, FACADE_CLASS_ATTRIBUTES,
|
||||
facadeClassType.internalName, null, superClassForFacade, emptyArray()
|
||||
)
|
||||
if (singleSourceFile != null) {
|
||||
@@ -161,13 +146,6 @@ class MultifileClassCodegenImpl(
|
||||
}
|
||||
}
|
||||
|
||||
private fun KtFile.isJvmSynthetic(): Boolean {
|
||||
return annotationEntries.any { entry ->
|
||||
val descriptor = state.bindingContext[BindingContext.ANNOTATION, entry]
|
||||
descriptor?.annotationClass?.let(DescriptorUtils::getFqNameSafe) == JVM_SYNTHETIC_ANNOTATION_FQ_NAME
|
||||
}
|
||||
}
|
||||
|
||||
override fun generate() {
|
||||
assert(delegateGenerationTasks.isEmpty()) { "generate() is called twice for facade class $facadeFqName" }
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
|
||||
internal class ObjectSuperCallArgumentGenerator(
|
||||
@@ -64,6 +65,12 @@ internal class ObjectSuperCallArgumentGenerator(
|
||||
pushDefaultValueOnStack(type, iv)
|
||||
}
|
||||
|
||||
public override fun generateDefaultJava(i: Int, argument: DefaultValueArgument) {
|
||||
val type = parameters[i].asmType
|
||||
val value = superValueParameters[i].findJavaDefaultArgumentValue(type, typeMapper)
|
||||
value.put(type, iv)
|
||||
}
|
||||
|
||||
public override fun generateVararg(i: Int, argument: VarargValueArgument) {
|
||||
generateSuperCallArgument(i)
|
||||
}
|
||||
|
||||
@@ -36,16 +36,14 @@ class SamWrapperClasses(private val state: GenerationState) {
|
||||
expressionCodegen: ExpressionCodegen,
|
||||
contextDescriptor: CallableMemberDescriptor
|
||||
): Type {
|
||||
val parentContext = expressionCodegen.context
|
||||
val isInsideInline = InlineUtil.isInlineOrContainingInline(parentContext.contextDescriptor) ||
|
||||
isInsideInlineLambdaContext(parentContext, state)
|
||||
val isInsideInline = InlineUtil.isInlineOrContainingInline(expressionCodegen.context.contextDescriptor) ||
|
||||
isInsideInlineLambdaContext(expressionCodegen.context, state)
|
||||
return samInterfaceToWrapperClass.getOrPut(WrapperKey(samType, file, isInsideInline)) {
|
||||
SamWrapperCodegen(state, samType, expressionCodegen.parentCodegen, parentContext, isInsideInline)
|
||||
.genWrapper(file, contextDescriptor)
|
||||
SamWrapperCodegen(state, samType, expressionCodegen.parentCodegen, isInsideInline).genWrapper(file, contextDescriptor)
|
||||
}
|
||||
}
|
||||
|
||||
private fun isInsideInlineLambdaContext(context: CodegenContext<*>, state: GenerationState): Boolean {
|
||||
private fun isInsideInlineLambdaContext(context: CodegenContext<*>, state: GenerationState):Boolean {
|
||||
var parent: CodegenContext<*>? = context
|
||||
while (parent != null && parent != state.rootContext) {
|
||||
if (parent is InlineLambdaContext) return true
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.backend.common.CodegenUtil;
|
||||
import org.jetbrains.kotlin.codegen.context.ClassContext;
|
||||
import org.jetbrains.kotlin.codegen.context.CodegenContext;
|
||||
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
|
||||
import org.jetbrains.kotlin.config.LanguageFeature;
|
||||
@@ -63,7 +64,6 @@ public class SamWrapperCodegen {
|
||||
private final KotlinTypeMapper typeMapper;
|
||||
private final SamType samType;
|
||||
private final MemberCodegen<?> parentCodegen;
|
||||
private final CodegenContext<?> parentContext;
|
||||
private final int visibility;
|
||||
private final int classFlags;
|
||||
public static final String SAM_WRAPPER_SUFFIX = "$0";
|
||||
@@ -72,7 +72,6 @@ public class SamWrapperCodegen {
|
||||
@NotNull GenerationState state,
|
||||
@NotNull SamType samType,
|
||||
@NotNull MemberCodegen<?> parentCodegen,
|
||||
@NotNull CodegenContext<?> parentContext,
|
||||
boolean isInsideInline
|
||||
) {
|
||||
this.state = state;
|
||||
@@ -80,7 +79,6 @@ public class SamWrapperCodegen {
|
||||
this.typeMapper = state.getTypeMapper();
|
||||
this.samType = samType;
|
||||
this.parentCodegen = parentCodegen;
|
||||
this.parentContext = parentContext;
|
||||
visibility = isInsideInline ? ACC_PUBLIC : NO_FLAG_PACKAGE_PRIVATE;
|
||||
int synth = state.getLanguageVersionSettings().supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic) ? ACC_SYNTHETIC : 0;
|
||||
classFlags = visibility | ACC_FINAL | ACC_SUPER | synth;
|
||||
@@ -172,6 +170,7 @@ public class SamWrapperCodegen {
|
||||
|
||||
private void generateInnerClassInformation(@NotNull KtFile file, Type asmType, ClassBuilder cv) {
|
||||
parentCodegen.addSyntheticAnonymousInnerClass(new SyntheticInnerClassInfo(asmType.getInternalName(), classFlags));
|
||||
FieldOwnerContext<?> parentContext = parentCodegen.context;
|
||||
CodegenContext<?> outerContext = MemberCodegen.getNonInlineOuterContext(parentContext);
|
||||
assert outerContext != null :
|
||||
"Outer context for SAM wrapper " + asmType.getInternalName() + " is null, parentContext:" + parentContext;
|
||||
|
||||
@@ -5,7 +5,18 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil.unboxPrimitiveTypeOrNull
|
||||
import org.jetbrains.kotlin.codegen.StackValue.*
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.load.java.Constant
|
||||
import org.jetbrains.kotlin.load.java.EnumEntry
|
||||
import org.jetbrains.kotlin.load.java.descriptors.NullDefaultValue
|
||||
import org.jetbrains.kotlin.load.java.descriptors.StringDefaultValue
|
||||
import org.jetbrains.kotlin.load.java.descriptors.getDefaultValueFromAnnotation
|
||||
import org.jetbrains.kotlin.load.java.lexicalCastFrom
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.DFS
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
|
||||
@@ -75,3 +86,40 @@ class FunctionCallStackValue(
|
||||
resultKotlinType: KotlinType?,
|
||||
lambda: (v: InstructionAdapter) -> Unit
|
||||
) : OperationStackValue(resultType, resultKotlinType, lambda)
|
||||
|
||||
fun ValueParameterDescriptor.findJavaDefaultArgumentValue(targetType: Type, typeMapper: KotlinTypeMapper): StackValue {
|
||||
val descriptorWithDefaultValue = DFS.dfs(
|
||||
listOf(this.original),
|
||||
{ it.original.overriddenDescriptors.map(ValueParameterDescriptor::getOriginal) },
|
||||
object : DFS.AbstractNodeHandler<ValueParameterDescriptor, ValueParameterDescriptor?>() {
|
||||
var result: ValueParameterDescriptor? = null
|
||||
|
||||
override fun beforeChildren(current: ValueParameterDescriptor?): Boolean {
|
||||
if (current?.declaresDefaultValue() == true && current.getDefaultValueFromAnnotation() != null) {
|
||||
result = current
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun result(): ValueParameterDescriptor? = result
|
||||
}
|
||||
) ?: error("Should be at least one descriptor with default value: $this")
|
||||
|
||||
val defaultValue = descriptorWithDefaultValue.getDefaultValueFromAnnotation()
|
||||
if (defaultValue is NullDefaultValue) {
|
||||
return constant(null, targetType)
|
||||
}
|
||||
|
||||
val value = (defaultValue as StringDefaultValue).value
|
||||
val castResult = type.lexicalCastFrom(value) ?: error("Should be checked in frontend")
|
||||
|
||||
return when (castResult) {
|
||||
is EnumEntry -> enumEntry(castResult.descriptor, typeMapper)
|
||||
is Constant -> {
|
||||
val unboxedType = unboxPrimitiveTypeOrNull(targetType) ?: targetType
|
||||
return coercion(constant(castResult.value, unboxedType), targetType, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.codegen.coroutines.CoroutineCodegenUtilKt;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.when.SwitchCodegenProvider;
|
||||
import org.jetbrains.kotlin.codegen.when.WhenByEnumsMapping;
|
||||
import org.jetbrains.kotlin.config.JvmDefaultMode;
|
||||
import org.jetbrains.kotlin.config.LanguageFeature;
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings;
|
||||
import org.jetbrains.kotlin.coroutines.CoroutineUtilKt;
|
||||
@@ -88,7 +87,6 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
private final LanguageVersionSettings languageVersionSettings;
|
||||
private final ClassBuilderMode classBuilderMode;
|
||||
private final DelegatedPropertiesCodegenHelper delegatedPropertiesCodegenHelper;
|
||||
private final JvmDefaultMode jvmDefaultMode;
|
||||
|
||||
public CodegenAnnotatingVisitor(@NotNull GenerationState state) {
|
||||
this.bindingTrace = state.getBindingTrace();
|
||||
@@ -99,7 +97,6 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
this.languageVersionSettings = state.getLanguageVersionSettings();
|
||||
this.classBuilderMode = state.getClassBuilderMode();
|
||||
this.delegatedPropertiesCodegenHelper = new DelegatedPropertiesCodegenHelper(state);
|
||||
jvmDefaultMode = state.getJvmDefaultMode();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -588,7 +585,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
}
|
||||
|
||||
return AsmUtil.asmTypeByClassId(
|
||||
DescriptorUtils.isInterface(descriptor) && !jvmDefaultMode.getForAllMethodsWithBody()
|
||||
DescriptorUtils.isInterface(descriptor)
|
||||
? classId.createNestedClassId(Name.identifier(JvmAbi.DEFAULT_IMPLS_CLASS_NAME))
|
||||
: classId
|
||||
);
|
||||
|
||||
@@ -721,16 +721,9 @@ class CoroutineCodegenForNamedFunction private constructor(
|
||||
}
|
||||
|
||||
val isInterfaceMethod = DescriptorUtils.isInterface(suspendFunctionJvmView.containingDeclaration)
|
||||
val callableAccessorMethod =
|
||||
typeMapper.mapToCallableMethod(
|
||||
context.accessibleDescriptor(suspendFunctionJvmView.unwrapFrontendVersion(), null),
|
||||
// Obtain default impls method for interfaces
|
||||
isInterfaceMethod
|
||||
)
|
||||
|
||||
val callableMethod =
|
||||
typeMapper.mapToCallableMethod(
|
||||
suspendFunctionJvmView.unwrapFrontendVersion(),
|
||||
suspendFunctionJvmView,
|
||||
// Obtain default impls method for interfaces
|
||||
isInterfaceMethod
|
||||
)
|
||||
@@ -743,10 +736,10 @@ class CoroutineCodegenForNamedFunction private constructor(
|
||||
|
||||
if (suspendFunctionJvmView.isOverridable && !isInterfaceMethod && captureThisType != null) {
|
||||
val owner = captureThisType.internalName
|
||||
val impl = callableAccessorMethod.getAsmMethod().getImplForOpenMethod(owner)
|
||||
val impl = callableMethod.getAsmMethod().getImplForOpenMethod(owner)
|
||||
codegen.v.invokestatic(owner, impl.name, impl.descriptor, false)
|
||||
} else {
|
||||
callableAccessorMethod.genInvokeInstruction(codegen.v)
|
||||
callableMethod.genInvokeInstruction(codegen.v)
|
||||
}
|
||||
|
||||
if (inlineClassToBoxInInvokeSuspend != null) {
|
||||
|
||||
@@ -1217,27 +1217,6 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction:
|
||||
fun isAlive(insnIndex: Int, variableIndex: Int): Boolean =
|
||||
liveness[insnIndex].isAlive(variableIndex)
|
||||
|
||||
fun nextSuspensionPointEndLabel(insn: AbstractInsnNode): LabelNode {
|
||||
val suspensionPoint =
|
||||
InsnSequence(insn, method.instructions.last).firstOrNull { isAfterSuspendMarker(it) } ?: method.instructions.last
|
||||
return suspensionPoint as? LabelNode ?: suspensionPoint.findNextOrNull { it is LabelNode } as LabelNode
|
||||
}
|
||||
|
||||
fun nextSuspensionPointStartLabel(insn: AbstractInsnNode): LabelNode {
|
||||
val suspensionPoint =
|
||||
InsnSequence(insn, method.instructions.last).firstOrNull { isBeforeSuspendMarker(it) } ?: method.instructions.last
|
||||
return suspensionPoint as? LabelNode ?: suspensionPoint.findPreviousOrNull { it is LabelNode } as LabelNode
|
||||
}
|
||||
|
||||
fun min(a: LabelNode, b: LabelNode): LabelNode =
|
||||
if (method.instructions.indexOf(a) < method.instructions.indexOf(b)) a else b
|
||||
|
||||
fun max(a: LabelNode, b: LabelNode): LabelNode =
|
||||
if (method.instructions.indexOf(a) < method.instructions.indexOf(b)) b else a
|
||||
|
||||
fun containsSuspensionPoint(a: LabelNode, b: LabelNode): Boolean =
|
||||
InsnSequence(min(a, b), max(a, b)).none { isBeforeSuspendMarker(it) }
|
||||
|
||||
val oldLvt = arrayListOf<LocalVariableNode>()
|
||||
for (record in method.localVariables) {
|
||||
oldLvt += record
|
||||
@@ -1258,35 +1237,23 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction:
|
||||
// No variable in LVT -> do not add one
|
||||
val lvtRecord = oldLvt.findRecord(insnIndex, variableIndex) ?: continue
|
||||
if (lvtRecord.name == CONTINUATION_VARIABLE_NAME) continue
|
||||
// Extend lvt record to the next suspension point
|
||||
val endLabel = min(lvtRecord.end, nextSuspensionPointEndLabel(insn))
|
||||
val endLabel = insn as? LabelNode ?: insn.findNextOrNull { it is LabelNode } as? LabelNode ?: continue
|
||||
// startLabel can be null in case of parameters
|
||||
@Suppress("NAME_SHADOWING") val startLabel = startLabel ?: lvtRecord.start
|
||||
// Attempt to extend existing local variable node corresponding to the record in
|
||||
// the original local variable table.
|
||||
val recordToExtend: LocalVariableNode? = oldLvtNodeToLatestNewLvtNode[lvtRecord]
|
||||
if (recordToExtend != null && containsSuspensionPoint(recordToExtend.end, startLabel)) {
|
||||
var recordToExtend: LocalVariableNode? = oldLvtNodeToLatestNewLvtNode[lvtRecord]
|
||||
if (recordToExtend != null && InsnSequence(recordToExtend.end, startLabel).none { isBeforeSuspendMarker(it) }) {
|
||||
recordToExtend.end = endLabel
|
||||
} else {
|
||||
val node = LocalVariableNode(lvtRecord.name, lvtRecord.desc, lvtRecord.signature, startLabel, endLabel, lvtRecord.index)
|
||||
if (lvtRecord !in oldLvtNodeToLatestNewLvtNode) {
|
||||
method.localVariables.add(node)
|
||||
}
|
||||
method.localVariables.add(node)
|
||||
oldLvtNodeToLatestNewLvtNode[lvtRecord] = node
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val deadVariables = arrayListOf<Int>()
|
||||
outer@for (variableIndex in start until method.maxLocals) {
|
||||
if (oldLvt.none { it.index == variableIndex }) continue
|
||||
for (insnIndex in 0 until (method.instructions.size() - 1)) {
|
||||
if (isAlive(insnIndex, variableIndex)) continue@outer
|
||||
}
|
||||
deadVariables += variableIndex
|
||||
}
|
||||
|
||||
for (variable in oldLvt) {
|
||||
// $continuation and $result are dead, but they are used by debugger, as well as fake inliner variables
|
||||
// For example, $continuation is used to create async stack trace
|
||||
@@ -1295,26 +1262,10 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction:
|
||||
isFakeLocalVariableForInline(variable.name)
|
||||
) {
|
||||
method.localVariables.add(variable)
|
||||
continue
|
||||
}
|
||||
// this acts like $continuation for lambdas. For example, it is used by debugger to create async stack trace. Keep it.
|
||||
if (variable.name == "this" && !isForNamedFunction) {
|
||||
method.localVariables.add(variable)
|
||||
continue
|
||||
}
|
||||
|
||||
// Shrink LVT records of dead variables to the next suspension point
|
||||
if (variable.index in deadVariables) {
|
||||
method.localVariables.add(
|
||||
LocalVariableNode(
|
||||
variable.name,
|
||||
variable.desc,
|
||||
variable.signature,
|
||||
variable.start,
|
||||
nextSuspensionPointStartLabel(variable.start),
|
||||
variable.index
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,10 +90,7 @@ class AnonymousObjectTransformer(
|
||||
val node = MethodNode(access, name, desc, signature, exceptions)
|
||||
if (name == "<init>") {
|
||||
if (constructor != null) {
|
||||
throw RuntimeException(
|
||||
"Lambda, SAM or anonymous object should have only one constructor.\n" +
|
||||
"First:\n${constructor.nodeText}\n\nSecond:\n${node.nodeText}\n"
|
||||
)
|
||||
throw RuntimeException("Lambda, SAM or anonymous object should have only one constructor")
|
||||
}
|
||||
constructor = node
|
||||
} else {
|
||||
@@ -465,29 +462,6 @@ class AnonymousObjectTransformer(
|
||||
val indexToFunctionalArgument = transformationInfo.functionalArguments
|
||||
val capturedParams = HashSet<Int>()
|
||||
|
||||
// Possible cases where we need to add each lambda's captures separately:
|
||||
//
|
||||
// 1. Top-level object in an inline lambda that is *not* being inlined into another object. In this case, we
|
||||
// have no choice but to add a separate field for each captured variable. `capturedLambdas` is either empty
|
||||
// (already have the fields) or contains the parent lambda object (captures used to be read from it, but
|
||||
// the object will be removed and its contents inlined).
|
||||
//
|
||||
// 2. Top-level object in a named inline function. Again, there's no option but to add separate fields.
|
||||
// `capturedLambdas` contains all lambdas used by this object and nested objects.
|
||||
//
|
||||
// 3. Nested object, either in an inline lambda or an inline function. This case has two subcases:
|
||||
// * The object's captures are passed as separate arguments (e.g. KT-28064 style object that used to be in a lambda);
|
||||
// we *could* group them into `this$0` now, but choose not to. Lambdas are replaced by their captures to match.
|
||||
// * The object's captures are already grouped into `this$0`; this includes captured lambda parameters (for objects in
|
||||
// inline functions) and a reference to the outer object or lambda (for objects in lambdas), so `capturedLambdas` is
|
||||
// empty anyway.
|
||||
//
|
||||
// The only remaining case is a top-level object inside a (crossinline) lambda that is inlined into another object.
|
||||
// Then, the reference to the soon-to-be-removed lambda class containing the captures (and it exists, or else the object
|
||||
// would not have needed regeneration in the first place) is simply replaced with a reference to the outer object, and
|
||||
// that object will contain loose fields for everything we need to capture.
|
||||
val topLevelInCrossinlineLambda = parentFieldRemapper is InlinedLambdaRemapper && !parentFieldRemapper.parent!!.isRoot
|
||||
|
||||
//load captured parameters and patch instruction list
|
||||
// NB: there is also could be object fields
|
||||
val toDelete = arrayListOf<AbstractInsnNode>()
|
||||
@@ -496,12 +470,10 @@ class AnonymousObjectTransformer(
|
||||
val parameterAload = fieldNode.previous as VarInsnNode
|
||||
val varIndex = parameterAload.`var`
|
||||
val functionalArgument = indexToFunctionalArgument[varIndex]
|
||||
// If an outer `this` is already captured by this object, rename it if any inline lambda will capture
|
||||
// one of the same type, causing the code below to create a clash. Note that the values can be different.
|
||||
// TODO: this is only really necessary if there will be a name *and* type clash.
|
||||
val shouldRename = !topLevelInCrossinlineLambda && isThis0(fieldName) &&
|
||||
indexToFunctionalArgument.values.any { it is LambdaInfo && it.capturedVars.any { it.fieldName == fieldName } }
|
||||
val newFieldName = if (shouldRename) addUniqueField(fieldName + INLINE_FUN_THIS_0_SUFFIX) else fieldName
|
||||
val newFieldName = if (isThis0(fieldName) && shouldRenameThis0(parentFieldRemapper, indexToFunctionalArgument.values))
|
||||
getNewFieldName(fieldName, true)
|
||||
else
|
||||
fieldName
|
||||
val info = capturedParamBuilder.addCapturedParam(
|
||||
Type.getObjectType(transformationInfo.oldClassName), fieldName, newFieldName,
|
||||
Type.getType(fieldNode.desc), functionalArgument is LambdaInfo, null
|
||||
@@ -536,17 +508,35 @@ class AnonymousObjectTransformer(
|
||||
//For all inlined lambdas add their captured parameters
|
||||
//TODO: some of such parameters could be skipped - we should perform additional analysis
|
||||
val allRecapturedParameters = ArrayList<CapturedParamDesc>()
|
||||
if (!topLevelInCrossinlineLambda) {
|
||||
val capturedOuterThisTypes = mutableSetOf<String>()
|
||||
if (parentFieldRemapper !is InlinedLambdaRemapper || parentFieldRemapper.parent!!.isRoot) {
|
||||
// Possible cases:
|
||||
//
|
||||
// 1. Top-level object in an inline lambda that is *not* being inlined into another object. In this case, we
|
||||
// have no choice but to add a separate field for each captured variable. `capturedLambdas` is either empty
|
||||
// (already have the fields) or contains the parent lambda object (captures used to be read from it, but
|
||||
// the object will be removed and its contents inlined).
|
||||
//
|
||||
// 2. Top-level object in a named inline function. Again, there's no option but to add separate fields.
|
||||
// `capturedLambdas` contains all lambdas used by this object and nested objects.
|
||||
//
|
||||
// 3. Nested object, either in an inline lambda or an inline function. This case has two subcases:
|
||||
// * The object's captures are passed as separate arguments (e.g. KT-28064 style object that used to be in a lambda);
|
||||
// we could group them into `this$0` now, but choose not to. Lambdas are replaced by their captures.
|
||||
// * The object's captures are already grouped into `this$0`; this includes captured lambda parameters (for objects in
|
||||
// inline functions) and a reference to the outer object or lambda (for objects in lambdas), so `capturedLambdas` is
|
||||
// empty and the choice doesn't matter.
|
||||
//
|
||||
val alreadyAdded = HashMap<String, CapturedParamInfo>()
|
||||
for (info in capturedLambdas) {
|
||||
for (desc in info.capturedVars) {
|
||||
// Merge all outer `this` of the same type captured by inlined lambdas, since they have to be the same
|
||||
// object. Outer `this` captured by the original object itself should have been renamed above,
|
||||
// and can have a different value even if the same type is captured by a lambda.
|
||||
val recapturedParamInfo = if (isThis0(desc.fieldName))
|
||||
capturedParamBuilder.addCapturedParam(desc, desc.fieldName, !capturedOuterThisTypes.add(desc.type.className))
|
||||
else
|
||||
capturedParamBuilder.addCapturedParam(desc, addUniqueField(desc.fieldName + INLINE_TRANSFORMATION_SUFFIX), false)
|
||||
val key = desc.fieldName + "$$$" + desc.type.className
|
||||
val alreadyAddedParam = alreadyAdded[key]
|
||||
|
||||
val recapturedParamInfo = capturedParamBuilder.addCapturedParam(
|
||||
desc,
|
||||
alreadyAddedParam?.newFieldName ?: getNewFieldName(desc.fieldName, false),
|
||||
alreadyAddedParam != null
|
||||
)
|
||||
if (info is ExpressionLambda && info.isCapturedSuspend(desc)) {
|
||||
recapturedParamInfo.functionalArgument = NonInlineableArgumentForInlineableParameterCalledInSuspend
|
||||
}
|
||||
@@ -561,6 +551,10 @@ class AnonymousObjectTransformer(
|
||||
allRecapturedParameters.add(desc)
|
||||
|
||||
constructorParamBuilder.addCapturedParam(recapturedParamInfo, recapturedParamInfo.newFieldName).remapValue = composed
|
||||
|
||||
if (isThis0(desc.fieldName)) {
|
||||
alreadyAdded.put(key, recapturedParamInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (capturedLambdas.isNotEmpty()) {
|
||||
@@ -585,6 +579,24 @@ class AnonymousObjectTransformer(
|
||||
return constructorAdditionalFakeParams
|
||||
}
|
||||
|
||||
private fun shouldRenameThis0(parentFieldRemapper: FieldRemapper, values: Collection<FunctionalArgument>): Boolean {
|
||||
return if (isFirstDeclSiteLambdaFieldRemapper(parentFieldRemapper)) {
|
||||
values.any { it is LambdaInfo && it.capturedVars.any { isThis0(it.fieldName) } }
|
||||
} else false
|
||||
}
|
||||
|
||||
private fun getNewFieldName(oldName: String, originalField: Boolean): String {
|
||||
if (AsmUtil.CAPTURED_THIS_FIELD == oldName) {
|
||||
return if (!originalField) {
|
||||
oldName
|
||||
} else {
|
||||
//rename original 'this$0' in declaration site lambda (inside inline function) to use this$0 only for outer lambda/object access on call site
|
||||
addUniqueField(oldName + INLINE_FUN_THIS_0_SUFFIX)
|
||||
}
|
||||
}
|
||||
return addUniqueField(oldName + INLINE_TRANSFORMATION_SUFFIX)
|
||||
}
|
||||
|
||||
private fun addUniqueField(name: String): String {
|
||||
val existNames = fieldNames.getOrPut(name) { LinkedList() }
|
||||
val suffix = if (existNames.isEmpty()) "" else "$" + existNames.size
|
||||
@@ -592,4 +604,7 @@ class AnonymousObjectTransformer(
|
||||
existNames.add(newName)
|
||||
return newName
|
||||
}
|
||||
|
||||
private fun isFirstDeclSiteLambdaFieldRemapper(parentRemapper: FieldRemapper): Boolean =
|
||||
parentRemapper !is RegeneratedLambdaFieldRemapper && parentRemapper !is InlinedLambdaRemapper
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.config.JVMConfigurationKeys
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.incremental.components.Position
|
||||
import org.jetbrains.kotlin.incremental.components.ScopeKind
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
@@ -41,6 +42,8 @@ import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
import org.jetbrains.org.objectweb.asm.commons.Method
|
||||
import org.jetbrains.org.objectweb.asm.tree.*
|
||||
import java.util.*
|
||||
import kotlin.collections.HashSet
|
||||
import kotlin.math.max
|
||||
|
||||
abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
||||
@@ -108,9 +111,11 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
||||
)
|
||||
}
|
||||
|
||||
protected fun generateStub(text: String, codegen: BaseExpressionCodegen) {
|
||||
protected fun generateStub(resolvedCall: ResolvedCall<*>?, codegen: BaseExpressionCodegen) {
|
||||
leaveTemps()
|
||||
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", "Call is part of inline cycle: $text")
|
||||
assert(resolvedCall != null)
|
||||
val message = "Call is part of inline cycle: " + resolvedCall!!.call.callElement.text
|
||||
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", message)
|
||||
}
|
||||
|
||||
protected fun endCall(result: InlineResult, registerLineNumberAfterwards: Boolean) {
|
||||
@@ -634,17 +639,35 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
||||
?: throw IllegalStateException("Couldn't find declaration file for $containerId")
|
||||
}
|
||||
|
||||
val methodNode = getMethodNodeInner(containerId, bytes, asmMethod, callableDescriptor) ?: return null
|
||||
|
||||
// KLUDGE: Inline suspend function built with compiler version less than 1.1.4/1.2-M1 did not contain proper
|
||||
// before/after suspension point marks, so we detect those functions here and insert the corresponding marks
|
||||
if (isLegacySuspendInlineFunction(callableDescriptor)) {
|
||||
insertLegacySuspendInlineMarks(methodNode.node)
|
||||
}
|
||||
|
||||
return methodNode
|
||||
}
|
||||
|
||||
private fun getMethodNodeInner(
|
||||
containerId: ClassId,
|
||||
bytes: ByteArray,
|
||||
asmMethod: Method,
|
||||
callableDescriptor: CallableMemberDescriptor
|
||||
): SMAPAndMethodNode? {
|
||||
val classType = AsmUtil.asmTypeByClassId(containerId)
|
||||
val methodNode = getMethodNode(bytes, asmMethod.name, asmMethod.descriptor, classType)
|
||||
var methodNode = getMethodNode(bytes, asmMethod.name, asmMethod.descriptor, classType)
|
||||
if (methodNode == null && requiresFunctionNameManglingForReturnType(callableDescriptor)) {
|
||||
val nameWithoutManglingSuffix = asmMethod.name.stripManglingSuffixOrNull()
|
||||
if (nameWithoutManglingSuffix != null) {
|
||||
val methodWithoutMangling = getMethodNode(bytes, nameWithoutManglingSuffix, asmMethod.descriptor, classType)
|
||||
if (methodWithoutMangling != null) return methodWithoutMangling
|
||||
methodNode = getMethodNode(bytes, nameWithoutManglingSuffix, asmMethod.descriptor, classType)
|
||||
}
|
||||
if (methodNode == null) {
|
||||
val nameWithImplSuffix = "$nameWithoutManglingSuffix-impl"
|
||||
methodNode = getMethodNode(bytes, nameWithImplSuffix, asmMethod.descriptor, classType)
|
||||
}
|
||||
return getMethodNode(bytes, "$nameWithoutManglingSuffix-impl", asmMethod.descriptor, classType)
|
||||
}
|
||||
|
||||
return methodNode
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.load.kotlin.getContainingKotlinJvmBinaryClass
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
||||
|
||||
// KLUDGE: Inline suspend function built with compiler version less than 1.1.4/1.2-M1 did not contain proper
|
||||
// before/after suspension point marks, so we detect those functions here and insert the corresponding marks
|
||||
|
||||
fun insertLegacySuspendInlineMarks(node: MethodNode) {
|
||||
with(node.instructions) {
|
||||
// look for return instruction before the end and insert "afterSuspendMarker" there
|
||||
insertBefore(findLastReturn(last) ?: return, produceSuspendMarker(false).instructions)
|
||||
// insert "beforeSuspendMarker" at the beginning
|
||||
insertBefore(first, produceSuspendMarker(true).instructions)
|
||||
}
|
||||
node.maxStack = node.maxStack.coerceAtLeast(2) // min stack need for suspend marker before return
|
||||
}
|
||||
|
||||
fun findLastReturn(node: AbstractInsnNode?): AbstractInsnNode? {
|
||||
var cur = node
|
||||
while (cur != null && cur.opcode != Opcodes.ARETURN) cur = cur.previous
|
||||
return cur
|
||||
}
|
||||
|
||||
private fun produceSuspendMarker(isStartNotEnd: Boolean): MethodNode =
|
||||
MethodNode().also { addSuspendMarker(InstructionAdapter(it), isStartNotEnd) }
|
||||
|
||||
fun isLegacySuspendInlineFunction(descriptor: CallableMemberDescriptor): Boolean {
|
||||
if (descriptor !is FunctionDescriptor) return false
|
||||
if (!descriptor.isSuspend || !descriptor.isInline) return false
|
||||
val jvmBytecodeVersion = descriptor.getContainingKotlinJvmBinaryClass()?.classHeader?.bytecodeVersion ?: return false
|
||||
return !jvmBytecodeVersion.isAtLeast(1, 0, 2)
|
||||
}
|
||||
@@ -60,8 +60,8 @@ class PsiInlineCodegen(
|
||||
callDefault: Boolean,
|
||||
codegen: ExpressionCodegen
|
||||
) {
|
||||
if (!state.globalInlineContext.enterIntoInlining(functionDescriptor, resolvedCall?.call?.callElement)) {
|
||||
generateStub(resolvedCall?.call?.callElement?.text ?: "<no source>", codegen)
|
||||
if (!state.globalInlineContext.enterIntoInlining(resolvedCall?.resultingDescriptor, resolvedCall?.call?.callElement)) {
|
||||
generateStub(resolvedCall, codegen)
|
||||
return
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -57,8 +57,6 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
|
||||
override fun onUseAsTainted() {
|
||||
hazard = true
|
||||
}
|
||||
|
||||
fun canRewrite() = !hazard && initCallInsn != null
|
||||
}
|
||||
|
||||
private class Transformer(private val internalClassName: String, private val methodNode: MethodNode) {
|
||||
@@ -74,7 +72,7 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
|
||||
assignLocalVars(frames)
|
||||
|
||||
for (refValue in refValues) {
|
||||
if (refValue.canRewrite()) {
|
||||
if (!refValue.hazard) {
|
||||
rewriteRefValue(refValue)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.codegen.optimization.transformer;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode;
|
||||
import org.jetbrains.org.objectweb.asm.tree.analysis.*;
|
||||
|
||||
@@ -32,7 +31,7 @@ public abstract class MethodTransformer {
|
||||
return analyzer.analyze(internalClassName, node);
|
||||
}
|
||||
catch (AnalyzerException e) {
|
||||
throw ExceptionUtilsKt.rethrow(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.codegen.createFreeFakeLocalPropertyDescriptor
|
||||
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.*
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapperBase
|
||||
import org.jetbrains.kotlin.config.JVMConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.JvmDefaultMode
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
@@ -31,6 +32,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils.isInterface
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyPrivateApi
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.nonSourceAnnotations
|
||||
import org.jetbrains.kotlin.resolve.jvm.annotations.hasJvmDefaultAnnotation
|
||||
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForParameterTypes
|
||||
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForReturnType
|
||||
import org.jetbrains.kotlin.serialization.DescriptorSerializer
|
||||
@@ -89,7 +91,7 @@ class JvmSerializerExtension @JvmOverloads constructor(
|
||||
}
|
||||
//TODO: support local delegated properties in new defaults scheme
|
||||
val containerAsmType =
|
||||
if (isInterface(descriptor) && !jvmDefaultMode.forAllMethodsWithBody) typeMapper.mapDefaultImpls(descriptor) else typeMapper.mapClass(descriptor)
|
||||
if (isInterface(descriptor)) typeMapper.mapDefaultImpls(descriptor) else typeMapper.mapClass(descriptor)
|
||||
writeLocalProperties(proto, containerAsmType, JvmProtoBuf.classLocalVariable)
|
||||
writeVersionRequirementForJvmDefaultIfNeeded(descriptor, proto, versionRequirementTable)
|
||||
|
||||
@@ -112,6 +114,13 @@ class JvmSerializerExtension @JvmOverloads constructor(
|
||||
versionRequirementTable: MutableVersionRequirementTable
|
||||
) {
|
||||
if (isInterface(classDescriptor)) {
|
||||
if (jvmDefaultMode == JvmDefaultMode.ENABLE && classDescriptor.unsubstitutedMemberScope.getContributedDescriptors().any {
|
||||
it is CallableMemberDescriptor && it.hasJvmDefaultAnnotation()
|
||||
}) {
|
||||
builder.addVersionRequirement(
|
||||
writeVersionRequirement(1, 2, 40, ProtoBuf.VersionRequirement.VersionKind.COMPILER_VERSION, versionRequirementTable)
|
||||
)
|
||||
}
|
||||
if (jvmDefaultMode == JvmDefaultMode.ALL_INCOMPATIBLE) {
|
||||
builder.addVersionRequirement(
|
||||
writeVersionRequirement(1, 4, 0, ProtoBuf.VersionRequirement.VersionKind.COMPILER_VERSION, versionRequirementTable)
|
||||
@@ -271,6 +280,10 @@ class JvmSerializerExtension @JvmOverloads constructor(
|
||||
|
||||
if (descriptor.isJvmFieldPropertyInInterfaceCompanion() && versionRequirementTable != null) {
|
||||
proto.setExtension(JvmProtoBuf.flags, JvmFlags.getPropertyFlags(true))
|
||||
|
||||
proto.addVersionRequirement(
|
||||
writeVersionRequirement(1, 2, 70, ProtoBuf.VersionRequirement.VersionKind.COMPILER_VERSION, versionRequirementTable)
|
||||
)
|
||||
}
|
||||
|
||||
if (getter?.needsInlineParameterNullCheckRequirement() == true || setter?.needsInlineParameterNullCheckRequirement() == true) {
|
||||
|
||||
@@ -27,19 +27,19 @@ import org.jetbrains.org.objectweb.asm.commons.Method
|
||||
import java.util.*
|
||||
|
||||
private val EXTERNAL_SOURCES_KINDS = arrayOf(
|
||||
JvmDeclarationOriginKind.CLASS_MEMBER_DELEGATION_TO_DEFAULT_IMPL,
|
||||
JvmDeclarationOriginKind.DEFAULT_IMPL_DELEGATION_TO_SUPERINTERFACE_DEFAULT_IMPL,
|
||||
JvmDeclarationOriginKind.DELEGATION,
|
||||
JvmDeclarationOriginKind.BRIDGE
|
||||
JvmDeclarationOriginKind.CLASS_MEMBER_DELEGATION_TO_DEFAULT_IMPL,
|
||||
JvmDeclarationOriginKind.DEFAULT_IMPL_DELEGATION_TO_SUPERINTERFACE_DEFAULT_IMPL,
|
||||
JvmDeclarationOriginKind.DELEGATION,
|
||||
JvmDeclarationOriginKind.BRIDGE
|
||||
)
|
||||
|
||||
private val PREDEFINED_SIGNATURES = listOf(
|
||||
"getClass()Ljava/lang/Class;",
|
||||
"notify()V",
|
||||
"notifyAll()V",
|
||||
"wait()V",
|
||||
"wait(J)V",
|
||||
"wait(JI)V"
|
||||
"getClass()Ljava/lang/Class;",
|
||||
"notify()V",
|
||||
"notifyAll()V",
|
||||
"wait()V",
|
||||
"wait(J)V",
|
||||
"wait(JI)V"
|
||||
).map { signature ->
|
||||
RawSignature(signature.substringBefore('('), signature.substring(signature.indexOf('(')), MemberKind.METHOD)
|
||||
}
|
||||
@@ -77,7 +77,8 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
val elements = LinkedHashSet<PsiElement>()
|
||||
if (noOwnImplementations) {
|
||||
elements.addIfNotNull(data.classOrigin.element)
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
for (origin in data.signatureOrigins) {
|
||||
var element = origin.element
|
||||
|
||||
@@ -95,9 +96,9 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
}
|
||||
|
||||
override fun onClassDone(
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
|
||||
) {
|
||||
reportDiagnosticsTasks.add {
|
||||
reportClashingWithPredefinedSignatures(classOrigin, classInternalName, signatures)
|
||||
@@ -106,9 +107,9 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
}
|
||||
|
||||
private fun reportClashingWithPredefinedSignatures(
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
|
||||
) {
|
||||
for (predefinedSignature in PREDEFINED_SIGNATURES) {
|
||||
if (!signatures.containsKey(predefinedSignature)) continue
|
||||
@@ -121,9 +122,9 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
}
|
||||
|
||||
private fun reportClashingSignaturesInHierarchy(
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
|
||||
) {
|
||||
val descriptor = classOrigin.descriptor
|
||||
if (descriptor !is ClassDescriptor) return
|
||||
@@ -140,7 +141,9 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
for ((rawSignature, origins) in groupedBySignature.entrySet()) {
|
||||
if (origins.size <= 1) continue
|
||||
|
||||
when (val diagnostic = computeDiagnosticToReport(classOrigin, classInternalName, rawSignature, origins)) {
|
||||
val diagnostic = computeDiagnosticToReport(classOrigin, classInternalName, rawSignature, origins)
|
||||
|
||||
when (diagnostic) {
|
||||
is ConflictingDeclarationError.AccidentalOverride -> {
|
||||
diagnostics.report(ErrorsJvm.ACCIDENTAL_OVERRIDE.on(diagnostic.element, diagnostic.data))
|
||||
}
|
||||
@@ -153,17 +156,16 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
|
||||
private sealed class ConflictingDeclarationError(val element: PsiElement, val data: ConflictingJvmDeclarationsData) {
|
||||
class AccidentalOverride(element: PsiElement, data: ConflictingJvmDeclarationsData) :
|
||||
ConflictingDeclarationError(element, data)
|
||||
|
||||
ConflictingDeclarationError(element, data)
|
||||
class ConflictingInheritedJvmDeclarations(element: PsiElement, data: ConflictingJvmDeclarationsData) :
|
||||
ConflictingDeclarationError(element, data)
|
||||
ConflictingDeclarationError(element, data)
|
||||
}
|
||||
|
||||
private fun computeDiagnosticToReport(
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
rawSignature: RawSignature,
|
||||
origins: Collection<JvmDeclarationOrigin>
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String,
|
||||
rawSignature: RawSignature,
|
||||
origins: Collection<JvmDeclarationOrigin>
|
||||
): ConflictingDeclarationError? {
|
||||
var memberElement: PsiElement? = null
|
||||
var ownNonFakeCount = 0
|
||||
@@ -209,17 +211,19 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
if (member is PropertyDescriptor) {
|
||||
processMember(member.getter)
|
||||
processMember(member.setter)
|
||||
} else if (member is FunctionDescriptor) {
|
||||
}
|
||||
else if (member is FunctionDescriptor) {
|
||||
val signatures =
|
||||
if (member.kind == FAKE_OVERRIDE)
|
||||
member.overriddenTreeUniqueAsSequence(useOriginal = true)
|
||||
// drop the root (itself)
|
||||
.drop(1)
|
||||
.mapTo(HashSet()) { it.asRawSignature() }
|
||||
else
|
||||
setOf(member.asRawSignature())
|
||||
if (member.kind == FAKE_OVERRIDE)
|
||||
member.overriddenTreeUniqueAsSequence(useOriginal = true)
|
||||
// drop the root (itself)
|
||||
.drop(1)
|
||||
.mapTo(HashSet()) { it.asRawSignature() }
|
||||
else
|
||||
setOf(member.asRawSignature())
|
||||
|
||||
signatures.forEach { rawSignature ->
|
||||
signatures.forEach {
|
||||
rawSignature ->
|
||||
groupedBySignature.putValue(rawSignature, OtherOrigin(member))
|
||||
}
|
||||
}
|
||||
@@ -228,10 +232,10 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
descriptor.defaultType.memberScope.getContributedDescriptors().forEach(::processMember)
|
||||
descriptor.getParentJavaStaticClassScope()?.run {
|
||||
getContributedDescriptors(DescriptorKindFilter.FUNCTIONS)
|
||||
.filter {
|
||||
it is FunctionDescriptor && DescriptorVisibilities.isVisibleIgnoringReceiver(it, descriptor)
|
||||
}
|
||||
.forEach(::processMember)
|
||||
.filter {
|
||||
it is FunctionDescriptor && DescriptorVisibilities.isVisibleIgnoringReceiver(it, descriptor)
|
||||
}
|
||||
.forEach(::processMember)
|
||||
}
|
||||
|
||||
return groupedBySignature
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods
|
||||
import org.jetbrains.kotlin.codegen.optimization.OptimizationClassBuilderFactory
|
||||
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.config.LanguageVersion.*
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ScriptDescriptor
|
||||
@@ -50,7 +49,6 @@ import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeApproximator
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
class GenerationState private constructor(
|
||||
val project: Project,
|
||||
@@ -206,20 +204,20 @@ class GenerationState private constructor(
|
||||
val target = configuration.get(JVMConfigurationKeys.JVM_TARGET) ?: JvmTarget.DEFAULT
|
||||
val runtimeStringConcat =
|
||||
if (target.majorVersion >= JvmTarget.JVM_9.majorVersion)
|
||||
configuration.get(JVMConfigurationKeys.STRING_CONCAT) ?: JvmStringConcat.INDY_WITH_CONSTANTS
|
||||
configuration.get(JVMConfigurationKeys.STRING_CONCAT) ?: JvmStringConcat.INLINE
|
||||
else JvmStringConcat.INLINE
|
||||
|
||||
val samConversionsScheme = run {
|
||||
val fromConfig = configuration.get(JVMConfigurationKeys.SAM_CONVERSIONS)
|
||||
if (fromConfig != null && target >= fromConfig.minJvmTarget)
|
||||
fromConfig
|
||||
else if (
|
||||
target >= JvmClosureGenerationScheme.INDY.minJvmTarget &&
|
||||
languageVersionSettings.supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic)
|
||||
)
|
||||
JvmClosureGenerationScheme.INDY
|
||||
else
|
||||
else {
|
||||
// TODO wait for KT-44844 (properly support 'invokedynamic' in JPS incremental compilation)
|
||||
// Use JvmClosureGenerationScheme.INDY if
|
||||
// JVM target is at least JVM_1_8 &&
|
||||
// SamWrapperClassesAreSynthetic language feature is supported
|
||||
JvmClosureGenerationScheme.CLASS
|
||||
}
|
||||
}
|
||||
|
||||
val lambdasScheme = run {
|
||||
@@ -245,6 +243,7 @@ class GenerationState private constructor(
|
||||
this.moduleName,
|
||||
languageVersionSettings,
|
||||
useOldManglingSchemeForFunctionsWithInlineClassesInSignatures,
|
||||
IncompatibleClassTrackerImpl(extraJvmDiagnosticsTrace),
|
||||
target,
|
||||
isIrBackend
|
||||
)
|
||||
@@ -321,7 +320,8 @@ class GenerationState private constructor(
|
||||
|
||||
val metadataVersion =
|
||||
configuration.get(CommonConfigurationKeys.METADATA_VERSION)
|
||||
?: LANGUAGE_TO_METADATA_VERSION.getValue(languageVersionSettings.languageVersion)
|
||||
?: if (languageVersionSettings.languageVersion >= LanguageVersion.LATEST_STABLE) JvmMetadataVersion.INSTANCE
|
||||
else JvmMetadataVersion(1, 1, 18)
|
||||
|
||||
val abiStability = configuration.get(JVMConfigurationKeys.ABI_STABILITY)
|
||||
|
||||
@@ -392,24 +392,6 @@ class GenerationState private constructor(
|
||||
|
||||
private fun shouldOnlyCollectSignatures(origin: JvmDeclarationOrigin) =
|
||||
classBuilderMode == ClassBuilderMode.LIGHT_CLASSES && origin.originKind in doNotGenerateInLightClassMode
|
||||
|
||||
companion object {
|
||||
private val LANGUAGE_TO_METADATA_VERSION = EnumMap<LanguageVersion, JvmMetadataVersion>(LanguageVersion::class.java).apply {
|
||||
val oldMetadataVersion = JvmMetadataVersion(1, 1, 18)
|
||||
this[KOTLIN_1_0] = oldMetadataVersion
|
||||
this[KOTLIN_1_1] = oldMetadataVersion
|
||||
this[KOTLIN_1_2] = oldMetadataVersion
|
||||
this[KOTLIN_1_3] = oldMetadataVersion
|
||||
this[KOTLIN_1_4] = JvmMetadataVersion(1, 4, 3)
|
||||
this[KOTLIN_1_5] = JvmMetadataVersion.INSTANCE
|
||||
this[KOTLIN_1_6] = JvmMetadataVersion(1, 6, 0)
|
||||
|
||||
check(size == LanguageVersion.values().size) {
|
||||
"Please add mappings from the missing LanguageVersion instances to the corresponding JvmMetadataVersion " +
|
||||
"in `GenerationState.LANGUAGE_TO_METADATA_VERSION`"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val doNotGenerateInLightClassMode = setOf(CLASS_MEMBER_DELEGATION_TO_DEFAULT_IMPL, BRIDGE, COLLECTION_STUB, AUGMENTED_BUILTIN_API)
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen.state
|
||||
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData
|
||||
import org.jetbrains.kotlin.util.slicedMap.Slices
|
||||
import org.jetbrains.kotlin.util.slicedMap.WritableSlice
|
||||
|
||||
interface IncompatibleClassTracker {
|
||||
fun record(binaryClass: KotlinJvmBinaryClass)
|
||||
|
||||
object DoNothing : IncompatibleClassTracker {
|
||||
override fun record(binaryClass: KotlinJvmBinaryClass) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class IncompatibleClassTrackerImpl(val trace: BindingTrace) : IncompatibleClassTracker {
|
||||
private val classes = linkedSetOf<String>()
|
||||
|
||||
override fun record(binaryClass: KotlinJvmBinaryClass) {
|
||||
if (classes.add(binaryClass.location)) {
|
||||
val errorData = IncompatibleVersionErrorData(
|
||||
binaryClass.classHeader.bytecodeVersion,
|
||||
JvmBytecodeBinaryVersion.INSTANCE,
|
||||
binaryClass.location,
|
||||
binaryClass.classId
|
||||
)
|
||||
trace.record(BYTECODE_VERSION_ERRORS, binaryClass.location, errorData)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val BYTECODE_VERSION_ERRORS: WritableSlice<String, IncompatibleVersionErrorData<JvmBytecodeBinaryVersion>> = Slices.createCollectiveSlice()
|
||||
}
|
||||
}
|
||||
@@ -87,6 +87,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
private val moduleName: String,
|
||||
val languageVersionSettings: LanguageVersionSettings,
|
||||
private val useOldInlineClassesManglingScheme: Boolean,
|
||||
private val incompatibleClassTracker: IncompatibleClassTracker = IncompatibleClassTracker.DoNothing,
|
||||
val jvmTarget: JvmTarget = JvmTarget.DEFAULT,
|
||||
private val isIrBackend: Boolean = false,
|
||||
private val typePreprocessor: ((KotlinType) -> KotlinType?)? = null,
|
||||
@@ -493,8 +494,9 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
boxInlineClassBeforeInvoke = true
|
||||
}
|
||||
else -> {
|
||||
invokeOpcode =
|
||||
if (superCall || DescriptorVisibilities.isPrivate(functionDescriptor.visibility)) INVOKESPECIAL else INVOKEVIRTUAL
|
||||
val isPrivateFunInvocation =
|
||||
DescriptorVisibilities.isPrivate(functionDescriptor.visibility) && !functionDescriptor.isSuspend
|
||||
invokeOpcode = if (superCall || isPrivateFunInvocation) INVOKESPECIAL else INVOKEVIRTUAL
|
||||
isInterfaceMember = false
|
||||
}
|
||||
}
|
||||
@@ -843,6 +845,8 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
skipGenericSignature: Boolean,
|
||||
hasSpecialBridge: Boolean
|
||||
): JvmMethodGenericSignature {
|
||||
checkOwnerCompatibility(f)
|
||||
|
||||
val sw = if (skipGenericSignature || f is AccessorForCallableDescriptor<*>)
|
||||
JvmSignatureWriter()
|
||||
else
|
||||
@@ -965,6 +969,15 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkOwnerCompatibility(descriptor: FunctionDescriptor) {
|
||||
val ownerClass = descriptor.getContainingKotlinJvmBinaryClass() ?: return
|
||||
|
||||
val version = ownerClass.classHeader.bytecodeVersion
|
||||
if (!version.isCompatible()) {
|
||||
incompatibleClassTracker.record(ownerClass)
|
||||
}
|
||||
}
|
||||
|
||||
fun mapDefaultMethod(functionDescriptor: FunctionDescriptor, kind: OwnerKind): Method {
|
||||
val jvmSignature = mapAsmMethod(functionDescriptor, kind)
|
||||
val ownerType = mapOwner(functionDescriptor)
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.jetbrains.kotlin.codegen
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.config.JvmAnalysisFlags
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.org.objectweb.asm.AnnotationVisitor
|
||||
|
||||
fun writeKotlinMetadata(
|
||||
@@ -32,9 +32,7 @@ fun writeKotlinMetadata(
|
||||
) {
|
||||
val av = cb.newAnnotation(JvmAnnotationNames.METADATA_DESC, true)
|
||||
av.visit(JvmAnnotationNames.METADATA_VERSION_FIELD_NAME, state.metadataVersion.toArray())
|
||||
if (!state.metadataVersion.isAtLeast(1, 5, 0)) {
|
||||
av.visit("bv", JvmBytecodeBinaryVersion.INSTANCE.toArray())
|
||||
}
|
||||
av.visit(JvmAnnotationNames.BYTECODE_VERSION_FIELD_NAME, JvmBytecodeBinaryVersion.INSTANCE.toArray())
|
||||
av.visit(JvmAnnotationNames.KIND_FIELD_NAME, kind.id)
|
||||
var flags = extraFlags
|
||||
if (state.languageVersionSettings.isPreRelease()) {
|
||||
|
||||
@@ -65,7 +65,6 @@ dependencies {
|
||||
testRuntimeOnly(intellijPluginDep("java"))
|
||||
|
||||
testRuntime(project(":kotlin-reflect"))
|
||||
testRuntime(androidDxJar())
|
||||
testRuntime(toolsJar())
|
||||
|
||||
antLauncherJar(commonDep("org.apache.ant", "ant"))
|
||||
@@ -87,7 +86,7 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
idea {
|
||||
this.module.generatedSourceDirs.add(generationRoot)
|
||||
}
|
||||
} else if (!kotlinBuildProperties.disableWerror) {
|
||||
} else if (!kotlinBuildProperties.useFir && !kotlinBuildProperties.disableWerror) {
|
||||
allprojects {
|
||||
tasks.withType<KotlinCompile<*>> {
|
||||
if (path !in tasksWithWarnings) {
|
||||
|
||||
@@ -30,7 +30,6 @@ dependencies {
|
||||
compile(project(":compiler:fir:checkers"))
|
||||
compile(project(":kotlin-util-klib"))
|
||||
compile(project(":kotlin-util-io"))
|
||||
compile(project(":compiler:ir.serialization.common"))
|
||||
|
||||
// TODO: as soon as cli-jvm is extracted out of this module, move this dependency there
|
||||
compileOnly(project(":compiler:ir.tree.impl"))
|
||||
|
||||
@@ -16,54 +16,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.cli.common
|
||||
|
||||
import com.intellij.util.LineSeparator
|
||||
import java.util.*
|
||||
val KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY = "kotlin.environment.keepalive"
|
||||
|
||||
enum class CompilerSystemProperties(val property: String) {
|
||||
COMPILE_DAEMON_ENABLED_PROPERTY("kotlin.daemon.enabled"),
|
||||
COMPILE_DAEMON_JVM_OPTIONS_PROPERTY("kotlin.daemon.jvm.options"),
|
||||
COMPILE_DAEMON_OPTIONS_PROPERTY("kotlin.daemon.options"),
|
||||
COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY("kotlin.daemon.client.options"),
|
||||
COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY("kotlin.daemon.client.alive.path"),
|
||||
COMPILE_DAEMON_LOG_PATH_PROPERTY("kotlin.daemon.log.path"),
|
||||
COMPILE_DAEMON_REPORT_PERF_PROPERTY("kotlin.daemon.perf"),
|
||||
COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY("kotlin.daemon.verbose"),
|
||||
COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY("kotlin.daemon.startup.timeout"),
|
||||
JAVA_RMI_SERVER_HOSTNAME("java.rmi.server.hostname"),
|
||||
DAEMON_RMI_SOCKET_BACKLOG_SIZE_PROPERTY("kotlin.daemon.socket.backlog.size"),
|
||||
DAEMON_RMI_SOCKET_CONNECT_ATTEMPTS_PROPERTY("kotlin.daemon.socket.connect.attempts"),
|
||||
DAEMON_RMI_SOCKET_CONNECT_INTERVAL_PROPERTY("kotlin.daemon.socket.connect.interval"),
|
||||
KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY("kotlin.environment.keepalive"),
|
||||
COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS("kotlin.daemon.custom.run.files.path.for.tests"),
|
||||
KOTLIN_COLORS_ENABLED_PROPERTY("kotlin.colors.enabled"),
|
||||
OS_NAME("os.name")
|
||||
;
|
||||
|
||||
var value
|
||||
get() = systemPropertyGetter(property)
|
||||
set(value) {
|
||||
systemPropertySetter(property, value!!)
|
||||
}
|
||||
|
||||
fun clear(): String? = systemPropertyCleaner(property)
|
||||
|
||||
companion object {
|
||||
var systemPropertyGetter: (String) -> String? = {
|
||||
System.getProperty(it)
|
||||
}
|
||||
|
||||
var systemPropertySetter: (String, String) -> String? = { key, value ->
|
||||
System.setProperty(key, value)
|
||||
}
|
||||
|
||||
var systemPropertyCleaner: (String) -> String? = { key ->
|
||||
System.clearProperty(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val isWindows: Boolean
|
||||
get() = CompilerSystemProperties.OS_NAME.value!!.toLowerCase(Locale.ENGLISH).startsWith("windows")
|
||||
|
||||
fun String?.toBooleanLenient(): Boolean? = when (this?.toLowerCase()) {
|
||||
null -> false
|
||||
|
||||
@@ -351,6 +351,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
)
|
||||
var inferenceCompatibility: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xsuppress-version-warnings",
|
||||
description = "Suppress warnings about outdated, inconsistent or experimental language or API versions"
|
||||
)
|
||||
var suppressVersionWarnings: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xextended-compiler-checks",
|
||||
description = "Enable additional compiler checks that might provide verbose diagnostic information for certain errors.\n" +
|
||||
@@ -504,9 +510,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
val apiVersion = parseVersion(collector, apiVersion, "API") ?: languageVersion
|
||||
|
||||
checkApiVersionIsNotGreaterThenLanguageVersion(languageVersion, apiVersion, collector)
|
||||
checkLanguageVersionIsStable(languageVersion, collector)
|
||||
checkOutdatedVersions(languageVersion, apiVersion, collector)
|
||||
checkProgressiveMode(languageVersion, collector)
|
||||
|
||||
val languageVersionSettings = LanguageVersionSettingsImpl(
|
||||
languageVersion,
|
||||
@@ -515,7 +518,13 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
configureLanguageFeatures(collector)
|
||||
)
|
||||
|
||||
checkIrSupport(languageVersionSettings, collector)
|
||||
if (!suppressVersionWarnings) {
|
||||
checkLanguageVersionIsStable(languageVersion, collector)
|
||||
checkOutdatedVersions(languageVersion, apiVersion, collector)
|
||||
checkProgressiveMode(languageVersion, collector)
|
||||
|
||||
checkIrSupport(languageVersionSettings, collector)
|
||||
}
|
||||
|
||||
return languageVersionSettings
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.cli.common.arguments
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.*
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.CALL
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.NO_CALL
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.config.ApiVersion
|
||||
@@ -125,13 +126,6 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(value = "-Xir-dce", description = "Perform experimental dead code elimination")
|
||||
var irDce: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xir-dce-runtime-diagnostic",
|
||||
valueDescription = "{$DCE_RUNTIME_DIAGNOSTIC_LOG|$DCE_RUNTIME_DIAGNOSTIC_EXCEPTION}",
|
||||
description = "Enable runtime diagnostics when performing DCE instead of removing declarations"
|
||||
)
|
||||
var irDceRuntimeDiagnostic: String? by NullableStringFreezableVar(null)
|
||||
|
||||
@Argument(value = "-Xir-dce-driven", description = "Perform a more experimental faster dead code elimination")
|
||||
var irDceDriven: Boolean by FreezableVar(false)
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(
|
||||
value = "-jvm-target",
|
||||
valueDescription = "<version>",
|
||||
description = "Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, 11, 12, 13, 14, 15 or 16), default is 1.8"
|
||||
description = "Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, 11, 12, 13, 14 or 15), default is 1.8"
|
||||
)
|
||||
var jvmTarget: String? by NullableStringFreezableVar(JvmTarget.DEFAULT.description)
|
||||
|
||||
@@ -84,12 +84,8 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
|
||||
// Advanced options
|
||||
|
||||
@DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.WARNING)
|
||||
@GradleOption(DefaultValues.BooleanFalseDefault::class)
|
||||
@Argument(
|
||||
value = "-Xuse-ir",
|
||||
description = "Use the IR backend. This option has no effect unless the language version less than 1.5 is used"
|
||||
)
|
||||
@Argument(value = "-Xuse-ir", description = "Use the IR backend")
|
||||
var useIR: Boolean by FreezableVar(false)
|
||||
|
||||
@GradleOption(DefaultValues.BooleanFalseDefault::class)
|
||||
@@ -365,9 +361,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
description = """Select code generation scheme for string concatenation.
|
||||
-Xstring-concat=indy-with-constants Concatenate strings using `invokedynamic` `makeConcatWithConstants`. Requires `-jvm-target 9` or greater.
|
||||
-Xstring-concat=indy Concatenate strings using `invokedynamic` `makeConcat`. Requires `-jvm-target 9` or greater.
|
||||
-Xstring-concat=inline Concatenate strings using `StringBuilder`
|
||||
default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise"""
|
||||
|
||||
-Xstring-concat=inline Concatenate strings using `StringBuilder`"""
|
||||
)
|
||||
var stringConcat: String? by NullableStringFreezableVar(JvmStringConcat.INLINE.description)
|
||||
|
||||
@@ -463,14 +457,6 @@ default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise""
|
||||
)
|
||||
var suppressDeprecatedJvmTargetWarning: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xtype-enhancement-improvements-strict-mode",
|
||||
description = "Enable strict mode for some improvements in the type enhancement for loaded Java types based on nullability annotations," +
|
||||
"including freshly supported reading of the type use annotations from class files. " +
|
||||
"See KT-45671 for more details"
|
||||
)
|
||||
var typeEnhancementImprovementsInStrictMode: Boolean by FreezableVar(false)
|
||||
|
||||
override fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
|
||||
val result = super.configureAnalysisFlags(collector)
|
||||
result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics
|
||||
@@ -493,7 +479,6 @@ default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise""
|
||||
result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview
|
||||
result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useFir
|
||||
result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses
|
||||
result[JvmAnalysisFlags.useIR] = !useOldBackend
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -502,9 +487,6 @@ default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise""
|
||||
if (strictJavaNullabilityAssertions) {
|
||||
result[LanguageFeature.StrictJavaNullabilityAssertions] = LanguageFeature.State.ENABLED
|
||||
}
|
||||
if (typeEnhancementImprovementsInStrictMode) {
|
||||
result[LanguageFeature.TypeEnhancementImprovementsInStrictMode] = LanguageFeature.State.ENABLED
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,4 @@ public interface K2JsArgumentConstants {
|
||||
String SOURCE_MAP_SOURCE_CONTENT_ALWAYS = "always";
|
||||
String SOURCE_MAP_SOURCE_CONTENT_NEVER = "never";
|
||||
String SOURCE_MAP_SOURCE_CONTENT_INLINING = "inlining";
|
||||
|
||||
String DCE_RUNTIME_DIAGNOSTIC_LOG = "log";
|
||||
String DCE_RUNTIME_DIAGNOSTIC_EXCEPTION = "exception";
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import org.jetbrains.kotlin.cli.common.ExitCode.COMPILATION_ERROR
|
||||
import org.jetbrains.kotlin.cli.common.ExitCode.OK
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.*
|
||||
import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoot
|
||||
import org.jetbrains.kotlin.cli.common.extensions.ScriptEvaluationExtension
|
||||
import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport
|
||||
@@ -193,21 +192,17 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
require(outputFile.extension == KLIB_FILE_EXTENSION) { "Please set up .klib file as output" }
|
||||
}
|
||||
|
||||
try {
|
||||
generateKLib(
|
||||
project = config.project,
|
||||
files = sourcesFiles,
|
||||
analyzer = AnalyzerWithCompilerReport(config.configuration),
|
||||
configuration = config.configuration,
|
||||
allDependencies = resolvedLibraries,
|
||||
friendDependencies = friendDependencies,
|
||||
irFactory = PersistentIrFactory,
|
||||
outputKlibPath = outputFile.path,
|
||||
nopack = arguments.irProduceKlibDir
|
||||
)
|
||||
} catch (e: JsIrCompilationError) {
|
||||
return COMPILATION_ERROR
|
||||
}
|
||||
generateKLib(
|
||||
project = config.project,
|
||||
files = sourcesFiles,
|
||||
analyzer = AnalyzerWithCompilerReport(config.configuration),
|
||||
configuration = config.configuration,
|
||||
allDependencies = resolvedLibraries,
|
||||
friendDependencies = friendDependencies,
|
||||
irFactory = PersistentIrFactory,
|
||||
outputKlibPath = outputFile.path,
|
||||
nopack = arguments.irProduceKlibDir
|
||||
)
|
||||
}
|
||||
|
||||
if (arguments.irProduceJs) {
|
||||
@@ -253,31 +248,22 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
return OK
|
||||
}
|
||||
|
||||
val compiledModule = try {
|
||||
compile(
|
||||
projectJs,
|
||||
mainModule,
|
||||
AnalyzerWithCompilerReport(config.configuration),
|
||||
config.configuration,
|
||||
phaseConfig,
|
||||
allDependencies = resolvedLibraries,
|
||||
friendDependencies = friendDependencies,
|
||||
mainArguments = mainCallArguments,
|
||||
generateFullJs = !arguments.irDce,
|
||||
generateDceJs = arguments.irDce,
|
||||
dceRuntimeDiagnostic = DceRuntimeDiagnostic.resolve(
|
||||
arguments.irDceRuntimeDiagnostic,
|
||||
messageCollector
|
||||
),
|
||||
dceDriven = arguments.irDceDriven,
|
||||
multiModule = arguments.irPerModule,
|
||||
relativeRequirePath = true,
|
||||
propertyLazyInitialization = arguments.irPropertyLazyInitialization,
|
||||
)
|
||||
} catch (e: JsIrCompilationError) {
|
||||
return COMPILATION_ERROR
|
||||
}
|
||||
|
||||
val compiledModule = compile(
|
||||
projectJs,
|
||||
mainModule,
|
||||
AnalyzerWithCompilerReport(config.configuration),
|
||||
config.configuration,
|
||||
phaseConfig,
|
||||
allDependencies = resolvedLibraries,
|
||||
friendDependencies = friendDependencies,
|
||||
mainArguments = mainCallArguments,
|
||||
generateFullJs = !arguments.irDce,
|
||||
generateDceJs = arguments.irDce,
|
||||
dceDriven = arguments.irDceDriven,
|
||||
multiModule = arguments.irPerModule,
|
||||
relativeRequirePath = true,
|
||||
propertyLazyInitialization = arguments.irPropertyLazyInitialization,
|
||||
)
|
||||
|
||||
val jsCode = if (arguments.irDce && !arguments.irDceDriven) compiledModule.dceJsCode!! else compiledModule.jsCode!!
|
||||
outputFile.writeText(jsCode.mainModule)
|
||||
@@ -436,19 +422,6 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
}
|
||||
}
|
||||
|
||||
fun DceRuntimeDiagnostic.Companion.resolve(
|
||||
value: String?,
|
||||
messageCollector: MessageCollector
|
||||
): DceRuntimeDiagnostic? = when (value?.toLowerCase()) {
|
||||
DCE_RUNTIME_DIAGNOSTIC_LOG -> DceRuntimeDiagnostic.LOG
|
||||
DCE_RUNTIME_DIAGNOSTIC_EXCEPTION -> DceRuntimeDiagnostic.EXCEPTION
|
||||
null -> null
|
||||
else -> {
|
||||
messageCollector.report(STRONG_WARNING, "Unknown DCE runtime diagnostic '$value'")
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
fun messageCollectorLogger(collector: MessageCollector) = object : Logger {
|
||||
override fun warning(message: String) = collector.report(STRONG_WARNING, message)
|
||||
override fun error(message: String) = collector.report(ERROR, message)
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij;
|
||||
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.AbstractExtensionPointBean;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public abstract class DynamicBundle extends AbstractBundle {
|
||||
private final static Logger LOG = Logger.getInstance(DynamicBundle.class);
|
||||
|
||||
protected DynamicBundle(@NotNull String pathToBundle) {
|
||||
super(pathToBundle);
|
||||
}
|
||||
|
||||
// see BundleUtil
|
||||
@Override
|
||||
protected ResourceBundle findBundle(@NotNull String pathToBundle,
|
||||
@NotNull ClassLoader baseLoader,
|
||||
@NotNull ResourceBundle.Control control) {
|
||||
ResourceBundle base = super.findBundle(pathToBundle, baseLoader, control);
|
||||
|
||||
LanguageBundleEP langBundle = findLanguageBundle();
|
||||
if (langBundle == null) return base;
|
||||
|
||||
ResourceBundle pluginBundle = super.findBundle(pathToBundle, langBundle.getLoaderForClass(), control);
|
||||
if (pluginBundle == null) return base;
|
||||
|
||||
try {
|
||||
if (DynamicBundleInternal.SET_PARENT != null) {
|
||||
DynamicBundleInternal.SET_PARENT.invoke(pluginBundle, base);
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.warn(e);
|
||||
return base;
|
||||
}
|
||||
return pluginBundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* "SET_PARENT" has been temporary moved into the internal class to fix Kotlin compiler.
|
||||
* It's to be refactored with "ResourceBundleProvider" since 'core-api' module will use java 1.9+
|
||||
*/
|
||||
private static class DynamicBundleInternal {
|
||||
private static final MethodHandle SET_PARENT;
|
||||
|
||||
static {
|
||||
try {
|
||||
Method method = ResourceBundle.class.getDeclaredMethod("setParent", ResourceBundle.class);
|
||||
method.setAccessible(true);
|
||||
SET_PARENT = MethodHandles.lookup().unreflect(method);
|
||||
}
|
||||
catch (NoSuchMethodException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// todo: one language per application
|
||||
@Nullable
|
||||
private static LanguageBundleEP findLanguageBundle() {
|
||||
try {
|
||||
Application application = ApplicationManager.getApplication();
|
||||
if (application == null) return null;
|
||||
if (application.isUnitTestMode() && !application.getExtensionArea().hasExtensionPoint(LanguageBundleEP.EP_NAME)) {
|
||||
return null;
|
||||
}
|
||||
return LanguageBundleEP.EP_NAME.findExtension(LanguageBundleEP.class);
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static final DynamicBundle INSTANCE = new DynamicBundle("") {
|
||||
};
|
||||
|
||||
public static class LanguageBundleEP extends AbstractExtensionPointBean {
|
||||
public static final ExtensionPointName<LanguageBundleEP> EP_NAME = ExtensionPointName.create("com.intellij.languageBundle");
|
||||
}
|
||||
|
||||
private static final Map<String, DynamicBundle> ourBundlesForForms = ContainerUtil.createConcurrentSoftValueMap();
|
||||
|
||||
/**
|
||||
* @deprecated used only dy GUI form builder
|
||||
*/
|
||||
@Deprecated
|
||||
public static ResourceBundle getBundle(@NotNull String baseName) {
|
||||
Class<?> callerClass = ReflectionUtil.findCallerClass(2);
|
||||
return getBundle(baseName, callerClass == null ? DynamicBundle.class : callerClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated used only dy GUI form builder
|
||||
*/
|
||||
@Deprecated
|
||||
public static ResourceBundle getBundle(@NotNull String baseName, @NotNull Class<?> formClass) {
|
||||
DynamicBundle dynamic = ourBundlesForForms.computeIfAbsent(baseName, s -> new DynamicBundle(s) {});
|
||||
ResourceBundle rb = dynamic.getResourceBundle(formClass.getClassLoader());
|
||||
|
||||
if (BundleBase.SHOW_LOCALIZED_MESSAGES) {
|
||||
return new ResourceBundle() {
|
||||
@Override
|
||||
protected Object handleGetObject(@NotNull String key) {
|
||||
Object get = rb.getObject(key);
|
||||
assert get instanceof String : "Language bundles should contain only strings";
|
||||
return BundleBase.appendLocalizationMarker((String)get);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Enumeration<String> getKeys() {
|
||||
return rb.getKeys();
|
||||
}
|
||||
};
|
||||
}
|
||||
return rb;
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser
|
||||
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.Services
|
||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
|
||||
import org.jetbrains.kotlin.progress.CompilationCanceledException
|
||||
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
||||
@@ -39,7 +40,7 @@ import org.jetbrains.kotlin.utils.KotlinPaths
|
||||
import org.jetbrains.kotlin.utils.PathUtil
|
||||
import java.io.File
|
||||
import java.io.PrintStream
|
||||
import java.util.ArrayList
|
||||
import java.util.*
|
||||
|
||||
abstract class CLICompiler<A : CommonCompilerArguments> : CLITool<A>() {
|
||||
|
||||
@@ -69,6 +70,8 @@ abstract class CLICompiler<A : CommonCompilerArguments> : CLITool<A>() {
|
||||
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, it)
|
||||
}
|
||||
|
||||
configuration.put(IrMessageLogger.IR_MESSAGE_LOGGER, IrMessageCollector(collector))
|
||||
|
||||
configuration.put(CLIConfigurationKeys.PERF_MANAGER, performanceManager)
|
||||
try {
|
||||
setupCommonArguments(configuration, arguments)
|
||||
|
||||
@@ -205,8 +205,8 @@ abstract class CLITool<A : CommonToolArguments> {
|
||||
if (System.getProperty("java.awt.headless") == null) {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
}
|
||||
if (CompilerSystemProperties.KOTLIN_COLORS_ENABLED_PROPERTY.value == null) {
|
||||
CompilerSystemProperties.KOTLIN_COLORS_ENABLED_PROPERTY.value = "true"
|
||||
if (System.getProperty(PlainTextMessageRenderer.KOTLIN_COLORS_ENABLED_PROPERTY) == null) {
|
||||
System.setProperty(PlainTextMessageRenderer.KOTLIN_COLORS_ENABLED_PROPERTY, "true")
|
||||
}
|
||||
|
||||
setupIdeaStandaloneExecution()
|
||||
|
||||
@@ -22,6 +22,7 @@ abstract class CommonCompilerPerformanceManager(private val presentableName: Str
|
||||
private var startGCData = mutableMapOf<String, GCData>()
|
||||
|
||||
private var irTranslationStart: Long = 0
|
||||
private var irLoweringStart: Long = 0
|
||||
private var irGenerationStart: Long = 0
|
||||
|
||||
private var targetDescription: String? = null
|
||||
@@ -88,6 +89,19 @@ abstract class CommonCompilerPerformanceManager(private val presentableName: Str
|
||||
)
|
||||
}
|
||||
|
||||
open fun notifyIRLoweringStarted() {
|
||||
irLoweringStart = PerformanceCounter.currentTime()
|
||||
}
|
||||
|
||||
open fun notifyIRLoweringFinished() {
|
||||
val time = deltaTime(irLoweringStart)
|
||||
measurements += IRMeasurement(
|
||||
lines,
|
||||
TimeUnit.NANOSECONDS.toMillis(time),
|
||||
IRMeasurement.Kind.LOWERING
|
||||
)
|
||||
}
|
||||
|
||||
open fun notifyIRGenerationStarted() {
|
||||
irGenerationStart = PerformanceCounter.currentTime()
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.cli.common.messages
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil.toSystemDependentName
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.util.PsiFormatUtil
|
||||
@@ -23,6 +24,7 @@ import org.jetbrains.kotlin.analyzer.AbstractAnalyzerWithCompilerReport
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.*
|
||||
import org.jetbrains.kotlin.codegen.state.IncompatibleClassTrackerImpl
|
||||
import org.jetbrains.kotlin.config.AnalysisFlags
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
@@ -31,12 +33,16 @@ import org.jetbrains.kotlin.diagnostics.*
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils.sortedDiagnostics
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages
|
||||
import org.jetbrains.kotlin.load.java.components.TraceBasedErrorReporter
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.AnalyzingUtils
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.checkers.ExperimentalUsageChecker
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmBindingContextSlices
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
import org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData
|
||||
|
||||
class AnalyzerWithCompilerReport(
|
||||
private val messageCollector: MessageCollector,
|
||||
@@ -240,5 +246,33 @@ class AnalyzerWithCompilerReport(
|
||||
fun reportSyntaxErrors(file: PsiElement, messageCollector: MessageCollector): SyntaxErrorReport {
|
||||
return reportSyntaxErrors(file, DefaultDiagnosticReporter(messageCollector))
|
||||
}
|
||||
|
||||
fun reportBytecodeVersionErrors(bindingContext: BindingContext, messageCollector: MessageCollector) {
|
||||
val severity =
|
||||
if (System.getProperty("kotlin.jvm.disable.bytecode.version.error") == "true") STRONG_WARNING
|
||||
else ERROR
|
||||
|
||||
val locations = bindingContext.getKeys(IncompatibleClassTrackerImpl.BYTECODE_VERSION_ERRORS)
|
||||
if (locations.isEmpty()) return
|
||||
|
||||
for (location in locations) {
|
||||
val data = bindingContext.get(IncompatibleClassTrackerImpl.BYTECODE_VERSION_ERRORS, location)
|
||||
?: error("Value is missing for key in binding context: $location")
|
||||
reportIncompatibleBinaryVersion(messageCollector, data, severity)
|
||||
}
|
||||
}
|
||||
|
||||
private fun reportIncompatibleBinaryVersion(
|
||||
messageCollector: MessageCollector,
|
||||
data: IncompatibleVersionErrorData<JvmBytecodeBinaryVersion>,
|
||||
severity: CompilerMessageSeverity
|
||||
) {
|
||||
messageCollector.report(
|
||||
severity,
|
||||
"Class '" + JvmClassName.byClassId(data.classId) + "' was compiled with an incompatible version of Kotlin. " +
|
||||
"The binary version of its bytecode is " + data.actualVersion + ", expected version is " + data.expectedVersion,
|
||||
CompilerMessageLocation.create(toSystemDependentName(data.filePath))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.cli.common.messages
|
||||
|
||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||
|
||||
class IrMessageCollector(private val messageCollector: MessageCollector) : IrMessageLogger {
|
||||
override fun report(severity: IrMessageLogger.Severity, message: String, location: IrMessageLogger.Location?) {
|
||||
messageCollector.report(severityToCLISeverity(severity), message, locationToCLILocation(location))
|
||||
}
|
||||
|
||||
companion object {
|
||||
private fun severityToCLISeverity(severity: IrMessageLogger.Severity): CompilerMessageSeverity {
|
||||
return when (severity) {
|
||||
IrMessageLogger.Severity.INFO -> CompilerMessageSeverity.INFO
|
||||
IrMessageLogger.Severity.WARNING -> CompilerMessageSeverity.WARNING
|
||||
IrMessageLogger.Severity.ERROR -> CompilerMessageSeverity.ERROR
|
||||
}
|
||||
}
|
||||
|
||||
private fun locationToCLILocation(location: IrMessageLogger.Location?): CompilerMessageLocation? {
|
||||
return location?.run {
|
||||
CompilerMessageLocation.Companion.create(filePath, line, column, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
package org.jetbrains.kotlin.cli.common.messages;
|
||||
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.util.LineSeparator;
|
||||
import kotlin.text.StringsKt;
|
||||
import org.fusesource.jansi.Ansi;
|
||||
import org.fusesource.jansi.internal.CLibrary;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties;
|
||||
import org.jetbrains.kotlin.cli.common.PropertiesKt;
|
||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.CapitalizeDecapitalizeKt;
|
||||
|
||||
import java.util.EnumSet;
|
||||
@@ -31,12 +31,13 @@ import java.util.Set;
|
||||
import static org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.*;
|
||||
|
||||
public abstract class PlainTextMessageRenderer implements MessageRenderer {
|
||||
public static final String KOTLIN_COLORS_ENABLED_PROPERTY = "kotlin.colors.enabled";
|
||||
public static final boolean COLOR_ENABLED;
|
||||
|
||||
static {
|
||||
boolean colorEnabled = false;
|
||||
// TODO: investigate why ANSI escape codes on Windows only work in REPL for some reason
|
||||
if (!PropertiesKt.isWindows() && "true".equals(CompilerSystemProperties.KOTLIN_COLORS_ENABLED_PROPERTY.getValue())) {
|
||||
if (!SystemInfo.isWindows && "true".equals(System.getProperty(KOTLIN_COLORS_ENABLED_PROPERTY))) {
|
||||
try {
|
||||
// AnsiConsole doesn't check isatty() for stderr (see https://github.com/fusesource/jansi/pull/35).
|
||||
colorEnabled = CLibrary.isatty(CLibrary.STDERR_FILENO) != 0;
|
||||
@@ -48,7 +49,7 @@ public abstract class PlainTextMessageRenderer implements MessageRenderer {
|
||||
COLOR_ENABLED = colorEnabled;
|
||||
}
|
||||
|
||||
private static final String LINE_SEPARATOR = System.lineSeparator();
|
||||
private static final String LINE_SEPARATOR = LineSeparator.getSystemLineSeparator().getSeparatorString();
|
||||
|
||||
private static final Set<CompilerMessageSeverity> IMPORTANT_MESSAGE_SEVERITIES = EnumSet.of(EXCEPTION, ERROR, STRONG_WARNING, WARNING);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class IRMeasurement(val lines: Int?, val milliseconds: Long, val kind: Kind) : P
|
||||
override fun render(): String = formatMeasurement("IR $kind", milliseconds, lines)
|
||||
|
||||
enum class Kind {
|
||||
TRANSLATION, GENERATION
|
||||
TRANSLATION, LOWERING, GENERATION
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,11 +12,7 @@ import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.psi.search.PsiSearchScopeUtil
|
||||
import com.intellij.util.SmartList
|
||||
import org.jetbrains.kotlin.asJava.KotlinAsJavaSupport
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClass
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClassForScript
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration
|
||||
import org.jetbrains.kotlin.config.JvmAnalysisFlags
|
||||
import org.jetbrains.kotlin.asJava.classes.*
|
||||
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
|
||||
import org.jetbrains.kotlin.fileClasses.javaFileFacadeFqName
|
||||
import org.jetbrains.kotlin.load.java.components.FilesByFacadeFqNameIndexer
|
||||
@@ -82,6 +78,8 @@ class CliKotlinAsJavaSupport(
|
||||
}.orEmpty()
|
||||
}
|
||||
|
||||
override fun getFakeLightClass(classOrObject: KtClassOrObject): KtFakeLightClass =
|
||||
KtDescriptorBasedFakeLightClass(classOrObject)
|
||||
|
||||
override fun findClassOrObjectDeclarationsInPackage(
|
||||
packageFqName: FqName, searchScope: GlobalSearchScope
|
||||
@@ -111,7 +109,7 @@ class CliKotlinAsJavaSupport(
|
||||
}
|
||||
|
||||
override fun getLightClass(classOrObject: KtClassOrObject): KtLightClass? =
|
||||
KtLightClassForSourceDeclaration.create(classOrObject, traceHolder.languageVersionSettings.getFlag(JvmAnalysisFlags.jvmDefaultMode))
|
||||
KtLightClassForSourceDeclaration.create(classOrObject)
|
||||
|
||||
override fun getLightClassForScript(script: KtScript): KtLightClassForScript? =
|
||||
KtLightClassForScript.create(script)
|
||||
|
||||
@@ -58,7 +58,7 @@ import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
|
||||
import org.jetbrains.kotlin.cli.common.CliModuleVisibilityManagerImpl
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
|
||||
import org.jetbrains.kotlin.cli.common.config.ContentRoot
|
||||
import org.jetbrains.kotlin.cli.common.config.KotlinSourceRoot
|
||||
import org.jetbrains.kotlin.cli.common.config.kotlinSourceRoots
|
||||
@@ -283,7 +283,7 @@ class KotlinCoreEnvironment private constructor(
|
||||
|
||||
fun addKotlinSourceRoots(rootDirs: List<File>) {
|
||||
val roots = rootDirs.map { KotlinSourceRoot(it.absolutePath, isCommon = false) }
|
||||
sourceFiles += createSourceFilesFromSourceRoots(configuration, project, roots).toSet() - sourceFiles
|
||||
sourceFiles += createSourceFilesFromSourceRoots(configuration, project, roots)
|
||||
}
|
||||
|
||||
fun createPackagePartProvider(scope: GlobalSearchScope): JvmPackagePartProvider {
|
||||
@@ -498,13 +498,16 @@ class KotlinCoreEnvironment private constructor(
|
||||
}
|
||||
// Disposing of the environment is unsafe in production then parallel builds are enabled, but turning it off universally
|
||||
// breaks a lot of tests, therefore it is disabled for production and enabled for tests
|
||||
if (CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.value.toBooleanLenient() != true) {
|
||||
if (System.getProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY).toBooleanLenient() != true) {
|
||||
// JPS may run many instances of the compiler in parallel (there's an option for compiling independent modules in parallel in IntelliJ)
|
||||
// All projects share the same ApplicationEnvironment, and when the last project is disposed, the ApplicationEnvironment is disposed as well
|
||||
Disposer.register(parentDisposable, Disposable {
|
||||
synchronized(APPLICATION_LOCK) {
|
||||
if (--ourProjectCount <= 0) {
|
||||
disposeApplicationEnvironment()
|
||||
@Suppress("ObjectLiteralToLambda") // Disposer tree depends on identity of disposables.
|
||||
Disposer.register(parentDisposable, object : Disposable {
|
||||
override fun dispose() {
|
||||
synchronized(APPLICATION_LOCK) {
|
||||
if (--ourProjectCount <= 0) {
|
||||
disposeApplicationEnvironment()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -19,10 +19,11 @@ package org.jetbrains.kotlin.cli.jvm.compiler
|
||||
import com.intellij.core.JavaCoreProjectEnvironment
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.psi.PsiManager
|
||||
import org.jetbrains.kotlin.resolve.jvm.KotlinCliJavaFileManager
|
||||
|
||||
open class KotlinCoreProjectEnvironment(
|
||||
disposable: Disposable,
|
||||
applicationEnvironment: KotlinCoreApplicationEnvironment
|
||||
) : JavaCoreProjectEnvironment(disposable, applicationEnvironment) {
|
||||
override fun createCoreFileManager() = KotlinCliJavaFileManagerImpl(PsiManager.getInstance(project))
|
||||
override fun createCoreFileManager(): KotlinCliJavaFileManager = KotlinCliJavaFileManagerImpl(PsiManager.getInstance(project))
|
||||
}
|
||||
|
||||
@@ -387,10 +387,14 @@ object KotlinToJVMBytecodeCompiler {
|
||||
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||
|
||||
performanceManager?.notifyIRGenerationStarted()
|
||||
performanceManager?.notifyIRLoweringStarted()
|
||||
generationState.beforeCompile()
|
||||
codegenFactory.generateModuleInFrontendIRMode(
|
||||
generationState, moduleFragment, symbolTable, sourceManager, extensions, FirJvmBackendExtension(session, components)
|
||||
generationState, moduleFragment, symbolTable, sourceManager, extensions, FirJvmBackendExtension(session, components),
|
||||
{
|
||||
performanceManager?.notifyIRLoweringFinished()
|
||||
performanceManager?.notifyIRGenerationStarted()
|
||||
}
|
||||
)
|
||||
CodegenFactory.doCheckCancelled(generationState)
|
||||
generationState.factory.done()
|
||||
@@ -405,6 +409,10 @@ object KotlinToJVMBytecodeCompiler {
|
||||
environment.messageCollector
|
||||
)
|
||||
|
||||
AnalyzerWithCompilerReport.reportBytecodeVersionErrors(
|
||||
generationState.extraJvmDiagnosticsTrace.bindingContext, environment.messageCollector
|
||||
)
|
||||
|
||||
performanceManager?.notifyIRGenerationFinished()
|
||||
performanceManager?.notifyGenerationFinished()
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||
@@ -603,6 +611,10 @@ object KotlinToJVMBytecodeCompiler {
|
||||
environment.messageCollector
|
||||
)
|
||||
|
||||
AnalyzerWithCompilerReport.reportBytecodeVersionErrors(
|
||||
generationState.extraJvmDiagnosticsTrace.bindingContext, environment.messageCollector
|
||||
)
|
||||
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||
return generationState
|
||||
}
|
||||
|
||||
@@ -202,13 +202,11 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
|
||||
|
||||
put(JVMConfigurationKeys.PARAMETERS_METADATA, arguments.javaParameters)
|
||||
|
||||
// TODO: ignore previous configuration value when we do not need old backend in scripting by default
|
||||
val useOldBackend = arguments.useOldBackend || (!arguments.useIR && get(JVMConfigurationKeys.IR) == false)
|
||||
val useIR = arguments.useFir ||
|
||||
if (languageVersionSettings.supportsFeature(LanguageFeature.JvmIrEnabledByDefault)) {
|
||||
!useOldBackend
|
||||
!arguments.useOldBackend
|
||||
} else {
|
||||
arguments.useIR && !useOldBackend
|
||||
arguments.useIR && !arguments.useOldBackend
|
||||
}
|
||||
|
||||
if (arguments.useIR && arguments.useOldBackend) {
|
||||
|
||||
@@ -19,7 +19,7 @@ public class KotlinCompilerVersion {
|
||||
// Binaries produced by this compiler with that language version (or any future language version) are going to be marked
|
||||
// as "pre-release" and will not be loaded by release versions of the compiler.
|
||||
// Change this value before and after every major release
|
||||
private static final boolean IS_PRE_RELEASE = false;
|
||||
private static final boolean IS_PRE_RELEASE = true;
|
||||
|
||||
public static final String TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY = "kotlin.test.is.pre.release";
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ object JvmAnalysisFlags {
|
||||
@JvmStatic
|
||||
val enableJvmPreview by AnalysisFlag.Delegates.Boolean
|
||||
|
||||
@JvmStatic
|
||||
val useIR by AnalysisFlag.Delegates.Boolean
|
||||
|
||||
private object Delegates {
|
||||
object JavaTypeEnhancementStateWarnByDefault {
|
||||
operator fun provideDelegate(instance: Any?, property: KProperty<*>): AnalysisFlag.Delegate<JavaTypeEnhancementState> =
|
||||
|
||||
@@ -32,7 +32,6 @@ enum class JvmTarget(
|
||||
JVM_13("13", Opcodes.V12 + 1),
|
||||
JVM_14("14", Opcodes.V12 + 2),
|
||||
JVM_15("15", Opcodes.V12 + 3),
|
||||
JVM_16("16", Opcodes.V12 + 4),
|
||||
;
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -10,7 +10,6 @@ import kotlinx.coroutines.Deferred
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.daemon.client.CompileServiceSessionAsync
|
||||
@@ -45,13 +44,13 @@ class KotlinCompilerClient : KotlinCompilerDaemonClient {
|
||||
val DAEMON_DEFAULT_STARTUP_TIMEOUT_MS = 10000L
|
||||
val DAEMON_CONNECT_CYCLE_ATTEMPTS = 3
|
||||
|
||||
val verboseReporting = CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.value != null
|
||||
val verboseReporting = System.getProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY) != null
|
||||
|
||||
private val log = Logger.getLogger("KotlinCompilerClient")
|
||||
|
||||
override fun getOrCreateClientFlagFile(daemonOptions: DaemonOptions): File =
|
||||
// for jps property is passed from IDEA to JPS in KotlinBuildProcessParametersProvider
|
||||
CompilerSystemProperties.COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY.value
|
||||
System.getProperty(COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY)
|
||||
?.let(String::trimQuotes)
|
||||
?.takeUnless(String::isBlank)
|
||||
?.let(::File)
|
||||
@@ -211,6 +210,8 @@ class KotlinCompilerClient : KotlinCompilerDaemonClient {
|
||||
}
|
||||
}
|
||||
|
||||
val COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY: String = "kotlin.daemon.client.options"
|
||||
|
||||
data class ClientOptions(
|
||||
var stop: Boolean = false
|
||||
) : OptionsGroup {
|
||||
@@ -219,11 +220,11 @@ class KotlinCompilerClient : KotlinCompilerDaemonClient {
|
||||
}
|
||||
|
||||
private fun configureClientOptions(opts: ClientOptions): ClientOptions {
|
||||
CompilerSystemProperties.COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY.value?.let {
|
||||
System.getProperty(COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY)?.let {
|
||||
val unrecognized = it.trimQuotes().split(",").filterExtractProps(opts.mappers, "")
|
||||
if (unrecognized.any())
|
||||
throw IllegalArgumentException(
|
||||
"Unrecognized client options passed via property ${CompilerSystemProperties.COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY.property}: " + unrecognized.joinToString(" ") +
|
||||
"Unrecognized client options passed via property $COMPILE_DAEMON_OPTIONS_PROPERTY: " + unrecognized.joinToString(" ") +
|
||||
"\nSupported options: " + opts.mappers.joinToString(", ", transform = { it.names.first() })
|
||||
)
|
||||
}
|
||||
@@ -455,11 +456,11 @@ class KotlinCompilerClient : KotlinCompilerDaemonClient {
|
||||
reportingTargets: DaemonReportingTargets
|
||||
): Boolean {
|
||||
val javaExecutable = File(File(System.getProperty("java.home"), "bin"), "java")
|
||||
val serverHostname = CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.value ?: error("${CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.property} is not set!")
|
||||
val serverHostname = System.getProperty(JAVA_RMI_SERVER_HOSTNAME) ?: error("$JAVA_RMI_SERVER_HOSTNAME is not set!")
|
||||
val platformSpecificOptions = listOf(
|
||||
// hide daemon window
|
||||
"-Djava.awt.headless=true",
|
||||
"-D${CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.property}=$serverHostname"
|
||||
"-D$JAVA_RMI_SERVER_HOSTNAME=$serverHostname"
|
||||
)
|
||||
val args = listOf(
|
||||
javaExecutable.absolutePath, "-cp", compilerId.compilerClasspath.joinToString(File.pathSeparator)
|
||||
@@ -508,13 +509,13 @@ class KotlinCompilerClient : KotlinCompilerDaemonClient {
|
||||
}
|
||||
try {
|
||||
// trying to wait for process
|
||||
val daemonStartupTimeout = CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.value?.let {
|
||||
val daemonStartupTimeout = System.getProperty(COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY)?.let {
|
||||
try {
|
||||
it.toLong()
|
||||
} catch (e: Exception) {
|
||||
reportingTargets.report(
|
||||
DaemonReportCategory.INFO,
|
||||
"unable to interpret ${CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.property} property ('$it'); using default timeout $DAEMON_DEFAULT_STARTUP_TIMEOUT_MS ms"
|
||||
"unable to interpret $COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY property ('$it'); using default timeout $DAEMON_DEFAULT_STARTUP_TIMEOUT_MS ms"
|
||||
)
|
||||
null
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.daemon.client
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.daemon.common.*
|
||||
@@ -49,11 +48,11 @@ object KotlinCompilerClient {
|
||||
val DAEMON_DEFAULT_STARTUP_TIMEOUT_MS = 10000L
|
||||
val DAEMON_CONNECT_CYCLE_ATTEMPTS = 3
|
||||
|
||||
val verboseReporting = CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.value != null
|
||||
val verboseReporting = System.getProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY) != null
|
||||
|
||||
fun getOrCreateClientFlagFile(daemonOptions: DaemonOptions): File =
|
||||
// for jps property is passed from IDEA to JPS in KotlinBuildProcessParametersProvider
|
||||
CompilerSystemProperties.COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY.value
|
||||
System.getProperty(COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY)
|
||||
?.let(String::trimQuotes)
|
||||
?.takeUnless(String::isBlank)
|
||||
?.let(::File)
|
||||
@@ -212,6 +211,7 @@ object KotlinCompilerClient {
|
||||
).get()
|
||||
}
|
||||
|
||||
val COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY: String = "kotlin.daemon.client.options"
|
||||
data class ClientOptions(
|
||||
var stop: Boolean = false
|
||||
) : OptionsGroup {
|
||||
@@ -220,11 +220,11 @@ object KotlinCompilerClient {
|
||||
}
|
||||
|
||||
private fun configureClientOptions(opts: ClientOptions): ClientOptions {
|
||||
CompilerSystemProperties.COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY.value?.let {
|
||||
System.getProperty(COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY)?.let {
|
||||
val unrecognized = it.trimQuotes().split(",").filterExtractProps(opts.mappers, "")
|
||||
if (unrecognized.any())
|
||||
throw IllegalArgumentException(
|
||||
"Unrecognized client options passed via property ${CompilerSystemProperties.COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY.property}: " + unrecognized.joinToString(" ") +
|
||||
"Unrecognized client options passed via property $COMPILE_DAEMON_OPTIONS_PROPERTY: " + unrecognized.joinToString(" ") +
|
||||
"\nSupported options: " + opts.mappers.joinToString(", ", transform = { it.names.first() }))
|
||||
}
|
||||
return opts
|
||||
@@ -369,11 +369,11 @@ object KotlinCompilerClient {
|
||||
|
||||
private fun startDaemon(compilerId: CompilerId, daemonJVMOptions: DaemonJVMOptions, daemonOptions: DaemonOptions, reportingTargets: DaemonReportingTargets): Boolean {
|
||||
val javaExecutable = File(File(System.getProperty("java.home"), "bin"), "java")
|
||||
val serverHostname = CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.value ?: error("${CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.property} is not set!")
|
||||
val serverHostname = System.getProperty(JAVA_RMI_SERVER_HOSTNAME) ?: error("$JAVA_RMI_SERVER_HOSTNAME is not set!")
|
||||
val platformSpecificOptions = listOf(
|
||||
// hide daemon window
|
||||
"-Djava.awt.headless=true",
|
||||
"-D$${CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.property}=$serverHostname")
|
||||
"-D$JAVA_RMI_SERVER_HOSTNAME=$serverHostname")
|
||||
val javaVersion = System.getProperty("java.specification.version")?.toIntOrNull()
|
||||
val javaIllegalAccessWorkaround =
|
||||
if (javaVersion != null && javaVersion >= 16)
|
||||
@@ -424,12 +424,12 @@ object KotlinCompilerClient {
|
||||
}
|
||||
try {
|
||||
// trying to wait for process
|
||||
val daemonStartupTimeout = CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.value?.let {
|
||||
val daemonStartupTimeout = System.getProperty(COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY)?.let {
|
||||
try {
|
||||
it.toLong()
|
||||
}
|
||||
catch (e: Exception) {
|
||||
reportingTargets.report(DaemonReportCategory.INFO, "unable to interpret ${CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.property} property ('$it'); using default timeout $DAEMON_DEFAULT_STARTUP_TIMEOUT_MS ms")
|
||||
reportingTargets.report(DaemonReportCategory.INFO, "unable to interpret $COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY property ('$it'); using default timeout $DAEMON_DEFAULT_STARTUP_TIMEOUT_MS ms")
|
||||
null
|
||||
}
|
||||
} ?: DAEMON_DEFAULT_STARTUP_TIMEOUT_MS
|
||||
|
||||
@@ -56,10 +56,12 @@ class CompileServiceClientSideImpl(
|
||||
while (keepAliveSuccess()) {
|
||||
delay(KEEPALIVE_PERIOD - millisecondsSinceLastUsed())
|
||||
}
|
||||
runWithTimeout(timeout = KEEPALIVE_PERIOD / 2) {
|
||||
val keepAliveAcknowledgement = runWithTimeout(timeout = KEEPALIVE_PERIOD / 2) {
|
||||
val id = sendMessage(keepAliveMessage)
|
||||
readMessage<Server.KeepAliveAcknowledgement<*>>(id)
|
||||
} ?: if (!keepAliveSuccess()) readActor.send(StopAllRequests()).also {
|
||||
}
|
||||
if (keepAliveAcknowledgement == null && !keepAliveSuccess()) {
|
||||
readActor.send(StopAllRequests())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.daemon.common
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
|
||||
import java.io.File
|
||||
import java.io.Serializable
|
||||
import java.lang.management.ManagementFactory
|
||||
@@ -24,47 +24,53 @@ import java.security.MessageDigest
|
||||
import java.util.*
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
|
||||
const val COMPILER_JAR_NAME: String = "kotlin-compiler.jar"
|
||||
const val COMPILER_SERVICE_RMI_NAME: String = "KotlinJvmCompilerService"
|
||||
const val COMPILER_DAEMON_CLASS_FQN: String = "org.jetbrains.kotlin.daemon.KotlinCompileDaemon"
|
||||
const val COMPILE_DAEMON_FIND_PORT_ATTEMPTS: Int = 10
|
||||
const val COMPILE_DAEMON_PORTS_RANGE_START: Int = 17001
|
||||
const val COMPILE_DAEMON_PORTS_RANGE_END: Int = 18000
|
||||
const val COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX: String = "--daemon-"
|
||||
const val COMPILE_DAEMON_DEFAULT_FILES_PREFIX: String = "kotlin-daemon"
|
||||
const val COMPILE_DAEMON_TIMEOUT_INFINITE_S: Int = 0
|
||||
const val COMPILE_DAEMON_DEFAULT_IDLE_TIMEOUT_S: Int = 7200 // 2 hours
|
||||
const val COMPILE_DAEMON_DEFAULT_UNUSED_TIMEOUT_S: Int = 60
|
||||
const val COMPILE_DAEMON_DEFAULT_SHUTDOWN_DELAY_MS: Long = 1000L // 1 sec
|
||||
const val COMPILE_DAEMON_MEMORY_THRESHOLD_INFINITE: Long = 0L
|
||||
const val COMPILE_DAEMON_FORCE_SHUTDOWN_DEFAULT_TIMEOUT_MS: Long = 10000L // 10 secs
|
||||
const val COMPILE_DAEMON_TIMEOUT_INFINITE_MS: Long = 0L
|
||||
const val COMPILE_DAEMON_IS_READY_MESSAGE = "Kotlin compile daemon is ready"
|
||||
|
||||
val COMPILE_DAEMON_DEFAULT_RUN_DIR_PATH: String
|
||||
get() = CompilerSystemProperties.COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS.value ?: FileSystem.getRuntimeStateFilesPath(
|
||||
"kotlin",
|
||||
"daemon"
|
||||
)
|
||||
val COMPILER_JAR_NAME: String = "kotlin-compiler.jar"
|
||||
val COMPILER_SERVICE_RMI_NAME: String = "KotlinJvmCompilerService"
|
||||
val COMPILER_DAEMON_CLASS_FQN: String = "org.jetbrains.kotlin.daemon.KotlinCompileDaemon"
|
||||
val COMPILE_DAEMON_FIND_PORT_ATTEMPTS: Int = 10
|
||||
val COMPILE_DAEMON_PORTS_RANGE_START: Int = 17001
|
||||
val COMPILE_DAEMON_PORTS_RANGE_END: Int = 18000
|
||||
val COMPILE_DAEMON_ENABLED_PROPERTY: String = "kotlin.daemon.enabled"
|
||||
val COMPILE_DAEMON_JVM_OPTIONS_PROPERTY: String = "kotlin.daemon.jvm.options"
|
||||
val COMPILE_DAEMON_OPTIONS_PROPERTY: String = "kotlin.daemon.options"
|
||||
val COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY: String = "kotlin.daemon.client.alive.path"
|
||||
val COMPILE_DAEMON_LOG_PATH_PROPERTY: String = "kotlin.daemon.log.path"
|
||||
val COMPILE_DAEMON_REPORT_PERF_PROPERTY: String = "kotlin.daemon.perf"
|
||||
val COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY: String = "kotlin.daemon.verbose"
|
||||
val COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX: String = "--daemon-"
|
||||
val COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY: String = "kotlin.daemon.startup.timeout"
|
||||
val COMPILE_DAEMON_DEFAULT_FILES_PREFIX: String = "kotlin-daemon"
|
||||
val COMPILE_DAEMON_TIMEOUT_INFINITE_S: Int = 0
|
||||
val COMPILE_DAEMON_DEFAULT_IDLE_TIMEOUT_S: Int = 7200 // 2 hours
|
||||
val COMPILE_DAEMON_DEFAULT_UNUSED_TIMEOUT_S: Int = 60
|
||||
val COMPILE_DAEMON_DEFAULT_SHUTDOWN_DELAY_MS: Long = 1000L // 1 sec
|
||||
val COMPILE_DAEMON_MEMORY_THRESHOLD_INFINITE: Long = 0L
|
||||
val COMPILE_DAEMON_FORCE_SHUTDOWN_DEFAULT_TIMEOUT_MS: Long = 10000L // 10 secs
|
||||
val COMPILE_DAEMON_TIMEOUT_INFINITE_MS: Long = 0L
|
||||
val COMPILE_DAEMON_IS_READY_MESSAGE = "Kotlin compile daemon is ready"
|
||||
|
||||
val COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS: String = "kotlin.daemon.custom.run.files.path.for.tests"
|
||||
val COMPILE_DAEMON_DEFAULT_RUN_DIR_PATH: String get() =
|
||||
System.getProperty(COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS)
|
||||
?: FileSystem.getRuntimeStateFilesPath("kotlin", "daemon")
|
||||
|
||||
val CLASSPATH_ID_DIGEST = "MD5"
|
||||
|
||||
|
||||
open class PropMapper<C, V, out P : KMutableProperty1<C, V>>(
|
||||
val dest: C,
|
||||
val prop: P,
|
||||
val names: List<String> = listOf(prop.name),
|
||||
val fromString: (String) -> V,
|
||||
val toString: ((V) -> String?) = { it.toString() },
|
||||
val skipIf: ((V) -> Boolean) = { false },
|
||||
val mergeDelimiter: String? = null
|
||||
) {
|
||||
open class PropMapper<C, V, out P : KMutableProperty1<C, V>>(val dest: C,
|
||||
val prop: P,
|
||||
val names: List<String> = listOf(prop.name),
|
||||
val fromString: (String) -> V,
|
||||
val toString: ((V) -> String?) = { it.toString() },
|
||||
val skipIf: ((V) -> Boolean) = { false },
|
||||
val mergeDelimiter: String? = null) {
|
||||
open fun toArgs(prefix: String = COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX): List<String> =
|
||||
when {
|
||||
skipIf(prop.get(dest)) -> listOf<String>()
|
||||
mergeDelimiter != null -> listOf(listOfNotNull(prefix + names.first(), toString(prop.get(dest))).joinToString(mergeDelimiter))
|
||||
else -> listOfNotNull(prefix + names.first(), toString(prop.get(dest)))
|
||||
}
|
||||
when {
|
||||
skipIf(prop.get(dest)) -> listOf<String>()
|
||||
mergeDelimiter != null -> listOf(listOfNotNull(prefix + names.first(), toString(prop.get(dest))).joinToString(mergeDelimiter))
|
||||
else -> listOfNotNull(prefix + names.first(), toString(prop.get(dest)))
|
||||
}
|
||||
|
||||
open fun apply(s: String) = prop.set(dest, fromString(s))
|
||||
}
|
||||
@@ -249,7 +255,7 @@ data class CompilerId(
|
||||
}
|
||||
|
||||
|
||||
fun isDaemonEnabled(): Boolean = CompilerSystemProperties.COMPILE_DAEMON_ENABLED_PROPERTY.value != null
|
||||
fun isDaemonEnabled(): Boolean = System.getProperty(COMPILE_DAEMON_ENABLED_PROPERTY) != null
|
||||
|
||||
fun configureDaemonJVMOptions(opts: DaemonJVMOptions,
|
||||
vararg additionalParams: String,
|
||||
@@ -283,16 +289,16 @@ fun configureDaemonJVMOptions(opts: DaemonJVMOptions,
|
||||
|
||||
if (inheritOtherJvmOptions) {
|
||||
opts.jvmParams.addAll(
|
||||
otherArgs.filterNot {
|
||||
it.startsWith("agentlib") ||
|
||||
it.startsWith("D" + CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property) ||
|
||||
it.startsWith("D" + CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.property) ||
|
||||
it.startsWith("D" + CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property) ||
|
||||
it.startsWith("D" + CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property)
|
||||
})
|
||||
otherArgs.filterNot {
|
||||
it.startsWith("agentlib") ||
|
||||
it.startsWith("D" + COMPILE_DAEMON_LOG_PATH_PROPERTY) ||
|
||||
it.startsWith("D" + KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY) ||
|
||||
it.startsWith("D" + COMPILE_DAEMON_JVM_OPTIONS_PROPERTY) ||
|
||||
it.startsWith("D" + COMPILE_DAEMON_OPTIONS_PROPERTY)
|
||||
})
|
||||
}
|
||||
}
|
||||
CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.value?.let {
|
||||
System.getProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY)?.let {
|
||||
opts.jvmParams.addAll(
|
||||
it.trimQuotes()
|
||||
.split("(?<!\\\\),".toRegex()) // using independent non-capturing group with negative lookahead zero length assertion to split only on non-escaped commas
|
||||
@@ -305,8 +311,8 @@ fun configureDaemonJVMOptions(opts: DaemonJVMOptions,
|
||||
opts.jvmParams.addAll(additionalParams)
|
||||
|
||||
if (inheritAdditionalProperties) {
|
||||
CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.value?.let { opts.jvmParams.add("D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"$it\"") }
|
||||
CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.value?.let { opts.jvmParams.add("D${CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.property}") }
|
||||
System.getProperty(COMPILE_DAEMON_LOG_PATH_PROPERTY)?.let { opts.jvmParams.add("D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"$it\"") }
|
||||
System.getProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY)?.let { opts.jvmParams.add("D$KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY") }
|
||||
}
|
||||
|
||||
if (opts.jvmParams.none { it.matches(jvmAssertArgsRegex) }) {
|
||||
@@ -332,15 +338,15 @@ fun configureDaemonJVMOptions(
|
||||
)
|
||||
|
||||
fun configureDaemonOptions(opts: DaemonOptions): DaemonOptions {
|
||||
CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.value?.let {
|
||||
System.getProperty(COMPILE_DAEMON_OPTIONS_PROPERTY)?.let {
|
||||
val unrecognized = it.trimQuotes().split(",").filterExtractProps(opts.mappers, "")
|
||||
if (unrecognized.any())
|
||||
throw IllegalArgumentException(
|
||||
"Unrecognized daemon options passed via property ${CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property}: " + unrecognized.joinToString(" ") +
|
||||
"Unrecognized daemon options passed via property $COMPILE_DAEMON_OPTIONS_PROPERTY: " + unrecognized.joinToString(" ") +
|
||||
"\nSupported options: " + opts.mappers.joinToString(", ", transform = { it.names.first() }))
|
||||
}
|
||||
CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.value?.let { opts.verbose = true }
|
||||
CompilerSystemProperties.COMPILE_DAEMON_REPORT_PERF_PROPERTY.value?.let { opts.reportPerf = true }
|
||||
System.getProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY)?.let { opts.verbose = true }
|
||||
System.getProperty(COMPILE_DAEMON_REPORT_PERF_PROPERTY)?.let { opts.reportPerf = true }
|
||||
return opts
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.daemon.common
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import java.io.IOException
|
||||
import java.io.Serializable
|
||||
import java.net.*
|
||||
@@ -27,7 +26,12 @@ import java.rmi.server.RMIClientSocketFactory
|
||||
import java.rmi.server.RMIServerSocketFactory
|
||||
import java.util.*
|
||||
|
||||
const val SOCKET_ANY_FREE_PORT = 0
|
||||
|
||||
const val SOCKET_ANY_FREE_PORT = 0
|
||||
const val JAVA_RMI_SERVER_HOSTNAME = "java.rmi.server.hostname"
|
||||
const val DAEMON_RMI_SOCKET_BACKLOG_SIZE_PROPERTY = "kotlin.daemon.socket.backlog.size"
|
||||
const val DAEMON_RMI_SOCKET_CONNECT_ATTEMPTS_PROPERTY = "kotlin.daemon.socket.connect.attempts"
|
||||
const val DAEMON_RMI_SOCKET_CONNECT_INTERVAL_PROPERTY = "kotlin.daemon.socket.connect.interval"
|
||||
const val DEFAULT_SERVER_SOCKET_BACKLOG_SIZE = 50
|
||||
const val DEFAULT_SOCKET_CONNECT_ATTEMPTS = 3
|
||||
const val DEFAULT_SOCKET_CONNECT_INTERVAL_MS = 10L
|
||||
@@ -39,9 +43,9 @@ object LoopbackNetworkInterface {
|
||||
|
||||
// size of the requests queue for daemon services, so far seems that we don't need any big numbers here
|
||||
// but if we'll start getting "connection refused" errors, that could be the first place to try to fix it
|
||||
val SERVER_SOCKET_BACKLOG_SIZE by lazy { CompilerSystemProperties.DAEMON_RMI_SOCKET_BACKLOG_SIZE_PROPERTY.value?.toIntOrNull() ?: DEFAULT_SERVER_SOCKET_BACKLOG_SIZE }
|
||||
val SOCKET_CONNECT_ATTEMPTS by lazy { CompilerSystemProperties.DAEMON_RMI_SOCKET_CONNECT_ATTEMPTS_PROPERTY.value?.toIntOrNull() ?: DEFAULT_SOCKET_CONNECT_ATTEMPTS }
|
||||
val SOCKET_CONNECT_INTERVAL_MS by lazy { CompilerSystemProperties.DAEMON_RMI_SOCKET_CONNECT_INTERVAL_PROPERTY.value?.toLongOrNull() ?: DEFAULT_SOCKET_CONNECT_INTERVAL_MS }
|
||||
val SERVER_SOCKET_BACKLOG_SIZE by lazy { System.getProperty(DAEMON_RMI_SOCKET_BACKLOG_SIZE_PROPERTY)?.toIntOrNull() ?: DEFAULT_SERVER_SOCKET_BACKLOG_SIZE }
|
||||
val SOCKET_CONNECT_ATTEMPTS by lazy { System.getProperty(DAEMON_RMI_SOCKET_CONNECT_ATTEMPTS_PROPERTY)?.toIntOrNull() ?: DEFAULT_SOCKET_CONNECT_ATTEMPTS }
|
||||
val SOCKET_CONNECT_INTERVAL_MS by lazy { System.getProperty(DAEMON_RMI_SOCKET_CONNECT_INTERVAL_PROPERTY)?.toLongOrNull() ?: DEFAULT_SOCKET_CONNECT_INTERVAL_MS }
|
||||
|
||||
val serverLoopbackSocketFactory by lazy { ServerLoopbackSocketFactory() }
|
||||
val clientLoopbackSocketFactory by lazy { ClientLoopbackSocketFactory() }
|
||||
@@ -121,7 +125,7 @@ fun findPortAndCreateRegistry(attempts: Int, portRangeStart: Int, portRangeEnd:
|
||||
* which may be slow and can cause a timeout when there is a network problem/misconfiguration.
|
||||
*/
|
||||
fun ensureServerHostnameIsSetUp() {
|
||||
if (CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.value == null) {
|
||||
CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.value = LoopbackNetworkInterface.loopbackInetAddressName
|
||||
if (System.getProperty(JAVA_RMI_SERVER_HOSTNAME) == null) {
|
||||
System.setProperty(JAVA_RMI_SERVER_HOSTNAME, LoopbackNetworkInterface.loopbackInetAddressName)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.daemon
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
@@ -128,7 +127,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
|
||||
|
||||
val logFile: Path = createTempFile("kotlin-daemon-test.", ".log")
|
||||
|
||||
val daemonJVMOptions = configureDaemonJVMOptions("D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"${logFile.loggerCompatiblePath}\"",
|
||||
val daemonJVMOptions = configureDaemonJVMOptions("D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"${logFile.loggerCompatiblePath}\"",
|
||||
inheritMemoryLimits = false, inheritOtherJvmOptions = false, inheritAdditionalProperties = false)
|
||||
val jar = tmpdir.absolutePath + File.separator + "hello.jar"
|
||||
|
||||
@@ -168,7 +167,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
|
||||
|
||||
val logFile: Path = createTempFile("kotlin-daemon-test.", ".log")
|
||||
|
||||
val daemonJVMOptions = configureDaemonJVMOptions("D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"${logFile.loggerCompatiblePath}\"",
|
||||
val daemonJVMOptions = configureDaemonJVMOptions("D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"${logFile.loggerCompatiblePath}\"",
|
||||
inheritMemoryLimits = false, inheritOtherJvmOptions = false, inheritAdditionalProperties = false)
|
||||
try {
|
||||
val (code, outputs) = compileOnDaemon(
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.daemon
|
||||
@@ -9,7 +20,6 @@ import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.util.io.FileUtilRt
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.kotlin.cli.AbstractCliTest
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
|
||||
import org.jetbrains.kotlin.cli.common.messages.PrintingMessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.repl.*
|
||||
@@ -32,7 +42,7 @@ import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.concurrent.thread
|
||||
import kotlin.io.path.ExperimentalPathApi
|
||||
import kotlin.io.path.invariantSeparatorsPathString
|
||||
import kotlin.io.path.invariantSeparatorsPath
|
||||
import kotlin.script.dependencies.Environment
|
||||
import kotlin.script.dependencies.ScriptContents
|
||||
import kotlin.script.experimental.dependencies.DependenciesResolver
|
||||
@@ -99,7 +109,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
fun makeTestDaemonJvmOptions(logFile: File? = null, xmx: Int = 384, args: Iterable<String> = listOf()): DaemonJVMOptions {
|
||||
val additionalArgs = arrayListOf<String>()
|
||||
if (logFile != null) {
|
||||
additionalArgs.add("D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"${logFile.loggerCompatiblePath}\"")
|
||||
additionalArgs.add("D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"${logFile.loggerCompatiblePath}\"")
|
||||
}
|
||||
args.forEach { additionalArgs.add(it) }
|
||||
val baseOpts = if (xmx > 0) DaemonJVMOptions(maxMemory = "${xmx}m") else DaemonJVMOptions()
|
||||
@@ -150,16 +160,16 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
fun testDaemonJvmOptionsParsing() {
|
||||
val backupJvmOptions = System.getProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property)
|
||||
val backupJvmOptions = System.getProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY)
|
||||
try {
|
||||
System.setProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, "-aaa,-bbb\\,ccc,-ddd,-Xmx200m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100,-xxx\\,yyy")
|
||||
System.setProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, "-aaa,-bbb\\,ccc,-ddd,-Xmx200m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100,-xxx\\,yyy")
|
||||
val opts = configureDaemonJVMOptions(inheritMemoryLimits = false, inheritAdditionalProperties = false, inheritOtherJvmOptions = false)
|
||||
assertEquals("200m", opts.maxMemory)
|
||||
assertEquals("10k", opts.maxMetaspaceSize)
|
||||
assertEquals("100", opts.reservedCodeCacheSize)
|
||||
assertEquals(arrayListOf("aaa", "bbb,ccc", "ddd", "xxx,yyy", "ea"), opts.jvmParams)
|
||||
|
||||
System.setProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, "-Xmx300m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100")
|
||||
System.setProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, "-Xmx300m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100")
|
||||
val opts2 = configureDaemonJVMOptions(inheritMemoryLimits = false, inheritAdditionalProperties = false, inheritOtherJvmOptions = false)
|
||||
assertEquals("300m", opts2.maxMemory)
|
||||
assertEquals( -1, DaemonJVMOptionsMemoryComparator().compare(opts, opts2))
|
||||
@@ -168,14 +178,14 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
val myXmxParam = ManagementFactory.getRuntimeMXBean().inputArguments.first { it.startsWith("-Xmx") }
|
||||
TestCase.assertNotNull(myXmxParam)
|
||||
val myXmxVal = myXmxParam.substring(4)
|
||||
System.clearProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property)
|
||||
System.clearProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY)
|
||||
val opts3 = configureDaemonJVMOptions(inheritMemoryLimits = true,
|
||||
inheritOtherJvmOptions = true,
|
||||
inheritAdditionalProperties = false)
|
||||
assertEquals(myXmxVal, opts3.maxMemory)
|
||||
}
|
||||
finally {
|
||||
restoreSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, backupJvmOptions)
|
||||
restoreSystemProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, backupJvmOptions)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,12 +215,12 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
private fun withDaemonJvmOptionsSetTo(newValue: String?, fn: () -> Unit) {
|
||||
val backup = getAndSetSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, newValue)
|
||||
val backup = getAndSetSystemProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, newValue)
|
||||
|
||||
try {
|
||||
fn()
|
||||
} finally {
|
||||
getAndSetSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, backup)
|
||||
getAndSetSystemProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, backup)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,15 +237,15 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
fun testDaemonOptionsParsing() {
|
||||
val backupOptions = System.getProperty(CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property)
|
||||
val backupOptions = System.getProperty(COMPILE_DAEMON_OPTIONS_PROPERTY)
|
||||
try {
|
||||
System.setProperty(CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property, "runFilesPath=abcd,autoshutdownIdleSeconds=1111")
|
||||
System.setProperty(COMPILE_DAEMON_OPTIONS_PROPERTY, "runFilesPath=abcd,autoshutdownIdleSeconds=1111")
|
||||
val opts = configureDaemonOptions(DaemonOptions(shutdownDelayMilliseconds = 1))
|
||||
assertEquals("abcd", opts.runFilesPath)
|
||||
assertEquals(1111, opts.autoshutdownIdleSeconds)
|
||||
}
|
||||
finally {
|
||||
restoreSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property, backupOptions)
|
||||
restoreSystemProperty(COMPILE_DAEMON_OPTIONS_PROPERTY, backupOptions)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,12 +518,12 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
val daemonOptions = makeTestDaemonOptions(getTestName(true))
|
||||
val jar = testTempDir.absolutePath + File.separator + "hello.jar"
|
||||
val args = listOf(
|
||||
File(File(System.getProperty("java.home"), "bin"), "java").absolutePath,
|
||||
"-Xmx256m",
|
||||
"-D${CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.property}",
|
||||
"-cp",
|
||||
daemonClientClassPath.joinToString(File.pathSeparator) { it.absolutePath },
|
||||
KotlinCompilerClient::class.qualifiedName!!) +
|
||||
File(File(System.getProperty("java.home"), "bin"), "java").absolutePath,
|
||||
"-Xmx256m",
|
||||
"-D$COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY",
|
||||
"-cp",
|
||||
daemonClientClassPath.joinToString(File.pathSeparator) { it.absolutePath },
|
||||
KotlinCompilerClient::class.qualifiedName!!) +
|
||||
daemonOptions.mappers.flatMap { it.toArgs(COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX) } +
|
||||
compilerId.mappers.flatMap { it.toArgs(COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX) } +
|
||||
File(getHelloAppBaseDir(), "hello.kt").absolutePath +
|
||||
@@ -641,16 +651,16 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
}
|
||||
|
||||
CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.value = "true"
|
||||
CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.value = "100000"
|
||||
System.setProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY, "true")
|
||||
System.setProperty(COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY, "100000")
|
||||
|
||||
val succeeded = try {
|
||||
(1..ParallelStartParams.threads).forEach { connectThread(it - 1) }
|
||||
doneLatch.await(PARALLEL_WAIT_TIMEOUT_S, TimeUnit.SECONDS)
|
||||
}
|
||||
finally {
|
||||
CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.clear()
|
||||
CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.clear()
|
||||
System.clearProperty(COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY)
|
||||
System.clearProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY)
|
||||
}
|
||||
|
||||
Thread.sleep(100) // Wait for processes to finish and close log files
|
||||
@@ -994,7 +1004,7 @@ internal val File.loggerCompatiblePath: String
|
||||
|
||||
@OptIn(ExperimentalPathApi::class)
|
||||
internal val Path.loggerCompatiblePath: String
|
||||
get() = invariantSeparatorsPathString
|
||||
get() = invariantSeparatorsPath
|
||||
|
||||
|
||||
open class TestKotlinScriptDummyDependenciesResolver : DependenciesResolver {
|
||||
|
||||
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.daemon.experimental.integration
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
@@ -218,7 +217,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
|
||||
|
||||
log.info("creating daemonJVMOptions")
|
||||
val daemonJVMOptions = configureDaemonJVMOptions(
|
||||
"D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"${externalLogFile.loggerCompatiblePath}\"",
|
||||
"D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"${externalLogFile.loggerCompatiblePath}\"",
|
||||
inheritMemoryLimits = false,
|
||||
inheritOtherJvmOptions = false,
|
||||
inheritAdditionalProperties = false
|
||||
@@ -279,7 +278,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
|
||||
reportPerf = true
|
||||
)
|
||||
val daemonJVMOptions = configureDaemonJVMOptions(
|
||||
"D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"${externalLogFile.loggerCompatiblePath}\"",
|
||||
"D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"${externalLogFile.loggerCompatiblePath}\"",
|
||||
inheritMemoryLimits = false, inheritOtherJvmOptions = false, inheritAdditionalProperties = false
|
||||
)
|
||||
try {
|
||||
|
||||
@@ -11,7 +11,6 @@ import junit.framework.TestCase
|
||||
import kotlinx.coroutines.*
|
||||
import org.jetbrains.kotlin.cli.AbstractCliTest
|
||||
import org.jetbrains.kotlin.cli.common.CLICompiler
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
|
||||
import org.jetbrains.kotlin.cli.common.messages.PrintingMessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.repl.*
|
||||
@@ -174,7 +173,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
fun makeTestDaemonJvmOptions(logFile: File? = null, xmx: Int = 384, args: Iterable<String> = listOf()): DaemonJVMOptions {
|
||||
val additionalArgs = arrayListOf<String>()
|
||||
if (logFile != null) {
|
||||
additionalArgs.add("D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"${logFile.loggerCompatiblePath}\"")
|
||||
additionalArgs.add("D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"${logFile.loggerCompatiblePath}\"")
|
||||
}
|
||||
args.forEach { additionalArgs.add(it) }
|
||||
val baseOpts = if (xmx > 0) DaemonJVMOptions(maxMemory = "${xmx}m") else DaemonJVMOptions()
|
||||
@@ -231,10 +230,10 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
fun ignore_testDaemonJvmOptionsParsing() {
|
||||
val backupJvmOptions = System.getProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property)
|
||||
val backupJvmOptions = System.getProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY)
|
||||
try {
|
||||
System.setProperty(
|
||||
CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property,
|
||||
COMPILE_DAEMON_JVM_OPTIONS_PROPERTY,
|
||||
"-aaa,-bbb\\,ccc,-ddd,-Xmx200m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100,-xxx\\,yyy"
|
||||
)
|
||||
val opts =
|
||||
@@ -244,7 +243,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
assertEquals("100", opts.reservedCodeCacheSize)
|
||||
assertEquals(arrayListOf("aaa", "bbb,ccc", "ddd", "xxx,yyy", "ea"), opts.jvmParams)
|
||||
|
||||
System.setProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, "-Xmx300m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100")
|
||||
System.setProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, "-Xmx300m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100")
|
||||
val opts2 =
|
||||
configureDaemonJVMOptions(inheritMemoryLimits = false, inheritAdditionalProperties = false, inheritOtherJvmOptions = false)
|
||||
assertEquals("300m", opts2.maxMemory)
|
||||
@@ -254,7 +253,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
val myXmxParam = ManagementFactory.getRuntimeMXBean().inputArguments.first { it.startsWith("-Xmx") }
|
||||
TestCase.assertNotNull(myXmxParam)
|
||||
val myXmxVal = myXmxParam.substring(4)
|
||||
System.clearProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property)
|
||||
System.clearProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY)
|
||||
val opts3 = configureDaemonJVMOptions(
|
||||
inheritMemoryLimits = true,
|
||||
inheritOtherJvmOptions = true,
|
||||
@@ -263,7 +262,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
assertEquals(myXmxVal, opts3.maxMemory)
|
||||
} finally {
|
||||
restoreSystemProperty(
|
||||
CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property,
|
||||
COMPILE_DAEMON_JVM_OPTIONS_PROPERTY,
|
||||
backupJvmOptions
|
||||
)
|
||||
}
|
||||
@@ -295,12 +294,12 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
private fun withDaemonJvmOptionsSetTo(newValue: String?, fn: () -> Unit) {
|
||||
val backup = getAndSetSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, newValue)
|
||||
val backup = getAndSetSystemProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, newValue)
|
||||
|
||||
try {
|
||||
fn()
|
||||
} finally {
|
||||
getAndSetSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, backup)
|
||||
getAndSetSystemProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, backup)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,14 +316,14 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
fun ignore_testDaemonOptionsParsing() {
|
||||
val backupOptions = System.getProperty(CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property)
|
||||
val backupOptions = System.getProperty(COMPILE_DAEMON_OPTIONS_PROPERTY)
|
||||
try {
|
||||
System.setProperty(CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property, "runFilesPath=abcd,autoshutdownIdleSeconds=1111")
|
||||
System.setProperty(COMPILE_DAEMON_OPTIONS_PROPERTY, "runFilesPath=abcd,autoshutdownIdleSeconds=1111")
|
||||
val opts = configureDaemonOptions(DaemonOptions(shutdownDelayMilliseconds = 1))
|
||||
assertEquals("abcd", opts.runFilesPath)
|
||||
assertEquals(1111, opts.autoshutdownIdleSeconds)
|
||||
} finally {
|
||||
restoreSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property, backupOptions)
|
||||
restoreSystemProperty(COMPILE_DAEMON_OPTIONS_PROPERTY, backupOptions)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -747,7 +746,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
val args = listOf(
|
||||
File(File(System.getProperty("java.home"), "bin"), "java").absolutePath,
|
||||
"-Xmx256m",
|
||||
"-D${CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.property}",
|
||||
"-D$COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY",
|
||||
"-cp",
|
||||
daemonClientClassPath.joinToString(File.pathSeparator) { it.absolutePath },
|
||||
KotlinCompilerClientInstance::class.qualifiedName!!
|
||||
@@ -947,15 +946,15 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
runBlocking {
|
||||
CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.value = "true"
|
||||
CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.value = "100000"
|
||||
System.setProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY, "true")
|
||||
System.setProperty(COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY, "100000")
|
||||
|
||||
val succeeded = try {
|
||||
(1..ParallelStartParams.threads).forEach { connectThread(it - 1) }
|
||||
doneLatch.await(PARALLEL_WAIT_TIMEOUT_S, TimeUnit.SECONDS)
|
||||
} finally {
|
||||
CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.clear()
|
||||
CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.clear()
|
||||
System.clearProperty(COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY)
|
||||
System.clearProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY)
|
||||
}
|
||||
|
||||
delay(1000) // Wait for processes to finish and close log files
|
||||
|
||||
@@ -25,8 +25,8 @@ import org.jetbrains.kotlin.build.report.BuildReporter
|
||||
import org.jetbrains.kotlin.build.report.RemoteBuildReporter
|
||||
import org.jetbrains.kotlin.build.report.RemoteReporter
|
||||
import org.jetbrains.kotlin.cli.common.CLICompiler
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.ExitCode
|
||||
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
|
||||
import org.jetbrains.kotlin.cli.common.arguments.*
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
@@ -102,7 +102,7 @@ abstract class CompileServiceImplBase(
|
||||
protected val log by lazy { Logger.getLogger("compiler") }
|
||||
|
||||
init {
|
||||
CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.value = "true"
|
||||
System.setProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY, "true")
|
||||
}
|
||||
|
||||
// wrapped in a class to encapsulate alive check logic
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.daemon
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.CLICompiler
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.environment.setIdeaIoUseFallback
|
||||
import org.jetbrains.kotlin.cli.js.K2JSCompiler
|
||||
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
@@ -61,7 +60,7 @@ abstract class KotlinCompileDaemonBase {
|
||||
init {
|
||||
val logTime: String = SimpleDateFormat("yyyy-MM-dd.HH-mm-ss-SSS").format(Date())
|
||||
val (logPath: String, fileIsGiven: Boolean) =
|
||||
CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.value?.trimQuotes()?.let { Pair(it, File(it).isFile) } ?: Pair("%t", false)
|
||||
System.getProperty(COMPILE_DAEMON_LOG_PATH_PROPERTY)?.trimQuotes()?.let { Pair(it, File(it).isFile) } ?: Pair("%t", false)
|
||||
val cfg: String =
|
||||
"handlers = java.util.logging.FileHandler\n" +
|
||||
"java.util.logging.FileHandler.level = ALL\n" +
|
||||
|
||||
@@ -16,7 +16,7 @@ import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.channels.actor
|
||||
import kotlinx.coroutines.channels.consumeEach
|
||||
import org.jetbrains.kotlin.cli.common.CLICompiler
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
|
||||
import org.jetbrains.kotlin.cli.common.repl.ReplCheckResult
|
||||
import org.jetbrains.kotlin.cli.common.repl.ReplCodeLine
|
||||
import org.jetbrains.kotlin.cli.common.repl.ReplCompileResult
|
||||
@@ -402,7 +402,7 @@ class CompileServiceServerSideImpl(
|
||||
scheduler = CompileServiceTaskScheduler(log)
|
||||
|
||||
// assuming logically synchronized
|
||||
CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.value = "true"
|
||||
System.setProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY, "true")
|
||||
|
||||
// TODO UNCOMMENT THIS : this.toRMIServer(daemonOptions, compilerId) // also create RMI server in order to support old clients
|
||||
// rmiServer = this.toRMIServer(daemonOptions, compilerId)
|
||||
|
||||
@@ -29,7 +29,6 @@ dependencies {
|
||||
testCompileOnly(project(":kotlin-reflect-api"))
|
||||
testRuntimeOnly(project(":kotlin-reflect"))
|
||||
testRuntimeOnly(project(":core:descriptors.runtime"))
|
||||
testRuntimeOnly(androidDxJar())
|
||||
testRuntimeOnly(project(":compiler:fir:fir2ir:jvm-backend"))
|
||||
|
||||
testImplementation(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
|
||||
@@ -54,6 +54,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/cast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("catchParameter.kt")
|
||||
public void testCatchParameter() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/catchParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("companion.kt")
|
||||
public void testCompanion() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/companion.kt");
|
||||
@@ -134,46 +139,6 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/enumWithCompanion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveWhenAndDNNType.kt")
|
||||
public void testExhaustiveWhenAndDNNType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveWhenAndDNNType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveWhenAndFlexibleType.kt")
|
||||
public void testExhaustiveWhenAndFlexibleType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveWhenAndFlexibleType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveness_boolean.kt")
|
||||
public void testExhaustiveness_boolean() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness_boolean.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveness_enum.kt")
|
||||
public void testExhaustiveness_enum() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness_enum.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveness_enumJava.kt")
|
||||
public void testExhaustiveness_enumJava() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness_enumJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveness_sealedClass.kt")
|
||||
public void testExhaustiveness_sealedClass() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness_sealedClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveness_sealedObject.kt")
|
||||
public void testExhaustiveness_sealedObject() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness_sealedObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveness_sealedSubClass.kt")
|
||||
public void testExhaustiveness_sealedSubClass() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness_sealedSubClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extension.kt")
|
||||
public void testExtension() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/extension.kt");
|
||||
@@ -239,6 +204,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/implicitTypeInFakeOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incorrectDataClass.kt")
|
||||
public void testIncorrectDataClass() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/incorrectDataClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incorrectSuperCall.kt")
|
||||
public void testIncorrectSuperCall() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/incorrectSuperCall.kt");
|
||||
@@ -414,6 +384,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/syntheticsVsNormalProperties.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("throwableSubclass.kt")
|
||||
public void testThrowableSubclass() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/throwableSubclass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("treeSet.kt")
|
||||
public void testTreeSet() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/treeSet.kt");
|
||||
@@ -484,6 +459,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/whenInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithWhenAsStatement.kt")
|
||||
public void testWhenWithWhenAsStatement() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/whenWithWhenAsStatement.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/arguments")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -1251,6 +1231,120 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/exhaustiveness")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Exhaustiveness extends AbstractLazyBodyIsNotTouchedTilContractsPhaseTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInExhaustiveness() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/exhaustiveness"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/negative")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Negative extends AbstractLazyBodyIsNotTouchedTilContractsPhaseTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInNegative() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/negative"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("missingBooleanBranch.kt")
|
||||
public void testMissingBooleanBranch() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/negative/missingBooleanBranch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("missingElse.kt")
|
||||
public void testMissingElse() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/negative/missingElse.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("missingEnumEntry.kt")
|
||||
public void testMissingEnumEntry() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/negative/missingEnumEntry.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("missingSealedInheritor.kt")
|
||||
public void testMissingSealedInheritor() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/negative/missingSealedInheritor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonExhaustiveWhenWithoutCoercionToUnit.kt")
|
||||
public void testNonExhaustiveWhenWithoutCoercionToUnit() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/negative/nonExhaustiveWhenWithoutCoercionToUnit.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Positive extends AbstractLazyBodyIsNotTouchedTilContractsPhaseTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPositive() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveWhenAndDNNType.kt")
|
||||
public void testExhaustiveWhenAndDNNType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveWhenAndDNNType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveWhenAndFlexibleType.kt")
|
||||
public void testExhaustiveWhenAndFlexibleType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveWhenAndFlexibleType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveness_boolean.kt")
|
||||
public void testExhaustiveness_boolean() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_boolean.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveness_enum.kt")
|
||||
public void testExhaustiveness_enum() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_enum.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveness_enumJava.kt")
|
||||
public void testExhaustiveness_enumJava() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_enumJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveness_sealedClass.kt")
|
||||
public void testExhaustiveness_sealedClass() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveness_sealedObject.kt")
|
||||
public void testExhaustiveness_sealedObject() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exhaustiveness_sealedSubClass.kt")
|
||||
public void testExhaustiveness_sealedSubClass() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedSubClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedIfInLambda.kt")
|
||||
public void testNestedIfInLambda() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/nestedIfInLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonExhaustiveWhenWithCoercionToUnit.kt")
|
||||
public void testNonExhaustiveWhenWithCoercionToUnit() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/nonExhaustiveWhenWithCoercionToUnit.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/expresssions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -2803,6 +2897,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("booleanElvisBoundSmartcast.kt")
|
||||
public void testBooleanElvisBoundSmartcast() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanElvisBoundSmartcast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("booleanOperators.kt")
|
||||
public void testBooleanOperators() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanOperators.kt");
|
||||
@@ -3098,6 +3197,39 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/suppress")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Suppress extends AbstractLazyBodyIsNotTouchedTilContractsPhaseTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSuppress() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/suppress"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("allWarnings.kt")
|
||||
public void testAllWarnings() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/suppress/allWarnings.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multipleWarnings.kt")
|
||||
public void testMultipleWarnings() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/suppress/multipleWarnings.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("singleError.kt")
|
||||
public void testSingleError() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/suppress/singleError.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("singleWarning.kt")
|
||||
public void testSingleWarning() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/suppress/singleWarning.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/types")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -1484,6 +1484,24 @@ public class FirTypeEnhancementTestGenerated extends AbstractFirTypeEnhancementT
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava/compiledJava/signatureAnnotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SignatureAnnotations extends AbstractFirTypeEnhancementTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSignatureAnnotations() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava/compiledJava/signatureAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("StableName.java")
|
||||
public void testStableName() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledJava/signatureAnnotations/StableName.java");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava/compiledJava/signaturePropagation")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -132,4 +132,67 @@ public class OwnFirTypeEnhancementTestGenerated extends AbstractOwnFirTypeEnhanc
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/enhancement/mapping"), Pattern.compile("^(.+)\\.java$"), null, true);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SignatureAnnotations extends AbstractOwnFirTypeEnhancementTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSignatureAnnotations() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("DefaultEnum.java")
|
||||
public void testDefaultEnum() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultEnum.java");
|
||||
}
|
||||
|
||||
@TestMetadata("DefaultLongLiteral.java")
|
||||
public void testDefaultLongLiteral() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultLongLiteral.java");
|
||||
}
|
||||
|
||||
@TestMetadata("DefaultNull.java")
|
||||
public void testDefaultNull() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNull.java");
|
||||
}
|
||||
|
||||
@TestMetadata("DefaultNullAndParameter.java")
|
||||
public void testDefaultNullAndParameter() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNullAndParameter.java");
|
||||
}
|
||||
|
||||
@TestMetadata("DefaultParameter.java")
|
||||
public void testDefaultParameter() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultParameter.java");
|
||||
}
|
||||
|
||||
@TestMetadata("EmptyParameterName.java")
|
||||
public void testEmptyParameterName() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/EmptyParameterName.java");
|
||||
}
|
||||
|
||||
@TestMetadata("ReorderedParameterNames.java")
|
||||
public void testReorderedParameterNames() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/ReorderedParameterNames.java");
|
||||
}
|
||||
|
||||
@TestMetadata("SameParameterName.java")
|
||||
public void testSameParameterName() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SameParameterName.java");
|
||||
}
|
||||
|
||||
@TestMetadata("SpecialCharsParameterName.java")
|
||||
public void testSpecialCharsParameterName() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SpecialCharsParameterName.java");
|
||||
}
|
||||
|
||||
@TestMetadata("StaticMethodWithDefaultValue.java")
|
||||
public void testStaticMethodWithDefaultValue() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/StaticMethodWithDefaultValue.java");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
package org.jetbrains.kotlin.fir
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.fir.resolve.firSymbolProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.symbolProvider
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import java.io.File
|
||||
|
||||
@@ -23,13 +22,12 @@ abstract class AbstractFirLoadBinariesTest : AbstractFirResolveWithSessionTestCa
|
||||
session: FirSession,
|
||||
packageFqName: FqName,
|
||||
moduleDescriptor: ModuleDescriptor,
|
||||
testDataPath: String,
|
||||
originalTestDataPath: String?
|
||||
testDataPath: String
|
||||
) {
|
||||
val declarationNames = DescriptorUtils.getAllDescriptors(moduleDescriptor.getPackage(packageFqName).memberScope)
|
||||
.mapTo(sortedSetOf()) { it.name }
|
||||
|
||||
val provider = session.firSymbolProvider
|
||||
val provider = session.symbolProvider
|
||||
|
||||
val builder = StringBuilder()
|
||||
val firRenderer = FirRenderer(builder)
|
||||
@@ -47,22 +45,9 @@ abstract class AbstractFirLoadBinariesTest : AbstractFirResolveWithSessionTestCa
|
||||
builder.appendLine()
|
||||
}
|
||||
|
||||
val isIgnored = originalTestDataPath?.let {
|
||||
InTextDirectivesUtils.isDirectiveDefined(File(originalTestDataPath).readText(), "// IGNORE_FIR")
|
||||
} ?: false
|
||||
|
||||
var wasError = false
|
||||
try {
|
||||
KotlinTestUtils.assertEqualsToFile(
|
||||
File(testDataPath),
|
||||
builder.toString()
|
||||
)
|
||||
} catch (e: Throwable) {
|
||||
if (!isIgnored) throw e
|
||||
wasError = true
|
||||
}
|
||||
if (isIgnored && !wasError) {
|
||||
throw AssertionError("Looks like test can be unmuted. Please remove `// IGNORE_FIR` directive")
|
||||
}
|
||||
KotlinTestUtils.assertEqualsToFile(
|
||||
File(testDataPath),
|
||||
builder.toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ abstract class AbstractFirLoadCompiledKotlin : AbstractFirLoadBinariesTest() {
|
||||
.removeSuffix(File(path).name)
|
||||
File(testDataDirectoryPath).mkdirs()
|
||||
|
||||
checkPackageContent(sessionWithDependency, packageFqName, moduleDescriptor, "$testDataDirectoryPath${getTestName(false)}.txt", path)
|
||||
checkPackageContent(sessionWithDependency, packageFqName, moduleDescriptor, "$testDataDirectoryPath${getTestName(false)}.txt")
|
||||
}
|
||||
|
||||
private fun compileKtFileToTmpDir(path: String): ModuleDescriptor {
|
||||
|
||||
@@ -21,7 +21,7 @@ class BuiltInsDeserializationForFirTestCase : AbstractFirLoadBinariesTest() {
|
||||
val session = createSession(environment, GlobalSearchScope.allScope(project))
|
||||
for (packageFqName in BuiltinsTestUtils.BUILTIN_PACKAGE_NAMES) {
|
||||
val path = "compiler/fir/analysis-tests/testData/builtIns/" + packageFqName.asString().replace('.', '-') + ".txt"
|
||||
checkPackageContent(session, packageFqName, moduleDescriptor, path, null)
|
||||
checkPackageContent(session, packageFqName, moduleDescriptor, path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
import org.jetbrains.kotlin.fir.FirRenderer
|
||||
import org.jetbrains.kotlin.fir.createSession
|
||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
|
||||
import org.jetbrains.kotlin.fir.resolve.firSymbolProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.symbolProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirCompositeSymbolProvider
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
@@ -65,6 +65,9 @@ abstract class AbstractFirTypeEnhancementTest : KtUsefulTestCase() {
|
||||
|
||||
private fun createEnvironment(content: String): KotlinCoreEnvironment {
|
||||
val classpath = mutableListOf(getAnnotationsJar(), ForTestCompileRuntime.runtimeJarForTests())
|
||||
if (InTextDirectivesUtils.isDirectiveDefined(content, "ANDROID_ANNOTATIONS")) {
|
||||
classpath.add(ForTestCompileRuntime.androidAnnotationsForTests())
|
||||
}
|
||||
if (InTextDirectivesUtils.isDirectiveDefined(content, "JVM_ANNOTATIONS")) {
|
||||
classpath.add(ForTestCompileRuntime.jvmAnnotationsForTests())
|
||||
}
|
||||
@@ -137,7 +140,7 @@ abstract class AbstractFirTypeEnhancementTest : KtUsefulTestCase() {
|
||||
|
||||
val javaFirDump = StringBuilder().also { builder ->
|
||||
val renderer = FirRenderer(builder)
|
||||
val symbolProvider = session.firSymbolProvider as FirCompositeSymbolProvider
|
||||
val symbolProvider = session.symbolProvider as FirCompositeSymbolProvider
|
||||
val javaProvider = symbolProvider.providers.filterIsInstance<JavaSymbolProvider>().first()
|
||||
|
||||
val topLevelJavaClasses = topPsiClasses.map { it.classId(FqName.ROOT) }
|
||||
|
||||
@@ -200,7 +200,7 @@ public final class Byte : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Byte>|, R
|
||||
|
||||
public open fun toByte(): R|kotlin/Byte|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public open fun toChar(): R|kotlin/Char|
|
||||
public open fun toChar(): R|kotlin/Char|
|
||||
|
||||
public open fun toDouble(): R|kotlin/Double|
|
||||
|
||||
@@ -288,19 +288,19 @@ public final class Char : R|kotlin/Comparable<kotlin/Char>|, R|java/io/Serializa
|
||||
|
||||
public final operator fun rangeTo(other: R|kotlin/Char|): R|kotlin/ranges/CharRange|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Conversion of Char to Number is deprecated. Use Char.code property instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.code.toByte())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public final fun toByte(): R|kotlin/Byte|
|
||||
public final fun toByte(): R|kotlin/Byte|
|
||||
|
||||
public final fun toChar(): R|kotlin/Char|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Conversion of Char to Number is deprecated. Use Char.code property instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.code.toDouble())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public final fun toDouble(): R|kotlin/Double|
|
||||
public final fun toDouble(): R|kotlin/Double|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Conversion of Char to Number is deprecated. Use Char.code property instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.code.toFloat())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public final fun toFloat(): R|kotlin/Float|
|
||||
public final fun toFloat(): R|kotlin/Float|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Conversion of Char to Number is deprecated. Use Char.code property instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.code)) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public final fun toInt(): R|kotlin/Int|
|
||||
public final fun toInt(): R|kotlin/Int|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Conversion of Char to Number is deprecated. Use Char.code property instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.code.toLong())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public final fun toLong(): R|kotlin/Long|
|
||||
public final fun toLong(): R|kotlin/Long|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Conversion of Char to Number is deprecated. Use Char.code property instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.code.toShort())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public final fun toShort(): R|kotlin/Short|
|
||||
public final fun toShort(): R|kotlin/Short|
|
||||
|
||||
private constructor(): R|kotlin/Char|
|
||||
|
||||
@@ -484,9 +484,9 @@ public final class Double : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Double>
|
||||
|
||||
public final operator fun times(other: R|kotlin/Short|): R|kotlin/Double|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toByte())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.3), errorSince = String(1.5)) public open fun toByte(): R|kotlin/Byte|
|
||||
@R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toByte())) ) public open fun toByte(): R|kotlin/Byte|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public open fun toChar(): R|kotlin/Char|
|
||||
public open fun toChar(): R|kotlin/Char|
|
||||
|
||||
public open fun toDouble(): R|kotlin/Double|
|
||||
|
||||
@@ -496,7 +496,7 @@ public final class Double : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Double>
|
||||
|
||||
public open fun toLong(): R|kotlin/Long|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toShort())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.3), errorSince = String(1.5)) public open fun toShort(): R|kotlin/Short|
|
||||
@R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toShort())) ) public open fun toShort(): R|kotlin/Short|
|
||||
|
||||
public final operator fun unaryMinus(): R|kotlin/Double|
|
||||
|
||||
@@ -663,9 +663,9 @@ public final class Float : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Float>|,
|
||||
|
||||
public final operator fun times(other: R|kotlin/Short|): R|kotlin/Float|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toByte())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.3), errorSince = String(1.5)) public open fun toByte(): R|kotlin/Byte|
|
||||
@R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toByte())) ) public open fun toByte(): R|kotlin/Byte|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public open fun toChar(): R|kotlin/Char|
|
||||
public open fun toChar(): R|kotlin/Char|
|
||||
|
||||
public open fun toDouble(): R|kotlin/Double|
|
||||
|
||||
@@ -675,7 +675,7 @@ public final class Float : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Float>|,
|
||||
|
||||
public open fun toLong(): R|kotlin/Long|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toShort())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.3), errorSince = String(1.5)) public open fun toShort(): R|kotlin/Short|
|
||||
@R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toShort())) ) public open fun toShort(): R|kotlin/Short|
|
||||
|
||||
public final operator fun unaryMinus(): R|kotlin/Float|
|
||||
|
||||
@@ -976,7 +976,7 @@ public final class Long : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Long>|, R
|
||||
|
||||
public open fun toByte(): R|kotlin/Byte|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public open fun toChar(): R|kotlin/Char|
|
||||
public open fun toChar(): R|kotlin/Char|
|
||||
|
||||
public open fun toDouble(): R|kotlin/Double|
|
||||
|
||||
@@ -1170,7 +1170,7 @@ public final class Short : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Short>|,
|
||||
|
||||
public open fun toByte(): R|kotlin/Byte|
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public open fun toChar(): R|kotlin/Char|
|
||||
public open fun toChar(): R|kotlin/Char|
|
||||
|
||||
public open fun toDouble(): R|kotlin/Double|
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user